/* ============================================================================
   RYVAKAI :: web/styles.css
   ----------------------------------------------------------------------------
   PURPOSE
     The single design system for the public site at https://ryvakai.com
     (index.html, download.html, play.html). One stylesheet, no build step, no
     preprocessor, no external host: the edge CSP is
       default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:
     so every font is a system stack, every colour is a token declared here, and
     nothing is fetched from a CDN.

   AUTHORITY MODEL
     Presentation only. This file holds no game state and makes no assertion
     about the world. Everything it renders is either static editorial copy or a
     value app.js received from the server-authoritative Go API. It must never be
     the reason a number appears on screen.

   ART DIRECTION (binding for this slice)
     Deep charcoal near-black ground. One cold "Veil" accent, a desaturated
     cyan-blue. One warm ember accent used sparingly, for emphasis only, never
     as a second theme colour. Sharp geometric edges (2px radius maximum),
     generous negative space, thin hairline rules, restrained motion.
     Typography-led rather than decoration-led.

     DELIBERATELY DARK-ONLY. `color-scheme: dark` is declared so form controls,
     scrollbars and focus rings render in the correct family. A light variant is
     not a missing feature; a half-committed light theme would read as a
     template, and the ground colour is part of the identity. Motion is opt-out
     via prefers-reduced-motion, which IS honoured throughout.

   CONTRAST
     Every ink/accent token below was measured against --ground (#0a0b0d) and
     against --panel-2 (#161920), the two darkest surfaces text sits on:
       --ink        16.2:1     --veil        7.5:1
       --ink-muted   7.6:1     --ember       7.4:1
       --ink-faint   5.3:1 on ground, 4.9:1 on --panel-2
     All clear WCAG AA for normal text. Do not introduce a dimmer ink token
     without re-measuring it.

   OWNER
     Web slice. Binding spec: docs/ARCHITECTURE_CONTRACT.md.
   ========================================================================== */

/* ---------------------------------------------------------------- 1. tokens */

:root {
  color-scheme: dark;

  /* Ground and surfaces. Each step is a deliberate elevation, not a gradient. */
  --ground: #0a0b0d;
  --ground-deep: #060709;
  --panel: #101216;
  --panel-2: #161920;
  --panel-3: #1d212a;

  /* Hairlines. The whole layout is built from these rather than from boxes. */
  --line: #20242c;
  --line-strong: #2b3038;
  --hairline: rgba(232, 236, 242, 0.09);

  /* Ink */
  --ink: #e6e9ee;
  --ink-muted: #9aa1ac;
  --ink-faint: #7e858f;

  /* Veil: the cold accent. Structure, state, links, section indices. */
  --veil: #78a6c4;
  --veil-bright: #a8c8dd;
  --veil-deep: #2c4557;
  --veil-wash: rgba(120, 166, 196, 0.09);
  --veil-edge: rgba(120, 166, 196, 0.32);

  /* Ember: the warm accent. Used sparingly and only for emphasis. */
  --ember: #e08a4c;
  --ember-wash: rgba(224, 138, 76, 0.1);
  --ember-edge: rgba(224, 138, 76, 0.34);

  /* Semantic state */
  --ok: #7fbf9a;
  --warn: #e0b04c;
  --bad: #d9736b;

  /* Type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --track-wide: 0.24em;
  --track-mid: 0.14em;

  /* Metrics */
  --maxw: 76rem;
  --maxw-prose: 40rem;
  --gutter: clamp(1.25rem, 4.5vw, 3.25rem);
  --section-y: clamp(4rem, 10vw, 8.5rem);
  --radius: 2px;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 120ms;
  --dur: 240ms;
  --dur-slow: 520ms;
}

/* ------------------------------------------------------------- 2. resets */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Sticky header height + breathing room, so anchors do not land under it. */
  scroll-padding-top: 6rem;
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--veil);
  text-decoration-color: var(--veil-deep);
  text-underline-offset: 0.22em;
  transition: color var(--dur-fast) var(--ease),
    text-decoration-color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--veil-bright);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--veil-bright);
  outline-offset: 3px;
  border-radius: var(--radius);
}

::selection {
  background: var(--veil-deep);
  color: var(--ink);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------- 3. typography */

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.t-display {
  font-size: clamp(2.6rem, 1.4rem + 6vw, 6.5rem);
  font-weight: 700;
  letter-spacing: var(--track-wide);
  line-height: 0.98;
  /* Tracking adds trailing space; nudge back so the block reads flush left. */
  margin-left: -0.03em;
  text-transform: uppercase;
}

.t-h1 {
  font-size: clamp(1.9rem, 1.2rem + 2.8vw, 3.25rem);
}

.t-h2 {
  font-size: clamp(1.45rem, 1.1rem + 1.5vw, 2.1rem);
}

.t-h3 {
  font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem);
  letter-spacing: -0.005em;
}

.t-lead {
  font-size: clamp(1.02rem, 0.95rem + 0.5vw, 1.28rem);
  line-height: 1.55;
  color: var(--ink);
  max-width: 46rem;
  text-wrap: pretty;
}

.t-body {
  color: var(--ink-muted);
  max-width: var(--maxw-prose);
  text-wrap: pretty;
}

.t-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--veil);
}

.t-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--ink-faint);
}

.t-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

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

.t-faint {
  color: var(--ink-faint);
}

.t-veil {
  color: var(--veil);
}

.t-ember {
  color: var(--ember);
}

.t-nowrap {
  white-space: nowrap;
}

/* ------------------------------------------------------------- 4. layout */

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell--narrow {
  max-width: 58rem;
}

.section {
  padding-block: var(--section-y);
  border-top: 1px solid var(--line);
  position: relative;
}

.section--flush {
  border-top: 0;
}

.section__head {
  display: grid;
  gap: 1.15rem;
  margin-bottom: clamp(2.25rem, 5vw, 3.75rem);
  max-width: 52rem;
}

.section__index {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--veil);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
}

.section__index::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--veil-edge), transparent 85%);
  max-width: 12rem;
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack--lg {
  gap: 1.75rem;
}

.stack--sm {
  gap: 0.5rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  align-items: center;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--ground);
  padding: 0.7rem 1.1rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: top var(--dur) var(--ease);
}

.skip-link:focus {
  top: 0.75rem;
  color: var(--ground);
}

/* ------------------------------------------------------ 5. status banner */

.banner {
  background: var(--ground-deep);
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-block: 0.6rem;
  color: var(--ink-muted);
}

.banner__flag {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--ember);
  font-size: 0.6875rem;
}

.banner__dot {
  width: 6px;
  height: 6px;
  background: var(--ember);
  flex: none;
  /* Square. The mark is geometric, not a rounded status pip. */
}

/* --------------------------------------------------------- 6. site header */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 11, 13, 0.86);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid var(--line);
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4rem;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  flex: none;
}

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

.wordmark__sigil {
  width: 20px;
  height: 20px;
  color: var(--veil);
  flex: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem 1.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.nav a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  padding-block: 0.35rem;
  position: relative;
}

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

.nav a[aria-current="page"] {
  color: var(--ink);
}

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.1rem;
  height: 1px;
  background: var(--veil);
}

/* Scoped under .masthead so this outranks the later `.btn { display:
   inline-flex }` rule (equal-specificity, later-wins had been re-showing the
   toggle at desktop width). The media query below re-shows it at a higher
   specificity still. */
.masthead .nav__toggle {
  display: none;
}

/* Progressive enhancement: without JS the nav stays a visible wrapped row.
   app.js sets data-nav="enhanced" once it can actually drive the disclosure. */
@media (max-width: 52rem) {
  .masthead[data-nav="enhanced"] .nav__toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .masthead[data-nav="enhanced"] .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-left: 0;
    border-top: 1px solid var(--line);
    padding-block: 0.5rem 1rem;
  }

  .masthead[data-nav="enhanced"][data-nav-open="true"] .nav {
    display: flex;
  }

  .masthead[data-nav="enhanced"] .nav a {
    width: 100%;
    padding-block: 0.7rem;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--line);
  }

  .masthead[data-nav="enhanced"] .nav a[aria-current="page"]::after {
    display: none;
  }
}

/* -------------------------------------------------------- 7. buttons */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.72rem 1.35rem;
  min-height: 2.75rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-line);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.btn:hover {
  --btn-line: var(--veil);
  color: var(--btn-fg);
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--primary {
  --btn-bg: var(--ink);
  --btn-fg: var(--ground);
  --btn-line: var(--ink);
}

.btn--primary:hover {
  --btn-bg: #fff;
  --btn-line: #fff;
  color: var(--ground);
}

.btn--veil {
  --btn-bg: var(--veil-wash);
  --btn-fg: var(--veil-bright);
  --btn-line: var(--veil-deep);
}

.btn--veil:hover {
  --btn-line: var(--veil);
  color: var(--veil-bright);
}

.btn--quiet {
  --btn-line: var(--line);
  --btn-fg: var(--ink-muted);
  padding-inline: 0.9rem;
}

.btn--quiet:hover {
  --btn-fg: var(--ink);
}

.btn--sm {
  padding: 0.45rem 0.85rem;
  min-height: 2.15rem;
  font-size: 0.6875rem;
}

.btn--block {
  width: 100%;
}

.btn--danger:hover {
  --btn-line: var(--bad);
  --btn-fg: var(--bad);
}

/* --------------------------------------------------------- 8. surfaces */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
}

.panel--raised {
  background: var(--panel-2);
}

.panel--veil {
  border-color: var(--veil-deep);
  background: linear-gradient(180deg, var(--veil-wash), transparent 60%),
    var(--panel);
}

.panel--ember {
  border-color: rgba(224, 138, 76, 0.28);
  background: linear-gradient(180deg, var(--ember-wash), transparent 60%),
    var(--panel);
}

.note {
  border-left: 2px solid var(--line-strong);
  padding: 0.15rem 0 0.15rem 1.05rem;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  max-width: 46rem;
}

.note--veil {
  border-left-color: var(--veil);
}

.note--ember {
  border-left-color: var(--ember);
}

/* Hairline grid: cells separated by 1px gaps over a line-coloured backing.
   Cheaper and sharper than per-cell borders, and never double-draws. */
.hairgrid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.hairgrid > * {
  background: var(--panel);
  padding: clamp(1.15rem, 2.6vw, 1.75rem);
}

.hairgrid--2 {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.hairgrid--3 {
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.hairgrid--4 {
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

/* Key/value spec strip. The cell colour is a token so the same component can
   sit directly on the page ground or inside a panel without a seam. */
.spec {
  --spec-cell: var(--ground);
  display: grid;
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.panel .spec {
  --spec-cell: var(--panel-2);
}

.spec > div {
  background: var(--spec-cell);
  padding: 0.95rem 1rem 0.95rem 0;
}

.panel .spec > div {
  padding-inline: 1rem;
}

.spec dt,
.spec .spec__k {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}

.spec dd,
.spec .spec__v {
  font-size: 0.9375rem;
  color: var(--ink);
  margin: 0;
}

/* Latest-update card (home). app.js fills it from /downloads/manifest.json;
   it stays hidden until a build exists, so it can never claim one that
   does not. One cold accent edge, no second theme colour. */
.update {
  margin-top: clamp(1.5rem, 3.5vw, 2.25rem);
  max-width: 46rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--veil);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--veil-wash), transparent 65%),
    var(--panel);
  padding: clamp(1.1rem, 2.5vw, 1.5rem);
  display: grid;
  gap: 0.8rem;
}

.update__head {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.85rem;
  flex-wrap: wrap;
}

/* ----------------------------------------------------------- 9. badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--panel);
  white-space: nowrap;
}

.badge--veil {
  color: var(--veil);
  border-color: var(--veil-deep);
  background: var(--veil-wash);
}

.badge--ember {
  color: var(--ember);
  border-color: var(--ember-edge);
  background: var(--ember-wash);
}

.badge--ok {
  color: var(--ok);
  border-color: rgba(127, 191, 154, 0.32);
}

.badge--warn {
  color: var(--warn);
  border-color: rgba(224, 176, 76, 0.32);
}

.badge--bad {
  color: var(--bad);
  border-color: rgba(217, 115, 107, 0.32);
}

.badge__dot {
  width: 5px;
  height: 5px;
  background: currentColor;
  flex: none;
}

/* -------------------------------------------------------------- 10. hero */

.hero {
  position: relative;
  padding-block: clamp(4.5rem, 12vw, 9.5rem) clamp(3.5rem, 8vw, 6rem);
  overflow: hidden;
}

/* Two flat washes and a hairline horizon. No imagery, no parallax. */
.hero::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 130%;
  background: radial-gradient(
      ellipse 70% 55% at 22% 0%,
      rgba(120, 166, 196, 0.12),
      transparent 62%
    ),
    radial-gradient(
      ellipse 55% 45% at 88% 12%,
      rgba(224, 138, 76, 0.055),
      transparent 60%
    );
  pointer-events: none;
}

.hero__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(
    90deg,
    var(--hairline) 1px,
    transparent 1px
  );
  background-size: clamp(4rem, 9vw, 7.5rem) 100%;
  mask-image: linear-gradient(180deg, transparent, #000 30%, transparent 95%);
  -webkit-mask-image: linear-gradient(
    180deg,
    transparent,
    #000 30%,
    transparent 95%
  );
  opacity: 0.7;
}

.hero__inner {
  position: relative;
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

.hero__rule {
  height: 1px;
  width: min(22rem, 60%);
  background: linear-gradient(90deg, var(--ember), var(--veil) 45%, transparent);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

/* ------------------------------------------------- 11. character cards */

.cast {
  display: grid;
  gap: clamp(1rem, 2vw, 1.25rem);
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

/* Image frame. The fallback sits UNDER the <img>, so a missing file degrades
   gracefully with or without JavaScript: the img simply fails to paint and the
   plate texture shows through. app.js additionally marks .is-missing to drop
   the browser's broken-image glyph. */
.plate {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.plate--wide {
  aspect-ratio: 16 / 9;
}

.plate__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.5rem;
  text-align: center;
  padding: 1.25rem;
  background-image: repeating-linear-gradient(
    -45deg,
    var(--hairline) 0 1px,
    transparent 1px 11px
  );
}

.plate__fallback span {
  font-size: 0.6875rem;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--ink-faint);
}

.plate__fallback::before {
  content: "";
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  transform: rotate(45deg);
}

.plate img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  background: var(--panel-2);
}

.plate.is-missing img {
  display: none;
}

.card__body {
  display: grid;
  gap: 0.9rem;
  padding: clamp(1.1rem, 2.4vw, 1.5rem);
  flex: 1;
}

.card__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.card__text {
  color: var(--ink-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.card__foot {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  margin-top: auto;
  display: grid;
  gap: 0.55rem;
}

/* Resource bars. Width arrives as an inline --w custom property, computed from
   the archetype table so the five profiles are compared on ONE shared scale. */
.bar {
  display: grid;
  grid-template-columns: 4.75rem 1fr auto;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.bar__track {
  height: 3px;
  background: var(--panel-3);
  position: relative;
  overflow: hidden;
}

.bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w, 0%);
  background: var(--bar-color, var(--veil));
}

.bar__val {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  font-size: 0.75rem;
}

.bar--vitality {
  --bar-color: var(--bad);
}

.bar--stamina {
  --bar-color: var(--ok);
}

.bar--veil {
  --bar-color: var(--veil);
}

/* Small secondary mesh render beside the concept plate. */
.thumb {
  position: relative;
  width: 4.5rem;
  aspect-ratio: 1;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
}

.thumb .plate__fallback::before {
  width: 18px;
  height: 18px;
}

.thumb .plate__fallback span {
  display: none;
}

.thumb img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.is-missing img {
  display: none;
}

/* ------------------------------------------------------------ 12. tables */

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* Wide content scrolls inside its own box; the page body never does. */
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 40rem;
}

thead th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.85rem 1rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-muted);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody th {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  vertical-align: top;
}

tbody tr:last-child th {
  border-bottom: 0;
}

/* --------------------------------------------------- 13. technique list */

.tech {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.tech__item {
  background: var(--panel);
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0 clamp(1rem, 2.5vw, 2rem);
  padding: clamp(1.25rem, 2.8vw, 1.9rem);
  transition: background-color var(--dur) var(--ease);
}

.tech__item:hover {
  background: var(--panel-2);
}

.tech__num {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--veil);
  letter-spacing: 0.06em;
  padding-top: 0.2rem;
}

.tech__main {
  display: grid;
  gap: 0.75rem;
}

.tech__name {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
}

@media (max-width: 34rem) {
  .tech__item {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .tech__num {
    padding-top: 0;
  }
}

/* --------------------------------------------------------- 14. forms */

.field {
  display: grid;
  gap: 0.4rem;
}

.field > label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--ink-faint);
}

.input {
  width: 100%;
  padding: 0.72rem 0.85rem;
  min-height: 2.75rem;
  background: var(--ground-deep);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease);
}

.input::placeholder {
  color: var(--ink-faint);
  opacity: 1;
}

.input:hover {
  border-color: #3a4048;
}

.input:focus {
  border-color: var(--veil);
  outline: 2px solid var(--veil-edge);
  outline-offset: 0;
}

.input[aria-invalid="true"] {
  border-color: var(--bad);
}

.hint {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.err {
  font-size: 0.75rem;
  color: var(--bad);
  min-height: 1.1rem;
}

.err:empty {
  display: none;
}

.checkline {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  cursor: pointer;
}

.checkline input {
  margin-top: 0.28rem;
  accent-color: var(--veil);
  width: 1rem;
  height: 1rem;
  flex: none;
}

/* Tabs (sign in / create account) */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0.7rem 1.05rem;
  margin-bottom: -1px;
  color: var(--ink-faint);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

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

.tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--veil);
}

/* Archetype picker: a radio group styled as selectable plates. */
.picker {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}

.pick {
  position: relative;
  display: block;
  cursor: pointer;
}

.pick input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* Written as <span> so the whole plate can live inside a <label>; blockified
   here because inline boxes ignore aspect-ratio and height. */
.pick__body {
  display: block;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
  transition: border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
  height: 100%;
}

.pick:hover .pick__body {
  border-color: var(--line-strong);
  background: var(--panel-3);
}

.pick input:checked + .pick__body {
  border-color: var(--veil);
  background: linear-gradient(180deg, var(--veil-wash), transparent 70%),
    var(--panel-2);
}

.pick input:focus-visible + .pick__body {
  outline: 2px solid var(--veil-bright);
  outline-offset: 2px;
}

.pick__plate {
  display: block;
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--panel-3);
  border-bottom: 1px solid var(--line);
}

.pick__plate img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  filter: grayscale(0.55) contrast(1.03);
  transition: filter var(--dur) var(--ease);
}

.pick input:checked + .pick__body .pick__plate img {
  filter: none;
}

.pick__plate.is-missing img {
  display: none;
}

.pick__text {
  display: grid;
  gap: 0.2rem;
  padding: 0.7rem 0.8rem 0.85rem;
}

.pick__name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}

.pick__role {
  font-size: 0.6875rem;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--veil);
}

/* ---------------------------------------------------- 15. status widget */

.status {
  display: grid;
  gap: 0.9rem;
}

.status__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.serverlist {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.serverrow {
  background: var(--panel-2);
  display: grid;
  gap: 0.35rem 1rem;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0.95rem 1.1rem;
}

.serverrow__name {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.9375rem;
}

.serverrow__meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.empty {
  background: var(--panel-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  color: var(--ink-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ------------------------------------------------------- 16. checksum */

.hashline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.hash {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-muted);
  background: var(--ground-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  word-break: break-all;
  overflow-wrap: anywhere;
  flex: 1 1 22rem;
  min-width: 0;
}

pre {
  background: var(--ground-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--ink-muted);
}

pre b {
  color: var(--ink);
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.08em 0.36em;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ------------------------------------------------------------ 17. lists */

.ticks {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.7rem;
  max-width: 46rem;
}

.ticks li {
  position: relative;
  padding-left: 1.6rem;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.ticks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 7px;
  height: 1px;
  background: var(--veil);
}

.ticks--ember li::before {
  background: var(--ember);
}

.ticks--muted li::before {
  background: var(--ink-faint);
}

.changelog {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.changelog__entry {
  background: var(--panel);
  padding: clamp(1.25rem, 2.8vw, 1.85rem);
  display: grid;
  gap: 0.9rem;
}

.changelog__head {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------ 18. footer */

.footer {
  border-top: 1px solid var(--line);
  background: var(--ground-deep);
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

.footer__grid {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3rem);
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.footer__col {
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.footer__col a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

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

.footer__base {
  margin-top: clamp(2rem, 5vw, 3rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-faint);
}

/* ----------------------------------------------------------- 19. utility */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

/* ---------------------------------------------------------- 20. motion */

/* Reveal on scroll. app.js adds .is-in via IntersectionObserver. The default
   state is VISIBLE; JS opts elements into the hidden start state only after it
   confirms IntersectionObserver exists, so content never gets stranded. */
[data-reveal] {
  transition: opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease);
}

[data-reveal].is-armed {
  opacity: 0;
  transform: translateY(12px);
}

[data-reveal].is-armed.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal].is-armed,
  [data-reveal].is-armed.is-in {
    opacity: 1;
    transform: none;
  }

  .card:hover {
    transform: none;
  }
}

/* ------------------------------------------------------------ 21. print */

@media print {
  .masthead,
  .banner,
  .hero__grid,
  .btn,
  .footer__grid {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .panel,
  .hairgrid > *,
  .tech__item {
    background: #fff;
    border-color: #ccc;
  }
}
