@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
:root {
  color-scheme: light;
  --bg: #f6f4ed; --surface: #fff; --ink: #202b27; --muted: #455752;
  --line: #b9c8bd; --accent: #195b49; --soft: #e1ebe1; --signal: #185946;
}
[data-theme=dark] {
  color-scheme: dark;
  --bg: #172522; --surface: #20312c; --ink: #f2f7f2; --muted: #c1d1c9;
  --line: #4c685b; --accent: #a2e3c2; --soft: #2a4037; --signal: #b6eed5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 19px/1.68 Inter, system-ui, "Segoe UI", sans-serif; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: .14em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button, input, select, .button { padding: .55rem .85rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--surface); }
.button { display: inline-block; text-decoration: none; font-weight: 700; }
.primary, #top { background: var(--accent); border-color: var(--accent); color: var(--bg); }
img { display: block; max-width: 100%; height: auto; }
.wrap { width: min(1200px, calc(100% - 3rem)); margin-inline: auto; }
.skip { position: fixed; top: -8rem; left: 1rem; z-index: 5; background: var(--surface); padding: .9rem; }
.skip:focus { top: 1rem; }
header { position: sticky; top: 0; z-index: 3; background: var(--bg); border-bottom: 1px solid var(--line); }
header nav { min-height: 70px; display: flex; align-items: center; gap: .8rem; font-size: 1.12rem; }
.brand { margin-right: auto; font-weight: 800; color: var(--ink); text-decoration: none; }
.nav-links { display: flex; align-items: center; justify-content: flex-end; gap: .2rem; }
.nav-links a { text-decoration: none; color: var(--ink); font-weight: 750; padding: .46rem .63rem; border-radius: .45rem; }
.nav-links a:hover, .nav-links a:focus-visible { background: var(--soft); color: var(--accent); }
.icon { display: grid; place-items: center; padding: 0; width: 44px; height: 44px; flex: 0 0 44px; }
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#menu, .sun, [data-theme=dark] .moon { display: none; }
[data-theme=dark] .sun { display: block; }
.hero { background: var(--soft); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 2rem; padding-block: 4rem; }
.hero img { border-radius: 14px; border: 1px solid var(--line); }
.kicker { color: var(--signal); font-weight: 750; font-size: .86rem; }
h1, h2 { line-height: 1.09; letter-spacing: -.045em; margin: .4rem 0 1rem; }
h1 { font-size: clamp(2.4rem, 5.7vw, 4.6rem); }
h2 { font-size: clamp(1.85rem, 4vw, 3.1rem); }
.lede { color: var(--muted); font-size: 1.13rem; }
section { padding-block: 3rem; border-bottom: 1px solid var(--line); }
section p { max-width: 79ch; }
.actions, .badges, .contents, .filters, .viewer-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.badges a { text-decoration: none; font-size: .87rem; font-weight: 750; padding: .25rem .65rem; background: var(--surface); border: 1px solid var(--line); border-radius: 2rem; }
.downloads { margin-top: 1.25rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; }
.scroll { overflow-x: auto; scrollbar-color: var(--accent) var(--soft); }
table { min-width: 590px; width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .7rem .95rem; border-bottom: 1px solid var(--line); }
thead { background: var(--soft); }
tbody tr:last-child td { border: 0; }
pre { margin: 0; padding: 1rem; width: max-content; }
code { font-family: Consolas, "IBM Plex Mono", monospace; }
.slider { display: block; width: 100%; margin: .5rem 0; padding: 0; accent-color: var(--accent); }
.filters { align-items: end; margin-top: 1.3rem; }
.filters label { display: grid; gap: .2rem; font-weight: 700; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
figure { margin: 0; overflow: hidden; }
figure a { display: block; }
figure a:focus-visible { outline-offset: -4px; }
figure img { width: 100%; aspect-ratio: 8 / 5; border-bottom: 1px solid var(--line); }
figcaption { padding: .8rem 1rem 1rem; }
figcaption span { display: block; color: var(--muted); font-size: .93rem; }
dialog { width: min(1120px, calc(100% - 1rem)); max-height: calc(100dvh - 1rem); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: .8rem; }
dialog::backdrop { background: #071426db; }
body:has(dialog[open]) { overflow: hidden; }
.viewer-tools { justify-content: space-between; gap: .4rem; }
.viewer-buttons { display: flex; flex-wrap: wrap; gap: .35rem; }
.stage { overflow: auto; max-height: 64dvh; background: var(--soft); margin-block: .55rem; }
.stage img { width: auto; max-height: 64dvh; margin: auto; touch-action: pan-y; }
.stage.zoomed img { width: 1440px; max-width: none; max-height: none; touch-action: auto; }
#viewer-caption { margin: .3rem 0; }
#top { position: fixed; bottom: 1rem; right: 1rem; z-index: 2; width: 53px; height: 53px; }
#top svg { width: 28px; height: 28px; stroke-width: 3.6; }
footer { padding-block: 2rem 4rem; }
@media (max-width: 1190px) {

  #menu { display: grid; }
  .nav-links { display: none; position: absolute; inset: 100% 0 auto; padding: .5rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); max-height: calc(100dvh - 71px); overflow-y: auto; }
  .nav-links.open { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; }
  .nav-links a { padding: .65rem .55rem; }
  .nav-links a + a { border-top: 1px solid var(--line); }
}
@media (max-width: 1000px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  body { font-size: 18px; }
  .wrap { width: calc(100% - 2rem); }
  .gallery, .hero-grid { grid-template-columns: 1fr; }
  .hero-grid { padding-block: 2.4rem; }
  .filters label { width: 100%; }
}

.demo-panel { padding: clamp(.8rem, 2.4vw, 1.6rem); }
.demo-filters { margin: 0 0 1.1rem; }
#stencil-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.stencil-slice { background: var(--bg); border: 1px solid var(--line); border-radius: .6rem; padding: .6rem; text-align: center; }
.stencil-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; margin-top: .4rem; }
.stencil-grid span { background: var(--soft); padding: .4rem .12rem; border-radius: .25rem; font-size: .9rem; font-variant-numeric: tabular-nums; }
.stencil-grid .diagonal { color: var(--bg); background: var(--accent); font-weight: 800; }
.stencil-grid .outside { background: var(--bg); color: var(--muted); }
#stencil-output { font-weight: 700; }
#stencil-partials { margin-bottom: .25rem; }
@media (max-width: 680px) {
  #stencil-cells { grid-template-columns: 1fr; }
}
