/* Spooligan manual. Fonts, colours and the receipt kit come from brand/spooligan-brand.css, loaded first. */
:root { --side: 272px; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration-thickness: 1.5px; text-underline-offset: .18em; }
a:hover { text-decoration-color: var(--hi); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 4px; }
code { font-family: var(--mono); font-size: .86em; background: var(--accent-soft); color: var(--ink); padding: .1em .35em; border-radius: 5px; }
h1, h2 { font-family: var(--serif); font-weight: 400; color: var(--heading); line-height: 1.06; margin: 0; text-wrap: balance; }
h3, h4 { font-family: var(--font); color: var(--ink); line-height: 1.25; margin: 0; }
h2 { font-size: clamp(1.9rem, 1.25rem + 2.2vw, 2.9rem); }
h3 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; margin: 2.2rem 0 .7rem; }
h4 { font: 700 .95rem/1.3 var(--mono); letter-spacing: .04em; }
p { margin: .6rem 0 1rem; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--panel); padding: 8px 12px; }
.eyebrow { font: 700 .76rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 .6rem; }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow: auto; padding: 18px 14px 18px 18px; border-right: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; }
.side-head { display: flex; align-items: center; justify-content: space-between; }
.side-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); }
.side-brand img { display: block; width: 132px; height: auto; }
.theme { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.theme svg { width: 18px; height: 18px; fill: currentColor; }
.search { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; flex: none; }
.search input { border: 0; outline: 0; background: transparent; color: var(--ink); font: 14px var(--font); padding: 9px 0; width: 100%; }
.nav { display: flex; flex-direction: column; font-size: 14px; }
.nav > a { padding: 6px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.nav > a.nav-home { color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.nav > a:hover { background: var(--accent-soft); color: var(--accent); }
.nav > a.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); border-radius: 0 8px 8px 0; }
.nav .count { font: 600 11px var(--mono); background: var(--accent); color: var(--bg); border-radius: 99px; padding: 1px 7px; }
.nav-groups { margin: 2px 0 8px 10px; border-left: 1px solid var(--line-2); padding-left: 8px; }
.nav-gname { display: block; font: 700 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: 10px 8px 5px; }
.nav-block { display: inline-block; text-decoration: none; margin: 1px; }
.nav-block code { display: inline-block; font-size: 12px; background: transparent; color: var(--ink); padding: 2px 7px; border-radius: 6px; border: 1px solid transparent; }
.nav-block:hover code, .nav-block.active code { border-color: var(--line-2); background: var(--panel); color: var(--accent); }
.nav-empty { font-size: 13px; color: var(--muted); padding: 4px 8px; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--muted); }
main { min-width: 0; padding: 0 clamp(18px, 4vw, 64px) 40px; max-width: 1360px; }

/* ---------------------------------------------------------------- hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; align-items: center; padding: 56px 0 28px; }
.wordmark { margin: 0; line-height: 0; }
.wordmark img { width: min(520px, 100%); height: auto; }
.tagline { font: italic 500 clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem)/1.15 var(--font-tag); color: var(--ink); margin: .6rem 0 1rem; }
.lede { font-size: 1.12rem; max-width: 60ch; color: var(--ink); }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.btn { display: inline-flex; align-items: center; padding: 11px 18px; border-radius: 12px; border: 1.5px solid var(--accent); color: var(--accent); font-weight: 700; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--bg); }
.btn:hover { color: var(--hi); border-color: var(--hi); } .btn.primary:hover { background: var(--hi); color: #fff; }
.hero-art { position: relative; min-height: 360px; }
.hero-art .art { display: block; width: min(100%, 420px); height: auto; margin: 0 auto; box-sizing: border-box; }
.hero-paper { position: absolute; right: -4px; bottom: -40px; width: 180px; transform: rotate(4deg); padding: 10px 8px !important; }
.hero-paper img { width: 100% !important; height: auto; }
/* Brand art: the colour logo on every theme, on a cream plate on the dark one (no recoloured logo). The line-art
   mascot and poses sit on a cream ground there too, so the charcoal outlines stay visible. No shadows on the art. */
.sp-logo-plate { display: inline-block; line-height: 0; }
:root[data-theme="dark"] .hero-art .art { background: var(--sp-cream); border-radius: 50%; padding: 5%; }
.hero-tear { margin: 8px 0 0; }

.ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 40px 0 10px; }
.way { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 6px; position: relative; box-shadow: var(--shadow); }
.way h3 { margin: 0 0 .2rem; font-size: 1.25rem; }
.way p { font-size: 14.5px; margin: .3rem 0 .8rem; }
.way-n { position: absolute; top: 14px; right: 16px; font: 400 2rem/1 var(--serif); color: var(--tan); }

/* ---------------------------------------------------------------- sections */
.sec { padding: 56px 0 10px; border-top: 1px solid var(--line); margin-top: 36px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.pose { height: 112px; width: auto; border-radius: 22px; flex: none; box-sizing: border-box; }
:root[data-theme="dark"] .pose { background: var(--sp-cream); padding: 6px; }
.sec > p, .sec > .split p { max-width: 75ch; }
/* callouts: small receipts with a mono label and the mascot's expression (focused, idea, surprised, oops) */
.aside, .warn { position: relative; max-width: 75ch; background: var(--receipt); color: var(--sp-ink); font-size: 15px; line-height: 1.55; padding: 16px 18px calc(16px + var(--tear)) 88px; min-height: 72px; box-sizing: border-box;
  --tear: 7px; -webkit-mask: linear-gradient(#000 0 0) top/100% calc(100% - var(--tear)) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/calc(var(--tear) * 2) var(--tear) repeat-x;
  mask: linear-gradient(#000 0 0) top/100% calc(100% - var(--tear)) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/calc(var(--tear) * 2) var(--tear) repeat-x;
  filter: drop-shadow(0 1px 0 rgba(43, 43, 43, .12)); }
.aside::before, .warn::before { content: ""; position: absolute; left: 16px; top: 14px; width: 56px; height: 56px; background: url(brand/focused.svg) center/contain no-repeat; }
.aside.tip::before { background-image: url(brand/idea.svg); }
.aside.important::before { background-image: url(brand/surprised.svg); }
.warn::before { background-image: url(brand/oops.svg); }
.aside code, .warn code { background: var(--sp-green-soft); color: var(--sp-ink); }
.aside a { color: var(--sp-navy); }
.callout-k, .warn strong { display: block; font: 700 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--sp-green); margin-bottom: 2px; }
.aside.important .callout-k, .warn strong { color: var(--sp-red); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 36px; align-items: start; }
.split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.split-art { position: sticky; top: 20px; }
ul.ticks { padding-left: 0; list-style: none; } ul.ticks li { padding-left: 26px; position: relative; margin: 6px 0; }
ul.ticks li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 10px; height: 6px; border-left: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(-45deg); }

/* ---------------------------------------------------------------- code */
.code-wrap, .term { position: relative; margin: 10px 0 14px; }
pre.code, .term { background: var(--code-bg); color: var(--code-ink); border-radius: 12px; font: 13px/1.6 var(--mono); }
pre.code { margin: 0; padding: 14px 16px; overflow: auto; tab-size: 2; }
pre.code code, .term code { background: none; padding: 0; color: inherit; font-size: inherit; }
pre.code.small { font-size: 11.5px; line-height: 1.5; padding: 9px 11px; border-radius: 9px; }
.code .k { color: #9FD3B4; } .code .s, .term .s { color: #F2C98F; } .code .n { color: #F4A79E; } .code .b { color: #B9B5F5; }
.code .c, .term .c { color: #8A9A90; font-style: italic; } .code .p { color: #8A9A90; } .code .v { color: #E9E4D4; }
.term .k { color: #9FD3B4; font-weight: 700; } .term .b { color: #B9B5F5; } .term .v { color: #E9E4D4; } .term .p { color: #8A9A90; }
.copy { position: absolute; top: 8px; right: 8px; min-height: 28px; font: 600 11px var(--font); color: var(--code-ink); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); border-radius: 7px; padding: 4px 9px; cursor: pointer; opacity: .75; z-index: 2; }
.copy:hover, .copy:focus-visible { opacity: 1; background: rgba(255, 255, 255, .16); }
.copy.done { color: #9FD3B4; border-color: #9FD3B4; opacity: 1; }
.term-cmd { position: relative; padding: 11px 80px 11px 16px; white-space: pre-wrap; word-break: break-word; }
.prompt { color: var(--tan); user-select: none; }
/* the command on ink, what it printed on a white receipt torn off under it */
.term { background: none; border-radius: 0; }
.term-cmd { background: var(--code-bg); border-radius: var(--radius); }
.term-out { margin: 0 6px; padding: 12px 16px calc(14px + var(--tear)); background: var(--receipt); color: var(--sp-ink); font: 12.5px/1.55 var(--mono); white-space: pre; overflow: auto; max-height: 420px;
  --tear: 7px; -webkit-mask: linear-gradient(#000 0 0) top/100% calc(100% - var(--tear)) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/calc(var(--tear) * 2) var(--tear) repeat-x;
  mask: linear-gradient(#000 0 0) top/100% calc(100% - var(--tear)) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/calc(var(--tear) * 2) var(--tear) repeat-x; }
.term-out .s { color: var(--sp-navy); } .term-out .c, .term-out .p { color: #6B675E; } .term-out .k { color: var(--sp-green); } .term-out .b { color: var(--sp-navy); } .term-out .v { color: var(--sp-ink); }
.term-exit { position: absolute; right: 18px; bottom: 16px; font: 700 11px var(--mono); color: var(--sp-red); }
.code-file { margin: 10px 0 14px; }
.code-name { font: 600 12px var(--mono); color: var(--muted); margin: 0 0 6px 2px; }
.code-file .code-wrap { margin: 0; }
details.peek { margin: 14px 0; }
details.peek > summary, .fields-wrap > summary { cursor: pointer; font-weight: 700; color: var(--accent); list-style: none; display: inline-flex; gap: 8px; align-items: center; }
details > summary::-webkit-details-marker { display: none; }
details.peek > summary::before, .fields-wrap > summary::before { content: "▸"; transition: transform .15s; display: inline-block; }
details[open] > summary::before { transform: rotate(90deg); }

/* ---------------------------------------------------------------- paper */
.paper { margin: 0; background: var(--paper); padding: 22px 32px; display: inline-block; position: relative; box-shadow: var(--shadow); border-radius: 3px;
  --zz: 7px;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 90deg, #0000 91deg) bottom / calc(2 * var(--zz)) 51% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 90deg, #0000 91deg) top / calc(2 * var(--zz)) 51% repeat-x;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 90deg, #0000 91deg) bottom / calc(2 * var(--zz)) 51% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 90deg, #0000 91deg) top / calc(2 * var(--zz)) 51% repeat-x;
  filter: drop-shadow(0 6px 10px rgba(43, 43, 43, .14)); box-shadow: none; }
.paper.p58 { padding: 22px 40px; }
.paper img { display: block; max-width: 100%; height: auto; mix-blend-mode: multiply; image-rendering: pixelated; }
.paper.tall { max-height: 560px; overflow: hidden; }
.paper.tall::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; background: linear-gradient(transparent, var(--paper)); }

/* ---------------------------------------------------------------- galleries */
.gallery { display: grid; gap: 22px; align-items: start; margin: 14px 0; }
.gallery.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .gallery.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gal { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.gal .paper { padding: 12px 14px; }
.gal figcaption { font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.gal figcaption .code-wrap { margin: 0; }
.gal figcaption code { align-self: flex-start; }
.strip-gallery { display: flex; gap: 22px; overflow-x: auto; padding: 16px 4px 22px; scroll-snap-type: x proximity; align-items: flex-start; }
.strip-gallery .gal { flex: 0 0 236px; scroll-snap-align: start; }
.strip-gallery .paper { max-height: 520px; overflow: hidden; }
.strip-gallery .paper img { image-rendering: auto; }
.strip-gallery .zoom { text-decoration: none; display: block; }
.tune-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 18px 0; }
.tune-grid .paper img { image-rendering: auto; }
.tune-name { font: 700 12px var(--mono); color: var(--hi); text-transform: uppercase; letter-spacing: .1em; }
.gallery .paper img { image-rendering: auto; }

/* ---------------------------------------------------------------- anatomy */
.anatomy-bar, .blocks-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin: 18px 0; }
.anatomy-bar details.peek { margin: 0; }
.seg { display: inline-flex; align-items: center; background: var(--panel); border: 1px solid var(--line-2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 13px var(--font); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--bg); }
.seg.small button { font-size: 12px; padding: 4px 10px; }
.seg-label { font-size: 13px; color: var(--muted); padding: 0 8px 0 6px; }
.anat { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 72px; margin-top: 20px; background: #1E2522; border-radius: 22px; padding: 36px 32px; box-shadow: var(--shadow); }
.anat-receipt { position: relative; z-index: 1; }
.anat-receipt .paper { padding: 26px 32px; }
.anat-img { position: relative; line-height: 0; }
.reg { position: absolute; left: -10px; right: -10px; border: 1.5px dashed rgba(47, 93, 70, .0); border-radius: 6px; transition: background .15s, border-color .15s; }
.anat:hover .reg { border-color: rgba(47, 93, 70, .28); }
.reg span { position: absolute; top: 2px; left: -6px; transform: translateX(-100%); font: 600 10.5px/1 var(--mono); color: #CFCABB; background: #2E3833; border-radius: 4px; padding: 3px 6px; opacity: 0; transition: opacity .15s; white-space: nowrap; }
.reg.on { background: rgba(212, 165, 116, .16); border-color: var(--golden-tan); }
.reg.on span { opacity: 1; }
.anat-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: visible; }
.anat-lines path { fill: none; stroke: #5E6D65; stroke-width: 1.2; }
.anat-lines path.on { stroke: var(--golden-tan); stroke-width: 2; }
.anat-lines circle { fill: #5E6D65; } .anat-lines circle.on { fill: var(--golden-tan); }
.anat-notes { list-style: none; margin: 0; padding: 0; position: relative; }
.note { position: absolute; left: 0; right: 0; color: #DCD7C8; padding: 2px 0 0; transition: transform .15s; }
.note-head { display: flex; align-items: center; gap: 8px; }
.note-head a { text-decoration: none; }
.note-head code { background: #2E3833; color: #9FD3B4; font-size: 13px; font-weight: 700; padding: 3px 8px; }
.note-n { font: 700 11px/1 var(--mono); width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--golden-tan); color: #1E2522; }
.note-rows { font: 11px var(--mono); color: #8A9A90; margin-left: auto; }
.note p { margin: 4px 0 6px; font-size: 13px; line-height: 1.45; color: #C9C4B4; }
.note pre.code { background: #141A17; }
.note.on .note-head code { background: var(--golden-tan); color: #1E2522; }
.note.on pre.code { outline: 1px solid var(--golden-tan); }

/* ---------------------------------------------------------------- blocks */
.chips-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-nav a { font: 600 13px var(--font); text-decoration: none; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--ink); background: var(--panel); }
.chips-nav a:hover { border-color: var(--accent); color: var(--accent); }
.group { margin-top: 30px; }
.group-head { display: flex; align-items: baseline; gap: 16px; border-bottom: 2px solid var(--accent); padding-bottom: 8px; margin-bottom: 6px; }
.group-head h3 { margin: 0; font-size: 1.8rem; }
.group-head p { margin: 0; color: var(--muted); }
.block { padding: 26px 0 30px; border-bottom: 1px dashed var(--line-2); }
.block-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.block-head h4 a { text-decoration: none; }
.block-head h4 code { font-size: 1.25rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 8px; }
.alias { font: 600 12px var(--mono); color: var(--muted); border: 1px dashed var(--line-2); border-radius: 6px; padding: 2px 7px; }
.alias::before { content: "alias "; font-family: var(--font); font-weight: 400; }
.tier { margin-left: auto; font: 700 10.5px var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-2); padding: 3px 8px; border-radius: 99px; }
.block-desc { font-size: 1.04rem; margin: 8px 0 14px; max-width: 80ch; }
.example { display: grid; grid-template-columns: minmax(280px, 1fr) auto; gap: 26px; align-items: start; margin: 16px 0 22px; }
.ex-code { min-width: 0; position: sticky; top: 16px; }
.example.static .ex-code { position: static; }
.ex-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--code-bg); border-radius: 12px 12px 0 0; padding: 9px 12px 0 16px; }
.ex-title { font: 600 12.5px var(--font); color: #9FD3B4; }
.ex-bar .copy { position: static; }
.ex-bar + pre.code { border-radius: 0 0 12px 12px; padding-top: 10px; }
.ex-note { font-size: 13.5px; color: var(--muted); margin: 8px 2px; }
.ex-render { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.ex-render .paper { min-width: 260px; padding: 18px 22px; }
.dims { font: 11.5px var(--mono); color: var(--muted); margin: 0; }
.warn { margin-top: 10px; font: 12.5px/1.5 var(--mono); padding-left: 84px; }
.warn::before { width: 52px; height: 52px; }
.fields-wrap { margin-top: 6px; }
.fields-wrap .count { font: 600 11px var(--mono); background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 1px 7px; }
/* tables: receipt line items, square corners and dotted rules */
table.fields { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; background: var(--panel); border-radius: 2px; overflow: hidden; box-shadow: 0 1px 0 var(--line-2); }
table.fields th { text-align: left; font: 700 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); background: none; padding: 11px 12px 8px; border-bottom: 2px dashed var(--line-2); }
table.fields td { padding: 9px 12px; border-top: 2px dotted var(--line); vertical-align: top; }
table.fields td:first-child { white-space: nowrap; }
table.fields.cli td:first-child { white-space: pre-wrap; width: 34%; }
.enum { font: 12px var(--mono); color: var(--enum); }
.req { margin-left: 6px; font: 700 10px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--hi); }
.falias { display: block; font: 11.5px var(--mono); color: var(--muted); }
.common-note { font-size: 13.5px; color: var(--muted); }
.block.hide, .group.hide, .nav-block.hide, .nav-group.hide { display: none; }
.no-match { position: relative; padding: 18px 18px 18px 96px; min-height: 92px; box-sizing: border-box; background: var(--receipt); color: var(--sp-ink); border-radius: 4px; border: 2px dashed var(--line-2); }
.no-match::before { content: ""; position: absolute; left: 18px; top: 14px; width: 64px; height: 64px; background: url(brand/thinking.svg) center/contain no-repeat; }
.no-match b { display: block; font: 400 1.25rem/1.2 var(--serif); color: var(--sp-green); margin-bottom: 4px; }
.no-match .linkish { color: var(--sp-navy); }
.linkish { border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------------------------------------------------------------- footer, lightbox */
.foot-tear { margin-top: 60px; }
.foot { display: flex; gap: 18px; align-items: center; padding: 26px 0; font-size: 14px; }
.foot-sign { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); margin: 0 0 6px; }
.foot img { display: block; }
.foot p { margin: 2px 0; }
.lightbox { position: fixed; inset: 0; background: rgba(43, 43, 43, .85); z-index: 70; display: flex; justify-content: center; justify-content: safe center; overscroll-behavior: contain; overflow: auto; padding: 40px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { background: var(--sp-white); padding: 34px 32px; --tear: 10px; -webkit-mask: linear-gradient(#000 0 0) center/100% calc(100% - 2 * var(--tear)) no-repeat, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top/calc(var(--tear) * 2) var(--tear) repeat-x, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/calc(var(--tear) * 2) var(--tear) repeat-x; mask: linear-gradient(#000 0 0) center/100% calc(100% - 2 * var(--tear)) no-repeat, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top/calc(var(--tear) * 2) var(--tear) repeat-x, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/calc(var(--tear) * 2) var(--tear) repeat-x; image-rendering: pixelated; height: auto; align-self: flex-start; max-width: none; }

/* ---------------------------------------------------------------- always */
[hidden] { display: none !important; }
html, body { overflow-x: clip; } /* last guard only: nothing below is meant to stick out */
.ln { display: block; }
.ln:empty::before { content: "\200b"; }
.term-cmd .ln { display: inline; }
.term-cmd .ln + .ln::before { content: "\A"; }
pre.code.sh { padding-right: 76px; white-space: pre-wrap; overflow-x: hidden; overflow-wrap: break-word; }
pre.code.sh .ln { padding-left: calc(var(--h, 2) * 1ch); text-indent: calc(var(--h, 2) * -1ch); }
.copy::after { content: ""; position: absolute; inset: -8px -6px; }
.ex-bar .copy { position: relative; }
.tap { display: none; }
@media (hover: none) { .tap { display: inline; } }
.topbar, .drawer-close, .scrim, .reg-n { display: none; }
.lb-close { position: fixed; top: calc(env(safe-area-inset-top) + 12px); right: max(12px, env(safe-area-inset-right)); min-height: 44px; z-index: 2; }
.lb-close > span { font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; font-size: .82rem; }
body.lb-open { overflow: hidden; }
.note pre.code { font-size: 10.5px; line-height: 1.45; padding: 7px 10px; max-height: 62px; overflow: hidden; position: relative; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.note.on { z-index: 5; }
.note.on pre.code { max-height: none; -webkit-mask-image: none; mask-image: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.gallery > *, .split > *, .ways > *, .tune-grid > *, .example > *, .anat > * { min-width: 0; }

/* ---------------------------------------------------------------- narrower desktops and tablets */
@media (max-width: 1320px) {
  .example { grid-template-columns: minmax(0, 1fr); }
  .ex-code { position: static; }
  .anat { gap: 0 48px; padding: 28px 20px; }
}
@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 520px; }
  .split, .split.even { grid-template-columns: minmax(0, 1fr); } .split-art { position: static; }
  .tune-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- 900px and down: top bar and a drawer */
@media (max-width: 900px) {
  html { scroll-padding-top: 76px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 30;
    padding: calc(env(safe-area-inset-top) + 8px) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
    background: var(--bg); background: color-mix(in srgb, var(--bg) 90%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  .top-brand { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--accent); }
  .top-brand img { display: block; width: 132px; height: auto; }
  .top-home { margin-left: auto; display: flex; align-items: center; min-height: 44px; padding: 0 12px; font-weight: 600; color: var(--accent); text-decoration: none; }
  .menu { display: grid; align-content: center; gap: 5px; width: 44px; height: 44px; padding: 0 11px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; flex: none; }
  .menu span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
  /* The drawer: off screen and hidden when closed, so it can't be tapped, focused or scrolled to. */
  .sidebar { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; height: auto; width: min(340px, 86vw); transform: translateX(-100%); visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s; box-shadow: var(--shadow); overscroll-behavior: contain;
    padding: calc(env(safe-area-inset-top) + 14px) 14px calc(env(safe-area-inset-bottom) + 14px) max(16px, env(safe-area-inset-left)); }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .22s ease; }
  body.nav-open { overflow: hidden; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(12, 15, 13, .55); }
  .scrim[hidden] { display: none; }
  .side-head { gap: 8px; } .theme { margin-left: auto; }
  .theme, .drawer-close { width: 44px; height: 44px; border-radius: 12px; }
  .drawer-close { display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); cursor: pointer; }
  .drawer-close svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
  .search input { font-size: 16px; padding: 11px 0; } /* under 16px, iOS zooms the page on focus and leaves it zoomed */
  .nav { font-size: 16px; }
  .nav > a { min-height: 44px; padding: 8px 12px; }
  .nav-block { margin: 2px; }
  .nav-block code { display: inline-flex; align-items: center; min-height: 40px; font-size: 14px; padding: 0 10px; border-color: var(--line); }
  .ways, .gallery.g3 { grid-template-columns: minmax(0, 1fr); }
  .pose { height: 84px; }
  /* anatomy: the receipt, then the notes as a list; numbers on the receipt's edge instead of labels over it */
  .anat { display: block; padding: 16px 12px; border-radius: 18px; }
  .anat-lines { display: none; }
  .anat-receipt { max-width: 520px; margin: 0 auto; }
  .anat-receipt .paper { display: block; padding: 18px 12px 18px 34px; }
  .reg { left: 0; right: 0; pointer-events: none; border-color: rgba(47, 93, 70, .22); }
  .reg span { display: none; }
  .reg-n { display: grid; place-items: center; position: absolute; left: -29px; top: 1px; width: 22px; height: 22px; border-radius: 50%; background: var(--golden-tan); color: #1E2522; font: 700 11px/1 var(--mono); }
  .reg.on .reg-n { box-shadow: 0 0 0 3px rgba(212, 165, 116, .45); }
  .anat-notes { margin-top: 18px; display: grid; gap: 10px; height: auto !important; }
  .note { position: static; padding: 12px; background: #262F2A; border-radius: 12px; cursor: pointer; }
  .note-head code { font-size: 14px; }
  .note-n { width: 24px; height: 24px; font-size: 12px; flex: none; }
  .note p { font-size: 14.5px; }
  .note pre.code { font-size: 12px; max-height: none; -webkit-mask-image: none; mask-image: none; }
  .note.on { outline: 2px solid var(--golden-tan); }
  .note.on pre.code { box-shadow: none; outline: 0; }
}

/* ---------------------------------------------------------------- phones */
@media (max-width: 700px) {
  body { font-size: 16px; }
  main { padding: 0 max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); overflow-wrap: break-word; }
  main p, main li, main td, figcaption { overflow-wrap: anywhere; }
  h2 { font-size: 2rem; } h3 { font-size: 1.3rem; margin-top: 1.8rem; }
  /* hero: stacked, the mascot smaller, the receipt it held drops (it's shown in Getting started) */
  .hero { gap: 6px; padding: 22px 0 8px; }
  .hero-art { min-height: 0; max-width: none; display: flex; justify-content: center; }
  .hero-art .art { width: min(230px, 64%); }
  .tagline { font-size: 1.3rem; }
  .lede { font-size: 1.05rem; }
  .hero-cta .btn { flex: 1 1 100%; justify-content: center; min-height: 48px; }
  .ways { margin-top: 18px; gap: 12px; }
  .way p { font-size: 15px; }
  .sec { padding-top: 34px; margin-top: 22px; }
  .sec-head { align-items: center; gap: 14px; }
  .sec-head > div { min-width: 0; }
  .pose { height: 68px; border-radius: 16px; }
  .split { gap: 14px; }
  /* code: lines wrap with a hanging indent (set per line by the generator), so nothing scrolls sideways */
  pre.code, .term-out { white-space: pre-wrap; overflow-x: hidden; overflow-wrap: break-word; }
  .ln { padding-left: calc(var(--h, 2) * 1ch); text-indent: calc(var(--h, 2) * -1ch); }
  .term-cmd .ln { padding: 0; text-indent: 0; }
  pre.code { padding: 12px 14px; font-size: 13px; }
  pre.code.sh { padding-right: 82px; }
  .term-cmd { padding: 12px 82px 12px 14px; }
  .term-out { font-size: 12px; padding: 10px 14px 12px; max-height: 360px; overflow-y: auto; }
  .copy { top: 7px; right: 7px; min-height: 30px; padding: 5px 11px; font-size: 12px; }
  .ex-bar .copy { min-height: 30px; }
  /* receipts: full width, tap to zoom */
  .paper, .ex-render .paper, .split-art .paper { display: block; width: 100%; max-width: 100%; min-width: 0; padding: 14px 12px; }
  .paper img { width: 100%; image-rendering: auto; cursor: zoom-in; }
  .paper.tall { max-height: 520px; }
  /* block examples: the render, then its YAML */
  .block { padding: 22px 0 24px; }
  .block-head h4 code { font-size: 1.2rem; }
  .example { display: flex; flex-direction: column; gap: 12px; margin: 14px 0 20px; }
  .ex-render { order: -1; align-items: stretch; gap: 8px; }
  .ex-render .seg { align-self: flex-start; }
  .seg button, .seg.small button { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .anatomy-bar, .blocks-bar { gap: 12px; }
  .seg-label { flex-basis: 100%; padding: 4px 6px 2px; display: none; }
  .chips-nav { gap: 8px; }
  .chips-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; font-size: 14px; }
  details.peek > summary, .fields-wrap > summary { min-height: 44px; }
  .gallery.g2, .tune-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .gal .paper { padding: 10px 8px; }
  .strip-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; overflow: visible; padding: 10px 0 14px; }
  .strip-gallery .gal { flex: none; }
  .strip-gallery .paper { max-height: 340px; }
  .gal figcaption { font-size: 14px; }
  .gal figcaption code { align-self: stretch; overflow-wrap: anywhere; }
  /* tables: one card per row */
  table.fields { display: block; background: none; box-shadow: none; border-radius: 0; overflow: visible; font-size: 15px; }
  table.fields thead { display: none; }
  table.fields tbody { display: grid; gap: 8px; }
  table.fields tr { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 6px 12px; align-items: baseline; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
  table.fields td { display: block; padding: 0; border: 0; min-width: 0; }
  table.fields td:first-child, table.fields.cli td:first-child { white-space: normal; width: auto; font-weight: 600; }
  table.fields td:nth-child(2) { justify-self: end; text-align: right; color: var(--muted); font-size: 14px; }
  table.fields td:nth-child(n+3), table.fields td:has(> .enum) { grid-column: 1 / -1; justify-self: stretch; text-align: left; }
  table.fields td:has(> .enum) .enum { font-size: 13px; }
  table.fields .def::before, table.tune td:nth-child(2)::before { content: "Default "; font: 600 12px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; }
  table.tune td:nth-child(3)::before { content: "Also "; font: 600 12px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; }
  table.fields .def.none { display: none; }
  table.fields .falias { display: inline; margin-left: 8px; }
  table.fields.two tr, table.fields.cli tr { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  table.fields.two td:nth-child(2), table.fields.cli td:nth-child(2) { justify-self: stretch; text-align: left; color: var(--ink); font-size: 15px; }
  table.fields.cli td:first-child code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .hero-art .hero-paper { display: none; }
  .hero-art .art { width: min(200px, 56%); }
  .code .b, .term .b { white-space: nowrap; }
  .foot { flex-direction: column; align-items: flex-start; gap: 10px; }
  .lightbox { padding: calc(env(safe-area-inset-top) + 64px) 8px calc(env(safe-area-inset-bottom) + 24px); justify-content: flex-start; }
  .lightbox img { padding: 22px 12px; }
}
.demo-k { font: 700 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--hi); margin: 14px 0 6px; }
.demo-fig { margin: 0; } .demo-fig figcaption { text-align: center; }
