/* Font display optimization */
@font-face {
  font-family: 'Simple-Line-Icons';
  font-display: swap;
}

@font-face {
  font-family: 'FontAwesome';
  font-display: swap;
}

/* Accessibility: Improve color contrast for better readability */
/* Ensure text has sufficient contrast ratio (WCAG AA: 4.5:1 for normal text) */

/* Fix any low-contrast text */
.services-item p {
  color: #333 !important; /* Darker text for better contrast */
}

.testimonial-item p {
  color: #333 !important;
}

/* Ensure links have good contrast */
a {
  color: #0056b3; /* Darker blue for better contrast */
}

a:hover {
  color: #003d82;
}

/* Focus indicators for keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

/* Skip to main content link (for screen readers and keyboard users) */
.skip-to-main {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 10px;
  background-color: #667eea;
  color: white;
  text-decoration: none;
}

.skip-to-main:focus {
  left: 10px;
  top: 10px;
}

/* Preloader styles */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #fff;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#loader-1 {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Smooth scrolling for the entire page */
html {
  scroll-behavior: smooth;
}

/* Project card hover effects */
.project-card {
  transition: all 0.3s ease;
  cursor: pointer;
}

.project-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.15) !important;
}

/* Services item hover effects */
.services-item {
  transition: all 0.3s ease;
}

.services-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* Testimonial item hover effects */
.testimonial-item {
  transition: all 0.3s ease;
}

.testimonial-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
}

/* Hobby item hover effects */
.hobby-item {
  transition: all 0.3s ease;
}

.hobby-item:hover {
  transform: scale(1.05);
}

/* Content box hover effects */
.content-box {
  transition: all 0.3s ease;
}

.content-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
}

/* ── Profile image rendering ───────────────────────────── */
#about .img-thumb img {
  filter: contrast(1.08) brightness(1.02);
  image-rendering: -webkit-optimize-contrast;
}

/* Fix overlapping headings in Education/Experience sections - Keep original timeline design */
.timeline .line-title {
  line-height: 1.6 !important;
  margin-bottom: 15px !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.timeline .content-text span {
  display: block;
  margin-bottom: 8px;
  margin-top: 8px;
}

.timeline .line-text {
  margin-top: 10px;
  line-height: 1.6;
}

/* Add spacing between timeline items using padding instead of margin to keep line connected */
.timeline li {
  padding-bottom: 35px !important;
}

.timeline li:last-child {
  padding-bottom: 0 !important;
}

/* Responsive fixes for medium to large screens */
@media (min-width: 992px) and (max-width: 2560px) {
  .timeline .line-title {
    font-size: 16px;
    line-height: 1.7 !important;
    margin-bottom: 18px !important;
  }
}

/* Fix for 4K and ultra-wide screens */
@media (min-width: 2560px) {
  .timeline .line-title {
    font-size: 18px;
    line-height: 1.8 !important;
    margin-bottom: 20px !important;
  }
}

/* Fix Services section h3 line-height and alignment */
.services-item .services-content h3 {
  line-height: 1.4 !important;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  text-align: center;
}

.services-item .services-content h3 a {
  line-height: 1.4 !important;
  text-align: center;
  width: 100%;
  display: block;
}

/* Ensure equal height for service boxes */
.services-item {
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.services-item .services-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Add padding to Achievement boxes */
#achievements .content-box {
  padding: 30px !important;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

/* Add padding to Featured Project cards */
.project-card {
  padding: 30px !important;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.project-highlight {
  padding: 50px !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Make project cards clickable */
.project-card {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.project-card:hover {
  text-decoration: none;
  color: inherit;
}

/* Custom styles for contact form */
#msgSubmit {
  margin-top: 15px;
  padding: 10px;
  border-radius: 5px;
  font-size: 16px;
}

#msgSubmit.hidden {
  display: none;
}

#msgSubmit.text-success {
  color: #28a745;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
}

#msgSubmit.text-danger {
  color: #dc3545;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
}

#msgSubmit.text-info {
  color: #17a2b8;
  background-color: #d1ecf1;
  border: 1px solid #bee5eb;
}

.contact-block form .form-control {
  margin-bottom: 15px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.contact-block form .btn {
  margin-top: 10px;
}

/* ── Utility: icon helpers ─────────────────────────────── */
.icon-center { text-align: center; margin-bottom: 15px; }
.icon-lg     { font-size: 48px; }
.icon-gold    { color: #FFD700 !important; }
.icon-silver  { color: #C0C0C0 !important; }
.icon-bronze  { color: #CD7F32 !important; }
.icon-green   { color: #4CAF50 !important; }
.icon-blue    { color: #2196F3 !important; }
.icon-primary { color: #667eea !important; }
.icon-danger  { color: #F44336 !important; }
.icon-warning { color: #FF9800 !important; }
.icon-teal    { color: #00BCD4 !important; }
.icon-mr      { margin-right: 8px; }

/* Override bad template rule: main.css sets .list-unstyled li { color: #d9534f } (red) */
.list-unstyled li,
.list-item { color: #444 !important; }

/* ── Section backgrounds ───────────────────────────────── */
#achievements {
  background-color: #f9f9f9;
}

/* ── Achievement cards ─────────────────────────────────── */
.achievement-card {
  background: white;
  border-radius: 8px;
  margin-bottom: 20px;
  min-height: 280px;
}
.box-title {
  text-align: center;
  margin-bottom: 15px;
  font-size: 20px;
}
.list-item { margin-bottom: 10px; }

/* ── Section description ───────────────────────────────── */
.section-desc {
  max-width: 700px;
  margin: 0 auto 40px;
  text-align: center;
}

/* ── Project highlight (FlashGuard) ────────────────────── */
.featured-badge {
  background: rgba(255,255,255,0.2);
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}
.project-title {
  margin-top: 20px;
  margin-bottom: 15px;
  font-size: 32px;
}
.project-desc {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 20px;
}
.project-tech-tag {
  background: rgba(255,255,255,0.2);
  padding: 8px 15px;
  border-radius: 20px;
  margin-right: 10px;
  display: inline-block;
  margin-bottom: 10px;
}
.awards-wrap  { margin-bottom: 20px; }
.awards-label { margin-bottom: 10px; }
.project-featured-wrap { margin-bottom: 50px; }

/* ── Project cards ─────────────────────────────────────── */
.card-icon-wrap   { text-align: center; margin-bottom: 20px; }
.card-title-center { text-align: center; margin-bottom: 15px; }
.card-desc-center { text-align: center; color: #666; margin-bottom: 15px; }
.tech-tag {
  background: #f0f0f0;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  margin-right: 5px;
  display: inline-block;
  margin-bottom: 5px;
}

/* ── Private repo note on project cards ───────────────── */
.private-repo-note {
  text-align: center;
  color: #999;
  font-size: 12px;
  margin-top: 12px;
  margin-bottom: 0;
}

/* ── Hobby icons ───────────────────────────────────────── */
.hobby-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.hobby-icon i { font-size: 36px; color: white; }
.hobby-icon--purple { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.hobby-icon--red    { background: linear-gradient(135deg, #F44336 0%, #E91E63 100%); }
.hobby-icon--green  { background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%); }
.hobby-icon--orange { background: linear-gradient(135deg, #FF9800 0%, #FF5722 100%); }

/* ── Services checklist ────────────────────────────────── */
.services-checklist {
  list-style: none;
  padding: 0;
  margin-top: 15px;
  font-size: 13px;
  color: #666;
}
.services-checklist li { margin-bottom: 5px; }

/* ── Hobby items ───────────────────────────────────────── */
.hobby-item {
  text-align: center;
  padding: 30px;
  margin-bottom: 30px;
}

.hobby-item h4 {
  margin-bottom: 10px;
}

.hobby-item p {
  color: #666;
}

/* ── Available for Remote Work badge ───────────────────── */
.available-badge {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #c8e6c9;
}

/* ── Skills section ────────────────────────────────────── */
.skill-category {
  margin-bottom: 30px;
}

.skill-category h5 {
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 15px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  background: #f0f4ff;
  color: #3a5bd9;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #c7d4f9;
  display: inline-block;
}

.skill-row-2 {
  margin-top: 10px;
}

/* ── FlashGuard project image ──────────────────────────── */
.project-img-wrap {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.project-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

/* ── Project highlight card ────────────────────────────── */
.project-highlight {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 15px;
  color: white;
  cursor: pointer;
}

/* ── Other project cards ───────────────────────────────── */
a.project-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  margin-bottom: 30px;
  min-height: 320px;
}

/* ── Dark mode ─────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a2e;
    color: #e0e0e0;
  }

  section.section-padding {
    background-color: #1a1a2e !important;
  }

  #achievements, #skills {
    background-color: #16213e !important;
  }

  .services-item,
  .content-box,
  .achievement-card {
    background: #16213e !important;
    border-color: #2d3561 !important;
  }

  a.project-card {
    background: #16213e !important;
    border-color: #2d3561 !important;
    color: #e0e0e0 !important;
  }

  .services-item p,
  .card-desc-center,
  .hobby-item p,
  .pro-detail,
  .pro-title,
  .admin-profile li,
  .line-text,
  .timeline .content-text p,
  .section-desc,
  p {
    color: #c8c8c8 !important;
  }

  /* Timeline (Resume) boxes */
  .timeline li {
    border-left-color: #2d3561 !important;
  }

  .timeline li .content-text {
    background: #16213e !important;
  }

  .timeline .line-title {
    color: #c8d8ff !important;
  }

  .timeline .content-text span {
    color: #8899cc !important;
  }

  .timeline .line-text,
  .timeline .content-text p {
    color: #b0bec5 !important;
  }

  .timelin-title {
    color: #e0e0e0 !important;
  }

  /* Achievement cards */
  .list-unstyled li,
  .list-item {
    color: #c8c8c8 !important;
  }

  .box-title {
    color: #e0e0e0 !important;
  }

  /* Contact section */
  .contact-form-area {
    background: #16213e !important;
    box-shadow: 0 0 30px rgba(0,0,0,0.5) !important;
  }

  .contact-form-area h2 {
    color: #e0e0e0 !important;
  }

  .footer-right-contact {
    border-color: #2d3561 !important;
  }

  .footer-right-contact .single-contact,
  .footer-right-contact .single-contact p,
  .footer-right-contact .single-contact p a {
    color: #c8c8c8 !important;
  }

  .contact-block .form-control {
    background: #0f1b35 !important;
    border-color: #2d3561 !important;
    color: #e0e0e0 !important;
  }

  .contact-block .form-control::placeholder {
    color: #6a7fad !important;
  }

  /* About section profile image */
  #about .img-thumb img {
    border-color: #2d3561 !important;
  }

  /* Project cards */
  .private-repo-note {
    color: #6a7fad !important;
  }

  /* Services section */
  .services-item .services-content h3 a {
    color: #c8d8ff !important;
  }

  .services-checklist li {
    color: #b0bec5 !important;
  }

  /* Hobbies & Skills section backgrounds */
  #hobbies,
  #skills {
    background-color: #1a1a2e !important;
  }

  /* Back-to-top button */
  a.back-to-top i {
    background: #0e7fa3 !important;
  }

  /* Footer */
  .footer-area .footer-text p,
  .footer-area .footer-text p a {
    color: #b0b0b0 !important;
  }

  .tech-tag {
    background: #2d2d4e !important;
    color: #c0c0e0 !important;
    border-color: #444 !important;
  }

  .skill-tag {
    background: #1e2a5e !important;
    color: #9ab0f9 !important;
    border-color: #2d3d7e !important;
  }

  .available-badge {
    background: #1b3a2d !important;
    color: #81c784 !important;
    border-color: #2e5c3e !important;
  }

  h1, h2, h3, h4, h5, h6 {
    color: #e0e0e0 !important;
  }

  .section-title {
    color: #e0e0e0 !important;
  }

  .skill-category h5 {
    color: #c0d0ff !important;
  }
}

/* Print Styles */
@media print {
  /* Hide unnecessary elements */
  #preloader,
  .navbar,
  .header-button,
  .social-icon,
  .back-to-top,
  #contact,
  footer,
  .wow,
  button,
  .btn,
  .form-control,
  textarea,
  input,
  #hobbies,
  #portfolios,
  .counter-section {
    display: none !important;
  }

  /* Reset colors for print */
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.5;
  }

  /* Ensure content fits on page */
  .container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Section spacing */
  section {
    page-break-inside: avoid;
    margin-bottom: 20px;
    background: white !important;
  }

  /* Headings */
  h1, h2, h3, h4, h5, h6 {
    color: black !important;
    page-break-after: avoid;
  }

  .section-title {
    color: black !important;
    border-bottom: 2px solid black;
    padding-bottom: 10px;
    margin-bottom: 20px;
  }

  /* About section */
  #about .img-thumb {
    display: none;
  }

  #about .profile-wrapper {
    width: 100%;
  }

  .admin-profile li {
    display: inline-block;
    width: 48%;
    margin-bottom: 5px;
  }

  /* Resume/Timeline sections */
  .timeline {
    border-left: 2px solid black !important;
  }

  .timeline li {
    page-break-inside: avoid;
    margin-bottom: 15px;
  }

  .timeline .line-title {
    color: black !important;
    font-weight: bold;
  }

  /* Services section */
  .services-item {
    page-break-inside: avoid;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 10px;
  }

  /* Achievements section */
  #achievements .content-box {
    page-break-inside: avoid;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: none !important;
  }

  /* Projects section */
  .project-highlight {
    page-break-inside: avoid;
    border: 2px solid black;
    padding: 15px;
    margin-bottom: 15px;
    background: white !important;
    color: black !important;
  }

  .project-card {
    page-break-inside: avoid;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 10px;
  }

  /* Links */
  a {
    color: black !important;
    text-decoration: none !important;
  }

  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }

  /* Don't show URLs for internal links */
  a[href^="#"]:after,
  a[href^="javascript:"]:after {
    content: "";
  }

  /* Images */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* Hero section adjustments */
  #hero-area {
    background: white !important;
    padding: 20px 0;
  }

  .head-title {
    color: black !important;
    font-size: 24pt;
  }

  /* Page breaks */
  .page-break {
    page-break-before: always;
  }

  /* Header on each page */
  @page {
    margin: 2cm;
    @top-center {
      content: "Damika Anupama Nanayakkara - Portfolio";
    }
  }
}
