/* Xag — black, green, and the two marks.
 *
 * There are two marks in Xag, so there are exactly two accent colours here: one
 * for a name, one for a written value. Everything else is neutral. A third
 * accent would contradict, in the only language a page really speaks, the thing
 * this page is saying.
 *
 * The green is the theme's; the amber is the second mark. They stay apart for a
 * reader with deuteranopia or protanopia, which two greens would not. */

:root {
  color-scheme: dark;

  --bg: #04070a;
  --bg-soft: #070d0c;
  --panel: #0a1310;
  --fg: #e4efe8;
  --muted: #7d9389;
  --rule: #17251f;

  /* The two marks, and only two. */
  --name: #3ee08a;
  --value: #e0a94a;

  /* A third pair, and a different question: not what a piece of Xag is, but
   * whether a claim about the language is a thing to want. Only the tagline
   * asks it, and only four lines of it. */
  --good: #3ee08a;
  --cost: #ff6b5e;

  --green-dim: rgba(62, 224, 138, 0.14);
  --green-line: rgba(62, 224, 138, 0.22);

  /* Brighter than the body text, for the few things that want to stand out. */
  --emph: #ffffff;
  /* What is legible on top of an accent-coloured block. */
  --on-accent: #04150c;

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

  --measure: 42rem;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  /* No bounce past either end, and no scroll chaining out of the page. */
  overscroll-behavior: none;
}

body {
  margin: 0;
  overscroll-behavior: none;
  /* The dock floats over the bottom of the window, so the page stops short of
   * it rather than running underneath. */
  padding: 0 0 9rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════ the hero ══════════════ */

.hero {
  position: relative;
  overflow: hidden;
  min-height: min(92vh, 820px);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--rule);
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 78rem;
  margin-inline: auto;
  padding: 5rem 1.5rem;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  grid-template-areas:
    "mark  mark"
    "words cards";
  gap: 3rem;
  align-items: center;
}

.hero-mark { grid-area: mark; justify-self: center; margin-bottom: 1rem; }
.hero-words { grid-area: words; }
.cards { grid-area: cards; }

/* The cards only exist on the front page, so the others get the column back. */
.hero.compact .hero-inner {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "mark" "words";
}

.hero.compact .hero-mark { margin-bottom: 0; }

/* On every page but the first, the sky stays and the words stand aside. */
.hero.compact { min-height: 0; }
.hero.compact .hero-inner { padding: 3.5rem 1.5rem 2.5rem; }
.hero.compact h1 { font-size: clamp(2.4rem, 8vw, 3.6rem); margin-bottom: 0; }
.hero.compact .tagline,
.hero.compact .warning,
.hero.compact .cta { display: none; }

.hero-words { max-width: 38rem; }

/* The name sits on something rather than floating in the sky. The same glass
 * as the cards and the dock, so it belongs to the page rather than to the
 * space behind it. */
.hero-mark h1 {
  padding: 0.12em 0.42em 0.2em;
  border-radius: 24px;
  background: rgba(7, 18, 14, 0.55);
  border: 1px solid var(--green-line);
  backdrop-filter: blur(18px) saturate(0.9);
  -webkit-backdrop-filter: blur(18px) saturate(0.9);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.5);
}

.hero h1 {
  font-family: var(--sans);
  font-size: clamp(4.5rem, 13vw, 9rem);
  line-height: 0.92;
  letter-spacing: 0.03em;
  font-weight: 500;
  margin: 0 0 1.25rem;
  color: var(--emph);
}

.tagline {
  /* Six lines rather than four, and the longest of them is long. Measured at
   * 1440: the text runs 530px in a 605px column, so there is an eighth of the
   * width spare for a machine whose fonts come out wider. A step larger left
   * only a twenty-fifth. */
  font-size: clamp(1.02rem, 1.95vw, 1.42rem);
  line-height: 1.4;
  text-wrap: pretty;
  letter-spacing: -0.015em;
  font-weight: 400;
  margin: 0 0 1.75rem;
  color: var(--fg);
}

/* One to a line, said deliberately rather than left to wherever the measure
 * happens to run out. */
.tagline span { display: block; }

/* What the language gives you, and what it charges. Every theme answers this,
 * in its own green and its own red. */
.tagline .good { color: var(--good); }
.tagline .cost { color: var(--cost); }

/* A cost belongs to the claim above it, so it sits close under it and the gap
 * goes between the pairs instead. */
.tagline .cost + .good { margin-top: 0.7em; }

.hero .warning {
  display: block;
  width: fit-content;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  margin: 0 0 2rem;
  background: rgba(4, 7, 10, 0.55);
}

/* The one link that lives outside `main`, so it says so for itself. */
.warning a {
  color: var(--name);
  text-decoration-color: var(--green-line);
}

.warning a:hover { text-decoration-color: var(--name); }

.cta {
  display: inline-block;
  background: var(--name);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 0 0 rgba(62, 224, 138, 0);
}

.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(62, 224, 138, 0.32);
}

/* ── the blocks down the right ── */

.cards { display: flex; flex-direction: column; gap: 0.65rem; }

.card {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1.15rem 1.35rem;
  border-radius: 14px;
  text-align: left;
  font: inherit;
  color: var(--fg);
  background: rgba(7, 18, 14, 0.74);
  border: 1px solid var(--green-line);
  backdrop-filter: blur(16px) saturate(0.8);
  -webkit-backdrop-filter: blur(16px) saturate(0.8);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.card:hover {
  background: rgba(16, 40, 30, 0.85);
  border-color: rgba(62, 224, 138, 0.5);
  transform: translateX(3px);
}

[data-theme="silver"] .card:hover {
  background: rgba(32, 38, 47, 0.88);
  border-color: rgba(203, 214, 228, 0.5);
}

.card:focus-visible {
  outline: 2px solid var(--name);
  outline-offset: 2px;
}

.card-icon {
  font-family: var(--mono);
  font-size: 1.05rem;
  color: var(--name);
  width: 1.9rem;
  flex: none;
  text-align: center;
}

.card-label { flex: 1; font-size: 1.02rem; }

.card-arrow {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.18s ease, transform 0.18s ease;
}

.card:hover .card-arrow { stroke: var(--name); transform: translateX(3px); }

/* ══════════════ the space behind it ══════════════ */

.space { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.space-defs { position: absolute; width: 0; height: 0; }

.stars, .rocks, .shards, .flashes { position: absolute; inset: 0; }

.star {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: #dff7e9;
}

.twinkles { animation: twinkle var(--secs) ease-in-out var(--delay) infinite alternate; }

@keyframes twinkle {
  from { opacity: 0.12; }
  to   { opacity: 0.95; }
}

/* The transform is written every frame from Rust; nothing here animates it. */
.rock {
  position: absolute;
  will-change: transform;
}

.rock svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* A rim, so the outline reads against the black, and a lit face so the light
 * appears to be coming from somewhere. */
.rock .body { stroke: rgba(126, 245, 184, 0.45); stroke-width: 1.4; }
.rock .facet { fill: rgba(168, 255, 214, 0.22); }

.rock.far    { opacity: 0.5;  filter: blur(1.4px); }
.rock.middle { opacity: 0.8;  filter: drop-shadow(0 0 9px rgba(62, 224, 138, 0.2)); }
.rock.near   { opacity: 0.95; filter: drop-shadow(0 0 16px rgba(62, 224, 138, 0.26)); }

/* What is left of two rocks that met. Hidden until there is something to
 * show; the size, the place and the fading are all written from Rust. */
.shard {
  position: absolute;
  display: none;
  will-change: transform, opacity;
}

.shard svg { width: 100%; height: 100%; display: block; overflow: visible; }

.shard polygon {
  fill: #9dffcd;
  stroke: rgba(230, 255, 242, 0.65);
  stroke-width: 3;
}

/* The light of the impact, which is over before the pieces are. */
.flash {
  position: absolute;
  display: none;
  border-radius: 50%;
  transform-origin: center;
  will-change: transform, opacity;
  background: radial-gradient(
    circle,
    rgba(214, 255, 233, 0.9),
    rgba(62, 224, 138, 0.42) 42%,
    rgba(62, 224, 138, 0) 70%
  );
}

/* The words sit on the left and want the dark; the bottom hands over to the
 * page. */
.scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 2%, rgba(4, 7, 10, 0.82) 20%,
      rgba(4, 7, 10, 0.34) 38%, rgba(4, 7, 10, 0) 56%),
    radial-gradient(110% 80% at 74% 44%, rgba(62, 224, 138, 0.1), transparent 64%),
    linear-gradient(to bottom, transparent 78%, var(--bg) 100%);
}

/* The rocks stop being moved in `space::animate`, which checks this too. */
@media (prefers-reduced-motion: reduce) {
  .twinkles { animation: none; }
  html { scroll-behavior: auto; }
}

/* ══════════════ the page ══════════════ */

main, .site-footer {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.lede {
  font-size: 1.15rem;
  color: var(--fg);
  margin: 3.5rem 0 0;
}

section { padding-top: 3.5rem; }

h2 {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

p { margin: 0 0 1.15rem; }

.claim {
  font-family: var(--mono);
  font-size: 1.02rem;
  line-height: 1.5;
  margin: 1.75rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--green-line);
}

a { color: inherit; text-underline-offset: 3px; }

/* A link is green. The cards and the call to action are their own things and
 * keep their own colour. */
main a, .site-footer a, .fallback a {
  color: var(--name);
  text-decoration-color: rgba(62, 224, 138, 0.4);
}

main a:hover, .site-footer a:hover, .fallback a:hover {
  text-decoration-color: var(--name);
}

/* Said sideways, down the edge of the page, because it is a note about how the
 * page is made rather than anything the page is saying. */
.vertical-note {
  position: fixed;
  left: 1.15rem;
  top: 50%;
  z-index: 5;
  margin: 0;
  writing-mode: vertical-rl;
  transform: translateY(-50%) rotate(180deg);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* Below this there is no margin to stand it in, and it would cross the text. */
@media (max-width: 64rem) {
  .vertical-note { display: none; }
}

.warning {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.6rem 0.85rem;
}

/* ── code ── */

code, pre { font-family: var(--mono); }

p code, li code, td code {
  font-size: 0.88em;
  background: var(--panel);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

pre {
  margin: 0;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 1rem 1.1rem;
  font-size: 0.82rem;
  line-height: 1.6;
  tab-size: 4;
}

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

/* The two marks, and the neutrals around them. */
.tk-name    { color: var(--name); }
.tk-value   { color: var(--value); }
.tk-word    { color: var(--fg); }
.tk-punct   { color: var(--muted); }
.tk-comment { color: var(--muted); font-style: italic; }

/* An escape is an item sitting beside the text, not hidden inside it — so it is
 * drawn as standing outside rather than given a colour of its own. */
.tk-escape {
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0 0.15em;
}

/* ── a sample, and what it printed ── */

.sample { margin: 0 0 1.5rem; }
.sample .code { border-radius: 5px 5px 0 0; }

.sample figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.45rem 1.1rem;
  border-inline: 1px solid var(--rule);
  background: var(--bg-soft);
}

.sample figcaption .filename { color: var(--fg); }
.sample figcaption .cmd { background: none; padding: 0; }

.output { border-radius: 0 0 5px 5px; background: var(--bg-soft); }
.output code { color: var(--fg); white-space: pre-wrap; }

.diagnostic {
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-soft);
}

/* ── the marks table ── */

.marks-table { border-collapse: collapse; margin: 0 0 1.5rem; font-size: 0.95rem; }
.marks-table td { padding: 0.3rem 1.25rem 0.3rem 0; vertical-align: baseline; }
.marks-table td:first-child { font-family: var(--mono); white-space: nowrap; }
.marks-table code { background: none; padding: 0; font-size: 0.95rem; }

/* ── the live panel ── */

.marks { margin: 2rem 0 0; }

.marks-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  align-items: stretch;
}

.marks-input, .marks-out {
  min-height: 15rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
  tab-size: 4;
}

.marks-input {
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 1rem 1.1rem;
  resize: vertical;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

.marks-input:focus {
  outline: 1px solid var(--green-line);
  outline-offset: -1px;
  color: var(--fg);
}

.marks-out { margin: 0; white-space: pre-wrap; }
.marks-note { font-size: 0.85rem; color: var(--muted); margin: 0.75rem 0 0; }

/* ── the rest ── */

.engines { margin: 0 0 1.15rem; padding-left: 1.1rem; }
.engines li { margin-bottom: 0.85rem; }
.engines strong { color: var(--name); font-weight: 600; }

blockquote {
  margin: 0 0 1.15rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

blockquote footer { font-family: var(--mono); font-size: 0.8rem; }

.site-footer {
  margin-top: 4.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer p { margin: 0 0 0.4rem; }
.fine { font-size: 0.78rem; }
.sep { color: var(--rule); }

/* Before the WebAssembly arrives, and if it never does. */
.fallback { max-width: var(--measure); margin-inline: auto; padding: 5rem 1.5rem; }
.fallback h1 { font-size: 3rem; margin: 0 0 1.25rem; letter-spacing: -0.04em; }

@media (max-width: 60rem) {
  .hero-inner {
    grid-template-columns: 1fr !important;
    grid-template-areas: "mark" "words" "cards" !important;
    gap: 2.5rem;
    padding-block: 4rem;
  }
  .hero { min-height: 0; }
  .scrim {
    background:
      linear-gradient(180deg, rgba(4, 7, 10, 0.72), rgba(4, 7, 10, 0.42) 45%, var(--bg)),
      radial-gradient(110% 60% at 70% 30%, rgba(62, 224, 138, 0.14), transparent 60%);
  }
}

@media (max-width: 44rem) {
  .marks-panes { grid-template-columns: 1fr; }
  .marks-input { min-height: 9rem; }
}

/* ══════════════ the dock ══════════════ */

/* Where the site is navigated from. It floats over the bottom of the window
 * rather than sitting at the end of the page, so it is reachable from anywhere
 * without scrolling back. */
.dock {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  max-width: calc(100vw - 2rem);
  padding: 0.4rem;
  border-radius: 18px;
  border: 1px solid var(--green-line);
  background: rgba(7, 18, 14, 0.78);
  backdrop-filter: blur(16px) saturate(0.85);
  -webkit-backdrop-filter: blur(16px) saturate(0.85);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(126, 245, 184, 0.07);
  /* Narrow windows scroll it rather than squeezing the words. */
  overflow-x: auto;
  scrollbar-width: none;
}

.dock::-webkit-scrollbar { display: none; }

.dock-item {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0.55rem 0.95rem;
  border: 0;
  border-radius: 13px;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

button.dock-item:hover { color: var(--fg); background: var(--green-dim); }

.dock-item.here {
  color: var(--name);
  background: var(--green-dim);
}

.dock-item:focus-visible {
  outline: 2px solid var(--name);
  outline-offset: -2px;
}

/* Leads nowhere yet, and looks like it. Not a button, so it cannot be clicked
 * or tabbed to, and it says why when hovered. */
.dock-item.waiting {
  color: var(--rule);
  cursor: default;
  text-decoration: line-through;
  text-decoration-color: rgba(125, 147, 137, 0.4);
}

@media (max-width: 40rem) {
  .dock { bottom: 0.9rem; border-radius: 15px; gap: 0.1rem; }
  .dock-item { font-size: 0.72rem; padding: 0.5rem 0.7rem; }
}

/* Where the dock is too narrow to show everything, its ends fade — otherwise
 * the sections past the edge are hidden with nothing saying they are there. */
@media (max-width: 44rem) {
  .dock {
    mask-image: linear-gradient(
      90deg, transparent 0, #000 14px, #000 calc(100% - 20px), transparent 100%
    );
    -webkit-mask-image: linear-gradient(
      90deg, transparent 0, #000 14px, #000 calc(100% - 20px), transparent 100%
    );
  }
}

/* ══════════════ where the display can actually show it ══════════════ */

/* The palette above is sRGB and every colour is declared there first. This says
 * the same colours again in Display P3, on displays that can hold them.
 *
 * The greens go most of the way to the P3 primary rather than a shade past
 * sRGB. A green a few percent outside the smaller gamut is a green nobody can
 * see the point of, and the whole gain of P3 over sRGB is in exactly this
 * corner — saturated greens are where the two gamuts differ most.
 *
 * It is put on the rocks, the button and the impact, which are the only large
 * areas of colour on the page. On thin text and one-pixel borders a gamut
 * difference is real and invisible.
 *
 * Both questions have to be asked. `color-gamut: p3` says the display can show
 * the colour; `dynamic-range: high` says it has the headroom to show it
 * brightly rather than tone-mapping it back down. A screen answering only the
 * first keeps the sRGB palette, because a wide-gamut colour squeezed into an
 * SDR envelope comes out muddier than the sRGB one it replaced.
 *
 * `@supports` guards the lot: a browser that cannot parse `color(display-p3 …)`
 * must not be handed a rule that drops the declaration and leaves a token
 * holding nothing. */
@supports (color: color(display-p3 0 1 0)) {
  @media (color-gamut: p3) and (dynamic-range: high) {
    :root:not([data-theme]) {
      /* The two marks, taken most of the way out. */
      --name: color(display-p3 0.12 1 0.46);
      --value: color(display-p3 1 0.66 0.13);

      --good: color(display-p3 0.12 1 0.46);
      --cost: color(display-p3 1 0.36 0.3);

      --green-dim: color(display-p3 0.12 1 0.46 / 0.16);
      --green-line: color(display-p3 0.12 1 0.46 / 0.3);
    }

    /* The rocks are the largest colour on the page, so this is where a wider
     * gamut is actually seen rather than merely used. */
    :root:not([data-theme]) .rock .body { stroke: color(display-p3 0.45 1 0.7 / 0.6); }
    :root:not([data-theme]) .rock .facet { fill: color(display-p3 0.7 1 0.86 / 0.3); }
    /* The stops live in the shared defs, which is a sibling of the rocks
     * rather than inside one — so they are reached from there. */
    :root:not([data-theme]) .space-defs .lit { stop-color: color(display-p3 0.2 1 0.55); }
    :root:not([data-theme]) .space-defs .dark { stop-color: color(display-p3 0.02 0.16 0.11); }

    :root:not([data-theme]) .rock.middle { filter: drop-shadow(0 0 11px color(display-p3 0.1 1 0.45 / 0.32)); }
    :root:not([data-theme]) .rock.near { filter: drop-shadow(0 0 20px color(display-p3 0.1 1 0.45 / 0.4)); }

    /* An impact is the one thing here that should be hard to look at. */
    :root:not([data-theme]) .shard polygon {
      fill: color(display-p3 0.55 1 0.75);
      stroke: color(display-p3 0.92 1 0.96 / 0.8);
    }

    :root:not([data-theme]) .flash {
      background: radial-gradient(
        circle,
        color(display-p3 0.88 1 0.94 / 0.98),
        color(display-p3 0.15 1 0.5 / 0.55) 42%,
        color(display-p3 0.15 1 0.5 / 0) 70%
      );
    }

    :root:not([data-theme]) .star { background: color(display-p3 0.9 1 0.95); }

    /* A solid block of it, which is the easiest place of all to see. */
    :root:not([data-theme]) .cta { background: color(display-p3 0.12 1 0.46); color: color(display-p3 0.01 0.09 0.04); }
    :root:not([data-theme]) .cta:hover { box-shadow: 0 6px 32px color(display-p3 0.1 1 0.45 / 0.45); }

    /* The arrival is the brightest thing the site ever puts on screen, and on
     * a display with headroom it should be uncomfortable. White at the top of
     * P3, with the glow around it in the widest green there is. */
    :root:not([data-theme]) .warp-reveal {
      color: color(display-p3 1 1 1);
      text-shadow:
        0 0 22px color(display-p3 0.55 1 0.78 / 0.95),
        0 0 60px color(display-p3 0.2 1 0.55 / 0.7),
        0 0 140px color(display-p3 0.12 1 0.46 / 0.5);
    }

    :root:not([data-theme]) .warp-reveal .phrase {
      border-bottom-color: color(display-p3 0.35 1 0.65);
    }

    :root:not([data-theme]) .warp-reveal b {
      color: color(display-p3 0.45 1 0.72);
    }

    :root:not([data-theme]) .streak {
      background: linear-gradient(
        90deg,
        color(display-p3 0.6 1 0.82 / 0),
        color(display-p3 0.5 1 0.78)
      );
    }

    :root:not([data-theme]) .scrim {
      background:
        linear-gradient(90deg, var(--bg) 2%, rgba(4, 7, 10, 0.82) 20%,
          rgba(4, 7, 10, 0.34) 38%, rgba(4, 7, 10, 0) 56%),
        radial-gradient(110% 80% at 74% 44%, color(display-p3 0.1 1 0.45 / 0.13), transparent 64%),
        linear-gradient(to bottom, transparent 78%, var(--bg) 100%);
    }
  }
}

/* Where a browser will hand back the headroom it is holding, take it. Nothing
 * above depends on this: it is ignored wherever it is not understood, and the
 * page is already correct without it. */
@supports (dynamic-range-limit: no-limit) {
  @media (dynamic-range: high) {
    :root:not([data-theme]),
    :root:not([data-theme]) .warp,
    :root:not([data-theme]) .warp-reveal { dynamic-range-limit: no-limit; }
  }
}

/* ══════════════ the warp ══════════════ */

/* The name is a button, and has to give none of that away until it is
 * hovered. */
.wordmark {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

button.wordmark:hover {
  color: var(--name);
  text-shadow: 0 0 46px var(--green-dim);
}

button.wordmark:focus-visible {
  outline: 2px solid var(--name);
  outline-offset: 6px;
  border-radius: 6px;
}

.warp {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  background: #000;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.28s ease;
}

/* Put on a line after the display, so the fade is a transition and not a
 * jump. */
.warp.running { opacity: 1; }

.warp-field { position: absolute; inset: 0; }

/* Each one is a bar lying along its own bearing: the origin is its inner end,
 * so a rotation aims it outwards and the translation carries it along itself.
 * Width is how long it is, which Rust writes as it speeds up. */
.streak {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 2px;
  width: 2px;
  transform-origin: 0 50%;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(214, 255, 233, 0), var(--name));
  will-change: transform, width, opacity;
}

.warp-reveal {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  width: min(90vw, 44rem);
  transform: translate(-50%, -50%) scale(0.86);
  text-align: center;
  font-size: clamp(1.5rem, 5.2vw, 3.4rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: #fff;
  opacity: 0;
  text-shadow:
    0 0 18px rgba(126, 245, 184, 0.55),
    0 0 70px rgba(62, 224, 138, 0.35);
}

/* One line under the whole of it. */
.warp-reveal .phrase {
  display: inline;
  border-bottom: 0.06em solid var(--name);
  padding-bottom: 0.14em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* The three letters that make the name are still marked, or the reveal reveals
 * nothing — but by colour now, since the underline belongs to the phrase. */
.warp-reveal b {
  color: var(--name);
  font-weight: inherit;
}

.warp-dismiss {
  position: absolute;
  left: 50%;
  bottom: 2.5rem;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0;
  animation: dismiss-in 0.6s ease 2s forwards;
}

@keyframes dismiss-in { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .warp { transition: none; }
  .warp-dismiss { animation: none; opacity: 1; }
}

/* ══════════════ Solarized Dark ══════════════ */

/* Ethan Schoonover's palette, and nothing else. The point of asking for
 * Solarized is to get Solarized rather than to get this site wearing it, so
 * everything the site does on its own account stops: the sky, the glow, the
 * glass, and the wider gamut, which is switched off at each of its own rules
 * rather than here.
 *
 *   base03 #002b36   base02 #073642   base01 #586e75   base00 #657b83
 *   base0  #839496   base1  #93a1a1   yellow #b58900   cyan   #2aa198
 */
:root[data-theme^="solarized"] {
  --bg: #002b36;
  --bg-soft: #073642;
  --panel: #073642;
  --fg: #839496;
  --muted: #586e75;
  --rule: rgba(88, 110, 117, 0.36);

  /* Still two marks, still only two. */
  --name: #2aa198;
  --value: #b58900;

  --green-dim: rgba(42, 161, 152, 0.12);
  --green-line: rgba(88, 110, 117, 0.36);

  --emph: #93a1a1;
  --on-accent: #002b36;

  --good: #859900;
  --cost: #dc322f;
}

/* The same sixteen the other way up. Only the six greys are exchanged — the
 * accents are the same accents, which is the whole idea of Solarized. */
:root[data-theme="solarized-light"] {
  color-scheme: light;

  --bg: #fdf6e3;
  --bg-soft: #eee8d5;
  --panel: #eee8d5;
  --fg: #657b83;
  --muted: #93a1a1;
  --rule: rgba(147, 161, 161, 0.55);

  --name: #2aa198;
  --value: #b58900;

  --green-dim: rgba(42, 161, 152, 0.1);
  --green-line: rgba(147, 161, 161, 0.55);

  --emph: #586e75;
  --on-accent: #fdf6e3;

  --good: #859900;
  --cost: #dc322f;
}

/* No sky. `space::pause` stops the frame loop as well; this is only so that
 * nothing is left on screen in the frame before it notices. */
[data-theme^="solarized"] .space { display: none; }

/* And no warp. The name is rendered as plain text rather than a button in this
 * theme, so there is nothing to click; this is the belt to that pair of
 * braces. */
[data-theme^="solarized"] .warp { display: none !important; }

/* Emphasised text is base1, which is as bright as this palette goes. */
/* The chip is the one thing that names a dark colour outright, because on the
 * alien theme it has stars behind it and wants to be part-transparent. */
[data-theme^="solarized"] .hero .warning { background: var(--panel); }

[data-theme^="solarized"] strong,
[data-theme^="solarized"] .marks-table strong { color: var(--emph); }

/* Flat. No blur behind anything, no light coming off anything. */
[data-theme^="solarized"] .hero-mark h1,
[data-theme^="solarized"] .card,
[data-theme^="solarized"] .dock,
[data-theme^="solarized"] .theme {
  background: var(--panel);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

[data-theme^="solarized"] .card:hover {
  background: var(--bg-soft);
  border-color: var(--muted);
  transform: none;
}

[data-theme^="solarized"] .card:hover .card-arrow { transform: none; }

[data-theme^="solarized"] .cta {
  background: var(--name);
  color: var(--on-accent);
  box-shadow: none;
}

[data-theme^="solarized"] .cta:hover { box-shadow: none; transform: none; }

[data-theme^="solarized"] .dock-item.here {
  background: var(--green-dim);
  color: var(--name);
}

[data-theme^="solarized"] button.dock-item:hover {
  background: var(--bg-soft);
  color: var(--emph);
}

[data-theme^="solarized"] .dock-item.waiting {
  color: var(--muted);
  text-decoration-color: var(--rule);
}

/* ══════════════ the theme switch ══════════════ */

.theme {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: rgba(7, 18, 14, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  transition: border-color 0.15s ease;
}

.theme:hover { border-color: var(--green-line); }

.theme label { color: var(--muted); cursor: default; }

/* A real select: it opens where the platform says it should, works from the
 * keyboard without being taught how, and is a wheel nobody needs to reinvent. */
.theme select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.25rem 1.6rem 0.25rem 0.7rem;
  background: var(--green-dim);
  color: var(--name);
  font: inherit;
  cursor: pointer;
  /* The arrow, drawn rather than fetched. */
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 0.85rem) 55%, calc(100% - 0.6rem) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.theme select:focus-visible {
  outline: 2px solid var(--name);
  outline-offset: 2px;
}

/* The open list is drawn by the platform, so it is told the colours rather
 * than styled. */
.theme option { background: var(--bg); color: var(--fg); }

[data-theme^="solarized"] .theme select { background: var(--green-dim); }

@media (max-width: 40rem) {
  .theme { top: 0.75rem; right: 0.75rem; font-size: 0.65rem; padding: 0.4rem 0.7rem; }
}

/* ══════════════ Silver ══════════════ */

/* The same place in a colder light. The sky stays — this is the alien theme's
 * sibling, not one of the flat ones — and everything that was lit green is lit
 * like metal instead.
 *
 * It gets no wide-gamut block of its own, and that is not an oversight: P3
 * buys almost nothing for greys, since the two gamuts differ most in saturated
 * colour and hardly at all near the neutral axis. The green theme is where
 * there was something to gain. */
:root[data-theme="silver"] {
  --bg: #06070a;
  --bg-soft: #0b0d11;
  --panel: #101318;
  --fg: #e6e9ee;
  --muted: #8b929c;
  --rule: #1d222a;

  /* Still two marks. Cool against warm, so they stay apart for a reader who
   * cannot tell a hue from a hue — the same reason the green theme's second
   * mark is amber. */
  --name: #cbd6e4;
  --value: #d8b46a;

  --green-dim: rgba(203, 214, 228, 0.12);
  --green-line: rgba(203, 214, 228, 0.22);

  --emph: #ffffff;
  --on-accent: #06070a;

  /* Muted, so they read as marks on metal rather than as traffic lights. */
  --good: #7fd8a6;
  --cost: #f08578;
}

/* The rocks are ore rather than moss. */
[data-theme="silver"] .space-defs .lit { stop-color: #9fb0c4; }
[data-theme="silver"] .space-defs .dark { stop-color: #0d1116; }

[data-theme="silver"] .rock .body { stroke: rgba(226, 235, 247, 0.5); }
[data-theme="silver"] .rock .facet { fill: rgba(240, 247, 255, 0.26); }
[data-theme="silver"] .rock.middle { filter: drop-shadow(0 0 9px rgba(190, 208, 230, 0.22)); }
[data-theme="silver"] .rock.near { filter: drop-shadow(0 0 16px rgba(190, 208, 230, 0.28)); }

[data-theme="silver"] .shard polygon {
  fill: #eaf1fb;
  stroke: rgba(255, 255, 255, 0.7);
}

[data-theme="silver"] .flash {
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.92),
    rgba(196, 214, 236, 0.42) 42%,
    rgba(196, 214, 236, 0) 70%
  );
}

[data-theme="silver"] .star { background: #eef3fa; }

[data-theme="silver"] .scrim {
  background:
    linear-gradient(90deg, var(--bg) 2%, rgba(6, 7, 10, 0.82) 20%,
      rgba(6, 7, 10, 0.34) 38%, rgba(6, 7, 10, 0) 56%),
    radial-gradient(110% 80% at 74% 44%, rgba(180, 200, 226, 0.1), transparent 64%),
    linear-gradient(to bottom, transparent 78%, var(--bg) 100%);
}

@media (max-width: 60rem) {
  [data-theme="silver"] .scrim {
    background:
      linear-gradient(180deg, rgba(6, 7, 10, 0.72), rgba(6, 7, 10, 0.42) 45%, var(--bg)),
      radial-gradient(110% 60% at 70% 30%, rgba(180, 200, 226, 0.12), transparent 60%);
  }
}

[data-theme="silver"] .hero-mark h1,
[data-theme="silver"] .card,
[data-theme="silver"] .dock,
[data-theme="silver"] .theme {
  background: rgba(16, 19, 24, 0.72);
}

[data-theme="silver"] .cta:hover { box-shadow: 0 6px 28px rgba(203, 214, 228, 0.26); }

/* The name is still the alien theme's to open, so it is plain text here and
 * looks it. */
[data-theme="silver"] .warp { display: none !important; }

/* A card that asks rather than points. It carries more words than the others,
 * so it is allowed to wrap where they may not. */
.card.asks .card-label {
  white-space: normal;
  line-height: 1.35;
}

.card.asks .card-icon { color: var(--value); }

/* The question itself, where the card lands. */
main h3 {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.75rem;
  scroll-margin-top: 2rem;
}
