/* The 2.0 home page's layout. Components and tokens live in css/nudii.css; this file only arranges them. */

/* ─── Hero: the page's first screen is the tank. .tank--sea keeps the pet's tank where it was and draws its water and
   sand across the whole band from a pseudo-element: assets/pixel/tank/default-sea-*.png, the plate, its mirror and open water,
   repeated from the tank's own left edge so the plate sits exactly under it. Above the art the band is --tide, the
   plate's top row, day and night. Below the sand it is the navy stand. Below 900 px: the title, the tank, then the
   rest; from 900 px the words sit in the water at the left, and the tank's column is exactly the tank's width. ── */
.hero { position: relative; isolation: isolate; overflow: hidden; padding-block: 0 var(--s8); background: var(--navy); }
.tank--sea, .tank--sea.night { background-image: none; background-color: transparent; overflow: visible; }
.tank--sea::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -100vh;
  bottom: 0;
  left: calc(-528px * var(--k) * 4);
  width: calc(528px * var(--k) * 8);
  background: var(--tide) url(/assets/pixel/tank/default-sea-day.png) repeat-x left bottom / calc(528px * var(--k)) calc(150px * var(--k));
  image-rendering: pixelated;
}
.tank--sea.night::before { background-image: url(/assets/pixel/tank/default-sea-night.png); }
.hero__grid { display: grid; gap: var(--s6) var(--s8); padding-top: var(--s6); grid-template-areas: "head" "stage" "body" "facts"; }
.hero__head { grid-area: head; margin: 0; }
.hero__stage { grid-area: stage; display: flex; justify-content: center; }
.hero__body { grid-area: body; min-width: 0; }
.hero__facts { grid-area: facts; margin: 0; }
.hero__body .lead { margin-bottom: 0; }
@media (min-width: 900px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "head stage" "body stage" "facts stage"; padding-top: 0; row-gap: var(--s4); }
  .hero__head { padding-top: calc(var(--t) * 16); }
  .hero__body { align-self: start; }
  .hero__facts { align-self: end; padding-bottom: calc(var(--s6) + var(--s8)); }
  .hero .h-hero { font-size: 48px; }
}
@media (min-width: 1180px) { .hero .h-hero { font-size: 64px; } }
.hero__keys { margin-block: var(--s6) var(--s4); }

/* The phone's first screen: the title, the tank with its care keys, the lead and the App
   Store key all inside 844 px at 390 px wide. The keys go icon-only (each label stays as the key's accessible name)
   in a 64 px column beside the tank, like the app's stand; under 372 px (264 + 12 + 64 + two 16 px gutters) that column no longer fits beside the 264 px
   tank, so the four keys sit in a row under it. */
@media (max-width: 599px) {
  .hero { padding-block: 0 var(--section); }
  .hero__grid { gap: calc(var(--t) * 6); }
  .hero .tank-block { grid-template-columns: auto 64px; column-gap: calc(var(--t) * 4); width: auto; justify-content: center; }
  .hero .care-bar { grid-template-columns: 64px; grid-auto-rows: 1fr; gap: calc(var(--t) * 4); margin-top: 0; }
  .hero .care-key { padding: 0; min-height: 44px; }
  .hero .care-key__label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .hero__motion { grid-column: 1 / -1; }
  .hero__keys { margin-block: var(--s4) var(--s2); }
  .hero__keys .key--primary { width: 100%; }
}
@media (max-width: 371px) {
  .hero .tank-block { grid-template-columns: auto; width: min-content; }
  .hero .care-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: auto; margin-top: calc(var(--t) * 5); }
  .hero .care-key { min-height: 52px; }
}
.hero__motion { display: flex; justify-content: flex-end; margin-top: var(--s2); }

/* ─── The whole life is free ────────────────────────────── */
.free-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
/* A receipt: each line runs a dotted leader to its Free stamp. */
.free-list li { display: flex; align-items: center; gap: var(--s3); font: 400 16px/1.1 var(--font-pixel); }
.free-list li > :first-child { flex: none; }
.free-list li::after { content: ""; order: 1; flex: 1; height: var(--t); background: repeating-linear-gradient(90deg, var(--rule-2) 0 var(--t), transparent var(--t) calc(var(--t) * 2)); }
.free-list .stamp { order: 2; }

/* ─── Talk: one of the pet's real lines, over its head (the Spanish Shawl adult stands at x 25–103, y 89 in the tank) ── */
.talk__tank .tank { overflow: visible; }
.talk__bubble { position: absolute; left: calc(20px * var(--k)); top: calc(46px * var(--k)); z-index: 1; margin: 0; white-space: nowrap; }
/* The Blue Dragon floats at y 27, far above the others, so its bubble sits near the tank's top edge. */
.talk__tank .tank:has(.px-blue-dragon-adult) .talk__bubble { top: calc(2px * var(--k)); }

/* ─── It grows: one nudii at every stage, on the same sand ──
   assets/gift/sea.png repeats across at the sprites' own scale. Its sand is 12 rows and each sprite stands 2 rows into
   it, so --sand is 10. A stage takes the width it needs, so the sea and sand run unbroken along each row; the stages
   wrap into two rows on a phone. */
.life { --k: 2; --sand: 10; list-style: none; margin: var(--s4) 0; padding: 0; display: flex; flex-wrap: wrap; }
@media (min-width: 900px) { .life { --k: 3; } }
.life__stage { flex: 1 1 auto; display: grid; }
.life__stage .label { padding: var(--s2); background: var(--navy); text-align: center; }
.life__sea {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: calc(76px * var(--k));
  padding-inline: var(--s3);
  padding-bottom: calc(var(--sand) * var(--k) * 1px);
  background: var(--tide) url(/assets/gift/sea.png) repeat-x left bottom / calc(2px * var(--k)) calc(240px * var(--k));
  image-rendering: pixelated;
}
.life__sea .px-sprite { flex: none; width: calc(var(--px-w) * var(--k) * 1px); height: calc(var(--px-h) * var(--k) * 1px); }
.life__unknown { width: calc(28px * var(--k)); background: var(--navy); }

/* ─── Species × habitats: the preview tank, then (from 900 px, beside it) the eight cards and the habitat keys ── */
.picker { display: grid; gap: var(--s8); }
@media (min-width: 900px) { .picker { grid-template-columns: auto minmax(0, 1fr); align-items: start; } }
.picker__stage { display: flex; justify-content: center; }
.picker__caption { display: grid; gap: var(--t); margin: calc(var(--t) * 5) 0 0; }
.picker__choices { display: grid; gap: var(--s8); min-width: 0; }
.species-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 600px) { .species-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.species-card, .species-card__key { display: grid; justify-items: start; align-content: start; gap: var(--s2); min-width: 0; }
.species-card__key {
  width: 100%;
  height: 100%;
  padding: var(--s3);
  background: none;
  border: 0;
  color: var(--foam);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.species-card__key:hover { background: var(--deep); }
.species-card__key[aria-pressed="true"] { background: var(--water); box-shadow: inset 0 var(--t) 0 var(--rim); }
.species-card .print { margin-bottom: var(--t); }
.species-card .portrait { --k: 3; background-color: var(--water); }   /* underwater, not a sticker on the foam print */
.species-card .label { overflow-wrap: anywhere; }
/* On a phone, once the cards are keys: four portraits to a row. The caption under the tank names the one chosen, and
   each key keeps its name for a screen reader. */
@media (max-width: 599px) {
  .species-grid:has(.species-card__key) { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--t); }
  .species-card__key { padding: var(--t); justify-items: center; }
  .species-card__key .label, .species-card__key .latin { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .species-card__key { position: relative; }
  .species-card .portrait { --k: 2; }
}
.habitats { display: grid; gap: var(--s4); }
.habitats__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); }
.habitats__head .label { margin: 0; color: var(--mist); }
.habitats .small { margin: 0; }

/* ─── Day and night: Talk and Away Tide share one full-bleed band. Each half stacks its copy over its tank until the
   half is wide enough, then puts the tank in a column exactly its width; a half left alone (the other's flag cut)
   spans the band. ── */
.duo { display: grid; }
@media (min-width: 900px) { .duo { grid-template-columns: 1fr 1fr; } .duo > :only-child { grid-column: 1 / -1; } }
.duo__half { container-type: inline-size; padding-block: var(--section); padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)); }
.duo__day { background: var(--water); }
.duo__night { background: var(--abyss); }
.duo__in { display: grid; gap: var(--s6); max-width: calc(var(--content) / 2); margin-inline: auto; }
@container (min-width: 600px) {
  .duo__day .duo__in { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .duo__night .duo__in { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
}
.duo__title { font-size: 32px; line-height: 1.05; margin: 0 0 var(--s4); }
.duo__copy .lead { font-size: 17px; }
.duo__tank { display: flex; justify-content: center; }

/* ─── Reef Arcade: one tank beside the ten games ── */
.cabinet { display: grid; gap: var(--s8); justify-items: center; }
@media (min-width: 900px) { .cabinet { grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: stretch; } }
.games { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: var(--t) var(--s4); }
@media (min-width: 600px) { .games { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(5, auto); } }
.game > .label, .game > .game__line { display: block; padding-inline: var(--s6) var(--s3); }
.game > .label { padding-top: var(--s3); }
.game > .game__line { padding-bottom: var(--s3); }
.game__line { color: var(--pencil); }
/* js/arcade.js wraps each row in a key; the chosen game takes the plate's rim, its fill and the game menu's cursor. */
.game__key { position: relative; display: block; width: 100%; min-height: 44px; padding: var(--s3) var(--s3) var(--s3) var(--s6); background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.game__key .label, .game__key .game__line { display: block; }
.game__key:hover { background: var(--deep); }
.game__key[aria-pressed="true"] { background: var(--water); box-shadow: inset 0 var(--t) 0 var(--rim); }
.game__key[aria-pressed="true"]::before {
  content: "";
  position: absolute;
  left: var(--s2);
  top: calc(var(--s3) + var(--t));
  width: calc(var(--t) * 2);
  height: calc(var(--t) * 3);
  background: var(--anna);
  clip-path: polygon(0 0, 50% 0, 50% 33.33%, 100% 33.33%, 100% 66.66%, 50% 66.66%, 50% 100%, 0 100%);
}

/* ─── Beyond the tank: six things, each with the app's own art at a whole scale ── */
.more { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s8) var(--s6); }
@media (min-width: 600px) { .more { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .more { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.more__item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s4); align-items: center; }
.more__art { flex: none; }
.more__stage { --k: 3; display: grid; place-items: center; width: 136px; height: 136px; background: var(--deep); overflow: hidden; }
.more__stage .px-sprite { width: calc(var(--px-w) * var(--k) * 1px); height: calc(var(--px-h) * var(--k) * 1px); background-color: transparent; }
.more__stage .portrait { --k: 4; }
.more__stage img { background: none; }
.more__gift { width: 128px; height: 112px; image-rendering: pixelated; }
.more__glyph { width: 88px; height: 88px; image-rendering: pixelated; }
.more__copy h3 { margin: 0 0 var(--s2); }
.more__copy p { margin: 0; font-size: 16px; line-height: 1.45; }

/* ─── Nudii Duel: one habitat plate beside its mirror (tools/pixel_export.py, export_arenas), 264 texels wide. The art
   faces left, so your nudii stands mirrored in the left half, facing the rival across the middle; each steps --in
   texels toward it. Narrower than the arena (a phone), it shows its middle, so it never sets the page's width; its
   width is a whole number of texel pairs, so the middle lands on a texel. The rival's bubble rides above its head. ── */
.arena { --k: 2; --in: 24; position: relative; display: flex; justify-content: center; width: 100%; width: round(down, 100%, calc(2px * var(--k))); max-width: calc(264px * var(--k)); overflow: hidden; }
@media (min-width: 600px) { .arena { --k: 3; } }
.arena .tank { --k: inherit; --tank-w: 264; box-shadow: none; overflow: visible; }
.arena [data-follow] { left: calc((132 - var(--px-x) - var(--px-w) + var(--in)) * var(--k) * 1px); transform: scaleX(-1); }
.arena [data-rival] { left: calc((132 + var(--px-x) - var(--in)) * var(--k) * 1px); }
.arena__intent { position: absolute; left: 50%; bottom: calc(100% - 6px * var(--k)); transform: translateX(-50%); padding: var(--s2); }
.duel { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4) var(--s8); }
@media (min-width: 720px) { .duel { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.duel li { padding-top: var(--s3); border-top: var(--t) solid var(--rule-2); font-size: 16px; line-height: 1.45; }
.board { display: grid; grid-template-columns: repeat(3, 36px); grid-auto-rows: 36px; gap: 4px; background: var(--rim); }
.board i { display: grid; place-items: center; background: var(--deep); color: var(--foam); font: 400 32px/1 var(--font-pixel); }

/* ─── The money section: the free list beside Deep Diver, then Fair by design in a row, then privacy ── */
.money { display: grid; gap: var(--s8); }
@media (min-width: 900px) { .money { grid-template-columns: 1fr 1fr; align-items: start; } }
.money .notebook p { margin-top: 0; }
.dd-rows { margin: 0 0 var(--s4); padding: 0; list-style: none; display: grid; gap: var(--s2); }
.dd-rows li { padding-left: var(--s6); position: relative; }
.dd-rows li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: var(--s2); height: var(--s2); background: var(--sun); }
.fair__title { font-size: 32px; line-height: 1.05; margin: var(--s8) 0 0; }
.fair { list-style: none; counter-reset: fair; margin: 0; padding: 0; display: grid; gap: var(--s6); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 600px) { .fair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .fair { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.fair li { counter-increment: fair; display: grid; gap: var(--s2); align-content: start; }
.fair li::before { content: counter(fair); font: 400 32px/1 var(--font-pixel); color: var(--mist); }
.money__privacy { margin: var(--s4) 0 0; color: var(--mist); max-width: var(--measure); }

/* ─── FAQ: the heading beside its questions from 900 px ── */
.faq { display: grid; gap: var(--s6); }
@media (min-width: 900px) { .faq { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; } }
.faq__head .h-section { margin-bottom: var(--s3); }

/* ─── Final: the one centred band ── */
.final__in { display: flex; flex-direction: column; align-items: center; gap: var(--s4); text-align: center; }
.final__in .tank { margin-bottom: var(--s4); }
.final__in .h-section { margin: 0; }

/* ─── Footer waitlist ───────────────────────────────────── */
.waitlist { max-width: 560px; }
.waitlist .input { flex: 1 1 220px; }

