/* The page: base, header, buttons, the "Built on" row, the sections
   below the hero and the footer.
   @decision(DL-004) */

/* ---- Base ---- */
*, *::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: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--olive-b); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
code, pre, kbd, samp { font-family: var(--mono); }
:not(pre) > code {
  font-size: 0.9em;
  background: var(--sunk);
  padding: 0.05em 0.3em;
  white-space: nowrap;
}
h1, h2, h3, p, ul, ol, dl, dd, figure, pre { margin: 0; }

.wrap {
  width: 100%;
  max-width: calc(var(--cols) * var(--cw) + 2 * var(--gutter));
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ---- Header ---- */
.top {
  position: relative;
  z-index: 2;
}
.top .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: calc(3 * var(--rh));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
}
.brand svg { width: 26px; height: auto; display: block; }
.nav { display: flex; gap: 20px; margin-left: auto; font-size: 0.9375rem; }
.nav a { color: var(--soft); text-decoration: none; }
.nav a:hover { color: var(--ink); text-decoration: underline; }

/* The theme toggle: light, dark, follow the system. */
.theme {
  display: inline-flex;
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  overflow: hidden;
}
.theme button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}
.theme button + button { border-left: 1px solid var(--rule-2); }
.theme button:hover { color: var(--ink); }
.theme button[aria-pressed="true"] { background: var(--sunk); color: var(--ink); }
.theme button:focus-visible { outline-offset: -2px; }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 639px) {
  .top .wrap { gap: 12px; }
  .nav { gap: 14px; font-size: 0.875rem; }
  .nav .wide-only { display: none; }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 4px;
  font: 500 0.9375rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--olive-b); color: var(--on-accent); border: 1px solid var(--olive-b); }
.btn-primary:hover { background: var(--olive); border-color: var(--olive); text-decoration: none; }
.btn-secondary { background: var(--raised); color: var(--ink); border: 1px solid var(--rule-2); }
.btn-secondary:hover { border-color: var(--soft); text-decoration: none; }

/* ---- Built on: the two projects' own logos, at their whole-pixel
   sizes, each with clear space of its own. Each logo is inlined in its
   dark-ink and its light-ink file, and the theme shows one.
   @decision(DL-007) */
.built-on {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin-top: calc(1.5 * var(--rh));
  font: 400 var(--t-sm)/1.2 var(--sans);
  color: var(--soft);
}
/* Padding keeps two strokes of clear space round each mark (6 px at
   OpenCode's 3 px stroke), inside the link's focus ring. */
.built-on .logo { display: block; padding: 6px; line-height: 0; }
.built-on .logo:first-of-type { margin-left: -6px; }
.built-on svg { display: block; }
/* On phones the label takes a line of its own, so the two marks share
   the next one rather than one of them wrapping alone. */
@media (max-width: 639px) {
  .built-on { gap: 4px 12px; }
  .built-on .label { flex-basis: 100%; }
}
.built-on .on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .built-on .on-light { display: none; }
  :root:not([data-theme="light"]) .built-on .on-dark { display: block; }
}
:root[data-theme="dark"] .built-on .on-light { display: none; }
:root[data-theme="dark"] .built-on .on-dark { display: block; }

/* ---- A rule that runs out: solid, then ╌, then ┈, like the ground
   under the bird. After each heading, and as the footer's ground. ---- */
.runout {
  display: flex;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  font: 400 var(--cell-fs)/1 var(--mono);
}
.runout::before {
  content: "────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────";
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.runout::after { content: "╌╌╌╌╌╌╌╌┈┈┈┈┈┈┈┈"; flex: none; }

/* ---- Sections below the hero ---- */
.sec {
  margin-top: var(--section);
  font-size: var(--t-read);
  scroll-margin-top: var(--rh);
}
/* The hero already ends with three rows of air, so the first section
   adds three more. */
.hero + .sec { margin-top: calc(3 * var(--rh)); }
/* A heading names the section; the rule after it runs to the edge. */
h2.rule {
  display: flex;
  align-items: baseline;
  gap: calc(2 * var(--cw));
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 600;
  margin-bottom: calc(2 * var(--rh));
}
h2.rule .runout {
  flex: 1;
  min-width: 0;
  color: var(--rule-2);
  transform: translateY(-0.06em);
}
@media (max-width: 639px) { h2.rule { font-size: 1.3125rem; } }
.sec h3 { font-size: var(--t-read); line-height: 1.45; font-weight: 600; text-wrap: balance; }

/* Under the heading: a margin column for labels and notes beside a
   reading column. */
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
.side .note {
  font-size: var(--t-md);
  line-height: 1.55;
  color: var(--soft);
  max-width: 22rem;
}
.side .note b { color: var(--ink); font-weight: 600; }

/* Why spov: each name hung in the margin like a wall label */
.entries { display: grid; gap: 2.25rem; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
.entry p { max-width: var(--measure); }
.entry .aside { margin-top: 0.6rem; font-size: var(--t-md); color: var(--soft); }
.entry .code { margin-top: 1rem; }

@media (min-width: 960px) {
  .split, .entry { grid-template-columns: var(--margin-w) minmax(0, 1fr); column-gap: var(--margin-gap); }
  .entry { grid-template-columns: var(--margin-w) minmax(0, var(--measure)); }
  .split > .side { grid-column: 1; }
  .split > .body { grid-column: 2; }
}

/* Phones: one column per reason, with a dotted ┈ rule between them.
   Every h3 below the hero takes the same size, so the install steps
   stay in step. */
@media (max-width: 899px) {
  .sec h3 { font-size: 1.0625rem; line-height: 1.35; }
  .entries { gap: 0; }
  .entry {
    gap: 0;
    padding: calc(0.25 * var(--rh)) 0 calc(0.75 * var(--rh));
  }
  .entry::before {
    content: "┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈";
    overflow: hidden;
    white-space: nowrap;
    font: 400 var(--cell-fs)/1 var(--mono);
    color: var(--rule-2);
    margin-bottom: calc(0.75 * var(--rh));
    user-select: none;
  }
  .entry:first-child::before { content: none; }
  .entry:first-child { padding-top: 0; }
  .entry > p, .entry > div > p:first-child { margin-top: 6px; color: var(--soft); }
}

/* Code blocks: sunk, square, scroll inside rather than widening the page */
.code {
  position: relative;
  background: var(--sunk);
  min-width: 0;
}
.code pre {
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  color: var(--ink);
}
/* The scrolling text stops short of the button instead of running under it. */
.code.has-copy pre { margin-right: 4.25rem; padding-right: 0.5rem; }
.copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  font: 500 var(--t-sm)/1.2 var(--sans);
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--rule-2);
  background: var(--raised);
  color: var(--soft);
  cursor: pointer;
}
.copy:hover { color: var(--ink); }

/* A session: the one real sequence on the page, so it is numbered */
.session-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; }
@media (min-width: 1152px) {
  .session-body { grid-template-columns: minmax(0, 30rem) auto; justify-content: space-between; }
}
ol.steps {
  list-style: none;
  padding: 0;
  counter-reset: s;
  display: grid;
  gap: 1.1rem;
  max-width: var(--measure);
}
ol.steps > li {
  counter-increment: s;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
}
ol.steps > li::before {
  content: counter(s);
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
ol.steps .sub { display: block; margin-top: 0.25rem; font-size: var(--t-md); color: var(--soft); }

.fig { min-width: 0; }
/* Line height 1.3 is the cell's own height, so the box-drawing
   connectors from Spov Cells join from row to row. */
.fig pre {
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--ink);
  overflow-x: auto;
  padding-bottom: 0.25rem;
  font-kerning: none;
  font-variant-ligatures: none;
}
.fig pre .q { color: var(--rule-2); }
.fig pre .d { color: var(--soft); }
.fig figcaption {
  margin-top: 1rem;
  font-size: var(--t-md);
  line-height: 1.55;
  color: var(--soft);
  max-width: 28rem;
}
.fig figcaption b { color: var(--ink); font-weight: 600; }

/* Install */
.needs {
  margin-top: 0.5rem;
  padding-left: 1.2rem;
  max-width: var(--measure);
  display: grid;
  gap: 0.3rem;
}
.needs li::marker { color: var(--faint); }
ol.steps.big { gap: 2.5rem; margin-top: 3rem; max-width: 44rem; }
ol.steps.big > li::before { font-weight: 600; color: var(--ink); }
ol.steps.big h3 { margin-bottom: 0.6rem; }
ol.steps.big .code { margin-top: 0.25rem; }
ol.steps.big p { max-width: var(--measure); }
ol.steps.big p + p, ol.steps.big .code + p { margin-top: 0.75rem; }
ol.steps.big .small { font-size: var(--t-md); color: var(--soft); }

/* ---- Footer. The disclaimer is in --soft, AA in both themes.
   @decision(DL-007) */
.foot {
  margin-top: var(--section);
  padding-bottom: 3rem;
  font-size: var(--t-md);
  color: var(--soft);
}
.foot .runout { color: var(--earth); margin-bottom: 1.5rem; }
.foot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.foot .disclaimer { margin-top: 1rem; max-width: 40rem; }

/* Questions: each one a <details>, closed, with a rule between them and
   a +/− in the cell font. @decision(DL-014) */
.faq details { border-top: 1px solid var(--rule); max-width: var(--measure); }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.85rem 0;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  font: 400 1.125rem/1 var(--mono);
  color: var(--soft);
}
.faq details[open] summary::after { content: "−"; }
.faq summary:hover::after { color: var(--ink); }
.faq summary:focus-visible { outline-offset: -2px; }
.faq details p { padding-bottom: 1rem; }
@media (max-width: 899px) { .faq summary { font-size: 1.0625rem; line-height: 1.35; } }
