/* Clankie shared theme. Aero Day, Aero Night, and Graphite.
   Fonts are Geist (SIL OFL, assets/fonts/LICENSE-Geist.txt), served locally (no CDN).
   html[data-theme] is day, night, or graphite, set before paint. */
@font-face { font-family: "Geist Serif"; src: url("./assets/fonts/GeistSerif-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("./assets/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("./assets/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* Aero Day. Palette lines up with the clankie.bot landing glass: ink, sheet, sky. */
:root, :root[data-theme="day"] {
  --paper: #eef6fc; --paper-2: #f7fbfe; --paper-3: #c5d6e8;
  --ink: #0f2747; --ink-2: #1a365d; --ink-3: #2f4a6e; --ink-soft: rgba(15, 39, 71, 0.78);
  --accent: #0f6b32;
  --glass: rgba(255, 255, 255, 0.72); --glass-stroke: rgba(255, 255, 255, 0.8); --glass-edge: rgba(255, 255, 255, 0.8);
  --glass-shadow: rgba(20, 60, 120, 0.22); --line: rgba(15, 39, 71, 0.14);
  --button: #ffffff; --button-fg: #0f2747;
  --sage: #0f6b32; --moss-pale: #d7efd4; --plum: #8a2450;
  --primary: #ffffff; --primary-ink: #0f2747;
  --sheet: rgba(255, 255, 255, 0.82); --card: rgba(255, 255, 255, 0.52); --card-edge: rgba(255, 255, 255, 0.72);
  --menu-bg: rgba(244, 249, 255, 0.96); --focus: #0b5fd0;
  --code-bg: rgba(13, 30, 62, 0.92); --code-fg: #f5f8ff; --code-muted: #b7cae8; --code-ok: #b7f0c8;
  --serif: "Geist Serif", ui-serif, Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1200px;
  --radius: 22px;
  --shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 18px 50px -24px rgba(20,60,120,.35);
  --ground: #4a9be0;
  color-scheme: light;
}
/* Aero Night. */
:root[data-theme="night"] {
  --paper: #0b1636; --paper-2: #101c40; --paper-3: #2a3d6e;
  --ink: #eef4ff; --ink-2: #d5e1fb; --ink-3: #b7c8ea; --ink-soft: rgba(226, 236, 255, 0.8);
  --accent: #9ee08d;
  --glass: rgba(16, 28, 64, 0.72); --glass-stroke: rgba(160, 190, 255, 0.32); --glass-edge: rgba(160, 190, 255, 0.32);
  --glass-shadow: rgba(0, 0, 0, 0.45); --line: rgba(200, 215, 255, 0.18);
  --button: #eef4ff; --button-fg: #0b1a3a;
  --sage: #9ee08d; --moss-pale: #1c3a32; --plum: #f0b2cd;
  --primary: #eef4ff; --primary-ink: #0b1a3a;
  --sheet: rgba(9, 18, 44, 0.78); --card: rgba(255, 255, 255, 0.06); --card-edge: rgba(170, 195, 255, 0.22);
  --menu-bg: rgba(10, 18, 42, 0.96); --focus: #9cc2ff;
  --code-bg: rgba(5, 11, 26, 0.86); --code-fg: #f5f8ff; --code-muted: #a9bee4; --code-ok: #9ee08d;
  --shadow: inset 0 1px 0 rgba(180,200,255,.16), 0 18px 50px -24px rgba(0,0,0,.55);
  --ground: #0b1636;
  color-scheme: dark;
}
/* Graphite. Palette authority: mockups/themes/themes.json, graphite.dark. */
:root[data-theme="graphite"] {
  --paper: #141311; --paper-2: #1c1a18; --paper-3: #34312d;
  --ink: #f3efe8; --ink-2: #b8b0a4; --ink-3: #8f877c; --ink-soft: #b8b0a4; --accent: #d8d2c8;
  --glass: rgba(30, 28, 26, 0.72); --glass-stroke: rgba(255, 255, 255, 0.14); --glass-edge: rgba(255, 255, 255, 0.14);
  --glass-shadow: rgba(0, 0, 0, 0.45); --line: rgba(255, 255, 255, 0.1);
  --button: #ece6da; --button-fg: #1a1714;
  --sage: #a3bf98; --moss-pale: #3f4a3a; --plum: #d4a3b6;
  --primary: #ece6da; --primary-ink: #1a1714;
  --sheet: rgba(22, 20, 18, 0.9); --card: rgba(255, 255, 255, 0.06); --card-edge: rgba(255, 255, 255, 0.1);
  --menu-bg: rgba(22, 20, 18, 0.98); --focus: #a3bf98;
  --code-bg: #100e0c; --code-fg: #f3efe8; --code-muted: #c4bbb0; --code-ok: #a3bf98;
  --shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 24px 60px -30px rgba(0,0,0,.6);
  --ground: #141311;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body { margin: 0; min-height: 100vh; padding-top: 76px; background: var(--ground); color: var(--ink); font: 400 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
/* Day and Night: the same pixel Frutiger Aero world as clankie.bot, softly veiled for calm reading.
   Graphite: the dithered app ground. */
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -2;
  background: #4a9be0 url("./assets/aero-day-bg.png") center bottom / cover no-repeat;
  image-rendering: pixelated; }
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: linear-gradient(180deg, rgba(226, 242, 255, 0.26) 0%, rgba(226, 242, 255, 0.14) 55%, rgba(226, 242, 255, 0.28) 100%); }
:root[data-theme="night"] body::before {
  background: #0b1636 url("./assets/aero-night-bg.png") center bottom / cover no-repeat;
  image-rendering: pixelated; }
:root[data-theme="night"] body::after {
  background: linear-gradient(180deg, rgba(6, 12, 32, 0.34) 0%, rgba(8, 16, 42, 0.24) 55%, rgba(6, 12, 32, 0.42) 100%); }
:root[data-theme="graphite"] body::before { left: 0; top: 0; width: 114vw; height: 114vh;
  background: #141311 url("./assets/app-ground-landscape.png") 0 0 / 100% 100% no-repeat; image-rendering: pixelated;
  animation: app-ground-drift 90s linear infinite alternate; will-change: transform; }
:root[data-theme="graphite"] body::after { display: none; }
@media (orientation: portrait) {
  :root[data-theme="graphite"] body::before { background-image: url("./assets/app-ground-portrait.png"); }
}
@keyframes app-ground-drift { to { transform: translate3d(-12vw, -10vh, 0); } }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }
/* ?bg=plain on Graphite: a smooth gradient, no dither */
html[data-bg="plain"][data-theme="graphite"] body::before { animation: none; width: 100%; height: 100%; image-rendering: auto; background: radial-gradient(120% 60% at 50% 118%, rgba(74, 70, 64, 0.75) 0%, rgba(52, 49, 45, 0.45) 38%, rgba(20, 19, 17, 0) 72%), linear-gradient(180deg, #141311 0%, #1c1a18 52%, #22201d 100%); }

h1, h2, h3, p { margin: 0; }
a { color: inherit; }
img, svg { display: block; }
button { font: inherit; color: inherit; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.012em; }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: calc(760px + 2 * var(--gutter)); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 12px; background: var(--button); color: var(--button-fg); text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--sage); outline-offset: 3px; border-radius: 12px; }

.eyebrow { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.32rem); line-height: 1.45; color: var(--ink); }
.body { color: var(--ink-2); max-width: 62ch; }
.aside { color: var(--ink-2); font-size: 0.95rem; }
.limit { color: var(--ink-2); font-size: 0.95rem; padding-left: 14px; border-left: 2px solid var(--paper-3); max-width: 60ch; }
h2.serif { font-size: clamp(2.1rem, 4.6vw, 3.6rem); line-height: 1.04; }
h3.serif { font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: 1.08; }
section { position: relative; }
.section-head > * + *, .narrow > * + *, .split > div > * + *, .works-head > * + * { margin-top: 16px; }
.section-head h2 + .lede, h2 + .lede, h3 + .lede { margin-top: 18px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; font: 500 1rem/1 var(--sans); text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: background .15s, transform .15s, border-color .15s; white-space: nowrap; }
.btn-primary { background: var(--button); color: var(--button-fg); }
.btn-primary:hover { background: #fffaf0; }
.btn-glass { background: var(--glass); color: var(--ink); border-color: var(--glass-stroke); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); box-shadow: 0 6px 20px -14px rgba(0,0,0,.5); }
.btn-glass:hover { border-color: rgba(255,255,255,.3); background: rgba(44,41,38,.7); }
.btn-small { min-height: 38px; padding: 0 16px; font-size: 0.9rem; }
.btn.is-inert { cursor: not-allowed; opacity: .55; }
.btn-primary.is-inert:hover { background: var(--button); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.glass { background: var(--glass); border: 1px solid var(--glass-stroke); border-radius: var(--radius); -webkit-backdrop-filter: blur(22px) saturate(1.05); backdrop-filter: blur(22px) saturate(1.05); box-shadow: var(--shadow); }

/* header: glass brand, link pills, Sign in, theme. Matches the clankie.bot landing header. */
.site-head { position: fixed; top: 16px; left: 16px; right: 16px; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
.site-head > * { pointer-events: auto; }
.site-head .glass { border-radius: 999px; backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 10px 30px var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.brand { display: flex; align-items: center; gap: 9px; padding: 9px 16px 9px 12px; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand svg { width: 20px; height: 20px; }
.site-nav { display: flex; gap: 8px; align-items: center; position: relative; }
.site-nav a, .site-nav button { font: inherit; font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: none; cursor: pointer; appearance: none; -webkit-appearance: none; }
.nav-links { display: flex; align-items: center; gap: 2px; padding: 4px; }
.nav-links a { padding: 7px 13px; border-radius: 999px; white-space: nowrap; border-bottom: 0; }
.nav-links a:hover { background: var(--card); }
.nav-signin { padding: 9px 16px; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.theme-ico { display: none; }
:root[data-theme="day"] .theme-ico-day, :root[data-theme="night"] .theme-ico-night, :root[data-theme="graphite"] .theme-ico-graphite { display: block; }
.nav-menu-btn { display: none; }
/* footer still uses the sprout wordmark */
.wordmark { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.wordmark .mark { width: 26px; height: 26px; fill: none; stroke: var(--sage); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wordmark .mark path:not(:first-child) { fill: color-mix(in srgb, var(--sage) 22%, transparent); }
.wordmark-text { font: 600 1.12rem/1 var(--mono); letter-spacing: .02em; }

/* pixel grain on Graphite; Aero uses the sky instead */
.grain-strip { height: 22px; background: url("./assets/graphite_dark.png") center 70% / 100% auto; image-rendering: pixelated; }
:root:not([data-theme="graphite"]) .grain-strip { display: none; }
.site-foot { max-width: var(--maxw); width: calc(100% - 2 * var(--gutter)); margin: 24px auto 32px; padding: 24px 0 26px; border-radius: 22px;
  background: var(--sheet); border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4); }
.foot-mark { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1rem; }
.foot-mark .wordmark-text { font-size: 1rem; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot-nav { display: flex; gap: 22px; }
.foot-nav a { color: var(--ink-2); text-decoration: none; font-size: .94rem; }
.foot-nav a:hover { color: var(--ink); }
.foot-mark .mono { font-size: .78rem; color: var(--ink-3); }
.foot-open { margin-top: 12px; color: var(--ink-3); font-size: .88rem; max-width: 70ch; }

/* responsive: header links fold into a panel. Sign in and the theme button stay out. */
@media (max-width: 960px) {
  .site-head { top: 10px; left: 10px; right: 10px; }
  body { padding-top: 64px; }
  .nav-menu-btn { display: grid; }
  .nav-links { position: absolute; top: 52px; right: 0; width: min(280px, calc(100vw - 24px)); flex-direction: column; align-items: stretch; gap: 2px; padding: 8px; border-radius: 22px;
    background: var(--menu-bg); backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .15s, transform .15s, visibility .15s; }
  .nav-links.open { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { padding: 12px 14px; font-size: 16px; }
}
@media (max-width: 400px) {
  .brand { padding: 8px 12px 8px 10px; font-size: 16px; }
  .nav-signin { padding: 9px 12px; }
}

/* ---- The loop, in five steps (docs: content/index.md `.loop-fig`) ----
   Equal-height steps joined left to right, step 4 is the human decision (ivory, as the
   decision card in the landing hero diagram), step 5 is live (moss ring), and a plum triage
   path runs from Live back to the workers. Selectors are doubled so these win over older
   per-site rules; sites can delete their own `.loop-fig` rules. */
.loop-fig.loop-fig { --fig-gap: 22px; position: relative; margin-top: 1.6em; padding: 22px 22px 18px; border-radius: 22px; background: rgba(20, 19, 17, 0.55); border: 1px solid var(--glass-stroke); box-shadow: inset 0 2px 16px rgba(0, 0, 0, 0.4); }
.loop-fig.loop-fig ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--fig-gap); counter-reset: step; align-items: stretch; }
.loop-fig.loop-fig li { position: relative; display: flex; flex-direction: column; gap: 6px; margin: 0; max-width: none; padding: 14px 14px 16px; border-radius: 16px; background: linear-gradient(180deg, rgba(58, 54, 49, 0.9), rgba(42, 39, 36, 0.9)); border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px -16px rgba(0, 0, 0, 0.8); }
.loop-fig.loop-fig li::before { counter-increment: step; content: counter(step, decimal-leading-zero); display: block; font: 500 .68rem/1 var(--mono); letter-spacing: .12em; color: var(--ink-3); }
/* the connector to the next step: a thin line with a small dark token, as in the hero diagram */
.loop-fig.loop-fig li:not(:last-child)::after { content: ""; position: absolute; top: 50%; right: calc(-1 * var(--fig-gap) - 1px); width: calc(var(--fig-gap) + 2px); height: 1px; background: rgba(255, 255, 255, 0.28); }
.loop-fig.loop-fig li strong { display: block; font: 500 .98rem/1.2 var(--sans); color: var(--ink); margin: 0; }
.loop-fig.loop-fig li span { display: block; font-size: .8rem; line-height: 1.4; color: var(--ink-3); margin: 0; }
.loop-fig.loop-fig li + li { margin-top: 0; }
/* step 4: the human decision point */
.loop-fig.loop-fig li.is-decision { background: linear-gradient(180deg, #f1ebe0, #e2dbcf); border-color: transparent; box-shadow: 0 0 0 3px rgba(236, 230, 218, 0.16), 0 14px 30px -16px rgba(0, 0, 0, 0.9); }
.loop-fig.loop-fig li.is-decision::before { content: "04 · you decide"; color: #6a6258; white-space: nowrap; letter-spacing: .02em; font-size: .62rem; }
.loop-fig.loop-fig li.is-decision strong { color: #1a1714; }
.loop-fig.loop-fig li.is-decision span { color: #5a544c; }
/* step 5: live, the moss ring */
.loop-fig.loop-fig li.is-live { border-color: rgba(163, 191, 152, 0.35); }
.loop-fig.loop-fig li.is-live strong::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; border: 2px solid var(--sage); box-shadow: 0 0 0 2px rgba(163, 191, 152, 0.18); vertical-align: 1px; }
/* triage: a real return path from Live (step 5) back to the workers (step 2) */
.loop-fig.loop-fig .loop-back { position: relative; max-width: none; margin: 0; padding: 30px 0 0 calc((100% - 4 * var(--fig-gap)) / 5 + var(--fig-gap)); text-align: left; font: 500 .8rem/1.4 var(--mono); color: var(--plum); }
.loop-fig.loop-fig .loop-back::before { content: ""; position: absolute; top: 0; height: 18px; left: calc((100% - 4 * var(--fig-gap)) / 5 * 1.5 + var(--fig-gap)); right: calc((100% - 4 * var(--fig-gap)) / 10); border: 2px solid var(--plum); border-top: 0; border-radius: 0 0 14px 14px; opacity: .85; }
.loop-fig.loop-fig .loop-back::after { content: ""; position: absolute; top: -2px; left: calc((100% - 4 * var(--fig-gap)) / 5 * 1.5 + var(--fig-gap) - 4px); border: 5px solid transparent; border-bottom: 7px solid var(--plum); border-top: 0; }
.loop-fig.loop-fig .loop-back span { font-family: var(--sans); color: var(--ink-2); font-weight: 400; }
@media (max-width: 760px) {
  .loop-fig.loop-fig { padding: 18px; }
  .loop-fig.loop-fig ol { grid-template-columns: 1fr; gap: 14px; }
  .loop-fig.loop-fig li:not(:last-child)::after { top: auto; bottom: -14px; left: 50%; right: auto; width: 2px; height: 14px; margin: 0; background: rgba(255,255,255,.18); }
  .loop-fig.loop-fig .loop-back { padding: 14px 0 0; text-align: left; }
  /* narrow: the return path becomes a plum rail beside the note, pointing back up to step 02 */
  .loop-fig.loop-fig .loop-back { padding: 10px 0 0 16px; margin-top: 10px; border-left: 2px solid var(--plum); }
  .loop-fig.loop-fig .loop-back::before { display: none; }
  .loop-fig.loop-fig .loop-back::after { display: none; }
}
