/* ============================================================
   BASE.CSS — Design System & Global Styles
   The single source of truth for every visual decision.
   Every other CSS file inherits from this.
   ============================================================ */

/* ── DESIGN TOKENS ── */
:root {
  /* Colors */
  --black:          #080808;
  --black-soft:     #0d0d0d;
  --offwhite:       #F5F5F0;
  --offwhite-dim:   rgba(240, 235, 226, 0.62);
  --amber:          #2DE2E6;
  --amber-bright:   #7FF0F3;
  --amber-dim:      #5BC6C9;
  --amber-glow:     rgba(45, 226, 230, 0.08);
  --gray-1:         #161616;
  --gray-2:         #1f1f1f;
  --gray-3:         #2a2a2a;
  --gray-4:         #3a3a3a;

  /* Typography */
  --font-display:   'Bebas Neue', sans-serif;
  --font-serif:     'Cormorant Garamond', serif;
  --font-mono:      'DM Mono', monospace;

  /* Spacing scale */
  --space-xs:    8px;
  --space-sm:    16px;
  --space-md:    32px;
  --space-lg:    48px;
  --space-xl:    80px;
  --space-2xl:   120px;
  --space-3xl:   160px;

  /* Easing */
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:    cubic-bezier(0.77, 0, 0.18, 1);
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Timing */
  --dur-fast:   0.3s;
  --dur-mid:    0.6s;
  --dur-slow:   0.9s;
  --dur-crawl:  1.4s;

  /* Layout */
  --page-pad:     48px;
  --nav-h:        88px;
}

/* ── RESET ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: auto; /* Lenis handles smooth scroll */
}

body {
  background: var(--black);
  color: var(--offwhite);
  font-family: var(--font-serif);
  font-weight: 300;
  overflow-x: hidden;
  cursor: none;
  min-height: 100vh;
}

/* Prevent FOUC — site hidden until preloader fires */
#site {
  opacity: 0;
  visibility: hidden;
}
#site.is-ready {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s var(--ease-out-expo);
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar               { width: 3px; }
::-webkit-scrollbar-track         { background: var(--black); }
::-webkit-scrollbar-thumb         { background: var(--amber-dim); border-radius: 0; }
::-webkit-scrollbar-thumb:hover   { background: var(--amber); }

/* ── SELECTION ── */
::selection {
  background: var(--amber);
  color: var(--black);
}

/* ── FOCUS VISIBLE (accessibility) ── */
:focus-visible {
  outline: 1px solid var(--amber);
  outline-offset: 4px;
}

/* ── CURSOR ── */
#cursor {
  position: fixed;
  top: 0; left: 0;
  width: 8px; height: 8px;
  background: var(--amber);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  transition: width 0.2s var(--ease-out-expo),
              height 0.2s var(--ease-out-expo),
              background 0.2s;
  will-change: left, top;
}
#cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 38px; height: 38px;
  border: 1px solid rgba(45, 226, 230, 0.45);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  will-change: transform, left, top;
}

/* Cursor states */
body.cursor-hover #cursor        { width: 4px; height: 4px; }
body.cursor-hover #cursor-ring   { width: 60px; height: 60px; border-color: rgba(45, 226, 230, 0.7); }
body.cursor-drag  #cursor-ring   { width: 72px; height: 72px; border-color: var(--amber); }
body.cursor-text  #cursor        { width: 2px; height: 24px; border-radius: 1px; }

/* ── NAVIGATION ── */
#main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--page-pad);
  /* Frosted glass on scroll (toggled by JS) */
  transition: background 0.5s, backdrop-filter 0.5s;
}
#main-nav.scrolled {
  background: rgba(8, 8, 8, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-2);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.14em;
  color: var(--offwhite);
  text-decoration: none;
  transform: translateY(-30px);
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease-out-expo),
              opacity var(--dur-slow) var(--ease-out-expo),
              color var(--dur-fast);
}
.nav-logo.in           { transform: translateY(0); opacity: 1; }
.nav-logo:hover        { color: var(--amber); }

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
  transform: translateY(-30px);
  opacity: 0;
  transition: transform var(--dur-slow) 0.1s var(--ease-out-expo),
              opacity var(--dur-slow) 0.1s var(--ease-out-expo);
}
.nav-links.in          { transform: translateY(0); opacity: 1; }

.nav-links a {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--offwhite);
  text-decoration: none;
  opacity: 0.45;
  position: relative;
  transition: opacity var(--dur-fast), color var(--dur-fast);
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0%; height: 1px;
  background: var(--amber);
  transition: width var(--dur-mid) var(--ease-in-out);
}
.nav-links a:hover        { opacity: 1; color: var(--amber); }
.nav-links a:hover::after { width: 100%; }

.nav-availability {
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(-30px);
  opacity: 0;
  transition: transform var(--dur-slow) 0.2s var(--ease-out-expo),
              opacity var(--dur-slow) 0.2s var(--ease-out-expo);
}
.nav-availability.in { transform: translateY(0); opacity: 1; }

.nav-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
  animation: navPulse 2.5s infinite;
}
@keyframes navPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 226, 230, 0.6); }
  50%       { box-shadow: 0 0 0 5px rgba(45, 226, 230, 0); }
}
.nav-avail-text {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber-dim);
}

/* ── SHARED SECTION UTILITIES ── */

/* Section label with decorative line */
.section-label,
.stage-eyebrow,
.contact-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--amber);
  display: flex;
  align-items: center;
  gap: 14px;
}

.eyebrow-line,
.label-line,
.tag-line {
  display: block;
  width: 20px;
  height: 1px;
  background: var(--amber);
  flex-shrink: 0;
}

/* Reveal animation — apply to any element, add .in via JS */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity var(--dur-slow) var(--ease-out-expo),
              transform var(--dur-slow) var(--ease-out-expo);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger helpers via inline style="--delay:Xs" */
.reveal[style*="--delay"] {
  transition-delay: var(--delay, 0s);
}

/* Clip-mask text reveal (used in hero & headings) */
.split-wrap {
  display: block;
  overflow: hidden;
  line-height: 0.92;
}
.split-line {
  display: block;
  transform: translateY(112%);
  transition: transform var(--dur-slow) var(--ease-out-expo);
}
.split-line.in {
  transform: translateY(0);
}

/* ── GRAIN OVERLAY ── */
/* Applied as a pseudo on hero and contact */
.hero-grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  opacity: 0.45;
  pointer-events: none;
  z-index: 2;
}

/* ── HORIZONTAL AMBER RULE ── */
.amber-rule {
  display: block;
  width: 0;
  height: 1px;
  background: var(--amber);
  transition: width 0.9s 0.6s var(--ease-out-expo);
}
.amber-rule.in { width: 60px; }

/* ── TYPOGRAPHY SCALE ── */
.t-display {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  line-height: 0.9;
}
.t-serif  { font-family: var(--font-serif); font-weight: 300; }
.t-mono   { font-family: var(--font-mono); font-weight: 300; }
.t-italic { font-family: var(--font-serif); font-style: italic; font-weight: 300; }

/* ── LINK RESET ── */
a { color: inherit; text-decoration: none; }
button { cursor: none; border: none; background: none; }
img, video { display: block; max-width: 100%; }

/* ── BORDERS ── */
.border-top    { border-top:    1px solid var(--gray-2); }
.border-bottom { border-bottom: 1px solid var(--gray-2); }

/* ── LENIS SMOOTH SCROLL ── */
html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ── PREVENT LAYOUT SHIFT ── */
canvas { display: block; }

/* ============================================================
   GLOBAL — hide mobile-only elements on desktop
   ============================================================ */
#hamburger   { display: none; }
#mobile-menu { display: none; }
.avail-mobile { display: none !important; }

/* ============================================================
   MOBILE — max-width: 768px
   ============================================================ */
@media (max-width: 768px) {

  .bl { display: none !important; }

  :root {
    --page-pad: 20px;
    --nav-h:    60px;
  }

  /* ── TOP BAR ── */
  .top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 500;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    transition: background 0.4s, backdrop-filter 0.4s;
    pointer-events: all;
  }
  .top-bar.scrolled {
    background: rgba(8,8,8,0.93);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--gray-2);
  }
  /* Hide desktop nav + avail in top bar */
  .top-bar .nav-links,
  .top-bar .avail { display: none !important; }

  /* ── HAMBURGER ── */
  #hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 6px;
    pointer-events: all;
    z-index: 600;
    position: relative;
  }
  #hamburger span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--offwhite);
    transition: all 0.4s cubic-bezier(.77,0,.18,1);
    transform-origin: center;
  }
  #hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  #hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  #hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  /* ── MOBILE MENU ── */
  #mobile-menu {
    display: flex;
    position: fixed;
    inset: 0;
    background: var(--black);
    z-index: 450;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s cubic-bezier(.16,1,.3,1);
  }
  #mobile-menu.open {
    opacity: 1;
    pointer-events: all;
  }
  /* Close X button inside menu */
  #mobile-menu-close {
    position: absolute;
    top: 24px;
    right: 28px;
    font-family: var(--font-serif);
    font-size: 32px;
    color: var(--offwhite);
    opacity: 0.5;
    cursor: pointer;
    line-height: 1;
    transition: opacity 0.3s, color 0.3s;
  }
  #mobile-menu-close:hover { opacity: 1; color: var(--amber); }

  #mobile-menu a {
    font-family: var(--font-display);
    font-size: clamp(48px, 13vw, 72px);
    color: var(--offwhite);
    text-decoration: none;
    letter-spacing: 0.06em;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.45s, transform 0.45s, color 0.3s;
  }
  #mobile-menu.open a { opacity: 1; transform: translateY(0); }
  #mobile-menu.open a:nth-child(2) { transition-delay: 0.08s; }
  #mobile-menu.open a:nth-child(3) { transition-delay: 0.16s; }
  #mobile-menu.open a:nth-child(4) { transition-delay: 0.24s; }
  #mobile-menu a:hover { color: var(--amber); }

  /* ── HERO ── */
  #hero { height: 100svh; overflow: hidden; }

  /* Available for hire — single instance above headline */
  .avail-mobile {
    display: flex !important;
    position: absolute;
    top: 76px;
    left: 16px;
    z-index: 5;
    align-items: center;
    gap: 8px;
  }
  /* Make sure the duplicate from top-bar is gone */
  .top-bar .avail { display: none !important; }

  /* Headline */
  .headline-wrap {
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    transform: translateY(-50%);
    text-align: left;
    padding: 0 16px;
    width: 100%;
  }
  .hl-line.l1 { font-size: 21vw; line-height: 0.88; white-space: nowrap; }
  .hl-line.l2 { font-size: 16.5vw; line-height: 0.9; padding-left: 0 !important; white-space: nowrap; }
  .hl-line.l3 { font-size: 21vw; line-height: 0.88; padding-left: 0 !important; white-space: nowrap; }

  .subtitle { justify-content: flex-start; font-size: 8px; letter-spacing: 0.18em; margin-top: 14px; }
  .sub-line { display: none; }

  /* Bottom bar — hide scroll + CTA, show role only */
  .bottom-bar { grid-template-columns: 1fr; gap: 4px; padding: 12px 20px 18px; }
  .br, .bc { display: none !important; }
  .bl { opacity: 1 !important; }
  .role { font-size: 8px; }
  .since { font-size: 7px; }

  /* Marquee */
  .mitem { font-size: 9px; }
  .mstrip { bottom: 60px; }

  /* ── WORK ── */
  .work-header { padding: 0 20px; }
  .cards-track { padding: 0 20px; gap: 14px; }
  .proj-card { width: 76vw; height: 56vh; flex-shrink: 0; }
  .proj-card.featured { width: 76vw; height: 62vh; }
  .work-index { display: none; }

  /* ── EXPAND OVERLAY — stacked on mobile ── */
  #expand-content {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto;
    padding: 80px 20px 40px;
    gap: 24px;
    align-items: start;
  }
  .exp-visual {
    width: 100%;
    aspect-ratio: 16 / 10;
  }
  .exp-title { font-size: clamp(40px, 11vw, 70px); }
  .exp-desc  { font-size: 16px; }

  /* ── ABOUT — columns stack, keep sticky scroll ── */
  #about-sticky {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
  }
  #about-visual-panel {
    border-right: none !important;
    border-bottom: 1px solid var(--gray-2);
    height: 42vh;
  }
  #about-content-panel {
    height: 58vh;
    padding: 28px 20px;
    overflow: hidden;
  }
  .stage-scrub-text { font-size: clamp(15px, 4vw, 20px); line-height: 1.6; }
  .manifesto-lines .mline { font-size: clamp(26px, 7vw, 40px); }
  .stat-num { font-size: clamp(30px, 8vw, 48px); }
  .stage-stats { gap: 20px; margin-top: 24px; flex-wrap: wrap; }
  .about-progress-rail { display: none; }

  /* ── CONTACT ── */
  #contact { padding-top: 100px; }
  .contact-headline .gword { font-size: clamp(44px, 12vw, 72px); }
  .contact-avail { flex-wrap: wrap; gap: 8px; }
  .contact-email { margin-left: 0 !important; font-size: 15px; }

  /* Form — all fields full width, stacked */
  .contact-form .form-row {
    display: flex !important;
    flex-direction: column !important;
    border-bottom: none !important;
  }
  .form-field {
    border-right: none !important;
    border-bottom: 1px solid var(--gray-2) !important;
  }

  /* Submit row */
  .form-submit-row {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding-top: 28px;
  }
  .form-note { text-align: center; order: 2; max-width: 100%; }
  .submit-btn { order: 1; width: 100%; justify-content: center; }

  /* ── FOOTER ── */
  .footer-ghost {
    font-size: clamp(44px, 13vw, 72px);
    text-align: center;
    padding: 40px 16px 0;
    white-space: normal;
    word-break: break-word;
    letter-spacing: -0.02em;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    padding: 28px 20px 36px;
    gap: 28px;
  }
  .footer-col--statement { grid-column: 1 / -1; }
  .footer-credits {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 14px 20px;
  }
}