/* Hallmark · pre-emit critique: P5 H5 E5 S5 R4 V5
 * Hallmark · genre: atmospheric · macrostructure: Bento Grid (index) +
 *   Long Document (setup) · theme: Midnight
 * enrichment: H9 custom illustration centrepiece, Tier-A pure CSS
 *   (card anatomy at the renderer's real geometry) + 2 fixed canvas blooms
 * nav: N5 floating pill (index) · N3 side-rail (setup)
 * footer: Ft5 statement (index) · Ft4 dense colophon (setup)
 * knobs: F1 Bento tiles=7, spans=irregular, border=none (elevation) ·
 *   H9 build=Tier-A pure CSS, animation=none, scale=dominant ·
 *   C1 shape=pill, density=spacious, adornment=arrow ·
 *   N5 width=content-sized, backdrop=blur+saturate, anchor=top-centred ·
 *   Ft5 sentence-width=28ch, wordmark=under sentence, rule=hairline
 * redesign of: Narrative Workflow / Almanac / N6 / Ft1 (2026-07-30, same day)
 * contrast: pass (40-41) · slop: pass (42-45) · honest: pass (46)
 * chrome: pass (47) · tokens: pass (48) · responsive: pass (49)
 * icons: pass (30) · mobile: pass (34, 49, 50-57)
 */

@import url("tokens.css");

/* --------------------------------------------------------------- base ---- */

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: clip;
  margin: 0;
  background-color: var(--color-paper);
  /* Two warm blooms, fixed, unanimated. The canvas is the design. */
  background-image:
    radial-gradient(
      70ch 55ch at 78% -8%,
      color-mix(in oklch, var(--color-accent) 16%, transparent),
      transparent 70%
    ),
    radial-gradient(
      60ch 50ch at 8% 34%,
      color-mix(in oklch, var(--color-accent) 9%, transparent),
      transparent 70%
    );
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.62;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  min-width: 0;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-color: var(--color-rule);
  text-underline-offset: 0.12em;
  text-decoration-thickness: from-font;
}

a:hover {
  text-decoration-color: var(--color-accent);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  /* Never transitioned: the ring must be there the instant focus lands. */
}

code,
kbd,
samp,
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--color-muted);
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--page-gutter);
  top: var(--space-xs);
  z-index: var(--z-sticky);
  background: var(--color-paper-2);
  color: var(--color-ink);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
}

.page {
  max-width: 78rem;
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

/* ------------------------------------------------- N5 · floating pill ---- */

.pill-nav {
  position: fixed;
  inset: var(--space-md) auto auto 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  max-width: calc(100% - (var(--space-md) * 2));
  padding: var(--space-2xs) var(--space-2xs) var(--space-2xs) var(--space-md);
  background: color-mix(in oklch, var(--color-paper) 72%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  backdrop-filter: blur(14px) saturate(130%);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill);
  z-index: var(--z-sticky);
}

.pill-nav__word {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.pill-nav__links {
  display: none;
  align-items: center;
  gap: var(--space-md);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-sm);
}

.pill-nav__links a {
  white-space: nowrap;
  color: var(--color-muted);
  text-decoration: none;
}

.pill-nav__links a:hover {
  color: var(--color-ink);
}

@media (min-width: 48rem) {
  .pill-nav__links {
    display: flex;
  }
}

/* ------------------------------------------------------ C1 · the verbs --- */

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: var(--space-sm) var(--space-lg);
  min-height: 44px;
  border: var(--rule-hair) solid var(--color-accent);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--dur-micro) var(--ease-out),
    transform var(--dur-micro) var(--ease-out);
}

.cta:hover,
.cta.is-hover {
  background: color-mix(in oklch, var(--color-accent) 82%, var(--color-ink));
}

.cta:active,
.cta.is-active {
  transform: translateY(1px);
}

.cta[aria-disabled="true"],
.cta:disabled {
  background: var(--color-paper-3);
  border-color: var(--color-rule);
  color: var(--color-neutral);
  cursor: not-allowed;
}

.cta--ghost {
  background: transparent;
  border-color: var(--color-rule);
  color: var(--color-ink);
}

.cta--ghost:hover,
.cta--ghost.is-hover {
  background: var(--color-paper-2);
  border-color: var(--color-muted);
}

.cta--sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
}

.link {
  white-space: nowrap;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 1px;
  transition: text-decoration-thickness var(--dur-micro) var(--ease-out);
}

.link:hover {
  text-decoration-thickness: 2px;
}

/* ------------------------------------- H9 · hero + card centrepiece ------ */

/* Clears the fixed pill nav so the hero tag never sits under it. */
main.page {
  padding-block-start: var(--space-3xl);
}

.hero {
  display: grid;
  gap: var(--space-2xl);
  padding-block: var(--space-xl) var(--space-3xl);
  align-items: center;
}

@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--space-3xl);
    padding-block: var(--space-lg) var(--space-3xl);
  }
}

.hero__tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.hero__tag::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
}

.hero__title {
  font-size: var(--text-display);
  max-width: 15ch;
  margin-top: var(--space-md);
}

.hero__lede {
  font-size: var(--text-md);
  color: var(--color-muted);
  max-width: 46ch;
  margin-top: var(--space-lg);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* Card anatomy, Tier-A pure CSS. Every proportion below is the renderer's:
   400x560 canvas, 18px radius, 5px frame, and the real zone boxes from
   rendering/collectible_card.py. The art window is deliberately empty and
   labelled: this is a diagram of a card, not a picture of one. */

.card-fig {
  margin: 0;
  display: grid;
  gap: var(--space-md);
  justify-items: center;
}

.card {
  position: relative;
  container-type: inline-size;
  width: min(100%, 21rem);
  aspect-ratio: 400 / 560;
  border-radius: var(--radius-card);
  border: 1.25% solid var(--grade-gold);
  background-image: linear-gradient(
    180deg,
    var(--card-backdrop-top),
    var(--card-backdrop-bottom)
  );
  color: var(--color-ink);
  overflow: hidden;
}

.card__zone {
  position: absolute;
  border-radius: var(--radius-sm);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--space-3xs);
  padding: var(--space-2xs);
  text-align: center;
}

.card__label {
  font-family: var(--font-mono);
  font-size: clamp(0.5rem, 1.6cqw + 0.3rem, 0.8rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  line-height: 1.3;
}

.card__banner {
  inset-inline: 3%;
  top: 2.14%;
  height: 10.36%;
  background: color-mix(in oklch, var(--grade-gold) 22%, transparent);
  border: var(--rule-hair) solid color-mix(in oklch, var(--grade-gold) 55%, transparent);
}

.card__banner .card__label {
  color: var(--color-ink);
}

.card__art {
  inset-inline: 7%;
  top: 14.64%;
  height: 58.57%;
  background: color-mix(in oklch, var(--color-paper) 60%, transparent);
  border: var(--rule-hair) dashed var(--color-rule);
}

.card__plate {
  inset-inline: 4%;
  top: 75.36%;
  height: 11.79%;
  background: color-mix(in oklch, var(--color-paper) 70%, transparent);
  border: var(--rule-hair) solid var(--color-rule);
}

.card__badge,
.card__serial {
  position: absolute;
  bottom: 2.5%;
  font-family: var(--font-mono);
  font-size: clamp(0.5rem, 1.4cqw + 0.28rem, 0.7rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.card__badge {
  inset-inline-start: 5%;
}

.card__serial {
  inset-inline-end: 5%;
}

.card-fig figcaption {
  font-size: var(--text-sm);
  color: var(--color-muted);
  max-width: 34ch;
  text-align: center;
}

/* --------------------------------------------------------- sections ---- */

.section {
  padding-block: var(--space-2xl);
}

.section--close {
  padding-block: var(--space-3xl) var(--space-2xl);
}

/* Section heads stack vertically in one column at every width. */
.section__head {
  display: block;
  max-width: var(--measure);
  margin-bottom: var(--space-xl);
}

.section__title {
  font-size: var(--text-xl);
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.section__title::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  transform: translateY(-0.1em);
}

.section__sub {
  color: var(--color-muted);
  margin-top: var(--space-sm);
}

/* ------------------------------------------------------- F1 · bento ---- */

.bento {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

@media (min-width: 40rem) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 64rem) {
  .bento {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .cell--2x2 {
    grid-column: span 2;
    grid-row: span 2;
  }

  .cell--2x1 {
    grid-column: span 2;
  }

  .cell--3x1 {
    grid-column: span 3;
  }
}

.cell {
  min-width: 0;
  background: var(--color-paper-2);
  border-radius: var(--radius-tile);
  padding: var(--space-lg);
  display: grid;
  align-content: start;
  gap: var(--space-sm);
  transition: background-color var(--dur-short) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cell:hover {
    background: var(--color-paper-3);
  }
}

/* Body face, not the mono outlier: these are editorial labels, and the outlier
   carries one role only (machine text: code, API field names, card micro-type). */
.cell__kicker {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.cell__title {
  font-size: var(--text-md);
}

.cell p {
  color: var(--color-muted);
}

.cell--2x2 .cell__title {
  font-size: var(--text-lg);
}

/* Grade ladder, living inside a bento tile. */

.ladder {
  list-style: none;
  margin: var(--space-xs) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-xs);
}

.ladder li {
  display: grid;
  grid-template-columns: 0.75rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--space-sm);
}

.ladder__chip {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--radius-sm);
  transform: translateY(0.1em);
}

.ladder__chip[data-grade="bronze"] {
  background: var(--grade-bronze);
}

.ladder__chip[data-grade="silver"] {
  background: var(--grade-silver);
}

.ladder__chip[data-grade="gold"] {
  background: var(--grade-gold);
}

.ladder__chip[data-grade="diamond"] {
  background: var(--grade-diamond);
}

.ladder__name {
  font-weight: 600;
}

.ladder__note {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
  white-space: nowrap;
}

.streams {
  list-style: none;
  margin: var(--space-xs) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* ------------------------------------------------------- apply block --- */

.apply {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 60rem) {
  .apply {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.panel {
  background: var(--color-paper-2);
  border-radius: var(--radius-tile);
  padding: var(--space-lg);
}

.panel h3 {
  font-size: var(--text-md);
}

.checklist {
  list-style: none;
  margin: var(--space-md) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-md);
}

.checklist li b {
  font-weight: 600;
}

.checklist li span {
  display: block;
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.contact {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: var(--rule-hair) solid var(--color-rule);
  font-size: var(--text-sm);
  color: var(--color-muted);
  word-break: break-word;
}

/* ---------------------------------------------------- Ft5 · statement -- */

.foot {
  padding-block: var(--space-2xl) var(--space-xl);
  display: grid;
  gap: var(--space-lg);
}

.foot__line {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 5vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  max-width: 28ch;
}

.foot__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding-block-start: var(--space-md);
  border-top: var(--rule-hair) solid var(--color-rule);
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.foot__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
}

.foot__links a {
  white-space: nowrap;
}

/* ============================================================ setup.html */

/* ------------------------------------------------------ N3 · side rail - */

.rail {
  border-bottom: var(--rule-hair) solid var(--color-rule);
  padding: var(--space-md) var(--page-gutter);
  background: var(--color-paper-2);
}

.rail__word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.rail__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
  margin: var(--space-xs) 0 0;
  padding: 0;
  font-size: var(--text-sm);
}

.rail__list a {
  white-space: nowrap;
  color: var(--color-muted);
}

.rail__list a:hover {
  color: var(--color-ink);
}

@media (min-width: 72rem) {
  .rail {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: 16ch;
    border-bottom: 0;
    border-inline-end: var(--rule-hair) solid var(--color-rule);
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    overflow-y: auto;
    z-index: var(--z-sticky);
  }

  .rail__list {
    display: grid;
    gap: var(--space-xs);
  }

  .doc-shell {
    padding-inline-start: 16ch;
  }
}

/* ---------------------------------------------------- long document ---- */

.doc {
  max-width: 44rem;
  margin-inline: auto;
  padding: var(--space-2xl) var(--page-gutter) var(--space-3xl);
}

.doc__title {
  font-size: var(--text-display-s);
  max-width: 20ch;
}


.prose > * + * {
  margin-top: var(--space-lg);
}

.prose p,
.prose li {
  max-width: var(--measure);
}

/* S4 · inline heads: they emerge from the flow, no spatial break. */
.prose h2 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-top: var(--space-2xl);
}

.prose h3 {
  font-size: var(--text-md);
  margin-top: var(--space-xl);
}

.prose ol,
.prose ul {
  padding-inline-start: 1.2em;
}

.prose li + li {
  margin-top: var(--space-xs);
}

.prose blockquote {
  margin: 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-paper-2);
  border-radius: var(--radius-tile);
  color: var(--color-muted);
}

.prose em {
  font-style: italic;
}

pre {
  margin: 0;
  padding: var(--space-md);
  background: var(--color-paper-2);
  border-radius: var(--radius-tile);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.55;
}

pre .lbl {
  display: block;
  color: var(--color-muted);
}

.field {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--text-sm);
}

.field th,
.field td {
  text-align: start;
  vertical-align: top;
  padding: var(--space-xs) var(--space-md) var(--space-xs) 0;
  border-bottom: var(--rule-hair) solid var(--color-rule);
}

.field th {
  font-family: var(--font-mono);
  font-weight: 400;
  white-space: nowrap;
}

/* ------------------------------------------------ Ft4 · dense colophon - */

.colophon {
  border-top: var(--rule-hair) solid var(--color-rule);
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-muted);
  max-width: var(--measure);
}

.colophon a {
  color: var(--color-ink);
}

/* ------------------------------------------------------------ motion --- */

/* Atmospheric motion is fade only. No slide, no bounce; the canvas does the
   work. One orchestrated entrance, capped well under 500ms total. */
.reveal {
  opacity: 0;
  animation: reveal var(--dur-long) var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes reveal {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }
}

@media (pointer: coarse) {
  .cta {
    min-height: 48px;
  }
}
