/* Amortance — one stylesheet for the front page and both worked examples.
   Instrument Sans and Geist Mono are served from ./fonts (OFL), no external requests;
   light and dark from the same tokens. */

@font-face {
  font-family: "Instrument Sans";
  src: url(/fonts/instrument-sans.woff2) format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url(/fonts/instrument-sans-italic.woff2) format("woff2");
  font-weight: 400 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url(/fonts/geist-mono.woff2) format("woff2");
  font-weight: 400 600; font-style: normal; font-display: swap;
}

:root {
  --bg: #fbfbf9;
  --bg-2: #f3f3ef;
  --fg: #16181d;
  --fg-2: #474c55;
  --muted: #6b7079;
  --line: #e3e3de;
  --line-2: #c9c9c2;
  --accent: #1f4fd8;
  --accent-bg: #e9efff;
  --radius: 12px;
  --radius-s: 8px;
  --container: 1120px;
  --measure: 66ch;
  --font: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
/* Dark comes from the system unless the visitor has chosen light; choosing dark forces
   it on a light system. The palette is written twice because CSS cannot share one
   declaration block between a media query and an attribute selector — check_pages.py
   asserts the two copies stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114;
    --bg-2: #171a1f;
    --fg: #e8eaed;
    --fg-2: #b7bcc5;
    --muted: #9aa1ab;
    --line: #272b32;
    --line-2: #3b404a;
    --accent: #8fb0ff;
    --accent-bg: #172038;
  }
}
:root[data-theme="dark"] {
    --bg: #0f1114;
    --bg-2: #171a1f;
    --fg: #e8eaed;
    --fg-2: #b7bcc5;
    --muted: #9aa1ab;
    --line: #272b32;
    --line-2: #3b404a;
    --accent: #8fb0ff;
    --accent-bg: #172038;
}
/* form controls and scrollbars follow the choice, not the system */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
@media (max-width: 640px) { body { font-size: 16px; } }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: clamp(2.125rem, 1.45rem + 3vw, 3.5rem); line-height: 1.08; letter-spacing: -0.028em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); line-height: 1.2; }
h3 { font-size: 1.125rem; line-height: 1.35; letter-spacing: -0.01em; }
p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
b, strong { font-weight: 600; }

a {
  color: inherit; text-decoration: underline; text-decoration-thickness: 1px;
  text-decoration-color: var(--line-2); text-underline-offset: 0.18em;
  transition: text-decoration-color .15s;
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

code, pre, kbd { font-family: var(--mono); }
code { font-size: .9em; background: var(--bg-2); padding: .1em .35em; border-radius: 4px; }
pre {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 16px 18px; overflow-x: auto; font-size: 13px; line-height: 1.55; margin: 0 0 16px;
}
pre code { background: none; padding: 0; font-size: inherit; }

.muted { color: var(--muted); }
.small { font-size: .9rem; }
.num, table { font-variant-numeric: tabular-nums; }
.measure { max-width: var(--measure); }
.eyebrow {
  font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px;
}
.lead, .lede {
  font-size: clamp(1.125rem, 1rem + .5vw, 1.3rem); line-height: 1.5; color: var(--fg-2);
  letter-spacing: -0.01em;
}
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
@media (min-width: 900px) { .container { padding: 0 40px; } }

.skip {
  position: absolute; left: 16px; top: -64px; z-index: 100;
  background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 16px; }

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; color: var(--fg); }
/* the wordmark is outlined text, drawn from the <symbol> at the top of each page;
   the height is its cap height, so 14px reads like 19px type */
.wordmark { display: block; height: 14px; width: auto; fill: currentColor; }
.site-nav { display: none; gap: 2px; margin-left: auto; }
.theme {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; padding: 0; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 8px; background: transparent; color: var(--fg-2);
  transition: background .15s, color .15s, border-color .15s;
}
.theme:hover { background: var(--bg-2); color: var(--fg); border-color: var(--fg); }
.theme svg { width: 17px; height: 17px; display: none; }
/* no attribute means "follow the system", and that is the icon shown */
.theme .i-system { display: block; }
:root[data-theme="light"] .theme .i-system, :root[data-theme="dark"] .theme .i-system { display: none; }
:root[data-theme="light"] .theme .i-light { display: block; }
:root[data-theme="dark"] .theme .i-dark { display: block; }
.site-nav a {
  text-decoration: none; color: var(--fg-2); padding: 8px 12px; border-radius: 8px; font-size: .95rem;
  transition: background .15s, color .15s;
}
.site-nav a:hover { color: var(--fg); background: var(--bg-2); }
.menu { position: relative; margin-left: auto; }
.menu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 36px;
  padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; font: 500 .875rem/1 var(--font);
}
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--bg-2); }
.menu nav {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; display: grid; padding: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .10); z-index: 60;
}
.menu nav a { text-decoration: none; color: var(--fg); padding: 10px 12px; border-radius: 8px; font-size: .95rem; }
.menu nav a:hover { background: var(--bg-2); }
@media (min-width: 960px) {
  .site-nav { display: flex; }
  .menu { display: none; }
  .site-header .theme { margin-left: 8px; }
}
@media (max-width: 420px) { .site-header .btn { display: none; } }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; white-space: nowrap;
  font: 500 .95rem/1 var(--font); text-decoration: none; cursor: pointer;
  border: 1px solid var(--fg); background: var(--fg); color: var(--bg);
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: color-mix(in srgb, var(--fg) 84%, var(--bg)); border-color: transparent; }
.btn-secondary { background: transparent; color: var(--fg); border-color: var(--line-2); }
.btn-secondary:hover { background: var(--bg-2); border-color: var(--fg); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .875rem; border-radius: 8px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cta-row .btn { white-space: normal; line-height: 1.25; padding-top: 11px; padding-bottom: 11px; text-align: center; }

/* ---------------------------------------------------------------- hero */

.hero { padding: clamp(48px, 7vw, 96px) 0 clamp(48px, 6vw, 80px); }
.hero-grid { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
  /* Beside the demo the copy column is 444-492px, and Instrument Sans needs about 7%
     less size than the system stack did to hold the headline at four lines. Track the
     column instead of the viewport: 46px at 1024, 52px from 1440 up. */
  .hero h1 { font-size: clamp(2.875rem, 1.9rem + 1.5vw, 3.25rem); }
}
.hero-copy { max-width: 640px; min-width: 0; }
.hero h1 { margin-bottom: 22px; }
.hero .lead { margin-bottom: 26px; }
.hero-cases { margin-top: 22px; max-width: 58ch; }
.hero-demo { min-width: 0; }
.demo-tabs {
  display: flex; gap: 2px; padding: 3px; margin-bottom: 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg);
}
.demo-tabs button {
  flex: 1 1 0; font: 500 .875rem/1.25 var(--font); color: var(--fg-2); background: transparent; border: 0;
  border-radius: 7px; padding: 6px 12px; min-height: 36px; cursor: pointer; transition: background .15s, color .15s;
}
@media (min-width: 640px) {
  .demo-tabs { display: inline-flex; }
  .demo-tabs button { flex: none; }
}
.demo-tabs button:hover { color: var(--fg); }
.demo-tabs button[aria-selected="true"] { background: var(--fg); color: var(--bg); }
.demo + .demo { margin-top: 16px; }
.demo {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2);
  padding: 24px; display: flex; flex-direction: column; gap: 16px;
  container-type: inline-size;
}
@media (min-width: 640px) { .demo { padding: 28px; } }
.demo .eyebrow { margin-bottom: 8px; }
.demo h3 { font-size: 1.25rem; }
.demo p { color: var(--fg-2); font-size: .95rem; }
.readings { display: grid; gap: 12px; }
/* side by side only when the card itself is wide enough for two columns of figures */
@container (min-width: 400px) { .readings { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.reading { border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-s); padding: 12px 14px; }
.reading h4 {
  font: 500 11px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}
.reading dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: .85rem; }
.reading dt { color: var(--muted); }
.reading dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.gap { color: var(--fg); }
.demo .gap { color: var(--fg); }
.gap strong {
  display: block; font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; color: var(--accent); margin-bottom: 4px;
}
.demo .more { margin-top: auto; font-weight: 500; text-decoration: none; }
.demos-note { margin-top: 16px; }
.demo .more:hover { text-decoration: underline; }

/* toggles — the same control on the front page and inside the examples */
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 8px; }
.ctl:last-child { margin-bottom: 0; }
.lbl { font: 500 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg button {
  font: 500 .875rem/1 var(--font); color: var(--fg); background: transparent; border: 0;
  padding: 0 12px; min-height: 36px; cursor: pointer; transition: background .15s, color .15s;
}
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button:hover { background: var(--bg-2); }
.seg button[aria-pressed="true"], .seg button.on { background: var(--fg); color: var(--bg); }
.seg button:focus-visible { outline-offset: -3px; border-radius: 0; }

/* ---------------------------------------------------------------- sections */

.section { padding: clamp(56px, 8vw, 96px) 0; border-top: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: clamp(28px, 4vw, 44px); }
.section-head h2 { margin-bottom: 14px; }
.split { display: grid; gap: 32px; }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; }
  .split > .sticky { position: sticky; top: 96px; align-self: start; }
}
.split h2 { margin-bottom: 14px; }

.grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; background: var(--bg); }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--fg-2); font-size: .95rem; }
.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.node { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 22px 24px; }
.node .n { display: block; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.node h3 { margin-bottom: 8px; }
.node p { color: var(--fg-2); font-size: .95rem; }
/* connectors: down the column on narrow screens, across the row from 900px */
.node + .node::before { content: ""; position: absolute; background: var(--line-2); left: 28px; top: -17px; width: 2px; height: 16px; }
.node + .node::after {
  content: ""; position: absolute; width: 8px; height: 8px; left: 25px; top: -9px;
  border-top: 2px solid var(--line-2); border-right: 2px solid var(--line-2); transform: rotate(135deg);
}
@media (min-width: 900px) {
  .flow { grid-template-columns: 1fr 1fr 1fr; gap: 44px; }
  .node + .node::before { left: -44px; top: 30px; width: 44px; height: 2px; }
  .node + .node::after { left: -14px; top: 27px; transform: rotate(45deg); }
}
.strip { margin: clamp(32px, 5vw, 48px) 0 0; padding-top: 24px; border-top: 1px solid var(--line); display: grid; gap: 20px; }
@media (min-width: 720px) { .strip { grid-template-columns: 1fr 1fr 1fr; gap: 32px; } }
.strip dt { font-weight: 600; margin-bottom: 4px; }
.strip dd { margin: 0; color: var(--fg-2); font-size: .95rem; }
.nolist { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px 40px; }
@media (min-width: 720px) { .nolist { grid-template-columns: 1fr 1fr; } }
.nolist li { position: relative; padding-left: 26px; }
.nolist li::before { content: "×"; position: absolute; left: 0; top: 0; color: var(--muted); font-weight: 600; }

.list { list-style: none; margin: 0 0 16px; padding: 0; }
.list li { position: relative; padding-left: 20px; margin: 0 0 10px; }
.list li::before { content: "—"; position: absolute; left: 0; color: var(--muted); }

.rule {
  background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  border-radius: var(--radius-s); padding: 14px 18px; margin: 0 0 16px; font-size: .9rem; line-height: 1.6;
}
.rule b { font-weight: 600; }
.rule .n { font-variant-numeric: tabular-nums; }
.explain { max-width: 800px; margin-top: clamp(32px, 5vw, 48px); }

.quote {
  margin: 0 0 16px; padding: 4px 0 4px 20px; border-left: 3px solid var(--line-2);
  font-size: 1.1rem; line-height: 1.5; color: var(--fg-2); letter-spacing: -0.01em;
}

.offer { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); padding: clamp(24px, 4vw, 44px); }
.offer h2 { max-width: 720px; }
.offer-grid { display: grid; gap: 18px; margin: 28px 0 32px; }
@media (min-width: 720px) { .offer-grid { grid-template-columns: 1fr 1fr 1fr; gap: 24px; } }
.offer-grid > div { border-top: 1px solid var(--line-2); padding-top: 14px; }
.offer-grid .eyebrow { margin-bottom: 6px; }
.offer-grid p { color: var(--fg-2); }

.note { max-width: 720px; }
.email { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.email a { font-weight: 500; font-size: 1.05rem; }

/* ---------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--line); padding: 48px 0 40px; font-size: .9rem; color: var(--muted); }
.footer-grid { display: grid; gap: 28px; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; } }
.footer-blurb { margin-top: 14px; max-width: 34ch; }
.site-footer h4 { font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 8px; }
.site-footer a { text-decoration: none; color: var(--fg-2); }
.site-footer a:hover { color: var(--fg); text-decoration: underline; }
.site-footer .wordmark { height: 13px; }
.footer-bottom {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between;
}

/* ---------------------------------------------------------------- worked examples */

.article { max-width: 768px; margin: 0 auto; padding: clamp(40px, 6vw, 64px) 24px 80px; }
.article .crumb { font-size: .875rem; color: var(--muted); margin: 0 0 24px; }
.article h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); margin-bottom: 20px; }
.article h2 {
  font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
}
.article h3 { font-size: 1.25rem; margin: 0 0 10px; }
.article .fork h3 { font-size: 1.05rem; }
.article section { margin-top: 44px; }
.article ul { list-style: none; margin: 0 0 16px; padding: 0; }
.article li { position: relative; padding-left: 20px; margin: 0 0 9px; }
.article li::before { content: "—"; position: absolute; left: 0; color: var(--muted); }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0 24px; }
.article .lede { margin-bottom: 16px; }

.scroll { overflow-x: auto; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; white-space: nowrap; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th {
  font-weight: 500; color: var(--muted); font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; border-bottom-color: var(--fg);
}
tr.total td { font-weight: 600; border-bottom: 0; }
tr.mark td { background: var(--bg-2); }
td.note, th.note { text-align: left; white-space: normal; color: var(--muted); }

.fork { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .fork { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.controls {
  border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--radius-s);
  padding: 16px 18px; margin: 24px 0 0;
}
.controls > p { margin: 0 0 12px; }
.controls .ctl button {
  font: 500 .875rem/1 var(--font); color: var(--fg); background: var(--bg);
  border: 1px solid var(--line-2); padding: 0 12px; min-height: 36px; border-radius: 8px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.controls .ctl button:hover { border-color: var(--fg); }
.controls .ctl button.on, .controls .ctl button[aria-pressed="true"] {
  background: var(--fg); color: var(--bg); border-color: var(--fg);
}
/* Wide enough for a rail beside the column: the controls hold their place while
   the page scrolls. Narrower than that, they stay in flow at the top. */
@media (min-width: 1200px) {
  .controls {
    position: fixed; top: 88px; left: calc(50% - 584px); width: 196px; margin: 0;
    max-height: calc(100vh - 112px); overflow: auto;
  }
  .controls > p { font-size: 13px; line-height: 1.5; margin-bottom: 14px; }
  .controls .ctl { display: block; margin: 0 0 14px; }
  .controls .lbl { display: block; margin-bottom: 6px; }
  .controls .ctl button { display: block; width: 100%; text-align: left; }
  .controls .ctl button + button { margin-top: 4px; }
}
