:root {
  --paper: #eef0e8;
  --ink: #1f2420;
  --muted: #5f675d;
  --rule: #cfd4c4;
  --lcd: #b7c09f;
  --lcd-ink: #27301f;
  --led: #d7362b;
  --case: #2c322d;
  --case-edge: #444c45;
  --link: #2f5d3a;
  --code-bg: #e2e6d8;
  --measure: 64ch;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171b18;
    --ink: #e4e8dc;
    --muted: #a1a99d;
    --rule: #333a34;
    --link: #a9d4b0;
    --code-bg: #232923;
    --case: #0f1210;
    --case-edge: #3a423b;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
}

a { color: var(--link); text-underline-offset: 0.2em; }
a:focus-visible, .button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--led);
  outline-offset: 3px;
  border-radius: 2px;
}

code { font-family: var(--mono); font-size: 0.9em; }
p code, h3 code { background: var(--code-bg); padding: 0.05em 0.35em; border-radius: 4px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 0.75rem; }

/* Page frame: one left-aligned column, the hero breaks out to two. */
.top, main, .foot {
  width: min(100% - 2.5rem, 70rem);
  margin-inline: auto;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
}
.brand { color: var(--ink); font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.top nav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--ink); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding-block: clamp(2rem, 6vw, 5rem) clamp(3rem, 7vw, 6rem);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5.2vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 750;
  max-width: 16ch;
}

.lede { max-width: 46ch; font-size: 1.2rem; color: var(--muted); margin: 1.5rem 0 2rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.button {
  display: inline-block;
  padding: 0.8rem 1.15rem;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.2;
}
.button:hover { background: var(--code-bg); }
.button-primary { background: var(--ink); color: var(--paper); }
.button-primary.is-disabled { cursor: default; opacity: 0.75; }
.button-primary.is-disabled:hover { background: var(--ink); }

/* The pager: the page's one loud object. */
.pager { margin: 0; justify-self: center; width: min(100%, 25rem); }

.pager-body {
  position: relative;
  background: linear-gradient(160deg, var(--case-edge), var(--case) 45%);
  border-radius: 28px 28px 34px 34px;
  padding: 2.25rem 1.5rem 1.5rem;
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.08),
    0 1.5rem 3rem -1rem rgb(20 26 20 / 0.45);
}

.led {
  position: absolute;
  top: 0.9rem;
  right: 1.6rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--led);
  box-shadow: 0 0 0.8rem var(--led);
  animation: blink 1.2s steps(2, jump-none) infinite;
}

@keyframes blink { 50% { opacity: 0.15; box-shadow: none; } }

.lcd {
  background: var(--lcd);
  color: var(--lcd-ink);
  border-radius: 6px;
  padding: 1rem 1.1rem 0.9rem;
  font-family: var(--mono);
  box-shadow: inset 0 3px 8px rgb(0 0 0 / 0.25);
}
.lcd p { margin: 0; }
.lcd-head { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 700; }
.lcd-head span:first-child { background: var(--lcd-ink); color: var(--lcd); padding: 0 0.35rem; }
.lcd-text { font-size: 1.05rem; line-height: 1.4; margin-block: 0.7rem !important; }
.lcd-foot { font-size: 0.75rem; opacity: 0.75; }

.pager-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1.1rem; }
.key {
  text-align: center;
  padding: 0.6rem 0;
  border-radius: 999px;
  background: #3b433c;
  color: #dfe5d6;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.35);
}
.key-ready { background: #dfe5d6; color: #1f2420; }

.pager figcaption { margin-top: 1rem; font-size: 0.9rem; color: var(--muted); text-align: center; }

/* Sections */
.section {
  max-width: var(--measure);
  padding-block: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--rule);
}

h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 1.5rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.35rem; line-height: 1.3; }
.section p { margin: 0 0 1rem; }
.note { color: var(--muted); }

/* Sequences: How it works and Install are real orders, so they are numbered. */
.steps, .install { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps > li, .install > li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.75rem;
}
.steps > li::before, .install > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95rem;
}
.steps p, .install p { margin: 0 0 0.5rem; }

pre {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  margin: 0.5rem 0 0.75rem;
  line-height: 1.5;
}

.features { margin: 0; }
.features > div { padding-block: 1rem; border-bottom: 1px solid var(--rule); }
.features > div:last-child { border-bottom: 0; }
.features dt { font-weight: 700; margin-bottom: 0.25rem; }
.features dd { margin: 0; color: var(--ink); }

.page-title { font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 0.5rem; }
.section ul { padding-left: 1.2rem; margin: 0 0 1rem; }
.section li { margin-bottom: 0.35rem; }
.section h2 + p, .section h2 + ul { margin-top: 0; }
.section p + h2, .section ul + h2 { margin-top: 2rem; }

.source-link { font-weight: 600; font-size: 1.1rem; }

details { border-bottom: 1px solid var(--rule); padding-block: 0.9rem; }
details:first-of-type { border-top: 1px solid var(--rule); }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 0.6rem 0 0.2rem !important; color: var(--muted); }

.foot {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Small screens: the pager follows the headline. */
@media (max-width: 52rem) {
  .hero { grid-template-columns: 1fr; }
  .top nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .led { animation: none; }
}
