/* ==========================================================================
   HOME — the descent: surface → underground → transformation → product
   One sticky stage drives the whole opening chapter.
   ========================================================================== */

/* ---- The scroll track -------------------------------------------------- */

.descent {
  position: relative;
  height: var(--track, 700vh);
  background: var(--ink-950);
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

/* Ground colour — lerped from near-black to warm paper by JS */
.stage__bg {
  position: absolute;
  inset: 0;
  background: var(--stage-bg, #060708);
  z-index: 0;
}

/* Soft light pooling at the tunnel mouth; fades as we surface into design */
.stage__glow {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: var(--glow, 1);
  background:
    radial-gradient(58% 46% at 50% 46%, rgba(217, 164, 94, 0.13), transparent 68%),
    radial-gradient(120% 80% at 50% 120%, rgba(176, 106, 60, 0.1), transparent 60%);
  pointer-events: none;
}

/* Atmospheric haze */
.stage__haze {
  position: absolute;
  inset: -10%;
  z-index: 3;
  opacity: var(--haze, 0.85);
  pointer-events: none;
  background:
    radial-gradient(70% 50% at 50% 55%, rgba(120, 116, 110, 0.16), transparent 70%),
    linear-gradient(to bottom, rgba(6, 7, 8, 0.7), transparent 30%, transparent 62%, rgba(6, 7, 8, 0.86));
  mix-blend-mode: screen;
}

/* Vignette keeps the frame cinematic */
.stage__vignette {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: var(--vignette, 1);
  box-shadow: inset 0 0 clamp(80px, 14vw, 220px) clamp(20px, 4vw, 70px) rgba(4, 5, 6, 0.85);
}

.scene {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Dust ------------------------------------------------------------- */

.dust {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: var(--dust, 1);
  transition: opacity 0.4s linear;
}
.dust i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: rgba(226, 214, 196, 0.55);
  animation: drift var(--dur) linear var(--delay) infinite;
  will-change: transform, opacity;
}
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(0.6); opacity: 0; }
  12%  { opacity: 0.7; }
  70%  { opacity: 0.5; }
  100% { transform: translate3d(var(--dx), -140px, 0) scale(1); opacity: 0; }
}

/* ---- Content layer ---------------------------------------------------- */

.stage__content {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: stretch;
  pointer-events: none;
}
.stage__content a,
.stage__content button { pointer-events: auto; }

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

.hero {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(5.5rem, 12vh, 9rem) var(--gutter) clamp(2rem, 5vh, 3.5rem);
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  color: #f2efe9;
  opacity: var(--hero-o, 1);
  transform: translate3d(0, var(--hero-y, 0px), 0);
  will-change: opacity, transform;
}

.hero__id {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.hero__id .mono { color: rgba(242, 239, 233, 0.6); }
.hero__id .mono strong {
  color: #f2efe9;
  font-weight: 500;
  letter-spacing: 0.16em;
}

/* Sized so the statement lands in three lines and the CTA row below it
   always stays on screen — the recruiter's exit must never be pushed
   under the fold by the type. */
.hero__main {
  align-self: end;
  max-width: min(760px, 56vw);
}

.hero__statement {
  font-size: clamp(2.1rem, 5vw, 4.6rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.045em;
  color: #f7f4ee;
}
.hero__statement em {
  font-style: normal;
  color: var(--amber);
}

.hero__origin {
  margin-top: clamp(1.25rem, 3vw, 2rem);
  color: rgba(242, 239, 233, 0.62);
}
.hero__origin .arw { color: var(--copper-lit); }

.hero__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: clamp(2rem, 5vh, 3.5rem);
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.8em;
  padding: 0.9em 1.5em;
  border: 1px solid rgba(242, 239, 233, 0.28);
  border-radius: var(--radius);
  color: #f7f4ee;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease),
    color 0.5s var(--ease);
}
.hero__cta:hover {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink-950);
}
.hero__cta .arw { transition: transform 0.4s var(--ease); }
.hero__cta:hover .arw { transform: translateX(4px); }

.hero__scroll {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  color: rgba(242, 239, 233, 0.45);
}
.hero__scroll .tick {
  display: block;
  width: 1px;
  height: 34px;
  background: linear-gradient(to bottom, rgba(242, 239, 233, 0.5), transparent);
  position: relative;
  overflow: hidden;
}
.hero__scroll .tick::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--amber);
  animation: tickfall 2.6s var(--ease-io) infinite;
}
@keyframes tickfall {
  0%   { transform: translateY(-100%); }
  55%  { transform: translateY(100%); }
  100% { transform: translateY(100%); }
}

/* ---- Depth readout ---------------------------------------------------- */

.hud {
  position: absolute;
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  opacity: var(--hud-o, 0);
  color: rgba(242, 239, 233, 0.55);
  pointer-events: none;
}
.hud__scale {
  width: 1px;
  height: 26vh;
  background: rgba(242, 239, 233, 0.16);
  position: relative;
}
.hud__scale::after {
  content: "";
  position: absolute;
  left: -2px;
  top: var(--hud-p, 0%);
  width: 5px;
  height: 1px;
  background: var(--amber);
}
.hud__val {
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  writing-mode: vertical-rl;
}

/* ---- Captions --------------------------------------------------------- */

.caps {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: var(--gutter);
}

.cap {
  position: absolute;
  width: min(100%, 1000px);
  text-align: center;
  opacity: 0;
  will-change: opacity, transform;
}
.cap p {
  margin: 0 auto;
  max-width: 24ch;
  font-size: clamp(1.5rem, 3.6vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--cap-color, #efece6);
}
.cap .mono {
  display: block;
  margin-bottom: 1.1rem;
  color: var(--copper-lit);
}

/* During the transformation the copy steps aside and lets the scene talk */
.cap--top { top: clamp(9vh, 13vh, 15vh); }
.cap--top p {
  font-size: clamp(1.05rem, 2.1vw, 1.75rem);
  max-width: 30ch;
  letter-spacing: -0.03em;
}

/* The operations list — six words, one grid */
.cap--ops ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.5rem, 2vw, 1.4rem) clamp(1rem, 4vw, 3rem);
  max-width: 780px;
  margin-inline: auto;
}
.cap--ops li {
  font-size: clamp(0.95rem, 1.9vw, 1.5rem);
  letter-spacing: -0.03em;
  color: #efece6;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(239, 236, 230, 0.14);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.cap--ops.is-on li { opacity: 1; transform: none; }
.cap--ops.is-on li:nth-child(1) { transition-delay: 0.00s; }
.cap--ops.is-on li:nth-child(2) { transition-delay: 0.08s; }
.cap--ops.is-on li:nth-child(3) { transition-delay: 0.16s; }
.cap--ops.is-on li:nth-child(4) { transition-delay: 0.24s; }
.cap--ops.is-on li:nth-child(5) { transition-delay: 0.32s; }
.cap--ops.is-on li:nth-child(6) { transition-delay: 0.40s; }

@media (max-width: 620px) {
  .cap--ops ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Stage labels for the transformation (MINE MAP → SYSTEM FLOW → …) */
.phase {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(2rem, 6vh, 3.5rem);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: var(--phase-o, 0);
  color: var(--phase-color, rgba(242, 239, 233, 0.55));
  pointer-events: none;
}
.phase__bar {
  width: clamp(60px, 10vw, 120px);
  height: 1px;
  background: currentColor;
  opacity: 0.3;
  position: relative;
}
.phase__bar::after {
  content: "";
  position: absolute;
  left: 0; top: 0;
  height: 1px;
  width: var(--phase-p, 0%);
  background: var(--copper-lit);
}
.phase__name {
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ---- Static fallback (reduced motion / no JS) -------------------------- */

.descent.is-static { height: auto; background: var(--ink-950); }
.descent.is-static .stage {
  position: relative;
  height: auto;
  min-height: 100vh;
  padding-bottom: clamp(3rem, 8vw, 6rem);
}
.descent.is-static .stage__bg { background: var(--ink-950); }
.descent.is-static .stage__glow,
.descent.is-static .stage__haze,
.descent.is-static .stage__vignette { display: none; }
.descent.is-static .stage__content { position: relative; inset: auto; display: block; }
.descent.is-static .hero { position: relative; inset: auto; opacity: 1; transform: none; min-height: 88vh; }
.descent.is-static .caps {
  position: relative;
  inset: auto;
  display: block;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-block: clamp(2rem, 6vw, 4rem);
}
.descent.is-static .cap {
  position: relative;
  opacity: 1;
  transform: none;
  width: 100%;
  text-align: left;
  padding-block: clamp(1rem, 3vw, 2rem);
  border-top: 1px solid rgba(239, 236, 230, 0.12);
}
.descent.is-static .cap p { margin-inline: 0; }
.descent.is-static .cap--ops li { opacity: 1; transform: none; }
.descent.is-static .hud,
.descent.is-static .phase,
.descent.is-static .dust { display: none; }
.descent.is-static .scene { position: relative; height: 60vh; }

/* ---- The handoff into the light --------------------------------------- */

.threshold {
  position: relative;
  z-index: 2;
  background: var(--paper);
  padding-top: clamp(4rem, 10vh, 8rem);
}

.threshold__line {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: start;
}
.threshold__mono { grid-column: 1 / 4; }
.threshold__text { grid-column: 5 / 12; }
.threshold__text p {
  font-size: clamp(1.35rem, 3vw, 2.35rem);
  line-height: 1.22;
  letter-spacing: -0.038em;
  color: var(--ink);
  max-width: 24ch;
}
.threshold__text p + p { margin-top: 1.6rem; color: var(--muted); }
@media (max-width: 800px) {
  .threshold__mono, .threshold__text { grid-column: 1 / -1; }
  .threshold__mono { margin-bottom: 1.25rem; }
}

/* ---- Selected work section head --------------------------------------- */

.work-intro {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: end;
  padding-bottom: clamp(2rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(3rem, 7vw, 6rem);
}
.work-intro__title { grid-column: 1 / 8; font-size: var(--fs-h2); }
.work-intro__aside { grid-column: 9 / 13; }
@media (max-width: 800px) {
  .work-intro__title, .work-intro__aside { grid-column: 1 / -1; }
}

.viewall {
  display: flex;
  justify-content: center;
  padding-top: clamp(3.5rem, 8vw, 7rem);
}
.viewall a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.8rem;
  font-size: clamp(1.5rem, 4vw, 2.75rem);
  letter-spacing: -0.04em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--line);
  transition: color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.viewall a:hover { color: var(--copper); border-color: var(--copper); }
.viewall .arw { transition: transform 0.5s var(--ease); }
.viewall a:hover .arw { transform: translateX(8px); }

/* ---- Responsive tuning ------------------------------------------------- */

@media (max-width: 1024px) {
  .descent { --track: 520vh; }
}
@media (max-width: 760px) {
  .descent { --track: 400vh; }
  .hero { grid-template-rows: auto 1fr auto; }
  .hero__main { max-width: none; }
  .hero__statement { font-size: clamp(2rem, 9.5vw, 3rem); }
  .hud { display: none; }
  .hero__foot { align-items: flex-start; flex-direction: column; gap: 1.5rem; }
}

/* ---- Numbers ----------------------------------------------------------- */
/* Sits between the threshold and the work: scale first, then the proof. */

.numbers {
  padding-block: clamp(3rem, 8vh, 6rem) clamp(1rem, 3vh, 2rem);
}
.numbers__label { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }

.numbers__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  border-top: 1px solid var(--line);
}

.stat { padding-top: clamp(1.25rem, 2.5vw, 2rem); }

.stat__value {
  font-size: clamp(2.75rem, 7vw, 5.5rem);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.05em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat__plus { color: var(--copper); }

.stat__label {
  margin: 0.9rem 0 0;
  font-size: 0.9375rem;
  letter-spacing: -0.012em;
  color: var(--muted);
  max-width: 20ch;
}

@media (max-width: 720px) {
  .numbers__grid { grid-template-columns: 1fr; gap: 0; }
  .stat { padding-block: 1.25rem; border-bottom: 1px solid var(--line-soft); }
  .stat:last-child { border-bottom: 0; }
  .stat__label { margin-top: 0.5rem; }
}
