/* Folio web theme: the site-wide design system, ported from the blog's "Grain".
   Droid Serif headings, Open Sans body, paper background with a faint noise
   texture, hairline rules, forest-green accent. Light only.

   Every public page links this file first and adds a small page stylesheet for
   its own layout. Class names here are page-agnostic; nothing in this file
   refers to a page's ids. The written spec is docs/web-design-system.md. */

@font-face { font-family: "Droid Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/DroidSerif-normal-400.woff2") format("woff2"); }
@font-face { font-family: "Droid Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/DroidSerif-italic-400.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/OpenSans-normal-400.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/OpenSans-normal-700.woff2") format("woff2"); }

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --font-serif: "Droid Serif", Georgia, "Times New Roman", serif;
  --font-sans: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  /* ink ladder: text colours from strongest to faintest */
  --ink: #181818; --fg: #444; --fg-muted: #777; --fg-ghost: #bbb;
  /* the one accent, plus its hover and its tint */
  --accent: #1c6d3a; --accent-hover: #125f2f; --mint: #ceecd7;
  --border-light: #efefef;
  /* surfaces */
  --paper: #fcfcfa; --panel-dark: #2b2f2b; --panel-dark-text: #e8e8e4; --panel-dark-border: #2a2f2a;

  --radius: 3px;
  --measure: 720px;
}

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

html, body { margin: 0; }
body {
  background-color: var(--paper);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px; line-height: 21px;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  position: relative;
}
/* subtle brand grain: tiled noise PNG, very faint so the page stays light */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0;
  background-image: url("/assets/noise-texture.png"); background-repeat: repeat;
  opacity: .18; mix-blend-mode: multiply; pointer-events: none;
}
/* The page wrapper paints above the grain overlay. */
.page { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--mint); }
a:hover { color: var(--accent-hover); border-bottom-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Inline code inside prose: green mono on a faint mint tint (the accent at 7%). */
:not(pre) > code { font-family: var(--font-mono); font-size: .85em; color: var(--accent);
  background: rgba(28, 109, 58, .07); padding: 1px 5px; border-radius: var(--radius); }

/* ---------- layout ---------- */
/* One reading column. Pages centre their content in it; the page stylesheet owns the vertical
   space around its sections (a hero above, or .page-head, and padding after the last section). */
.column { max-width: var(--measure); margin: 0 auto; padding: 0 20px; }
/* Opening block for pages without a hero: the title and subtitle with space above and below. */
.page-head { padding: 56px 0 28px; }
/* Pages that open with .page-head have no page stylesheet; keep the landing's 96px close. */
.column:has(> .page-head) { padding-bottom: 96px; }

/* ---------- headings and copy ---------- */
.eyebrow { margin: 0 0 14px; font-family: var(--font-sans); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--fg-muted); }
.page-title { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 40px; line-height: 1.05;
  letter-spacing: -.02em; color: var(--ink); }
.page-sub { margin: 14px 0 0; font-family: var(--font-serif); font-size: 18px; line-height: 1.55; color: var(--fg-muted); }
/* Body copy: paragraphs inside .prose, a step, a panel, or straight in the column.
   Zero specificity so modifiers such as .note and .actions win. */
:where(.prose, .step-body, .panel, .column) > p { margin: 12px 0 0; font-size: 14px; line-height: 1.66; color: var(--fg); }
:where(.prose, .column) > ul { margin: 12px 0 0; padding: 0 0 0 1.2em; font-size: 14px; line-height: 1.66; color: var(--fg); }
:where(.prose, .column) > ul > li + li { margin-top: 4px; }
.note { margin: 16px 0 0; font-family: var(--font-serif); font-style: italic; font-size: 13.5px;
  line-height: 1.6; color: var(--fg-muted); }
.actions { margin: 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.page-head + .actions, .prose + .actions, .panel > p + .actions { margin-top: 16px; }
form .actions { margin-top: 20px; }

/* ---------- pill button: outlined, fills on hover ---------- */
.pill { appearance: none; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-sans);
  font-weight: 700; font-size: 11px; line-height: 21px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent); background: none; border: 1px solid var(--accent); border-radius: 9999px;
  padding: 8px 20px; cursor: pointer; white-space: nowrap; transition: background .14s ease, color .14s ease; }
.pill:hover { background: var(--accent); color: #fff; }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill-large { padding: 10px 24px; }

/* ---------- form field: labelled text input ----------
   The label wraps the caption and the control:
     <label class="field">Display name <input name="display_name" required></label>
   Submit stays a .pill inside .actions, not this component. */
.field { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 16px 0 0;
  font-family: var(--font-sans); font-weight: 700; font-size: 11px; line-height: 1.4;
  text-transform: uppercase; letter-spacing: .04em; color: var(--fg-muted); }
.field input { appearance: none; font-family: var(--font-sans); font-weight: 400; font-size: 14px;
  line-height: 21px; letter-spacing: 0; text-transform: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--fg-muted); border-radius: var(--radius);
  padding: 8px 12px; width: 100%; max-width: 28rem; }
.field input:hover { border-color: var(--accent); }
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }

/* ---------- code block with an inline copy control ---------- */
.code { margin: 0; padding: 14px 16px; background: var(--panel-dark); color: var(--panel-dark-text);
  border: 1px solid var(--panel-dark-border); border-radius: var(--radius); font-family: var(--font-mono);
  font-size: 12.5px; line-height: 1.62; overflow-x: auto; }
.code code { font: inherit; color: inherit; background: none; padding: 0; }
/* Prose-length content wraps instead of scrolling. */
.code.prompt { white-space: pre-wrap; overflow-wrap: anywhere; }

/* The copy control sits at the end of the text it copies, inside the block:
   <code id="x">…</code><button class="copy" data-copy="x" aria-label="…">svg</button><span class="copy-status" role="status"></span> */
.copy { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 22px; height: 20px; margin-left: 10px; padding: 0; border: 0; border-radius: var(--radius);
  background: transparent; color: rgba(232, 232, 228, .6); cursor: pointer;
  transition: color .12s ease, background .12s ease; }
.copy:hover, .copy:focus-visible { color: #fff; background: rgba(255, 255, 255, .1); }
.copy:focus-visible { outline: 2px solid var(--mint); outline-offset: 1px; }
.copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; }
.copy .icon-check { display: none; }
/* After a successful copy the glyph swaps to a mint check for a moment. */
.copy[data-state="copied"] { color: var(--mint); }
.copy[data-state="copied"] .icon-clipboard { display: none; }
.copy[data-state="copied"] .icon-check { display: block; }
/* The live region the script writes "Copied" into is visually hidden; see .visually-hidden. */

/* ---------- numbered steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 46px 1fr; gap: 0 28px; padding: 22px 0;
  border-top: 1px solid var(--border-light); }
.steps li:last-child { border-bottom: 1px solid var(--border-light); }
.step-number { font-family: var(--font-serif); font-size: 15px; line-height: 1.7; color: var(--accent); }
.step-body { min-width: 0; }
.step-body h3 { margin: 0 0 10px; font-family: var(--font-serif); font-weight: 400; font-size: 20px;
  line-height: 1.2; letter-spacing: -.012em; color: var(--ink); }

/* ---------- visually hidden: present for assistive tech and focus order, no box on screen ----------
   Shared by the utility class, the tabset radios, and the copy control's live region. */
.visually-hidden, .tab-input, .copy-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- tabset: CSS-only tabs, no script ----------
   Markup, all direct children of one .tabset element, in this order:
     the radio inputs (class tab-input, one shared name, the default checked),
     a .tabs row of <label for> in the same order,
     a .panels wrapper whose children are the .panel elements in the same order.
   Up to four tabs. Add .tabs-pills to the row for the small pill variant used
   as a mode switch inside a panel. A panel may itself be a nested .tabset.
   A label may be an icon tab (class tab-icon) instead of text; see below. */
/* Inputs stay in the accessibility tree and focus order; only their box is hidden (.visually-hidden). */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-light); }
.tabs label { display: block; padding: 6px 15px; font-size: 14px; color: #666; border-top: 3px solid transparent;
  cursor: pointer; transition: color .12s ease-in-out, transform .12s ease-in-out; }
.tabs label:hover { color: #000; transform: translateY(-2px); }
.tabset > .tab-input:nth-of-type(1):checked ~ .tabs > label:nth-child(1),
.tabset > .tab-input:nth-of-type(2):checked ~ .tabs > label:nth-child(2),
.tabset > .tab-input:nth-of-type(3):checked ~ .tabs > label:nth-child(3),
.tabset > .tab-input:nth-of-type(4):checked ~ .tabs > label:nth-child(4) { color: var(--ink); border-top-color: var(--accent); }
.tabset > .tab-input:nth-of-type(1):focus-visible ~ .tabs > label:nth-child(1),
.tabset > .tab-input:nth-of-type(2):focus-visible ~ .tabs > label:nth-child(2),
.tabset > .tab-input:nth-of-type(3):focus-visible ~ .tabs > label:nth-child(3),
.tabset > .tab-input:nth-of-type(4):focus-visible ~ .tabs > label:nth-child(4) { outline: 2px solid var(--accent); outline-offset: 2px; }

.panels > .panel { display: none; padding-top: 26px; }
/* The panel's own padding spaces a leading paragraph; the prose margin would double it. */
.panels > .panel > p:first-child { margin-top: 0; }
.tabset > .tab-input:nth-of-type(1):checked ~ .panels > .panel:nth-child(1),
.tabset > .tab-input:nth-of-type(2):checked ~ .panels > .panel:nth-child(2),
.tabset > .tab-input:nth-of-type(3):checked ~ .panels > .panel:nth-child(3),
.tabset > .tab-input:nth-of-type(4):checked ~ .panels > .panel:nth-child(4) { display: block; }

/* Pill variant. The selected pill fills, so the state reads by lightness, not hue alone. */
.tabs-pills { gap: 8px; border-bottom: 0; margin-bottom: 22px; }
.tabs-pills label { font-family: var(--font-sans); font-weight: 700; font-size: 10px; text-transform: uppercase;
  letter-spacing: .05em; color: #666; border: 1px solid var(--fg-muted); border-radius: 9999px;
  padding: 3px 11px; transition: color .12s ease, border-color .12s ease, background .12s ease; }
.tabs-pills label:hover { color: var(--accent); border-color: var(--accent); transform: none; }
.tabset > .tab-input:nth-of-type(1):checked ~ .tabs-pills > label:nth-child(1),
.tabset > .tab-input:nth-of-type(2):checked ~ .tabs-pills > label:nth-child(2),
.tabset > .tab-input:nth-of-type(3):checked ~ .tabs-pills > label:nth-child(3),
.tabset > .tab-input:nth-of-type(4):checked ~ .tabs-pills > label:nth-child(4) { color: #fff; border-color: var(--accent);
  background: var(--accent); }
.tabs-pills ~ .panels > .panel { padding-top: 0; }

/* Icon variant. The label holds one decorative inline SVG drawn with currentColor, then a
   .visually-hidden span with the tab's name. The glyph is the accent because it is a control, not
   decoration; it darkens on hover the way text labels do, and the rail marks selection. */
.tabs .tab-icon { display: flex; align-items: center; }
.tabs .tab-icon svg { display: block; width: 21px; height: 21px; color: var(--accent); }
.tabs .tab-icon:hover svg { color: var(--accent-hover); }

/* Engines without :focus-visible would otherwise show no focus ring at all,
   because the focused radio itself is clipped to nothing. */
@supports not selector(:focus-visible) {
  .tabset > .tab-input:nth-of-type(1):focus ~ .tabs > label:nth-child(1),
  .tabset > .tab-input:nth-of-type(2):focus ~ .tabs > label:nth-child(2),
  .tabset > .tab-input:nth-of-type(3):focus ~ .tabs > label:nth-child(3),
  .tabset > .tab-input:nth-of-type(4):focus ~ .tabs > label:nth-child(4) { outline: 2px solid var(--accent); outline-offset: 2px; }
}

/* ---------- responsive ---------- */
@media (max-width: 620px) {
  .page-title { font-size: 32px; }
  .steps li { grid-template-columns: 1fr; gap: 6px 0; }
  .tabs label { padding: 6px 10px; }
}
