/* Switch tier pages (models.html, humanization.html): a vertical timeline with one
   dot per tier, each dot branching into a line of cards. Everything that moves reads
   custom properties published by tiers.js:

     --progress  on .timeline: how far the playhead has filled the spine, 0 -> 1
     --lit       on each .tier: 0 until the playhead reaches its dot, 1 once past it

   Pure black and white, same as the rest of the site (context/04-brand.md). */

:root {
  --paper: #fff;
  --line: rgba(255, 255, 255, .14);
  --dim: rgba(255, 255, 255, .62);
  --ease: cubic-bezier(.76, 0, .24, 1);
  --soft: cubic-bezier(.2, .7, .1, 1);
  --gut: 24px;
  --header: 60px;
  --spine-x: 12px;   /* spine centre, measured from the timeline's content edge */
  --indent: 72px;    /* where tier content starts, right of the spine */
}
@media (max-width: 767px) {
  :root { --gut: 16px; --spine-x: 8px; --indent: 40px; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; background: #000; }
body {
  margin: 0; background: #000; color: var(--paper);
  font-family: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.35; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 50; height: var(--header);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--gut);
  background: rgba(0, 0, 0, .78); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.top__mark img { display: block; height: 36px; width: auto; transition: transform .5s var(--ease); }
.top__mark:hover img { transform: rotate(-8deg) scale(1.06); }
.top__nav ul { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; font-size: 15px; }
.top__nav a { color: var(--dim); transition: color .2s; }
.top__nav a:hover, .top__nav a[aria-current="page"] { color: var(--paper); }
@media (max-width: 599px) {
  .top__nav ul { gap: 14px; font-size: 13px; }
}

/* ---------- Intro ---------- */
.intro {
  max-width: 1180px; margin: 0 auto;
  padding: clamp(56px, 8vw, 120px) var(--gut) clamp(48px, 6vw, 88px);
}
.intro__kicker { margin: 0 0 16px; font-size: 12px; line-height: 18px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }
.intro__title { margin: 0; max-width: 16ch; font-size: clamp(40px, 6vw, 92px); line-height: 1.02; font-weight: 300; letter-spacing: -0.025em; }
.intro__lead { margin: 22px 0 0; max-width: 52ch; color: var(--dim); font-size: 16px; line-height: 1.55; }
.intro > * { animation: rise 1s var(--soft) both; animation-delay: calc(var(--i, 0) * 90ms + 120ms); }
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 28px, 0); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative; max-width: 1180px; margin: 0 auto;
  padding: 0 var(--gut) 0 calc(var(--gut) + var(--indent));
}
/* The rail. tiers.js sets its top and height to run exactly dot to dot. */
.timeline__spine {
  position: absolute; left: calc(var(--gut) + var(--spine-x) - 1px);
  top: 0; height: 0; width: 2px; background: var(--line);
}
.timeline__fill {
  position: absolute; left: 0; top: 0; width: 100%;
  height: calc(var(--progress, 0) * 100%); background: var(--paper);
}
/* The playhead: where the fill currently ends. */
.timeline__fill::after {
  content: ""; position: absolute; left: 50%; bottom: -5px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--paper);
  translate: -50% 0;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .08), 0 0 24px 4px rgba(255, 255, 255, .35);
}

.tier { --lit: 0; position: relative; padding-bottom: clamp(96px, 12vw, 170px); }
.tier:last-child { padding-bottom: 0; }

/* The dot pops the moment the playhead reaches it, rather than fading over the
   whole --lit ramp. */
.tier__dot {
  --pop: clamp(0, calc(var(--lit) * 12), 1);
  position: absolute; top: 2px;
  left: calc(var(--spine-x) - var(--indent) - 9px);
  width: 18px; height: 18px; border-radius: 50%; background: #000;
  border: 1.5px solid rgb(255 255 255 / calc(.35 + var(--pop) * .65));
  box-shadow: inset 0 0 0 9px rgb(255 255 255 / var(--pop)), 0 0 0 calc(var(--pop) * 7px) rgb(255 255 255 / .1);
}

/* Tiers you haven't reached yet are readable but dim. */
.tier__head { opacity: calc(.34 + clamp(0, calc(var(--lit) * 4), 1) * .66); }
.tier__kicker { margin: 0 0 12px; font-size: 12px; line-height: 18px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }
.tier__title { margin: 0; font-size: clamp(28px, 3.4vw, 50px); line-height: 1.08; font-weight: 300; letter-spacing: -0.015em; }
.tier__summary { margin: 14px 0 0; max-width: 56ch; color: var(--dim); font-size: 15px; line-height: 1.55; }

/* The line of cards, and the arrow that runs into it from the spine. */
.tier__line { position: relative; margin-top: clamp(28px, 3.4vw, 44px); }
.tier__branch {
  position: absolute; top: 50%; height: 12px; translate: 0 -50%;
  left: calc(var(--spine-x) - var(--indent) + 1px);
  width: calc(var(--indent) - var(--spine-x) - 8px);
  background: linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, .7)) left center / 100% 1px no-repeat;
  /* Draws left to right, ahead of the cards. clip-path rather than scaleX so the
     chevron is never squashed on the way. */
  clip-path: inset(0 calc((1 - clamp(0, calc(var(--lit) * 3), 1)) * 100%) 0 0);
}
.tier__branch::after {
  content: ""; position: absolute; right: 1px; top: 50%;
  width: 8px; height: 8px;
  border-top: 1px solid rgba(255, 255, 255, .7); border-right: 1px solid rgba(255, 255, 255, .7);
  transform: translateY(-50%) rotate(45deg);
}

.tier__items {
  list-style: none; margin: 0; padding: 4px 0 14px;
  display: flex; align-items: stretch;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.tier__items::-webkit-scrollbar { display: none; }
/* Cards cascade in one after another off a single --lit value. */
.tier__slot {
  --show: clamp(0, calc(var(--lit) * 1.8 - var(--k) * .35), 1);
  display: flex; align-items: center; flex: none; scroll-snap-align: start;
  opacity: var(--show);
  transform: translate3d(calc((1 - var(--show)) * 36px), 0, 0);
}
.tier__slot + .tier__slot::before {
  content: ""; flex: none; width: 56px; height: 12px; margin: 0 4px; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='12' viewBox='0 0 56 12'%3E%3Cpath d='M0 6H53M48 1l5 5-5 5' fill='none' stroke='white' stroke-width='1.2'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Cards ---------- */
.card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  width: clamp(236px, 23vw, 300px); min-height: 256px; padding: 20px 20px 18px;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 16px;
  background: rgba(255, 255, 255, .025); color: var(--paper);
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), transform .35s var(--ease);
}
.tier:last-child .card { border-color: rgba(255, 255, 255, .3); }
.card:hover, .card:focus-visible { background: var(--paper); color: #000; border-color: var(--paper); transform: translateY(-4px); }
.card:focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; }
.card__tag { padding-right: 52px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; opacity: .62; }   /* clear of the index */
.card__index { position: absolute; top: 20px; right: 20px; font-size: 11px; letter-spacing: .1em; opacity: .45; font-variant-numeric: tabular-nums; }
.card__name { margin-top: auto; padding-top: 44px; font-size: clamp(30px, 2.6vw, 40px); font-weight: 300; letter-spacing: -0.02em; line-height: 1; }
.card__blurb { margin-top: 10px; font-size: 14px; line-height: 1.45; opacity: .66; }
.card__more { margin-top: 18px; display: inline-flex; gap: 8px; align-items: center; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.card__more span { transition: transform .35s var(--ease); }
.card:hover .card__more span { transform: translateX(4px); }

@media (max-width: 767px) {
  .card { width: 74vw; min-height: 236px; }
  .tier__slot + .tier__slot::before { width: 34px; }
  /* Let the line run to the screen edge so it reads as scrollable. */
  .tier__items { margin-right: calc(var(--gut) * -1); padding-right: var(--gut); }
}

/* ---------- The "see more?" dialog, which grows into the full sheet ---------- */
.sheet {
  padding: 0; border: 0; background: transparent; color: var(--paper);
  max-width: none; max-height: none; overflow: visible;
}
.sheet::backdrop { background: rgba(0, 0, 0, .74); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet__panel {
  position: relative; width: min(92vw, 440px); max-height: 88vh; overflow: auto;
  padding: 28px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 20px;
  background: #0a0a0a; box-shadow: 0 40px 120px rgba(0, 0, 0, .8);
  transition: width .5s var(--ease), padding .5s var(--ease);
}
.sheet.is-full .sheet__panel { width: min(92vw, 720px); padding: 36px; }
.sheet__panel > * { animation: rise .6s var(--soft) both; }
.sheet__panel > :nth-child(2) { animation-delay: 50ms; }
.sheet__panel > :nth-child(3) { animation-delay: 100ms; }
.sheet__panel > :nth-child(4) { animation-delay: 150ms; }
.sheet__panel > :nth-child(5) { animation-delay: 200ms; }
.sheet__panel > :nth-child(6) { animation-delay: 250ms; }
.sheet__kicker { margin: 0 0 14px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }
.sheet__q { margin: 0; font-size: 28px; font-weight: 300; line-height: 1.15; letter-spacing: -0.01em; }
.sheet__name { margin: 0; font-size: clamp(40px, 6vw, 64px); font-weight: 300; line-height: 1; letter-spacing: -0.025em; }
.sheet__blurb { margin: 12px 0 0; color: var(--dim); font-size: 15px; line-height: 1.55; }
.sheet__spec { margin: 26px 0 0; border-top: 1px solid var(--line); }
.sheet__spec div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.sheet__spec dt { color: var(--dim); font-size: 13px; }
.sheet__spec dd { margin: 0; font-size: 14px; line-height: 1.45; }
@media (max-width: 520px) {
  .sheet__panel, .sheet.is-full .sheet__panel { padding: 22px; }
  .sheet__spec div { grid-template-columns: 1fr; gap: 4px; }
}
.sheet__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.sheet__x {
  position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2); font-size: 13px; color: var(--dim);
  transition: color .2s, border-color .2s;
}
.sheet__x:hover { color: var(--paper); border-color: var(--paper); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .35);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.btn:hover { background: var(--paper); color: #000; }
.btn--solid { background: var(--paper); color: #000; border-color: var(--paper); }
.btn--solid:hover { background: rgba(255, 255, 255, .86); }
.btn:focus-visible, .sheet__x:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }

/* ---------- Footer: onward ---------- */
.foot {
  max-width: 1180px; margin: 0 auto;
  padding: clamp(140px, 24vh, 260px) var(--gut) 64px;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px;
}
.foot__next { display: flex; flex-direction: column; gap: 10px; font-size: clamp(26px, 3vw, 44px); font-weight: 300; letter-spacing: -0.015em; }
.foot__next small { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }
.foot__arrow { display: inline-block; transition: transform .35s var(--ease); }
.foot__next:hover .foot__arrow { transform: translateX(6px); }
.foot__links { display: flex; gap: 20px; font-size: 14px; }
.foot__links a { color: var(--dim); transition: color .2s; }
.foot__links a:hover { color: var(--paper); }
