/* ============================================================
   The Innovation Department — styles
   Warm, young, editorial. Nyght Serif (display) + Inter (body).
   ============================================================ */

/* ---------- Nyght Serif (self-hosted, SIL OFL) ---------- */
@font-face {
  font-family: "Nyght Serif";
  src: url("fonts/01nyghtserif-light.woff") format("woff");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nyght Serif";
  src: url("fonts/01nyghtserif-lightitalic.woff") format("woff");
  font-weight: 300; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Nyght Serif";
  src: url("fonts/02nyghtserif-regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nyght Serif";
  src: url("fonts/02nyghtserif-regularitalic.woff") format("woff");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Nyght Serif";
  src: url("fonts/03nyghtserif-medium.woff") format("woff");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nyght Serif";
  src: url("fonts/03nyghtserif-mediumitalic.woff") format("woff");
  font-weight: 500; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Nyght Serif";
  src: url("fonts/04nyghtserif-bold.woff") format("woff");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nyght Serif";
  src: url("fonts/04nyghtserif-bolditalic.woff") format("woff");
  font-weight: 700; font-style: italic; font-display: swap;
}

:root {
  --cream:      #F4EFE6;
  --cream-deep: #EBE3D5;
  --ink:        #1C1A17;
  --ink-soft:   #4A463F;
  --muted:      #8A8478;
  --coral:      #FF5A36;
  --coral-deep: #E8410F;
  --line:       rgba(28, 26, 23, 0.14);

  --maxw: 1440px;            /* Alma container width */
  --pad: clamp(1.25rem, 5vw, 5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font-display: "Nyght Serif", Georgia, serif;
  --font-body: "Montserrat", system-ui, -apple-system, sans-serif;
  --fw-display: 400;   /* one consistent weight for ALL headers (Nyght ships 300/400/500/700) */

  /* ---- Alma type scale (responsive clamps, named by max px) ---- */
  --fs-hero:    clamp(3rem, -0.4rem + 13.5vw, 12rem);          /* fills desktop width */
  --fs-display: clamp(2.75rem, 1.759rem + 3.304vw, 5.0625rem);  /*  81 */
  --fs-h1:      clamp(2.125rem, 1.589rem + 1.786vw, 3.375rem);  /*  54 */
  --fs-h2:      clamp(1.625rem, 1.357rem + 0.893vw, 2.25rem);   /*  36 */
  --fs-lead:    clamp(1.0625rem, 0.875rem + 0.625vw, 1.5rem);   /*  24 */
  --fs-body:    clamp(0.875rem, 0.714rem + 0.536vw, 1.25rem);   /*  20 */
  --fs-label:   clamp(0.6875rem, 0.607rem + 0.268vw, 0.875rem); /*  14 */

  color-scheme: light;
}

/* ---------- Dark theme ----------
   Same warm palette, inverted: a near-black warm ground with cream type.
   Applied for an explicit choice (data-theme="dark") OR by system
   preference when the user hasn't overridden it (:not([data-theme="light"])). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --cream:      #16130E;
  --cream-deep: #211C15;
  --ink:        #F4EFE6;
  --ink-soft:   #C7C0B2;
  --muted:      #9A9488;
  --coral:      #FF6A47;
  --coral-deep: #FF7E5A;
  --line:       rgba(244, 239, 230, 0.16);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --cream:      #16130E;
    --cream-deep: #211C15;
    --ink:        #F4EFE6;
    --ink-soft:   #C7C0B2;
    --muted:      #9A9488;
    --coral:      #FF6A47;
    --coral-deep: #FF7E5A;
    --line:       rgba(244, 239, 230, 0.16);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

a { color: inherit; text-decoration: none; }
em { font-style: italic; }

::selection { background: var(--coral); color: var(--cream); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--pad);
  font-size: 0.75rem;   /* 12px (Figma nav) */
  color: var(--muted);
}
.brand { display: inline-flex; align-items: center; transition: opacity 0.3s; }
.brand:hover { opacity: 0.6; }
.brand-logo { display: block; height: 0.9rem; width: auto; }
.nav { display: flex; align-items: center; gap: clamp(0.95rem, 1.8vw, 1.3rem); }
.nav a {
  position: relative;
  color: var(--ink);
  font-weight: 500;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: opacity 0.3s, color 0.3s;
}
.nav a:hover { opacity: 1; }
.nav a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; bottom: -3px;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform 0.35s var(--ease);
}
/* underline reveals on hover and for the active section (scroll-spy) */
.nav a:not(.nav-cta):hover::after,
.nav a:not(.nav-cta)[aria-current]::after { transform: scaleX(1); transform-origin: left; }
.nav a[aria-current] { opacity: 1; color: var(--coral-deep); }
.nav-cta { font-weight: 600; opacity: 1; }

/* ---------- Layout ---------- */
.section {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(7rem, 19vh, 13rem) var(--pad);
}
.section-index {
  display: inline-block;
  font-size: var(--fs-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--coral-deep);
  margin-bottom: clamp(2.6rem, 5vh, 4rem);
  font-weight: 600;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 7rem var(--pad) 3rem;
}
/* keep all hero content above the sand-trail layer */
.hero > :not(.sand-trail) { position: relative; z-index: 1; }
/* sand cursor trail */
.goo-defs { position: absolute; width: 0; height: 0; pointer-events: none; }
.sand-trail {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  filter: url(#sand-goo);
}
.sand-cell {
  position: absolute;
  border-radius: 50%;
  will-change: opacity, transform;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-hero);   /* Alma hero = 112px */
  line-height: 1.04;
  letter-spacing: -0.02em;
}
/* padding gives descenders (p, g, y) room inside the clip box;
   the equal negative margin keeps line spacing unchanged */
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.18em; margin-bottom: -0.18em; }
.hero-title .line > span { display: block; }
/* The statement is built from outlined-vector word SVGs laid on a shared
   baseline: script "Distinctive"/"brands" + serif "for"/"unmissable"/"products".
   Heights are em-based so the whole line scales with --fs-hero;
   bottom-alignment keeps the baselines together. */
.hero-title .line > span.words {
  display: flex;
  align-items: flex-end;
  /* words sit edge-to-edge — the spacing is baked into each SVG's bounds */
  gap: 0;
}
.hero-title .word { flex: 0 0 auto; }
.hero-title .word--script { height: 0.85em; }   /* distinctive / brands (vbH ≈ 75.7) */
.hero-title .word--serif  { height: 0.785em; }  /* for / unmissable / products (vbH ≈ 70) */
.hero-sub {
  font-family: var(--font-body);
  font-weight: 400;
  max-width: 32rem;   /* ≈ design 489px — wraps to two lines */
  margin-top: 2rem;
  font-size: 1.18rem;   /* ≈ 18.9px (Figma) */
  color: var(--ink-soft);
  line-height: 1.4;
  letter-spacing: -0.005em;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.4rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.85rem 1.5rem;
  border-radius: 100px;
  font-size: 0.95rem; font-weight: 500;
  transition: transform 0.4s var(--ease), background 0.3s, color 0.3s;
  will-change: transform;
}
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: var(--coral); color: #fff; }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn-block { width: 100%; padding: 1.05rem; font-size: 1.02rem; }

/* ---------- Statement headings (Approach + Process) ---------- */
.statement {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: clamp(2rem, 1.2rem + 2.5vw, 3.28rem);   /* ≈ 52px (Figma) */
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.statement-sub {
  font-family: var(--font-body);
  font-size: 1.18rem;   /* ≈ 18.9px */
  color: var(--ink-soft);
  margin-top: 1.4rem;
  line-height: 1.5;
  max-width: 42ch;
}

/* ---------- Services (under the Approach statement) ---------- */
.services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(2rem, 4vw, 4rem);
  margin-top: clamp(4rem, 8vh, 7rem);
  border-top: 1px solid var(--line);
  padding-top: 4rem;
}
.service { position: relative; }
.service-no {
  font-size: 0.6875rem; color: var(--muted); font-weight: 600; letter-spacing: 0.1em;   /* 11px */
}
.service h3 {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: 1.4rem;   /* ≈ 22.4px (Figma) */
  line-height: 1.5;
  margin: 0.7rem 0 0.65rem;
  letter-spacing: -0.01em;
}
.service p { color: var(--ink-soft); font-size: 0.875rem; line-height: 1.6; }   /* 14px */

/* ---------- Who ---------- */
.who { background: var(--cream-deep); max-width: none; }
.who > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.who-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
.who-photo {
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--cream);
}
.who-photo img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  filter: grayscale(1);
  transition: transform 0.8s var(--ease), filter 0.6s var(--ease);
}
.who-photo:hover img { transform: scale(1.04); filter: grayscale(0); }
.who-lead {
  font-family: "Instrument Serif", var(--font-display);
  font-weight: 400;
  font-size: clamp(1.55rem, 1.1rem + 1.3vw, 2rem);   /* ≈ 31px (Figma 47-5641) */
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 1.4rem;
}
.who-body p:not(.who-lead) { font-size: 1rem; color: var(--ink-soft); line-height: 1.6; margin-bottom: 1.6rem; max-width: 56ch; }   /* 16px */

/* ---------- How / Process ---------- */
.how .statement,
.work .statement { margin-bottom: clamp(1.8rem, 3.5vh, 2.6rem); }
.how-intro {
  max-width: 62ch;
  font-size: 1rem;   /* 16px */
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 5.5rem;
}
.steps-label {
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.4rem;
}

/* Process: four cream-deep cards — number, title, kicker, then a
   diamond-bulleted list with hairline separators. */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
}
.step {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  background: var(--cream-deep);
  padding: clamp(1.4rem, 2vw, 1.9rem) clamp(1.1rem, 1.7vw, 1.8rem) clamp(1.6rem, 2.2vw, 2.1rem);
}
.step-num {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.14em;
}
.step-head h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: 2rem;   /* 32px (Figma) */
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 0.55rem;
}
.step-kicker {
  display: block;
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral-deep);
}
.step ul {
  list-style: none;
  border-top: 1px solid var(--line);
}
.step li {
  display: flex;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.5;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.step li::before {
  content: "◆";
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.5em;
  position: relative;
  top: 0.5em;
}
.how-foot { margin-top: 3rem; font-size: var(--fs-label); color: var(--muted); max-width: 64ch; font-style: italic; }

/* ---------- The Work ---------- */
.work-intro { max-width: 60ch; font-size: 1rem; color: var(--ink-soft); line-height: 1.6; margin-bottom: 1.25rem; }   /* 16px */
.work-note { font-style: italic; font-size: 0.75rem; color: var(--muted); max-width: 70ch; margin-bottom: 4.5rem; }   /* 12px */
/* Work — grid of project cards */
.work-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.6rem, 3vw, 2.8rem) clamp(1.4rem, 2.5vw, 2.2rem);
}
.work-item { position: relative; display: block; }
/* Caption overlays the image's lower edge, revealed on hover over a gradient
   scrim (sits inside .work-thumb, so it's clipped to the rounded card). */
.work-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  padding: 2.6rem 1.1rem 1.05rem;
  background: linear-gradient(to top,
    rgba(20, 18, 15, 0.82) 0%,
    rgba(20, 18, 15, 0.45) 45%,
    rgba(20, 18, 15, 0) 100%);
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
  pointer-events: none;
}
.work-item:hover .work-caption { opacity: 1; transform: none; }
.work-name {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: clamp(1.25rem, 0.9rem + 1vw, 1.6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  /* Always light: the caption sits on a fixed dark scrim over the image,
     so this must not follow the theme (var(--cream) flips dark in dark mode). */
  color: #F4EFE6;
}
.work-desc { font-size: var(--fs-label); color: rgba(244, 239, 230, 0.82); margin-top: 0.25rem; }
.work-item--building .work-name { color: var(--coral); }
/* Touch devices (no hover): keep captions visible so names are never hidden */
@media (hover: none) {
  .work-caption { opacity: 1; transform: none; }
}

/* Project media — full-width card top (still, hover-swap, or autoplay video) */
.work-thumb {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cream-deep);
}
.work-thumb img,
.work-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.7s var(--ease);
}
/* Layered stills: base sits below, hover image cross-fades in on hover */
.work-thumb-base,
.work-thumb-hover {
  position: absolute; inset: 0;
}
.work-thumb-hover {
  opacity: 0;
  transition: opacity 0.55s var(--ease), transform 0.7s var(--ease);
}
.work-item:hover .work-thumb-hover { opacity: 1; }
.work-item:hover .work-thumb img,
.work-item:hover .work-thumb video { transform: scale(1.05); }
/* McDonald's: anchor the crop to the top so the headline text stays in frame */
.work-item--mcd .work-thumb img { object-position: center top; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact-title {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: clamp(2rem, 1.2rem + 2.5vw, 3.28rem);   /* ≈ 52px (Figma) */
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.contact-title .reveal-line { display: block; }
/* "Let's talk!" — hand-script (from Figma), centered below the title */
.contact-script {
  display: block;
  width: clamp(180px, 24vw, 250px);
  height: auto;
  margin: 0.7rem auto 0;
}
/* email pill — the single CTA */
.contact-email {
  max-width: 620px;
  margin: clamp(2.4rem, 5vh, 3.6rem) auto 0;
  font-size: 1.02rem;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem;
  justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto;
  padding: 2.5rem var(--pad) 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem; color: var(--muted);   /* 12px */
}
.to-top { color: var(--ink); font-weight: 500; transition: color 0.3s; }
.to-top:hover { color: var(--coral); }

/* ---------- Theme toggle (sliding sun/moon switch) ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle-icon { font-size: 0.85rem; opacity: 0.7; }
.theme-toggle-track {
  position: relative;
  width: 46px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--cream-deep);
  transition: border-color 0.3s, background 0.3s;
}
.theme-toggle-thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateY(-50%);
  transition: transform 0.35s var(--ease), background 0.3s;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle:hover .theme-toggle-track { border-color: var(--coral); }
.theme-toggle:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; border-radius: 100px; }
/* Slide the thumb to the moon when dark mode is active (by choice or by system) */
:root[data-theme="dark"] .theme-toggle-thumb { transform: translate(22px, -50%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-thumb { transform: translate(22px, -50%); }
}

/* ---------- Reveal base states (JS animates these in) ---------- */
.reveal-up { opacity: 0; transform: translateY(28px); }
.reveal-line { opacity: 0; }
/* All hero lines slide up EXCEPT the script line, which is "written" L→R instead */
.js-ready .hero-title .line:not(.line--write) > span { transform: translateY(110%); }
/* Script words start clipped from the right; JS sweeps the clip open to reveal
   them left-to-right, like cursive being written. */
.js-ready .hero-title .word--write { clip-path: inset(0% 100% 0% 0%); will-change: clip-path; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .services { grid-template-columns: 1fr; gap: 2.5rem; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .who-grid { grid-template-columns: 1fr; }
  .who-photo { order: -1; max-width: 320px; aspect-ratio: 1 / 1; }
  .work-list { grid-template-columns: repeat(2, 1fr); }
  .nav a:not(.nav-cta) { display: none; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .work-list { grid-template-columns: 1fr; }
  .site-header { font-size: 0.72rem; }
  .brand-logo { height: 0.72rem; max-width: 60vw; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal-up, .reveal-line { opacity: 1 !important; transform: none !important; }
  .js-ready .hero-title .line > span { transform: none !important; }
  .js-ready .hero-title .word--write { clip-path: none !important; }
}
