/* ==========================================================================
   Wildman Studio
   Bodoni Moda (display) / Newsreader (reading) / IBM Plex Mono (data)
   No accent colour by design: the only chroma on the page is the client
   work itself, and the dispersion in the glass.
   ========================================================================== */

:root {
  --void:    #0A0A0B;
  --pitch:   #0E0E10;
  --raise:   #141417;
  --bone:    #EDE9E1;
  --silver:  #A9A49B;
  --stone:   #7A756D;
  --line:    rgba(237, 233, 225, 0.14);
  --hair:    rgba(237, 233, 225, 0.07);

  --serif:   "Bodoni Moda", "Didot", "Bodoni MT", Georgia, serif;
  --read:    "Newsreader", "Times New Roman", Times, serif;
  --mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gut:     clamp(1.5rem, 5vw, 6rem);
  --rule:    cubic-bezier(0.22, 1, 0.36, 1);
  --slow:    cubic-bezier(0.65, 0, 0.35, 1);

  /* W glyph aspect, from the traced logo: 999 x 712 */
  --w-ratio: 0.712712;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--void);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--bone);
  font-family: var(--read);
  font-weight: 300;
  font-size: clamp(1rem, 0.72rem + 0.42vw, 1.18rem);
  line-height: 1.62;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(237, 233, 225, 0.9); color: var(--void); }

/* height:auto matters: the width/height attributes on an img are presentation
   hints, and without this the attribute height wins over aspect-ratio and
   object-fit crops the picture to a box nobody asked for. */
img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

/* anchor jumps have to clear the fixed pill */
[id] { scroll-margin-top: 6.5rem; }

:focus-visible {
  outline: 1px solid var(--bone);
  outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   Type roles
   -------------------------------------------------------------------------- */

.display {
  font-family: var(--serif);
  font-variation-settings: "opsz" 96;
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.028em;
  margin: 0;
}

.meta {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.6875rem;
  letter-spacing: 0.185em;
  text-transform: uppercase;
  color: var(--stone);
  margin: 0;
}

.lede {
  font-family: var(--read);
  font-weight: 300;
  color: var(--silver);
  max-width: 34ch;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Section frame
   -------------------------------------------------------------------------- */

.band {
  position: relative;
  padding-inline: var(--gut);
}

.band-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 1.4rem;
  border-bottom: 1px solid var(--hair);
}

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 70;
  display: flex;
  justify-content: center;
  padding: clamp(0.9rem, 2vw, 1.6rem);
  pointer-events: none;
}

.nav-pill {
  pointer-events: auto;
  border-radius: 999px;     /* liquidGL reads this for the lens shape */
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--silver);

  /* The optics are liquidGL (WebGL, see index.html): the pill itself stays
     transparent so the lens canvas behind it shows through. No backdrop-filter
     here — the library owns that. */
  background: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 12px 40px -18px rgba(0, 0, 0, 0.9);
  position: relative;
  overflow: hidden;
  transition: transform 0.55s var(--rule), opacity 0.45s var(--rule);
}

/* Content layer. liquidGL sets pointer-events:none on the target, so this is
   where the links get their clicks back. Smoked, not clear: several of the
   sites that pass behind the pill are light, and clear glass leaves the labels
   unreadable over those — the tint lives here now, over the lens. */
.nav-pill > .in {
  position: relative;
  z-index: 3;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.4rem);
  padding: 0.6rem 0.7rem 0.6rem 1.15rem;
  border-radius: inherit;
  background: rgba(10, 10, 12, 0.40);
}

/* No WebGL at all (very old devices): the library adds this class and a plain
   frosted backdrop-filter; give the pill its old smoked ground back. */
.nav-pill.lg-fallback { background: rgba(10, 10, 12, 0.52); }

/* Out of the way while reading down, back on the way up. A centred pill sits
   over body copy on a narrow screen otherwise. */
.nav.tucked .nav-pill {
  transform: translateY(-160%);
  opacity: 0;
}

/* specular edge: bright at the poles, gone at the equator */
.nav-pill::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    170deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.12) 22%,
    rgba(255, 255, 255, 0) 45%,
    rgba(255, 255, 255, 0) 58%,
    rgba(255, 255, 255, 0.14) 80%,
    rgba(255, 255, 255, 0.44) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.nav-slot {
  width: 1.65rem;
  height: calc(1.65rem * var(--w-ratio));
  flex: none;
}

.nav a { transition: color 0.35s var(--rule); }
.nav a:hover { color: var(--bone); }

.nav-links { display: flex; gap: clamp(1rem, 2.4vw, 2rem); }

.nav-mail {
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  background: rgba(237, 233, 225, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  color: var(--bone);
  transition: background 0.35s var(--rule);
}
.nav-mail:hover { background: rgba(237, 233, 225, 0.14); }

@media (max-width: 40rem) {
  .nav-links { display: none; }
}

/* --------------------------------------------------------------------------
   The lens: the logo W, as a piece of glass, fixed over the page
   -------------------------------------------------------------------------- */

.lens {
  position: fixed;
  top: 0;
  left: 0;
  /* width and height are set in px by main.js at the hero size, then only ever
     scaled DOWN toward the nav, so the mask and the backdrop stay crisp */
  width: 0;
  height: 0;
  z-index: 75;            /* above the nav pill: it lands inside it */
  pointer-events: none;
  transform-origin: 0 0;
  will-change: transform;
  opacity: var(--lens-fade, 1);
  transition: opacity 0.45s var(--rule);
}

.lens-refract {
  position: absolute;
  inset: 0;
  -webkit-mask-image: url(img/w.svg);
          mask-image: url(img/w.svg);
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
}

/* Only refract where the mask actually clips it. Without the mask this would
   be a blurred rectangle sitting over the hero, which is worse than nothing:
   the SVG art below still draws the W either way. */
@supports (mask-image: url("img/w.svg")) or (-webkit-mask-image: url("img/w.svg")) {
  .lens-refract {
    backdrop-filter: blur(9px) saturate(210%) brightness(1.55) contrast(1.08);
    -webkit-backdrop-filter: blur(9px) saturate(210%) brightness(1.55) contrast(1.08);
    background: rgba(237, 233, 225, 0.055);
  }
}

.lens-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* The glass fills in and becomes the solid mark as it docks into the nav. */
.lens-art .ink  { fill: var(--bone); opacity: var(--lens-ink, 0); }
.lens-art .body { fill: url(#lens-body); }
.lens-art .rim  { fill: none; stroke: url(#lens-rim); stroke-width: 4; }
.lens-art .spec { fill: none; stroke: url(#lens-spec); stroke-width: 6; }
/* dispersion: the only colour that is not the client work */
.lens-art .disp-r { fill: none; stroke: rgba(255, 96, 72, 0.30); stroke-width: 2.5; transform: translate(-2.5px, -1.5px); }
.lens-art .disp-b { fill: none; stroke: rgba(72, 148, 255, 0.30); stroke-width: 2.5; transform: translate(2.5px, 1.5px); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

/* Deliberately NOT a stacking context: the hero copy has to be able to sit
   above the fixed lens (z 75) so the wordmark stays crisp while the glass
   refracts the shader behind it. */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-shader {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* a slow vertical settle so the shader never reads as a flat plate */
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 11, 0.60) 0%,
    rgba(10, 10, 11, 0.10) 40%,
    rgba(10, 10, 11, 0.42) 76%,
    var(--void) 100%
  );
}

.hero-inner {
  position: relative;
  z-index: 80;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 8rem var(--gut) 2rem;
  gap: clamp(1.1rem, 2.2vw, 1.9rem);
  /* text only, and it sits above the nav (z 80 > 70): without this it
     swallows clicks meant for the pill while the hero is on screen */
  pointer-events: none;
}

.hero-eyebrow { color: var(--stone); }

/* keep the eyebrow on one line rather than letting it wrap into the wordmark */
@media (max-width: 30rem) {
  .hero-eyebrow { font-size: 0.575rem; letter-spacing: 0.13em; }
}

.wordmark {
  font-size: clamp(3rem, 12.2vw, 14rem);
  letter-spacing: -0.035em;
  line-height: 0.86;
}

.wordmark .en { display: block; }

.hero-lede {
  max-width: 30ch;
  text-align: center;
  font-size: clamp(1.02rem, 0.8rem + 0.5vw, 1.32rem);
}

.hero-foot {
  position: relative;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0 var(--gut) clamp(1.4rem, 3vw, 2.6rem);
  pointer-events: none;   /* same reason as .hero-inner */
}

.cue { display: grid; gap: 0.6rem; justify-items: center; }
.cue-rail {
  width: 1px;
  height: 3.2rem;
  background: linear-gradient(to bottom, var(--line), transparent);
  position: relative;
  overflow: hidden;
}
.cue-rail::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 40%;
  background: var(--bone);
  animation: cue-fall 2.6s var(--slow) infinite;
}
@keyframes cue-fall {
  0%   { transform: translateY(-100%); opacity: 0; }
  40%  { opacity: 1; }
  100% { transform: translateY(250%); opacity: 0; }
}

@media (max-width: 48rem) {
  .hero-foot { justify-content: center; }
  .hero-foot .meta:not(.cue .meta) { display: none; }
}

/* --------------------------------------------------------------------------
   Reveals
   -------------------------------------------------------------------------- */

.rise {
  opacity: 0;
  transform: translateY(1.6rem);
  transition:
    opacity 1.1s var(--rule),
    transform 1.1s var(--rule);
  transition-delay: var(--d, 0ms);
}
.rise.seen { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise { opacity: 1; transform: none; transition: none; }
  .cue-rail::after { animation: none; }
  /* words still come and go with the scroll, they just do not blur or drift */
  .word-big .l { filter: none; transform: none; }
  .word.on .word-big .l { animation: none; }
  .word-note { transform: none; }
  .card img { transition: none; }
  .mailto::after { transition: none; }
}

/* --------------------------------------------------------------------------
   Work: a pinned stage, one site at a time, with the index alongside
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Work: two rails on a tilted plane, drifting, shoved by scroll velocity
   -------------------------------------------------------------------------- */

.work {
  position: relative;
  height: calc(100svh * 2.6);
}

.work-pin {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(1rem, 2.5vh, 2rem);
  padding: clamp(5.5rem, 11vh, 8rem) 0 clamp(2.5rem, 6vh, 4rem);
  overflow: hidden;
}

.work-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding-inline: var(--gut);
}

/* the plane lives in perspective; the rails ride on it */
.rail-stage {
  perspective: 1500px;
  perspective-origin: 50% 46%;
  display: grid;
  align-content: center;
  overflow: hidden;
  /* The fade lives here, not on the rails: perspective magnifies the tilted
     plane past the viewport, which would carry a rail-level mask off-screen
     and leave the cards hard-cut at both edges. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 13%, #000 87%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 13%, #000 87%, transparent);
}

.rail-plane {
  display: grid;
  gap: clamp(0.9rem, 2.2vh, 1.9rem);
  transform-style: preserve-3d;
  will-change: transform;
}

.rail { overflow: hidden; }

.rail-track {
  display: flex;
  gap: clamp(0.7rem, 1.6vw, 1.5rem);
  width: max-content;
  will-change: transform;
}

.card {
  position: relative;
  flex: none;
  width: clamp(12rem, 21vw, 23rem);
  margin: 0;
  border: 1px solid var(--line);
  background: var(--pitch);
  overflow: hidden;
}

.card img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  /* --sat and --bri are set per frame on .rail-plane, so colour blooms in
     over the section and drains again rather than arriving all at once */
  filter: saturate(var(--sat, 1)) brightness(var(--bri, 1));
  transition: transform 1.1s var(--rule);
}

.card figcaption {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(to top, rgba(10, 10, 11, 0.92), rgba(10, 10, 11, 0));
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.55s var(--rule), transform 0.55s var(--rule);
}

.card figcaption .nm { color: var(--bone); }
.card figcaption .wt { color: var(--stone); flex: none; }

@media (hover: hover) {
  /* pointing at one brings its colour straight back, whatever the section
     is doing: the bloom is atmosphere, hover is intent */
  .card:hover img { filter: saturate(1.02) brightness(1); transform: scale(1.035); }
  .card:hover figcaption { opacity: 1; transform: none; }
}
/* touch has no hover, so the labels just stay on */
@media (hover: none) {
  .card figcaption { opacity: 1; transform: none; }
}

@media (max-width: 46rem) {
  .rail-plane { gap: 0.7rem; }
  .card { width: 70vw; }
}

/* --------------------------------------------------------------------------
   Statement: words light as they pass
   -------------------------------------------------------------------------- */

.say {
  padding: clamp(6rem, 16vh, 15rem) var(--gut) clamp(5rem, 14vh, 13rem);
  max-width: 62rem;
  margin-inline: auto;
}

.say-line {
  font-family: var(--serif);
  font-variation-settings: "opsz" 96;
  font-weight: 400;
  font-size: clamp(1.7rem, 4.4vw, 3.7rem);
  line-height: 1.18;
  letter-spacing: -0.022em;
  margin: 0 0 1.4em;
}

.say-line em { font-style: italic; }

.say .w { color: rgba(237, 233, 225, 0.22); transition: color 0.5s var(--rule); }
.say .w.lit { color: var(--bone); }

.say-tail {
  font-family: var(--read);
  font-size: clamp(1rem, 0.8rem + 0.4vw, 1.2rem);
  color: var(--silver);
  max-width: 42ch;
  margin: 0;
}

/* --------------------------------------------------------------------------
   What I do: black, then a word resolves out of it, then black again
   -------------------------------------------------------------------------- */

.doing {
  position: relative;
  height: calc(100svh * 6.8);
}

.doing-pin {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(1rem, 3vh, 2rem);
  padding: clamp(5.5rem, 11vh, 8rem) var(--gut) clamp(2rem, 5vh, 3.5rem);
}

.word-stack { position: relative; display: grid; align-content: center; }

.word {
  grid-area: 1 / 1;
  display: grid;
  gap: clamp(0.7rem, 2vh, 1.6rem);
  align-content: center;
  pointer-events: none;
}

.word-big {
  font-family: var(--serif);
  font-variation-settings: "opsz" 96;
  font-weight: 400;
  /* a floor for before the fonts load; main.js then sizes every word to the
     exact width of the column, so each one spans the screen */
  font-size: clamp(3.4rem, 17.5vw, 15rem);
  line-height: 0.86;
  letter-spacing: -0.035em;
  margin: 0;
  white-space: nowrap;
  width: max-content;      /* so the measured box is the text, not the column */
}

/* Every word runs its own 0-to-1 presence, set per frame on .word as --p.
   It sits at 0 for the first and last stretch of the word's scroll segment,
   so between words the screen is genuinely empty. Letters resolve out of the
   dark rather than flipping: blurred and low, to sharp and exact, staggered
   left to right off --i. */
/* The blur goes on the whole word, not on each letter. Per-letter it was seven
   big filter regions plus seven promoted layers, and that cost a 150ms hitch
   on the frame where a word started resolving. One region, same look. */
.word-big {
  filter: blur(calc((1 - var(--p, 0)) * 16px));
}
.word.settled .word-big { filter: none; }

.word-big .l {
  display: inline-block;
  color: var(--bone);
  --lp: clamp(0, calc((var(--p, 0) - var(--i) * 0.026) * 1.32), 1);
  opacity: var(--lp);
  transform: translateY(calc((1 - var(--lp)) * 0.16em));
}

/* the light coming up under the word, borrowed from lamp.tsx and stripped to
   a single hairline: it draws out from the centre and retracts on the way out */
.word-rule {
  height: 1px;
  width: min(100%, 34rem);
  background: linear-gradient(to right, transparent, var(--bone), transparent);
  transform: scaleX(var(--p, 0));
  opacity: calc(var(--p, 0) * 0.6);
  will-change: transform, opacity;
}

/* A pass of light over the live word. It has to go on each letter, not on the
   heading: a background-clip on the h3 paints nothing, because the letters are
   transformed and paint outside the parent's clipped background. */
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .word.on .word-big .l {
    background-image: linear-gradient(100deg,
      var(--bone) 0%, var(--bone) 42%,
      #FFFFFF 50%, var(--bone) 58%, var(--bone) 100%);
    background-size: 900% 100%;
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: word-sheen 6.5s var(--slow) infinite;
    animation-delay: calc(var(--i) * -55ms);
  }
}
@keyframes word-sheen {
  0%, 58% { background-position: 130% 50%; }
  100%    { background-position: -30% 50%; }
}

.word-note {
  font-family: var(--read);
  font-size: clamp(0.95rem, 0.78rem + 0.42vw, 1.2rem);
  color: var(--silver);
  max-width: 46ch;
  margin: 0;
  /* trails the word in, so the headline lands first */
  opacity: clamp(0, calc((var(--p, 0) - 0.3) * 2.4), 1);
  transform: translateY(calc((1 - var(--p, 0)) * 0.9rem));
}

@media (max-width: 40rem) {
  .word-big { font-size: clamp(2.6rem, 15vw, 6rem); }
  .word-rule { width: 100%; }
}

/* progress hairline under the word stack */
.work-bar { height: 1px; background: var(--hair); position: relative; }
.work-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--bone);
  width: var(--p, 0%);
}

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.close {
  padding: clamp(5rem, 12vh, 9rem) var(--gut) clamp(2rem, 5vh, 3rem);
  border-top: 1px solid var(--hair);
  display: grid;
  gap: clamp(1.6rem, 4vh, 2.8rem);
  justify-items: start;
}

.mailto {
  font-family: var(--serif);
  font-variation-settings: "opsz" 96;
  font-weight: 400;
  font-size: clamp(1.5rem, 6.6vw, 5.2rem);
  line-height: 1;
  letter-spacing: -0.032em;
  display: inline-block;
  position: relative;
  word-break: break-word;
}
.mailto::after {
  content: "";
  position: absolute;
  inset: auto 0 -0.14em 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 0.75s var(--rule);
}
.mailto:hover::after { transform: scaleX(1); transform-origin: 0 50%; }

.colophon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  justify-content: space-between;
  align-items: baseline;
  padding: clamp(1.6rem, 4vh, 2.6rem) var(--gut) clamp(1.6rem, 4vh, 2.4rem);
  border-top: 1px solid var(--hair);
}
