/* TCCT Thailand — Optimized stylesheet with dark/light mode
   Light mode is the default. Users toggle to dark via the header button.
   Theme persists across pages via localStorage.
   ============================================================ */

:root {
  /* Brand palette (unchanged across themes) */
  --color-accent: #c41e24;
  --color-accent-light: #e02a30;
  --color-accent-dark: #9a181d;
  --color-gold: #c9a84c;

  /* Brand navy — used in branded sections regardless of theme */
  --brand-navy: #0a1f44;
  --brand-navy-light: #132d5e;
  --brand-navy-dark: #06152e;

  /* Theme-driven tokens (Light defaults) */
  --color-primary: #0a1f44;
  --color-primary-light: #132d5e;
  --color-primary-dark: #06152e;
  --color-white: #ffffff;
  --color-gray-50: #f8f9fa;
  --color-gray-100: #f0f1f3;
  --color-gray-200: #d9dce1;
  --color-gray-300: #b0b5be;
  --color-gray-500: #6b7280;
  --color-gray-700: #374151;
  --color-gray-900: #111827;

  /* Surface & text tokens for adaptive areas */
  --bg-page: #ffffff;
  --bg-soft: #f8f9fa;
  --bg-alt: #f0f1f3;
  --surface: #ffffff;
  --surface-elev: #ffffff;
  --border: #d9dce1;
  --border-soft: #f0f1f3;
  --text-strong: #111827;
  --text: #374151;
  --text-soft: #6b7280;
  --text-muted: #9ca3af;

  /* Header glass effect (light) */
  --header-bg: rgba(10, 31, 68, 0.95);
  --header-border: rgba(255, 255, 255, 0.08);

  --font-heading: "Noto Sans Thai", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Noto Sans Thai", "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.14);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.20);
  --transition: all 0.3s ease;
}

/* ============================================================
   DARK THEME OVERRIDES
   Triggered by JS adding data-theme="dark" on <html>.
   Brand-coloured sections (navy hero, navy footer, page banners)
   intentionally keep their dark navy look in BOTH themes — they're
   identity, not chrome. We only flip the "page chrome" surfaces.
   ============================================================ */
[data-theme="dark"] {
  --bg-page: #0d1421;
  --bg-soft: #131b2c;
  --bg-alt: #1a2336;
  --surface: #161e2f;
  --surface-elev: #1d2740;
  --border: #2a3550;
  --border-soft: #1f2840;
  --text-strong: #f1f5f9;
  --text: #cbd5e1;
  --text-soft: #94a3b8;
  --text-muted: #64748b;

  /* In dark mode the navy header would blend with the body, so darken
     it a touch and strengthen the border for separation. */
  --header-bg: rgba(6, 12, 24, 0.92);
  --header-border: rgba(255, 255, 255, 0.06);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.7);

  /* ----- Legacy variable overrides for page-specific inline <style> blocks.
     The /about/ page (and others) ship their own inline CSS that references
     the original light-mode tokens. Rather than rewriting every inline rule,
     we re-map those tokens in dark mode so styles using them flip naturally. ----- */
  --color-primary: #e2e8f0;          /* was navy: re-map to light text for headings/labels */
  --color-primary-light: #cbd5e1;
  --color-primary-dark: #f1f5f9;
  --color-white: #161e2f;            /* legacy "white background" → surface */
  --color-gray-50: #131b2c;          /* legacy "soft bg" → soft */
  --color-gray-100: #1f2840;         /* legacy "soft border" → border-soft */
  --color-gray-200: #2a3550;
  --color-gray-300: #475569;
  --color-gray-500: #94a3b8;
  --color-gray-700: #cbd5e1;
  --color-gray-900: #f1f5f9;
}

/* Inline styles that hard-code #fff or white background need flipping
   in dark mode. We target the most common patterns from the about page. */
[data-theme="dark"] .timeline-card,
[data-theme="dark"] .team-badge {
  background: var(--surface) !important;
  border-color: var(--border-soft) !important;
}
[data-theme="dark"] .timeline-dot {
  border-color: var(--bg-soft) !important;
}
[data-theme="dark"] .org-info-item,
[data-theme="dark"] .org-dept {
  background: var(--bg-alt) !important;
}
/* Org-box stays primary (brand navy), but in dark mode the legacy
   --color-primary was remapped to text light. Force brand navy here. */
[data-theme="dark"] .org-box {
  background: var(--brand-navy) !important;
  color: #ffffff !important;
}
[data-theme="dark"] .org-box-sub {
  background: linear-gradient(135deg, #1a3a5c, #2c5f8a) !important;
}
[data-theme="dark"] .timeline-year {
  background: var(--brand-navy) !important;
  color: #ffffff !important;
}
[data-theme="dark"] .timeline-item.highlight .timeline-year {
  background: var(--color-accent) !important;
}
[data-theme="dark"] .org-info-item .oi-icon,
[data-theme="dark"] .team-badge-icon {
  background: var(--brand-navy) !important;
}
[data-theme="dark"] .equipment-section {
  background: var(--brand-navy) !important;
}
[data-theme="dark"] .timeline-section,
[data-theme="dark"] .team-section {
  background: var(--bg-soft) !important;
}
/* Scrollbar in dark mode */
[data-theme="dark"] .timeline-scroll {
  scrollbar-color: var(--brand-navy-light) var(--bg-alt) !important;
}
[data-theme="dark"] .timeline-scroll::-webkit-scrollbar-track {
  background: var(--bg-alt) !important;
}
[data-theme="dark"] .timeline-scroll::-webkit-scrollbar-thumb {
  background: var(--brand-navy-light) !important;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *:before, *:after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  font-size: 16px;
}
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-page);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

/* ============================================================
   HEADER (always navy regardless of theme — brand identity)
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--header-border);
  transition: background-color 0.25s ease;
}
.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.nav-logo img {
  height: 48px;
  width: auto;
  background: transparent;
}
.nav-logo-text {
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 2px;
}
.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}
.nav-links a {
  color: rgba(255, 255, 255, 0.8);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  letter-spacing: 0.3px;
  transition: var(--transition);
  position: relative;
}
.nav-links a:hover,
.nav-links a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}
.nav-links a.active:after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
}
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
}
.mobile-toggle span {
  width: 24px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: var(--transition);
}

/* Right-side controls cluster (theme toggle + lang switch) */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ----- Theme toggle button ----- */
.theme-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  padding: 0;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Show sun in dark mode, moon in light mode */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 768px) {
  .mobile-toggle {
    display: flex;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 80px;
    left: 0;
    width: 100%;
    background: rgba(10, 31, 68, 0.98);
    flex-direction: column;
    padding: 1rem;
    gap: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
}

/* ============================================================
   HERO (navy gradient overlay, identity — same in both themes)
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  height: 800px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-video,
.hero-poster {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 31, 68, 0.6),
    rgba(10, 31, 68, 0.3) 40%,
    rgba(10, 31, 68, 0.7)
  );
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #ffffff;
  padding: 0 2rem;
  max-width: 900px;
}
.hero-content h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}
.hero-content p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  opacity: 0.9;
  margin-bottom: 2rem;
  line-height: 1.8;
}
.hero-cta {
  display: inline-flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-align: center;
  white-space: nowrap;
}
.btn-primary {
  background: var(--color-accent);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--color-accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196, 30, 36, 0.4);
}
.btn-outline {
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.btn-outline:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: 5rem 2rem;
  background: var(--bg-page);
  color: var(--text);
  transition: background-color 0.25s ease, color 0.25s ease;
}
.section-dark {
  background: var(--brand-navy);
  color: #ffffff;
}
.section-light {
  background: var(--bg-soft);
}
.section-container {
  max-width: 1200px;
  margin: 0 auto;
}
.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}
.section-header h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  color: var(--text-strong);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}
.section-dark .section-header h2 {
  color: #ffffff;
}
.section-header .accent-line {
  width: 60px;
  height: 3px;
  background: var(--color-accent);
  margin: 1rem auto;
  border-radius: 2px;
}
.section-header p {
  font-size: 1.05rem;
  color: var(--text-soft);
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.8;
}
.section-dark .section-header p {
  color: rgba(255, 255, 255, 0.7);
}

/* ============================================================
   SERVICE CARDS
   ============================================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}
.service-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.service-card:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.service-card:hover:before {
  transform: scaleX(1);
}
.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.service-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-navy-light));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  font-size: 1.5rem;
  color: #ffffff;
}
.service-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 0.75rem;
}
.service-card p {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.7;
}

/* ============================================================
   PROJECT GALLERY / COMPARISON
   ============================================================ */
.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}
@media (max-width: 480px) {
  .project-gallery {
    grid-template-columns: 1fr;
  }
}
.project-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  background: var(--bg-alt);
}
.project-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.project-card:hover img {
  transform: scale(1.05);
}
.project-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(10, 31, 68, 0.85) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  display: flex;
  align-items: flex-end;
  padding: 1.5rem;
}
.project-card:hover .project-card-overlay {
  opacity: 1;
}
.project-card-overlay span {
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
}
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 2rem;
}
@media (max-width: 500px) {
  .comparison-grid {
    grid-template-columns: 1fr;
  }
}
.comparison-item {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--surface);
  transition: var(--transition);
}
.comparison-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.comparison-item img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
}
.comparison-label {
  padding: 0.75rem 1.25rem;
  background: var(--brand-navy);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}
@media (max-width: 768px) {
  .about-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}
.about-text h3 {
  font-size: 1.3rem;
  color: var(--text-strong);
  margin-bottom: 1rem;
}
.about-text p {
  color: var(--text-soft);
  margin-bottom: 1.25rem;
  line-height: 1.8;
}
.about-image {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* ============================================================
   STATS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}
.stat-item {
  text-align: center;
}
.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-accent);
  line-height: 1;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-top: 0.5rem;
}
.section-dark .stat-label {
  color: rgba(255, 255, 255, 0.7);
}

/* ============================================================
   MISSION / VISION CARDS (inside .section-dark)
   ============================================================ */
.mv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 768px) {
  .mv-grid {
    grid-template-columns: 1fr;
  }
}
.mv-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2.5rem;
  backdrop-filter: blur(8px);
}
.mv-card h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--color-gold);
}
.mv-card p {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.8;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}
@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}
.contact-info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.contact-info-list li {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.contact-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-navy-light));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
  font-size: 1.1rem;
}
.contact-detail h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}
.contact-detail p {
  font-size: 1rem;
  color: var(--text-strong);
}
.contact-detail a {
  color: var(--text-strong);
}
.contact-detail a:hover {
  color: var(--color-accent);
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text-strong);
  transition: var(--transition);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(196, 30, 36, 0.15);
}
.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* ============================================================
   FOOTER (always dark navy — brand identity)
   ============================================================ */
.site-footer {
  background: var(--brand-navy-dark);
  color: rgba(255, 255, 255, 0.6);
  padding: 3rem 2rem 1.5rem;
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
}
@media (max-width: 768px) {
  .footer-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.footer-brand img {
  height: 40px;
}
.footer-brand span {
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
}
.footer-desc {
  font-size: 0.9rem;
  line-height: 1.7;
}
.footer-links h4,
.footer-contact h4 {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.footer-links ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.footer-links a {
  font-size: 0.9rem;
  transition: var(--transition);
}
.footer-links a:hover {
  color: #ffffff;
  padding-left: 4px;
}
.footer-contact p {
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 0.8rem;
}

/* ============================================================
   PAGE BANNER (sub-pages hero)
   ============================================================ */
.page-banner {
  background: linear-gradient(135deg, var(--brand-navy-dark), var(--brand-navy));
  padding: 10rem 2rem 4rem;
  text-align: center;
  color: #ffffff;
  position: relative;
  overflow: hidden;
}
.page-banner:before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: rgba(196, 30, 36, 0.08);
}
.page-banner h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  position: relative;
}
.page-banner p {
  margin-top: 0.75rem;
  font-size: 1.1rem;
  opacity: 0.7;
  position: relative;
}

/* ============================================================
   ANIMATIONS — non-blocking (always visible without JS)
   ============================================================ */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fade-in-up {
  opacity: 1; /* default visible — protects against JS failure */
  transform: none;
}
@media (prefers-reduced-motion: no-preference) {
  html.js-ready .fade-in-up {
    animation: fadeInUp 0.8s ease backwards;
  }
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.active {
  display: flex;
}
.lightbox img {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: var(--shadow-xl);
}
.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  color: #ffffff;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   LANG SWITCH (inside header)
   ============================================================ */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}
.lang-switch a {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: var(--transition);
  letter-spacing: 0.5px;
}
.lang-switch a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}
.lang-switch a.active-lang {
  color: #ffffff;
  background: var(--color-accent);
  pointer-events: none;
}
@media (max-width: 768px) {
  .lang-switch {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
  }
}

/* ============================================================
   ABOUT SUB-NAV (sticky tabs on /about/)
   ============================================================ */
.about-subnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 80px;
  z-index: 100;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.about-subnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  justify-content: center;
}
.about-subnav a {
  padding: 1rem 1.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
}
.about-subnav a:hover {
  color: var(--text-strong);
  background: var(--bg-soft);
}
.about-subnav a.sub-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}
@media (max-width: 768px) {
  .about-subnav-inner {
    justify-content: flex-start;
  }
  .about-subnav a {
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
  }
}

/* ============================================================
   TIMELINE (about page)
   ============================================================ */
.tl-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .tl-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 600px) {
  .tl-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.tl-cell {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  text-align: center;
  transition: var(--transition);
  position: relative;
}
.tl-cell:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.tl-cell.tl-highlight {
  border: 2px solid var(--color-accent);
}
.tl-cell-year {
  display: inline-block;
  background: var(--brand-navy);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 16px;
  margin-bottom: 0.6rem;
}
.tl-cell.tl-highlight .tl-cell-year {
  background: var(--color-accent);
}
.tl-cell-icon {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}
.tl-cell h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.5;
  margin-bottom: 0.3rem;
}
.tl-cell p {
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.5;
}

/* ============================================================
   SCROLL TO TOP BUTTON
   ============================================================ */
.scroll-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease, background 0.3s ease;
}
.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-top:hover {
  background: var(--color-accent-dark);
  transform: translateY(-2px);
}
.scroll-top svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (max-width: 480px) {
  .scroll-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
}

/* ============================================================
   DARK MODE — image dimming (subtle, so photos don't glare)
   ============================================================ */
[data-theme="dark"] .comparison-item img,
[data-theme="dark"] .project-card img,
[data-theme="dark"] .about-image img {
  filter: brightness(0.92);
  transition: filter 0.25s ease;
}
[data-theme="dark"] .project-card:hover img,
[data-theme="dark"] .comparison-item:hover img {
  filter: brightness(1);
}

/* In dark mode, the CTA gradient section is too saturated — soften */
[data-theme="dark"] section[style*="linear-gradient(135deg, #c41e24"] {
  background: linear-gradient(135deg, #a01b21, #7d1418) !important;
}
