:root {
  --paper: #F1F2F4;
  --paper-2: #E7E9ED;
  --ink: #141821;
  --ink-2: #2B3140;
  --mute: #6B7180;
  --rule: #D3D6DE;
  --cobalt: #2140E6;
  --cobalt-ink: #1A33B8;
  --cobalt-soft: #DCE1FB;
  --marker: #FFD338;
  --marker-ink: #5A4400;
  --live: #1F8F4E;
  --on-cobalt: #FFFFFF;
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --code: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0F1320; --paper-2: #171C2B; --ink: #EAECF3; --ink-2: #C9CEDB; --mute: #98A0B4; --rule: #2A3145;
    --cobalt: #6D84FF; --cobalt-ink: #8CA0FF; --cobalt-soft: #1E2749; --marker: #FFD338; --marker-ink: #3A2C00; --live: #4CC47F; --on-cobalt: #0F1320;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0F1320; --paper-2: #171C2B; --ink: #EAECF3; --ink-2: #C9CEDB; --mute: #98A0B4; --rule: #2A3145;
  --cobalt: #6D84FF; --cobalt-ink: #8CA0FF; --cobalt-soft: #1E2749; --marker: #FFD338; --marker-ink: #3A2C00; --live: #4CC47F; --on-cobalt: #0F1320;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 1.125rem; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; letter-spacing: -0.02em; }
p { margin: 0; }
img, svg { max-width: 100%; }
.wrap { max-width: 1080px; margin-inline: auto; padding-inline: 24px; }
code { font-family: var(--code); font-size: 0.86em; background: var(--paper-2); padding: 1px 6px; border-radius: 3px; color: var(--ink); }

/* top bar */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.02rem; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.wordmark i { width: 12px; height: 12px; background: var(--cobalt); display: inline-block; transform: rotate(45deg); border-radius: 1px; }
.wordmark span { color: var(--mute); font-weight: 500; }
.bar-right { display: flex; align-items: center; gap: 12px; }
.theme { appearance: none; border: 1px solid var(--rule); background: transparent; color: var(--ink-2); width: 36px; height: 36px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.theme:hover { border-color: var(--cobalt); color: var(--cobalt); }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme .sun { display: none; } :root:not([data-theme="light"]) .theme .moon { display: block; } }
.subnav { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; font-family: var(--display); font-size: 0.9rem; font-weight: 500; flex-wrap: wrap; }
.subnav a { text-decoration: none; color: var(--ink-2); padding: 6px 10px; border-radius: 999px; }
.subnav a:hover { color: var(--cobalt); }
.subnav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.menu-btn, .menu-home { display: none; }
/* phone: one-row bar; the product links drop from the bar as a panel, menu button in the corner (as on the home page) */
@media (max-width: 760px) {
  .bar .wrap { flex-wrap: nowrap; }
  .wordmark span { display: none; }
  .bar.menu-open { backdrop-filter: none; -webkit-backdrop-filter: none; } /* a filter would trap the panel */
  .menu-btn { display: inline-flex; appearance: none; border: 1px solid var(--rule); background: transparent; color: var(--ink); width: 36px; height: 36px; border-radius: 999px; cursor: pointer; align-items: center; justify-content: center; flex: none; }
  .menu-btn .x, .menu-open .menu-btn .ham { display: none; }
  .menu-open .menu-btn .x { display: block; }
  .subnav { position: absolute; left: 0; right: 0; top: 100%; display: none; flex-direction: column; gap: 0; padding: 6px 20px 18px; background: var(--paper); border-bottom: 1px solid var(--rule); box-shadow: 0 18px 30px -20px rgba(0,0,0,.35); font-size: 1.15rem; font-weight: 600; }
  .menu-open .subnav { display: flex; }
  .subnav li { border-top: 1px solid var(--rule); }
  .subnav li:first-child { border-top: 0; }
  .subnav li.menu-home { display: list-item; }
  .subnav a { display: block; padding: 13px 0; border-radius: 0; color: var(--ink); }
  .subnav a[aria-current="page"] { background: none; color: var(--cobalt); }
  .subnav .menu-home a { color: var(--mute); font-weight: 500; }
}

/* hero */
.hero { padding-block: 64px 40px; display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; }
.hero .kicker { grid-column: 1 / -1; font-family: var(--display); font-weight: 600; color: var(--cobalt-ink); font-size: 1rem; }
.hero .kicker a { text-decoration: none; }
.hero h1 { grid-column: 1 / 10; font-size: clamp(2.2rem, 5.2vw, 4.2rem); font-weight: 700; line-height: 1; }
.hero .lede { grid-column: 1 / 8; font-size: 1.2rem; color: var(--ink-2); max-width: 60ch; margin-top: 8px; }
.hero .meta { grid-column: 9 / 13; align-self: end; font-family: var(--display); font-size: 0.92rem; color: var(--mute); line-height: 1.5; }
.hero .meta b { color: var(--ink); font-weight: 600; }
.hero .meta a { color: var(--cobalt-ink); text-decoration: none; }
@media (max-width: 860px) { .hero h1, .hero .lede, .hero .meta { grid-column: 1 / -1; } }

/* figure */
figure.loop { margin: 0; padding: 28px 0 8px; border-bottom: 1px solid var(--rule); }
figure.loop figcaption { padding-bottom: 20px; }
figure.loop svg { display: block; width: 100%; height: auto; color: var(--ink); }
figure.loop figcaption { font-family: var(--display); font-size: 0.92rem; color: var(--mute); margin-top: 14px; max-width: 70ch; }

/* stages */
section.block { padding-block: 64px; }
section.block + section.block { border-top: 1px solid var(--rule); }
.sec-head { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; margin-bottom: 32px; align-items: end; }
.sec-head h2 { grid-column: 1 / 6; font-size: clamp(1.8rem, 3.2vw, 2.6rem); font-weight: 700; line-height: 1; }
.sec-head .note { grid-column: 6 / 12; font-family: var(--display); color: var(--cobalt-ink); font-size: 1rem; line-height: 1.4; position: relative; padding-left: 18px; }
.sec-head .note::before { content: ""; position: absolute; left: 0; top: 0.35em; width: 10px; height: 2px; background: var(--cobalt); }
@media (max-width: 860px) { .sec-head h2, .sec-head .note { grid-column: 1 / -1; } }

.stages { list-style: none; margin: 0; padding: 0; counter-reset: stage; border-top: 2px solid var(--ink); }
.stages > li { display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; padding-block: 26px; border-bottom: 1px solid var(--rule); }
.stages > li::before { counter-increment: stage; content: counter(stage); font-family: var(--display); font-weight: 700; font-size: 1.6rem; color: var(--cobalt); line-height: 1; font-variant-numeric: tabular-nums; }
.stages h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.stages .what { color: var(--ink-2); font-size: 1.05rem; margin-top: 8px; max-width: 46ch; }
.stages .how { font-family: var(--display); font-size: 0.95rem; color: var(--ink-2); line-height: 1.55; }
.stages .how strong { display: block; color: var(--mute); font-weight: 600; font-size: 0.82rem; margin-bottom: 6px; }
.stages .how ul { margin: 0; padding-left: 18px; }
.stages .how li + li { margin-top: 6px; }
.stages > li > * { min-width: 0; }
.stages code { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .stages > li { grid-template-columns: 40px minmax(0, 1fr); }
  .stages .how { grid-column: 2; }
}

/* status */
.status { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 2px solid var(--ink); }
.status > div { padding: 26px 0 30px; }
.status > div + div { border-left: 1px solid var(--rule); padding-left: 32px; }
.status h3 { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.status h3::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--live); }
.status > div.next h3::before { background: var(--marker); }
.status ul { margin: 14px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 1.02rem; }
.status li + li { margin-top: 8px; }
@media (max-width: 760px) { .status { grid-template-columns: 1fr; } .status > div + div { border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; } }

/* table */
.tbl { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-family: var(--display); font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 12px 14px 12px 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; color: var(--mute); font-size: 0.85rem; border-bottom: 2px solid var(--ink); }
td:first-child { font-weight: 700; white-space: nowrap; }
td { color: var(--ink-2); }

/* prose */
.prose { max-width: 66ch; color: var(--ink-2); font-size: 1.12rem; }
.prose p + p { margin-top: 18px; }
.prose h3 { font-size: 1.3rem; margin-top: 36px; margin-bottom: 10px; color: var(--ink); }
.prose ul { padding-left: 20px; margin: 12px 0 0; }
.prose li + li { margin-top: 8px; }
.prose mark { background: linear-gradient(transparent 55%, var(--marker) 55%, var(--marker) 92%, transparent 92%); color: inherit; padding-inline: 2px; }

/* next */
.next-nav { padding-block: 40px 64px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-family: var(--display); }
.next-nav a { text-decoration: none; font-weight: 600; color: var(--cobalt-ink); }
.next-nav a:hover { text-decoration: underline; }
.next-nav small { display: block; color: var(--mute); font-weight: 500; font-size: 0.85rem; }

footer { padding-block: 24px 40px; border-top: 1px solid var(--rule); font-family: var(--display); font-size: 0.85rem; color: var(--mute); }
footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.social { display: flex; gap: 6px; }
.social a { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-2); }
.social a:hover { color: var(--cobalt); border-color: var(--cobalt); }


@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- the pattern page (mock) ---------- */
.sec-head { display: block; }
.sec-head .kick { font-family: var(--display); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--cobalt); margin-bottom: 12px; }
.sec-head .dek { font-family: var(--serif); font-size: 1.2rem; line-height: 1.45; color: var(--ink-2); max-width: 58ch; margin-top: 14px; }

.parts { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px; counter-reset: none; border-top: 2px solid var(--ink); }
.parts li { padding-top: 18px; position: relative; }
.parts li + li::before { content: ""; position: absolute; left: -12px; top: 18px; bottom: 0; border-left: 1px solid var(--rule); }
.parts .n { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; color: var(--cobalt); display: block; }
.parts h3 { font-size: 1.15rem; font-weight: 700; margin-top: 10px; line-height: 1.2; }
.parts p { font-family: var(--display); font-size: 0.95rem; color: var(--ink-2); margin-top: 6px; line-height: 1.45; }
@media (max-width: 1100px) { .parts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .parts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .parts { grid-template-columns: 1fr; } .parts li + li::before { display: none; } }

.stages .rule { margin-top: 12px; font-family: var(--display); font-weight: 600; color: var(--ink); font-size: 0.98rem; max-width: 46ch; border-left: 3px solid var(--cobalt); padding-left: 12px; }
.stages .how b { color: var(--ink); font-weight: 700; }
.ladder { list-style: none; margin: 14px 0 0; padding: 0; counter-reset: rung; max-width: 46ch; }
.ladder li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--rule); font-family: var(--display); font-size: 0.92rem; color: var(--ink-2); line-height: 1.4; }
.ladder li::before { counter-increment: rung; content: counter(rung); font-weight: 700; color: var(--cobalt); font-variant-numeric: tabular-nums; }
.ladder li b { display: block; color: var(--ink); font-weight: 700; grid-column: 2; }
.ladder li span { grid-column: 2; }

.fig { margin: 48px 0 0; }
.fig .scroll { overflow-x: auto; }
.fig svg { display: block; width: 100%; min-width: 820px; height: auto; color: var(--ink); font-family: var(--display); }
.fig figcaption { font-family: var(--display); font-size: 0.92rem; color: var(--mute); margin-top: 14px; max-width: 80ch; }
.fig .box { fill: var(--paper); stroke: currentColor; stroke-width: 1.5; }
.fig .box.key { stroke: var(--cobalt); stroke-width: 2; }
.fig .box.soft { fill: var(--cobalt-soft); stroke: var(--cobalt); stroke-width: 1; }
.fig .box.ghost { fill: none; stroke-dasharray: 4 4; }
.fig .panel { fill: none; stroke: currentColor; stroke-width: 1; opacity: 0.3; }
.fig .t { fill: currentColor; stroke: none; font-size: 13px; font-weight: 700; }
.fig .s { fill: currentColor; stroke: none; font-size: 11.5px; opacity: 0.75; }
.fig .l { fill: currentColor; stroke: none; font-size: 11px; opacity: 0.85; }
.fig .k { fill: var(--cobalt-ink); stroke: none; font-size: 11px; font-weight: 600; }
.fig .ln { stroke: currentColor; stroke-width: 1.5; fill: none; }
.fig .ln.key { stroke: var(--cobalt); stroke-width: 2; }
.fig .ln.dash { stroke-dasharray: 4 4; }
.fig .lane-t { fill: currentColor; stroke: none; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.55; }

.rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; border-top: 2px solid var(--ink); }
.rules li { padding: 24px 0 26px; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 44px 1fr; gap: 0 12px; }
.rules .n { font-family: var(--display); font-weight: 800; font-size: 1.6rem; line-height: 1; color: var(--cobalt); grid-row: 1 / 3; }
.rules h3 { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.rules p { color: var(--ink-2); font-size: 1.02rem; margin-top: 8px; max-width: 52ch; }
@media (max-width: 860px) { .rules { grid-template-columns: 1fr; } }

/* product pages: the opening panel */
.fig.top { margin: 24px 0 0; padding: 28px 0 8px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.fig.top figcaption { padding-bottom: 20px; }

.fig a { cursor: pointer; }
.fig a .panel { pointer-events: all; }
.fig a .link { fill: var(--cobalt-ink); }
.fig a:hover .panel { stroke: var(--cobalt); opacity: 1; }

/* product pages: kicker returns to Work; the vocabulary link sits at the end of the line */
.hero .kicker { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.hero .kicker .sep { color: var(--rule); }
.hero .kicker .muted { color: var(--mute); font-weight: 500; }
.hero .kicker .terms { margin-left: auto; font-size: 0.85rem; font-weight: 500; color: var(--mute); border-bottom: 1px solid var(--rule); }
.hero .kicker .terms:hover { color: var(--cobalt); border-color: var(--cobalt); }
