/* The page is built around one vertical seam, the way the Inspector separates a property's
   label from its value. The label column names what a block is; the content column holds it.
   The seam is structure, not decoration: nothing sits on it that is not a label. */

:root {
  --paper: #eef0f1;
  --panel: #ffffff;
  --ink: #1b1e21;
  --muted: #5b656d;
  --seam: #ccd1d5;
  --live: #2a7f52;
  --link: #2456a6;

  --label-col: 8.5rem;
  --gap: 2rem;

  /* No web font. A Japanese face costs megabytes, and this page's whole job is to be quick
     for someone who is already stuck. */
  --sans: "Yu Gothic UI", "Yu Gothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo,
          -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", Consolas, "DejaVu Sans Mono", monospace;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  font-feature-settings: "palt" 1;
}

/* Japanese breaks at almost any character boundary by default, which splits a word like
   見たり across two lines. auto-phrase breaks at phrase boundaries instead; where it is not
   supported the result is what the browser did before, so nothing is lost by asking. */
:lang(ja) {
  word-break: auto-phrase;
  line-break: strict;
}

a { color: var(--link); }
a:focus-visible,
summary:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #e4e7e9;
  padding: 0.1em 0.35em;
  border-radius: 2px;
  overflow-wrap: anywhere;
}

/* ── shell ─────────────────────────────────────────────────────────────── */

.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  padding: 1.25rem 0 0;
}

.lang-link { font-size: 0.9rem; }

/* ── hero: the finish line, not a pitch ────────────────────────────────── */

.hero { padding: 3.5rem 0 3rem; }

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.tagline {
  margin: 1.25rem 0 0;
  max-width: 34em;
  font-size: 1.05rem;
  color: var(--muted);
}

.headline {
  margin: 0.75rem 0 0;
  max-width: 34em;
  font-size: 1.05rem;
}

.hero-shot {
  margin: 2.5rem 0 0;
}

.hero-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--seam);
  border-radius: 3px;
}

.hero-shot figcaption {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.hero-shot .live { color: var(--live); font-weight: 700; }

/* ── the seam ──────────────────────────────────────────────────────────── */

.band {
  display: grid;
  grid-template-columns: var(--label-col) 1fr;
  column-gap: var(--gap);
  border-top: 1px solid var(--seam);
  padding: 2.75rem 0;
}

.band > .band-label {
  grid-column: 1;
  margin: 0;
  padding-right: var(--gap);
  border-right: 1px solid var(--seam);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.6;
  align-self: start;
  position: sticky;
  top: 1.5rem;
}

.band > .band-body { grid-column: 2; min-width: 0; }

.band-body > :first-child { margin-top: 0; }
.band-body > :last-child { margin-bottom: 0; }

.band-body p { max-width: 40em; }

/* ── requirements ──────────────────────────────────────────────────────── */

.prereq {
  margin: 0;
  padding: 0;
  list-style: none;
}

.prereq li {
  padding: 0.65rem 0;
  max-width: 44em;
}

.prereq li + li { border-top: 1px solid #e2e5e7; }

/* ── the two routes ────────────────────────────────────────────────────── */

.chooser {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chooser li + li { margin-top: 0.5rem; }

.chooser a {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  column-gap: 1rem;
  align-items: baseline;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--seam);
  border-radius: 3px;
  text-decoration: none;
  color: inherit;
}

.chooser a:hover { border-color: var(--link); }

.chooser .mark {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--link);
}

.chooser strong { display: block; font-size: 1.05rem; }
.chooser span.why { display: block; color: var(--muted); font-size: 0.95rem; }

/* ── steps ─────────────────────────────────────────────────────────────── */

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  column-gap: 1rem;
  padding: 2rem 0;
}

.steps > li + li { border-top: 1px solid #e2e5e7; }

.steps > li::before {
  content: counter(step);
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.6;
}

.steps > li > * { grid-column: 2; }

.steps h3 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  line-height: 1.6;
}

.steps p { margin: 0.6rem 0; max-width: 40em; }

/* ── commands and pasteable values ─────────────────────────────────────── */

.code-label {
  margin: 1.1rem 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

pre {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid var(--seam);
  border-left: 3px solid var(--link);
  border-radius: 3px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.7;
}

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

/* ── screenshots ───────────────────────────────────────────────────────── */

figure.shot { margin: 1.25rem 0 0; }

figure.shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--seam);
  border-radius: 3px;
}

figure.shot figcaption {
  margin: 0.6rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 40em;
}

/* ── asides ────────────────────────────────────────────────────────────── */

.aside {
  margin: 1rem 0 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--seam);
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 40em;
}

/* ── what it can do ────────────────────────────────────────────────────── */

.can-do { margin: 0; padding: 0; list-style: none; }

.can-do li {
  padding: 0.5rem 0 0.5rem 1.4rem;
  position: relative;
  max-width: 44em;
}

.can-do li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.1em;
  width: 0.55rem;
  height: 1px;
  background: var(--muted);
}

/* ── trouble ───────────────────────────────────────────────────────────── */

.trouble-list { margin: 0; padding: 0; list-style: none; }

.trouble-item { padding: 1.25rem 0; }
.trouble-item + .trouble-item { border-top: 1px solid #e2e5e7; }

.trouble-item h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.trouble-item p { margin: 0; max-width: 40em; }
.trouble-item .more { display: inline-block; margin-top: 0.5rem; font-size: 0.95rem; }

/* ── footer ────────────────────────────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--seam);
  padding: 2rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.foot ul {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.foot p { margin: 0; }

/* ── narrow screens: the seam folds away ───────────────────────────────── */

@media (max-width: 46rem) {
  body { line-height: 1.8; }

  .band {
    grid-template-columns: 1fr;
    row-gap: 1rem;
    padding: 2rem 0;
  }

  .band > .band-label {
    grid-column: 1;
    padding: 0 0 0.5rem;
    border-right: 0;
    border-bottom: 1px solid var(--seam);
    position: static;
  }

  .band > .band-body { grid-column: 1; }

  .steps > li { grid-template-columns: 1.75rem 1fr; column-gap: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Dark is the Editor's own theme, so a reader with it set is likely reading beside one. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1d1f;
    --panel: #232729;
    --ink: #e6e9ea;
    --muted: #98a2a8;
    --seam: #3a4145;
    --live: #5fbd88;
    --link: #7fb0ff;
  }

  code { background: #2d3234; }
  .prereq li + li,
  .steps > li + li,
  .trouble-item + .trouble-item { border-top-color: #2c3234; }}
