/* home.css — the home page only: the hero (headline, quick finder, figures,
 * helix), the floor (its views, its departures-board cards), the relationship
 * boards, and search results.
 *
 * Everything reusable lives in the system sheets — the group card is
 * entity.css, the ranked row is data.css, the band head is layout.css. What is
 * here is composition, plus the two things that exist on this one page: the
 * helix, and the floor card (.fcard, views/home/card.js). The floor card is a
 * candidate to graduate to entity.css if a second page wants a joinable card.
 */

/* ================================================================ hero */

.band-hero {
  background-image: var(--sky);
  padding-block: var(--s-7) var(--s-section);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  column-gap: var(--s-6);
  align-items: center;
}
/* The band's generic stacking margin does not apply between the two halves. */
.band > .hero > * + * { margin-top: 0; }

.hero-copy { display: grid; gap: var(--s-5); align-content: start; min-width: 0; }

.hero-kicker {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  padding-top: var(--s-2);
  border-top: var(--edge-strong);
  justify-self: start;
}
.hero-kicker .asof { font-size: inherit; letter-spacing: 0.04em; text-transform: none; }
.hero-kicker-sep { color: var(--rule); }

/* ---- the headline. The sentence is real; the number is the giant numeral. */
.hero-headline {
  max-width: 13ch;
  /* Reserve two lines before the data lands, so the swap from the placeholder
   * to the real sentence does not push the page down. */
  min-height: 1.9em;
}
.hl-art { display: block; perspective: 900px; perspective-origin: 50% 40%; }
.hl-w { display: inline-block; white-space: nowrap; transform-style: preserve-3d; }
.hl-l { display: inline-block; transform-origin: 50% 60%; }
.hl-num {
  font-family: var(--font-mono);
  font-weight: 560;
  letter-spacing: -0.07em;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--accent);
  text-shadow: var(--glow-hot);
  margin-right: 0.06em;
}
.hl-last { font-style: italic; font-weight: 380; }

.hero-dek { font-size: var(--t-lg); }

/* ---- the figures: a ruled run, number over its unit. */
.hero-figs {
  display: flex; flex-wrap: wrap;
  border-block: var(--edge);
}
.hero-fig {
  display: flex; flex-direction: column-reverse; justify-content: flex-end;
  gap: var(--s-1);
  flex: 1 1 8.5rem;
  padding: var(--s-3) var(--s-4) var(--s-3) 0;
  margin-right: var(--s-4);
  border-right: var(--edge-soft);
  min-width: 0;
}
.hero-fig:last-child { border-right: 0; margin-right: 0; }
.hero-fig dt { max-width: 14ch; }

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-6); }
/* Link-kind buttons drop their height; these are the page's second way in and
 * still need a whole thumb. */
.hero-actions .btn,
.board-foot-actions .btn[data-kind='link'] { min-height: 44px; }

/* ---- the quick finder: a topic box and one-tap picks into #/groups. Set as a
 * classified strip — a hairline box on paper, a surface step at night — so it
 * reads as the place to act, without a second loud colour. */
.finder {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-4);
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  border: var(--edge);
  border-top: var(--edge-strong);
  box-shadow: var(--shadow-lift);
}
:root[data-theme='dark'] .finder {
  background: var(--surface);
  border-color: var(--rule-soft);
  border-top-color: var(--accent-line);
  box-shadow: inset 0 1px 0 var(--halo), var(--shadow-lift);
}
.finder-form { display: grid; gap: var(--s-2); }
.finder-label { color: var(--ink-2); }
.finder-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.finder-input {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 48px;
  font-size: var(--t-base);     /* >= 16px, or iOS zooms the page on focus */
  background: var(--bg);
}
:root[data-theme='dark'] .finder-input { background: var(--bg-sunk); }
.finder-go { flex: 0 0 auto; min-height: 48px; }

.finder-picks {
  display: flex; flex-wrap: wrap;
  gap: var(--s-2);
  min-height: 44px;             /* the language picks land later; no jump */
  margin: 0; padding: 0;
  list-style: none;
}
.finder-pick {
  display: inline-flex; align-items: center;
  min-height: 44px;
  padding: 0 var(--s-4);
  border: var(--edge);
  border-radius: var(--r-full);
  color: var(--ink-2);
  font-size: var(--t-sm);
  font-weight: 520;
  white-space: nowrap;
  transition:
    color var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out),
    background-color var(--dur-2) var(--ease-out),
    transform var(--dur-3) var(--ease-spring);
}
.finder-pick:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--ink-wash);
  transform: translateY(-1px);
}
.finder-pick:active { transform: none; background: var(--ink-wash-2); }

/* ================================================================ helix
 *
 * CSS 3D, no library. .helix-spin carries --turn and --tilt (set by
 * views/home/helix.js each frame); every item is placed ONCE, from its index,
 * entirely in CSS:
 *
 *   angle  = --i x 360deg / --helix-per-turn
 *   height = (--i - --mid) x --helix-pitch          (busiest at the top)
 *   size   = --fs                                   (sqrt of people)
 *
 * and fades as it turns away with a CSS cos() of its angle plus the turn.
 * Where cos() is unsupported, the back half is simply hidden. */

.hero-art { min-width: 0; }

.helix {
  position: relative;
  display: grid;
  gap: var(--s-3);
  justify-items: center;
  user-select: none;
}

.helix-stage {
  position: relative;
  width: 100%;
  height: calc(var(--helix-pitch) * var(--n, 28) + 6rem);
  perspective: 1100px;
  perspective-origin: 50% 45%;
  /* The tower is wider than its column at the back of the turn; clip it to a
   * soft edge rather than letting it spill into the gutter. */
  mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent),
              linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
  -webkit-mask-composite: source-in;
}

/* The spine of the tower: one hairline, with a faint lamp in the night edition. */
.helix-core {
  position: absolute;
  left: 50%; top: 6%; bottom: 6%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--rule), transparent);
  box-shadow: var(--glow);
}

.helix-spin {
  --turn: -16deg;
  --tilt: -9deg;
  position: absolute;
  left: 50%; top: 50%;
  width: 0; height: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--tilt)) rotateY(var(--turn));
}

.helix-item {
  --a: calc(var(--i) * 360deg / var(--helix-per-turn));
  position: absolute;
  left: 0; top: 0;
  max-width: 15em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--helix-ink);
  font-family: var(--font-display);
  font-size: var(--fs, 1rem);
  font-weight: 520;
  line-height: 1.1;
  letter-spacing: var(--tr-title);
  transform:
    translate(-50%, -50%)
    translateY(calc((var(--i) - var(--mid, 0)) * var(--helix-pitch)))
    rotateY(var(--a))
    translateZ(var(--helix-r));
  backface-visibility: hidden;
  transition: color var(--dur-2) var(--ease-out);
}
.helix-item.is-untitled { font-style: italic; font-weight: 400; color: var(--ink-2); }
.helix-item:hover { color: var(--accent); text-shadow: var(--glow); }

/* With trig: the back half stays as a faint mirrored ghost that gives the tower
 * its volume, and the front brightens as it comes round. */
.helix.has-trig .helix-item {
  backface-visibility: visible;
  opacity: clamp(var(--helix-far), calc(0.12 + 0.88 * cos(var(--a) + var(--turn))), 1);
}

/* The arrival: once, on the first fill. `translate` is its own property, so
 * the placement transform above is untouched and nothing is laid out again. */
@media (prefers-reduced-motion: no-preference) {
  .helix:not(.is-arrived) .helix-item {
    animation: helix-in var(--dur-5) var(--ease-out) backwards;
    animation-delay: calc(var(--i) * 28ms);
  }
}
@keyframes helix-in {
  from { opacity: 0; translate: 0 2.5rem; }
}

.helix-cap { text-align: center; }

/* Under reduced motion the tower stands still — a complete, composed picture at
 * a fixed quarter turn (helix.js stops the loop and sets the pose). */
@media (prefers-reduced-motion: reduce) {
  .helix-item { transition: none; }
}

/* ========================================================= the floor */

.board-meta .asof { font-size: var(--t-xs); }
.board-body { min-height: 12rem; }

/* The snapshot note: the stale hue, a rule, and a full sentence. Not an alert —
 * old data is not wrong data (freshness.js) — but impossible to miss. */
.floor-stale {
  display: grid; gap: var(--s-1);
  max-width: 48rem;
  margin-bottom: var(--s-5);
  padding: var(--s-3) var(--s-4);
  border-left: var(--bw-4) solid var(--warn);
  background: color-mix(in oklab, var(--warn-quiet) 55%, transparent);
}
.floor-stale[hidden] { display: none; }
.floor-stale-title { color: var(--warn); font-weight: 650; }
.floor-stale-body { color: var(--ink-2); font-size: var(--t-sm); }
.floor-stale-body .asof { font-size: inherit; }
.floor-stale-body a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.floor-stale-body a:hover { color: var(--accent); }

.floor-controls { display: grid; gap: var(--s-3); margin-bottom: var(--s-5); }
.floor-views:empty, .board-filters:empty { display: none; }
.floor-view { gap: var(--s-2); }
.floor-view-n {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.board-filters .toggle { min-height: 44px; }

.board-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s-3) var(--s-5);
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: var(--edge);
}
.board-foot:empty { display: none; }
.board-count { color: var(--ink-3); font-size: var(--t-sm); }
.board-foot-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-6); }

/* ---- the board: a grid of departures. Same tracks as .gboard (entity.css). */
.fboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  column-gap: var(--s-5);
  margin: 0 calc(-1 * var(--s-3));
  padding: 0;
  list-style: none;
}
.fboard > li { min-width: 0; }

/* ---- the card. Head count left, in the measurement face; the facts right,
 * in canonical order (ui/group.js): pair · level, title, seats, mic · lock ·
 * age, and the way in. The title link is stretched over the whole card, so the
 * card opens the group; "Join" sits above that layer as its own link. */
.fcard {
  --fcard-n-w: 3.5rem;
  position: relative;
  display: grid;
  grid-template-columns: var(--fcard-n-w) minmax(0, 1fr);
  grid-template-areas:
    'n strip'
    'n title'
    'n seats'
    'n foot';
  grid-template-rows: auto auto auto 1fr;
  column-gap: var(--s-3);
  row-gap: var(--s-2);
  align-items: start;
  height: 100%;
  padding: var(--s-4) var(--s-3);
  border-top: var(--edge-soft);
  color: var(--ink);
  transition:
    transform var(--dur-3) var(--ease-spring),
    box-shadow var(--dur-3) var(--ease-out),
    background-color var(--dur-2) var(--ease-out);
}
/* No strip (a topic-less group with no level): the title takes the first row. */
.fcard:not(:has(.fcard-strip)) {
  grid-template-areas: 'n title' 'n seats' 'n foot';
  grid-template-rows: auto auto 1fr;
}
.fcard:hover,
.fcard:has(.fcard-link:focus-visible) {
  background: var(--surface);
  box-shadow: var(--shadow-hover);
  transform: translateY(var(--lift));
}
:root[data-theme='dark'] .fcard:hover,
:root[data-theme='dark'] .fcard:has(.fcard-link:focus-visible) {
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 var(--halo), var(--shadow-hover);
}
/* The ring goes round the CARD, since the whole card is the link's target. */
.fcard:has(.fcard-link:focus-visible) {
  outline: var(--bw-2) solid var(--accent);
  outline-offset: 0;
}
.fcard-link:focus-visible { outline: none; }

.fcard-n {
  grid-area: n;
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 3px;
  padding-top: 2px;
}
.fcard-n-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-fig-lg);
  font-weight: 520;
  line-height: var(--lh-flat);
  letter-spacing: var(--tr-fig);
}
.fcard-n-unit { color: var(--ink-3); font-size: var(--t-2xs); line-height: 1; }

.fcard-strip {
  grid-area: strip;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--s-1) var(--s-3);
  min-width: 0;
  color: var(--ink-2);
}
.fcard-strip .lang-pair { color: var(--ink-2); font-weight: 600; }

.fcard-title {
  grid-area: title;
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 520;
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-title);
  overflow-wrap: anywhere;
}
.fcard-link { color: inherit; transition: color var(--dur-2) var(--ease-out); }
.fcard-link::after { content: ''; position: absolute; inset: 0; z-index: 0; }
.fcard:hover .fcard-link, .fcard-link:focus-visible { color: var(--accent); }
.fcard-title-text.is-untitled { font-style: italic; font-weight: 420; color: var(--ink-2); }
.fcard:hover .fcard-title-text.is-untitled,
.fcard-link:focus-visible .fcard-title-text.is-untitled { color: var(--accent); }

/* ---- the seats: a slot per chair. Achromatic — a group property, not a
 * state (README "Colour meanings are frozen"); filled is ink, free is a ring. */
.fcard-seats {
  grid-area: seats;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--s-1) var(--s-3);
  min-width: 0;
}
.fcard-slots { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.fcard-slot {
  width: 10px; height: 10px;
  border-radius: var(--r-full);
  box-shadow: inset 0 0 0 1.5px var(--attr-line);
}
.fcard-slot.is-on { background: var(--attr-fill); box-shadow: none; }
.fcard-slot-more {
  margin-left: 2px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--t-3xs);
  font-variant-numeric: tabular-nums;
}
.fcard-seats-text { color: var(--ink-2); font-size: var(--t-xs); font-weight: 560; }
.fcard-seats[data-state='full'] .fcard-seats-text { color: var(--ink-3); font-weight: 500; }

.fcard-foot {
  grid-area: foot;
  align-self: end;
  /* One row: the facts wrap inside their own box, so "Join" never drops to a
   * line of its own and leaves the card half empty. */
  display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between;
  gap: var(--s-2) var(--s-3);
  min-width: 0;
}
.fcard-facts {
  flex: 1 1 0;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--s-1) var(--s-3);
  min-width: 0;
}
.fcard-age {
  display: inline-flex; align-items: center; gap: var(--s-1);
  color: var(--ink-3);
  font-size: var(--t-2xs);
  white-space: nowrap;
}
/* Still, not pulsing: two dozen looping dots is noise and paint cost; the
 * board's own as-of stamp already carries the one pulse. */
.fcard-age .live-dot { width: 6px; height: 6px; animation: none; }
/* A stage's mic label ("Only the Owner, Co-Owners and Guests can speak") is
 * longer than a phone card is wide; here, and only here, it may wrap. */
.fcard-facts .attr { flex: 0 1 auto; min-width: 0; white-space: normal; }

/* The way in. Above the stretched link (z-index), the one accented control on
 * the card, and a full 44px target even though it reads small. */
.fcard-join {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: var(--s-1);
  min-height: 44px; min-width: 44px;
  flex: none;
  margin-left: auto;
  padding: 0 var(--s-4);
  border: var(--bw-1) solid var(--accent-line);
  border-radius: var(--r-full);
  color: var(--accent);
  font-size: var(--t-sm);
  font-weight: 650;
  white-space: nowrap;
  transition:
    background-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    transform var(--dur-3) var(--ease-spring);
}
.fcard-join:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
:root[data-theme='dark'] .fcard-join:hover { box-shadow: var(--glow); }
.fcard-join:active { transform: scale(0.97); }
.fcard-join-arrow { display: inline-block; transition: transform var(--dur-3) var(--ease-spring); }
.fcard-join:hover .fcard-join-arrow { transform: translate(2px, -2px); }

/* A full or locked group recedes a step — still there, still openable, but
 * not where the eye lands first. Ink only, never a hue. */
.fcard[data-full] .fcard-n-value,
.fcard[data-locked] .fcard-n-value { color: var(--ink-3); }

/* The floor's signature moment: the chairs fill, one after another, when the
 * board draws. Transform and opacity only. */
@media (prefers-reduced-motion: no-preference) {
  .fcard-slot.is-on {
    animation: slot-fill var(--dur-4) var(--ease-spring) backwards;
    animation-delay: calc(120ms + var(--k, 0) * 45ms);
  }
}
@keyframes slot-fill {
  from { opacity: 0; transform: scale(0.2); }
}

/* ========================================================= the boards */

.rel-tabs { margin-bottom: var(--s-2); }
.band-rel .band-head { margin-bottom: var(--s-4); }
.band-rel .band-head-dek { font-size: var(--t-base); max-width: 44rem; }

.rel-board[aria-busy='true'] .ranked { opacity: 0.55; transition: opacity var(--dur-2); }

.rel-faces { padding-top: 2px; }
.rel-names { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0; }
.rel-name {
  font-weight: 650;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-2), color var(--dur-2);
}
.rel-name:hover { text-decoration-color: currentColor; }
.rel-joiner {
  color: var(--ink-3);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  white-space: pre;
}
.rel-alt { margin-top: var(--s-1); }
.rel-live {
  display: flex; align-items: center; gap: var(--s-2);
  margin-top: var(--s-2);
  color: var(--live);
  font-size: var(--t-xs);
  font-weight: 600;
}
.rel-live a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.rel-aside .provenance { position: sticky; top: calc(var(--topbar-h) + var(--s-5)); }

/* ============================================================ search */

.hits { display: grid; gap: var(--s-6); }
/* A half that answered with nothing takes no row, so the gap does not double. */
.hits-half:empty { display: none; }
.hit-group-label { margin-bottom: var(--s-3); }

.hit-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  column-gap: var(--s-5);
}
.hit {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 64px;
  padding: var(--s-3) var(--s-2);
  border-top: var(--edge-soft);
  transition: background-color var(--dur-1);
}
.hit:hover { background: var(--ink-wash); color: inherit; }
.hit:hover .hit-name { color: var(--accent); }
.hit-body { display: grid; min-width: 0; flex: 1; }
.hit-name { font-weight: 600; }
.hit-id { color: var(--ink-3); font-family: var(--font-mono); font-size: var(--t-3xs); }
.hit-side {
  display: grid; justify-items: end;
  color: var(--ink-2);
  font-size: var(--t-xs);
  text-align: right;
  white-space: nowrap;
}

/* ======================================================== breakpoints */

/* Two columns get tight before the tracks do: below 1100 the helix narrows. */
@media (max-width: 68.6875rem) {
  .hero { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); column-gap: var(--s-5); }
  :root { --helix-pitch: 1.05rem; }
}

/* One column: the hero is words and figures only, and the groups follow at
 * once. The helix is not built into the flow at all at this width — it is
 * display:none, so it never intersects and its loop never runs. */
@media (max-width: 44.9375rem) {
  .band-hero { padding-block: var(--s-5) var(--s-6); }
  .band-hero + .band-board { padding-top: var(--s-6); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-art { display: none; }
  .hero-copy { gap: var(--s-4); }
  .hero-headline { max-width: none; }
  /* The dek goes at phone width: the finder below it says the same thing as
   * an action, and the groups get ~110px nearer the first screen. The stale
   * caveat it carries is also in the shell's banner and the floor's note. */
  .hero-dek { display: none; }
  /* Three figures in ONE row at phone width, a size down, so the groups start
   * inside the first screen. */
  .hero-fig { flex: 1 1 0; padding-right: var(--s-2); margin-right: var(--s-2); }
  .hero-fig .fig[data-size='xl'] .fig-value { font-size: var(--t-fig-lg); }
  .hero-fig dt { font-size: var(--t-2xs); }
  .hero-action-boards { display: none; }
  .finder { padding: var(--s-3); }
  .finder-go { flex: 1 1 100%; }
  /* The picks and the filter row scroll sideways instead of stacking four
   * rows deep; the edge bleeds to the box so the scroll is discoverable. */
  .finder-picks {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: calc(-1 * var(--s-3));
    padding-inline: var(--s-3);
  }
  .finder-picks::-webkit-scrollbar { display: none; }
  .finder-picks > li { flex: none; }
  .board-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: calc(-1 * var(--s-gutter));
    padding-inline: var(--s-gutter);
    padding-block: 2px;
  }
  .board-filters::-webkit-scrollbar { display: none; }
  .board-filters .toggle { flex: none; }
  .rel-aside .provenance { position: static; }
}
