/* ════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES — Light (default) / Dark
   ════════════════════════════════════════════════ */
:root {
  /* Brand constants */
  --color-periwinkle: #b5c9ff;
  --color-royal:      #274db4;
  --color-navy:       #1e3a8a;
  --color-pink:       #FF007A;
  --color-dark:       #0a0a0b;
  --color-light:      #f0ece6;

  /* Light theme tokens */
  --bg:               #ffffff;
  --bg-surface:       #f8f7f5;
  --fg:               #0a0a0b;
  --fg-80:            rgba(10,10,11,0.80);
  --fg-72:            rgba(10,10,11,0.72);
  --fg-65:            rgba(10,10,11,0.65);
  --fg-60:            rgba(10,10,11,0.60);
  --fg-58:            rgba(10,10,11,0.58);
  --fg-55:            rgba(10,10,11,0.55);
  --fg-52:            rgba(10,10,11,0.52);
  --fg-50:            rgba(10,10,11,0.50);
  --fg-45:            rgba(10,10,11,0.45);
  --fg-40:            rgba(10,10,11,0.40);
  --fg-38:            rgba(10,10,11,0.38);
  --fg-28:            rgba(10,10,11,0.28);
  --fg-22:            rgba(10,10,11,0.22);
  --fg-20:            rgba(10,10,11,0.20);
  --fg-15:            rgba(10,10,11,0.15);
  --fg-10:            rgba(10,10,11,0.10);
  --fg-08:            rgba(10,10,11,0.08);
  --fg-07:            rgba(10,10,11,0.07);
  --fg-06:            rgba(10,10,11,0.06);
  --fg-05:            rgba(10,10,11,0.05);
  --fg-03:            rgba(10,10,11,0.03);
  --fg-025:           rgba(10,10,11,0.025);

  /* Structural */
  --border-subtle:    rgba(10,10,11,0.06);
  --border-light:     rgba(10,10,11,0.08);
  --border-medium:    rgba(10,10,11,0.10);
  --border-divider:   rgba(10,10,11,0.10);
  --card-bg:          rgba(10,10,11,0.03);
  --card-border-line: rgba(10,10,11,0.08);

  /* Nav / Header */
  --header-scrolled-bg:   rgba(255,255,255,0.92);
  --header-border-color:  rgba(10,10,11,0.08);
  --mobile-menu-bg:       rgba(255,255,255,0.97);
  --mobile-menu-border:   rgba(10,10,11,0.08);

  /* Scrollbar */
  --scrollbar-track: #f5f4f2;
  --scrollbar-thumb: rgba(39,77,180,0.4);

  /* Hero */
  --hero-radial: radial-gradient(ellipse 80% 60% at 50% 40%,
    rgba(39,77,180,0.07) 0%, rgba(181,201,255,0.02) 50%, transparent 70%);
  --hero-grid-color: rgba(39,77,180,0.02);

  /* Accent */
  --accent-light:     #274db4;
  --accent-muted:     rgba(39,77,180,0.65);
  --accent-ghost:     rgba(39,77,180,0.15);
  --tag-bg:           rgba(39,77,180,0.10);
  --tag-border-line:  rgba(39,77,180,0.20);
  --tag-color:        #274db4;

  /* Philosophy card */
  --philosophy-bg:            linear-gradient(135deg, rgba(39,77,180,0.08) 0%, rgba(39,77,180,0.03) 100%);
  --philosophy-border-color:  rgba(39,77,180,0.18);
  --philosophy-ai-border:     rgba(10,10,11,0.08);

  /* Hero outline button */
  --hero-outline-border:       rgba(39,77,180,0.30);
  --hero-outline-border-hover: rgba(39,77,180,0.65);

  /* Inverted CTA ("View all work" / hero primary button) */
  --cta-inv-bg:    #274db4;
  --cta-inv-color: #f0ece6;

  /* Service card hover */
  --service-card-hover-bg:     rgba(39,77,180,0.05);
  --service-card-hover-border: rgba(39,77,180,0.15);

  /* Social / live links */
  --social-hover-border: rgba(39,77,180,0.4);
  --live-link-color:     rgba(39,77,180,0.8);

  /* Tab buttons */
  --tab-hover-border: rgba(39,77,180,0.20);

  /* Project card hover shadow */
  --project-card-shadow: 0 0 0 1px rgba(39,77,180,0.15), 0 12px 40px rgba(0,0,0,0.10);

  /* Input focus */
  --input-focus-border: rgba(39,77,180,0.5);
}

/* ── Dark theme overrides ── */
html.dark {
  --bg:               #0a0a0b;
  --bg-surface:       #0a0a0b;
  --fg:               #f0ece6;
  --fg-80:            rgba(240,236,230,0.80);
  --fg-72:            rgba(240,236,230,0.72);
  --fg-65:            rgba(240,236,230,0.65);
  --fg-60:            rgba(240,236,230,0.60);
  --fg-58:            rgba(240,236,230,0.58);
  --fg-55:            rgba(240,236,230,0.55);
  --fg-52:            rgba(240,236,230,0.52);
  --fg-50:            rgba(240,236,230,0.50);
  --fg-45:            rgba(240,236,230,0.45);
  --fg-40:            rgba(240,236,230,0.40);
  --fg-38:            rgba(240,236,230,0.38);
  --fg-28:            rgba(240,236,230,0.28);
  --fg-22:            rgba(240,236,230,0.22);
  --fg-20:            rgba(240,236,230,0.20);
  --fg-15:            rgba(240,236,230,0.15);
  --fg-10:            rgba(240,236,230,0.10);
  --fg-08:            rgba(240,236,230,0.08);
  --fg-07:            rgba(240,236,230,0.07);
  --fg-06:            rgba(240,236,230,0.06);
  --fg-05:            rgba(240,236,230,0.05);
  --fg-03:            rgba(240,236,230,0.03);
  --fg-025:           rgba(240,236,230,0.025);

  --border-subtle:    rgba(240,236,230,0.05);
  --border-light:     rgba(240,236,230,0.07);
  --border-medium:    rgba(240,236,230,0.08);
  --border-divider:   rgba(240,236,230,0.10);
  --card-bg:          rgba(240,236,230,0.025);
  --card-border-line: rgba(240,236,230,0.07);

  --header-scrolled-bg:   rgba(10,10,11,0.88);
  --header-border-color:  rgba(240,236,230,0.06);
  --mobile-menu-bg:       rgba(10,10,11,0.97);
  --mobile-menu-border:   rgba(240,236,230,0.05);

  --scrollbar-track: #0a0a0b;
  --scrollbar-thumb: rgba(39,77,180,0.55);

  --hero-radial: radial-gradient(ellipse 80% 60% at 50% 40%,
    rgba(39,77,180,0.20) 0%, rgba(181,201,255,0.04) 50%, transparent 70%);
  --hero-grid-color: rgba(181,201,255,0.02);

  --accent-light:     #b5c9ff;
  --accent-muted:     rgba(181,201,255,0.6);
  --accent-ghost:     rgba(181,201,255,0.2);
  --tag-bg:           rgba(30,58,138,0.5);
  --tag-border-line:  rgba(181,201,255,0.18);
  --tag-color:        #b5c9ff;

  --philosophy-bg:            linear-gradient(135deg, rgba(30,58,138,0.28) 0%, rgba(39,77,180,0.12) 100%);
  --philosophy-border-color:  rgba(30,58,138,0.7);
  --philosophy-ai-border:     rgba(240,236,230,0.07);

  --hero-outline-border:       rgba(181,201,255,0.35);
  --hero-outline-border-hover: rgba(181,201,255,0.70);

  --cta-inv-bg:    #f0ece6;
  --cta-inv-color: #0a0a0b;

  --service-card-hover-bg:     rgba(181,201,255,0.05);
  --service-card-hover-border: rgba(181,201,255,0.28);

  --social-hover-border: rgba(181,201,255,0.4);
  --live-link-color:     rgba(181,201,255,0.7);

  --tab-hover-border: rgba(181,201,255,0.20);

  --project-card-shadow: 0 0 0 1px rgba(181,201,255,0.25), 0 12px 40px rgba(0,0,0,0.45);

  --input-focus-border: rgba(181,201,255,0.5);
}


/* ════════════════════════════════════════════════
   SKIP LINK
   ════════════════════════════════════════════════ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1.25rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-medium);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 1rem; }


/* ════════════════════════════════════════════════
   FOCUS VISIBLE — global indicator
   ════════════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 3px;
  border-radius: 2px;
}


/* ════════════════════════════════════════════════
   BASE
   ════════════════════════════════════════════════ */
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--fg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Unbounded', system-ui, sans-serif; }


/* ════════════════════════════════════════════════
   LIGHT MODE — override Tailwind brand-color classes
   ════════════════════════════════════════════════ */

/* bg-brand-dark on body → transparent (CSS var handles it) */
html:not(.dark) body.bg-brand-dark {
  background-color: var(--bg) !important;
}

/* text-brand-light / text-brand-light/XX → dark text */
html:not(.dark) .text-brand-light {
  color: #0a0a0b !important;
}
html:not(.dark) [class*="text-brand-light/"] {
  color: rgb(10 10 11 / var(--tw-text-opacity, 1)) !important;
}

/* text-brand-periwinkle → royal blue in light (for labels, spans, accents) */
html:not(.dark) .text-brand-periwinkle {
  color: var(--color-royal) !important;
}

/* bg-brand-dark sections/panels in light mode */
html:not(.dark) .bg-brand-dark {
  background-color: var(--bg) !important;
}

/* Mobile menu border in light mode */
html:not(.dark) #mobile-menu {
  border-top-color: var(--mobile-menu-border) !important;
}
html:not(.dark) .mobile-nav-link[class*="border-b"] {
  border-bottom-color: var(--border-light) !important;
}

/* Work carousel cards: text is overlaid on dark photos — always stay light */
html:not(.dark) .work-card .text-brand-light,
html:not(.dark) .work-card [class*="text-brand-light/"] {
  color: #f0ece6 !important;
}
html:not(.dark) .work-card .text-brand-periwinkle {
  color: #b5c9ff !important;
}
html:not(.dark) .work-card {
  --fg-65: rgba(240,236,230,0.65);
  --fg-72: rgba(240,236,230,0.72);
  --fg-38: rgba(240,236,230,0.38);
  --fg-55: rgba(240,236,230,0.55);
  --fg-50: rgba(240,236,230,0.50);
}

/* Case study "next project" card: text is overlaid on dark photo — always stay light */
html:not(.dark) .cs-next-card .text-brand-light,
html:not(.dark) .cs-next-card [class*="text-brand-light/"] {
  color: #f0ece6 !important;
}
html:not(.dark) .cs-next-card .text-brand-periwinkle {
  color: #b5c9ff !important;
}
html:not(.dark) .cs-next-card {
  --fg-38: rgba(240,236,230,0.38);
  --fg-50: rgba(240,236,230,0.50);
}


/* ════════════════════════════════════════════════
   FADE-IN SCROLL ANIMATION
   ════════════════════════════════════════════════ */
.fade-in {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
.fade-in:nth-child(2) { transition-delay: 0.08s; }
.fade-in:nth-child(3) { transition-delay: 0.16s; }
.fade-in:nth-child(4) { transition-delay: 0.08s; }
.fade-in:nth-child(5) { transition-delay: 0.16s; }


/* ════════════════════════════════════════════════
   FIXED HEADER
   ════════════════════════════════════════════════ */
#site-header {
  background: transparent;
  border-bottom: 1px solid transparent;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: background 0.3s ease, border-color 0.3s ease,
              backdrop-filter 0.3s ease, opacity 0.4s ease,
              transform 0.4s ease;
}
#site-header.nav-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#site-header.scrolled {
  background: var(--header-scrolled-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--header-border-color);
}

/* Always-visible header variant (work.html, case studies) */
#site-header.always-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}


/* ════════════════════════════════════════════════
   THEME TOGGLE BUTTON
   ════════════════════════════════════════════════ */
.theme-toggle {
  width: 2rem; height: 2rem;
  border-radius: 0.375rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-light);
  color: var(--fg-55);
  background: transparent;
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--border-medium);
  background: var(--fg-05);
}


/* ════════════════════════════════════════════════
   CUSTOM SCROLLBAR
   ════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-light); }
html {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}


/* ════════════════════════════════════════════════
   MOBILE MENU
   ════════════════════════════════════════════════ */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
#mobile-menu { animation: slideDown 0.2s ease; }


/* ════════════════════════════════════════════════
   PROJECT CARDS
   ════════════════════════════════════════════════ */
.project-card {
  transition: opacity 0.28s ease, transform 0.28s ease, box-shadow 0.3s ease;
}
@media (hover: hover) {
  .project-card:hover {
    box-shadow: var(--project-card-shadow);
  }
}


/* ════════════════════════════════════════════════
   CASE STUDY TAB BUTTONS
   ════════════════════════════════════════════════ */
.tab-btn {
  color: var(--fg-40);
  border: 1px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
@media (hover: hover) {
  .tab-btn:hover {
    color: var(--fg-80);
    border-color: var(--tab-hover-border);
  }
}
.tab-btn.active {
  background: #274db4;
  color: #f0ece6;
  border-color: transparent;
}


/* ════════════════════════════════════════════════
   PROJECT GRID — single project centering
   ════════════════════════════════════════════════ */
.project-grid.single-project { justify-items: center; }


/* ════════════════════════════════════════════════
   CONTACT FORM FOCUS
   ════════════════════════════════════════════════ */
input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--input-focus-border);
}


/* ════════════════════════════════════════════════
   LIGHTBOX
   ════════════════════════════════════════════════ */
#lightbox {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0, 0, 0, 0.88);
  display: flex; align-items: center; justify-content: center;
}
#lightbox img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
}


/* ════════════════════════════════════════════════
   TOUCH-SAFE HOVER COMPONENTS
   ════════════════════════════════════════════════ */

/* Back / breadcrumb links */
.back-link {
  color: var(--fg-40);
  transition: color 0.3s ease;
}
@media (hover: hover) {
  .back-link:hover { color: var(--accent-light); }
}

/* Hero outline CTA */
.hero-outline-btn {
  border: 1px solid var(--hero-outline-border);
  color: var(--fg);
  transition: border-color 0.3s ease, color 0.3s ease;
}
@media (hover: hover) {
  .hero-outline-btn:hover {
    border-color: var(--hero-outline-border-hover);
    color: var(--accent-light);
  }
}

/* CV button arrow */
.cv-btn svg {
  transition: transform 0.25s ease;
}
@media (hover: hover) {
  .cv-btn:hover svg {
    transform: translateX(4px);
  }
}

/* Service cards */
.service-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border-line);
  transition: background 0.3s ease, border-color 0.3s ease;
}
@media (hover: hover) {
  .service-card:hover {
    background: var(--service-card-hover-bg);
    border-color: var(--service-card-hover-border);
  }
}

/* Social icon buttons */
.social-btn {
  border: 1px solid var(--border-medium);
  color: var(--fg-45);
  transition: border-color 0.3s ease, color 0.3s ease;
}
@media (hover: hover) {
  .social-btn:hover {
    border-color: var(--social-hover-border);
    color: var(--accent-light);
  }
}

/* Live project links in case studies */
.live-link {
  color: var(--live-link-color);
  transition: color 0.3s ease;
}
@media (hover: hover) {
  .live-link:hover { color: var(--accent-light); }
}


/* ════════════════════════════════════════════════
   HERO STATS — hide dividers on very small screens
   ════════════════════════════════════════════════ */
.hero-stat-divider { display: none; }
@media (min-width: 480px) {
  .hero-stat-divider { display: block; }
}


/* ════════════════════════════════════════════════
   CONTACT CARDS — hover + focus-visible (replaces inline handlers)
   ════════════════════════════════════════════════ */
.contact-card-whatsapp:hover,
.contact-card-whatsapp:focus-visible {
  border-color: rgba(37, 211, 102, 0.45) !important;
  background: rgba(37, 211, 102, 0.08) !important;
}
.contact-card-email:hover,
.contact-card-email:focus-visible {
  border-color: rgba(181, 201, 255, 0.4) !important;
  background: rgba(181, 201, 255, 0.08) !important;
}


/* ════════════════════════════════════════════════
   CAROUSEL PAUSE BUTTON
   ════════════════════════════════════════════════ */
.carousel-pause-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border-light);
  color: var(--fg-45);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.carousel-pause-btn:hover {
  color: var(--fg);
  border-color: var(--border-medium);
  background: var(--fg-05);
}


/* ════════════════════════════════════════════════
   WORK CAROUSEL
   ════════════════════════════════════════════════ */
.work-track {
  display: flex;
  gap: 1.25rem;
  width: max-content;
  animation: marquee-left 40s linear infinite;
  padding: 0 1.25rem;
}
.work-track:hover { animation-play-state: paused; }
.work-card {
  flex-shrink: 0;
  width: min(640px, 80vw);
}


/* ════════════════════════════════════════════════
   TESTIMONIAL MARQUEE
   ════════════════════════════════════════════════ */
.testimonial-track {
  display: flex;
  gap: 1.25rem;
  width: max-content;
  animation: marquee-left 32s linear infinite;
}
.testimonial-track:hover { animation-play-state: paused; }
@keyframes marquee-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.testimonial-card {
  flex-shrink: 0;
  width: 320px;
  display: flex;
  flex-direction: column;
}


/* ════════════════════════════════════════════════
   HERO GRID
   ════════════════════════════════════════════════ */
.hero-radial {
  background: var(--hero-radial),
    repeating-linear-gradient(
      0deg,
      var(--hero-grid-color) 0px,
      var(--hero-grid-color) 1px,
      transparent 1px,
      transparent 40px
    ),
    repeating-linear-gradient(
      90deg,
      var(--hero-grid-color) 0px,
      var(--hero-grid-color) 1px,
      transparent 1px,
      transparent 40px
    );
}

.hero-grid {
  background:
    repeating-linear-gradient(
      0deg,
      var(--hero-grid-color) 0px,
      var(--hero-grid-color) 1px,
      transparent 1px,
      transparent 40px
    ),
    repeating-linear-gradient(
      90deg,
      var(--hero-grid-color) 0px,
      var(--hero-grid-color) 1px,
      transparent 1px,
      transparent 40px
    );
}


/* ════════════════════════════════════════════════
   HERO LIQUID BLOBS
   ════════════════════════════════════════════════ */
.hero-blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform, border-radius;
  filter: blur(80px);
  opacity: 0.16;
}
.hero-blob-1 {
  width: 660px;
  height: 540px;
  background: radial-gradient(ellipse at center, rgba(39,77,180,0.80), transparent 70%);
  top: -8%;
  left: 15%;
  animation: blob-morph-1 20s ease-in-out infinite;
}
.hero-blob-2 {
  width: 520px;
  height: 460px;
  background: radial-gradient(ellipse at center, rgba(181,201,255,0.75), transparent 70%);
  top: 25%;
  right: 5%;
  animation: blob-morph-2 24s ease-in-out infinite;
}
.dark .hero-blob { opacity: 0.22; }

@keyframes blob-morph-1 {
  0%,100% { border-radius: 60% 40% 70% 30% / 50% 60% 40% 50%; transform: translate(0,0) scale(1); }
  33%     { border-radius: 40% 60% 30% 70% / 60% 40% 60% 40%; transform: translate(28px,-18px) scale(1.05); }
  66%     { border-radius: 70% 30% 50% 50% / 40% 60% 50% 60%; transform: translate(-18px,14px) scale(0.97); }
}
@keyframes blob-morph-2 {
  0%,100% { border-radius: 50% 50% 60% 40% / 60% 40% 55% 45%; transform: translate(0,0) scale(1); }
  40%     { border-radius: 65% 35% 45% 55% / 45% 55% 35% 65%; transform: translate(-24px,20px) scale(1.07); }
  70%     { border-radius: 35% 65% 55% 45% / 55% 45% 65% 35%; transform: translate(14px,-28px) scale(0.95); }
}


/* ════════════════════════════════════════════════
   REDUCED MOTION — stop auto-scrolling carousels
   ════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .work-track,
  .testimonial-track,
  .hero-blob {
    animation: none !important;
  }
  .fade-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
