/* ============================================================================
   ALab — alab.systems
   One screen. Serif for the statement, monospace for everything that names a
   thing. No webfonts, no images, no external requests; two scripts: /aterm's
   install.js (the copy button) and platform.js (the platform picker — also
   the header button on /terminal). The homepage loads none.
   ========================================================================== */

:root {
  --bg: #F5F3EC;
  --fg: #1B1D18;
  --fg-dim: #4D4F47;
  --muted: #64665D;
  --rule: #847E72;
  --accent: #0F6A78;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: ui-serif, Charter, "Bitstream Charter", "Iowan Old Style", Georgia, "Times New Roman", serif;

  color-scheme: light;
}

/* Both themes get the same care: the neutrals are warm in light (paper) and
   near-black-green in dark (terminal), and the accent is re-solved for each
   ground rather than reused — 5.64:1 on paper, 8.44:1 on the dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0D0C;
    --fg: #E6E4DD;
    --fg-dim: #A3A199;
    --muted: #8A8983;
    --rule: #6A6C64;
    --accent: #5BB8C4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C0D0C;
  --fg: #E6E4DD;
  --fg-dim: #A3A199;
  --muted: #8A8983;
  --rule: #6A6C64;
  --accent: #5BB8C4;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F5F3EC;
  --fg: #1B1D18;
  --fg-dim: #4D4F47;
  --muted: #64665D;
  --rule: #847E72;
  --accent: #0F6A78;
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  padding: clamp(1.5rem, 6vw, 4rem);
}

main { width: 100%; }

/* The rail is the whole identity here: one accent stroke in the margin, the
   same device the products use to mark a diagnostic.
   41rem: wide enough that the subpage by-line (ALab · alab.systems · By … ·
   hello@ · © · socials — 70 mono chars + two 1em marks, 599px in SF Mono and
   584px in Menlo at 13px, CoreText-measured) sits on one line inside the
   rail's padding (content box 622px, so ≥23px of slack) — one line from a
   ~716px viewport up in Safari, ~700px in Chrome/Firefox (Menlo); below that
   it wraps at a middot, as it must on phones. At 34rem it wrapped on every
   page but the homepage. */
.card {
  max-width: 41rem;
  margin-inline: auto;
  border-left: 2px solid var(--accent);
  padding-left: clamp(1.25rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

p { margin: 0; }

.wordmark {
  font: 600 0.9375rem var(--mono);
  letter-spacing: -0.01em;
  color: var(--fg);
}
.wordmark .bar { color: var(--accent); margin-right: 0.35em; }
.wordmark a { color: inherit; text-decoration: none; }
.wordmark a:hover, .wordmark a:focus-visible { color: var(--accent); }

/* /aterm#install: the Install block, then one section per install lane; mono
   headings per the design rule (headings name things, so they are set like
   identifiers). */
.lane { display: flex; flex-direction: column; gap: 0.6rem; }
.install h2, .lane h2 {
  font: 600 0.9375rem var(--mono);
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--fg);
}

h1 {
  font: 400 clamp(2rem, 1.3rem + 3.4vw, 3.25rem)/1.1 var(--serif);
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

.what {
  font: 400 clamp(1.0625rem, 1rem + 0.4vw, 1.25rem)/1.5 var(--serif);
  color: var(--fg-dim);
}

.links { font: 400 0.9375rem var(--mono); }
.links .gh { width: 1em; height: 1em; vertical-align: -0.15em; margin-right: 0.4em; }

/* Install: a static command line that install.js upgrades into a copy
   button. The accent border marks the block; only the JS-built button gets
   cursor and hover, so without the script nothing advertises an action. */
.install {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
}

.install-or {
  font: italic 400 0.8125rem/1 var(--serif);
  color: var(--muted);
  margin-top: 0.125rem;
}

.install-what {
  font: 400 0.9375rem/1.5 var(--serif);
  color: var(--fg);
}
.install-what code { font: 600 0.95em var(--mono); }

.download {
  display: inline-block;
  font: 600 0.9375rem var(--mono);
  background: var(--accent);
  border-radius: 4px;
  padding: 0.7rem 1.1rem;
}
a.download {
  color: var(--bg);
  text-decoration: none;
}
a.download:hover, a.download:focus-visible {
  color: var(--bg);
  background: color-mix(in srgb, var(--accent) 85%, var(--fg));
}
/* the OS mark after the label ("Download aterm "): the type's own size and ink */
a.download .os { width: 1em; height: 1em; vertical-align: -0.15em; margin-left: 0.45em; }
/* The button when the picked platform has no published build: the same
   shape, hollow, no link (platform.js drops the href), and it says so. The
   ring is an inset shadow so the height does not change on the swap. */
a.download.download-none {
  color: var(--fg-dim);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--fg-dim);
  cursor: default;
}

/* Platform picker (/aterm, under the download button): five small marks on
   one line — an OS glyph at the type's size and the architecture in small
   mono — hidden until platform.js runs, so without the script nothing
   advertises an action. The pick is the accent with a solid accent underline;
   the rest are --muted at full opacity (5.3:1 light / 5.6:1 dark — these are
   controls, so no fade). A DASHED underline in --fg-dim marks a platform with
   no published build — dashed is this site's "limit" stroke (the warning
   rail), legible in grayscale and to a colour-blind reader. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.platforms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.1rem;
}
/* author `display: flex` would beat the UA's [hidden] rule — keep the no-JS state honest */
.platforms[hidden] { display: none; }
.plat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.15rem 0 0.25rem;
  font: 400 0.6875rem/1 var(--mono);
  letter-spacing: -0.01em;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}
.plat svg { width: 0.875rem; height: 0.875rem; }
.plat[data-available="false"] { border-bottom: 1px dashed var(--fg-dim); }
.plat:hover, .plat:focus-visible { color: var(--fg); }
.plat[aria-pressed="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
/* pressed AND no build: the accent says "this is your pick", the dashes still say "no build" */
.plat[aria-pressed="true"][data-available="false"] { border-bottom-style: dashed; }

.install-cmdline {
  font: 400 0.8125rem/1.5 var(--mono);
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  width: 100%;
  margin: 0;
  text-align: left;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--fg-dim);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
}
button.install-cmdline {
  cursor: pointer;
  transition: background-color 120ms ease;
}
button.install-cmdline:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

.install-prompt { color: var(--accent); user-select: none; }
/* min-width: 0 lets the flex item shrink below the URL's intrinsic width so
   the command wraps instead of widening the card on narrow screens. */
.install-cmd {
  font: inherit;
  min-width: 0;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
}
.install-copy {
  margin-left: auto;
  padding-left: 0.6em;
  flex-shrink: 0;
  color: var(--accent);
}
.install-btn.copied .install-copy { font-weight: 600; }

.install-note {
  font: 400 0.875rem/1.6 var(--serif);
  color: var(--muted);
}
.install-note code { font: 400 0.9em var(--mono); }
.install-note a { color: var(--muted); }
.install-note a:hover, .install-note a:focus-visible { color: var(--accent); }

/* Reserve one line so the copied/selected announcement never shifts layout. */
.install-status {
  font: 400 0.8125rem/1.5 var(--serif);
  color: var(--fg-dim);
  min-height: 1.25rem;
}

/* Visually hidden, still read by assistive tech (the button's action label). */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.by {
  font: 400 0.8125rem/1.6 var(--mono);
  color: var(--muted);
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-wrap: anywhere;
}

a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
a:hover, a:focus-visible {
  color: var(--accent);
  text-decoration-thickness: 2px;
}
.by a { color: var(--muted); }
.by a:hover, .by a:focus-visible { color: var(--accent); }
/* the ALab mark that opens the by-line — the wordmark's weight, the page's ink */
.by .mark { font-weight: 600; color: var(--fg); }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

@media print {
  body { background: #fff; color: #000; }
}

/* social marks in the by-line: inline SVG, same colour rules as the by-line links */
.by .soc { display: inline-block; vertical-align: -0.15em; margin-left: 0.1em; }
.by .soc svg { width: 1em; height: 1em; }
