/* ---------- inner pages ---------- */
.page-head { padding-top: clamp(36px, 6vw, 80px); padding-bottom: clamp(24px, 3vw, 36px); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); margin: 0 0 22px; padding: 0; list-style: none; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs li + li::before { content: "/"; margin-right: 8px; opacity: .6; }
.page-title { font-size: clamp(2.75rem, 1.4rem + 5vw, 5.5rem); line-height: .92; letter-spacing: -.03em; font-variation-settings: "wdth" 118; margin-bottom: 18px; text-wrap: balance; }
.page-lead { font-size: clamp(1.125rem, 1rem + .5vw, 1.375rem); color: var(--ink-2); max-width: 47ch; text-wrap: pretty; margin-bottom: 0; }
.head-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: clamp(24px, 4vw, 56px); align-items: end; }
/* the title scales with its column too, so a long first word never strands "An" on a line of its own */
.head-grid > :first-child { container-type: inline-size; }
.head-grid .page-title { font-size: min(clamp(2.75rem, 1.4rem + 5vw, 5.5rem), 12.5cqi); }
@media (max-width: 900px) { .head-grid { grid-template-columns: 1fr; align-items: start; } }
.head-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }

.spec { margin: 0; border-top: 2px solid var(--ink); }
.spec div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.spec dt { font-family: var(--font-mono); font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.spec dd { margin: 0; font-size: .9375rem; color: var(--ink); }
.spec dd a { font-weight: 600; }

/* viewer */
.viewer { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); overflow: hidden; box-shadow: var(--shadow-1); }
.viewer-stage { position: relative; height: clamp(340px, 46vw, 560px); background:
  radial-gradient(80% 90% at 50% 40%, var(--surface), color-mix(in srgb, var(--tint, var(--surface-2)) var(--stub-mix), var(--surface-2))); }
/* Each project page takes a faint tint from its object: PC violet, felt green, ticket amber,
   blueprint blue, owl navy, card orange. */
#fpslabs { --tint: var(--p-fpslabs); }
#briarwatch { --tint: var(--p-briarwatch); }
#micandmore { --tint: var(--p-micandmore); }
#renostack { --tint: var(--p-renostack); }
#pingowl { --tint: var(--p-pingowl); }
#skills { --tint: var(--p-skills); }
/* the mic and the owl are tall and narrow: a shorter stage leaves less empty floor around them */
[data-viewer="mic"] .viewer-stage, [data-viewer="owl"] .viewer-stage { height: clamp(320px, 36vw, 460px); }
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.viewer canvas:active { cursor: grabbing; }
.viewer-tip { position: absolute; left: 16px; bottom: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; pointer-events: none; }
.viewer-tip svg { width: 14px; height: 14px; }
.viewer-tip { transition: opacity .4s ease; }
.viewer.was-turned .viewer-tip { opacity: 0; } /* the hint has done its job */
@media (hover: none) { .viewer-tip { display: none; } } /* touch: a swipe turns the model; no label over it */
.viewer-badge { position: absolute; left: 16px; top: 14px; color: var(--muted); pointer-events: none; display: flex; gap: 8px; align-items: center; }
.viewer-readout { position: absolute; right: 16px; top: 14px; pointer-events: none; text-align: right; }
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.viewer-bar .grp { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.viewer-bar .lbl { color: var(--muted); }
.no-3d .viewer { display: flex; flex-direction: column; }
.no-3d .viewer-stage { height: auto; min-height: 0; background: none; }
/* Without WebGL, controls that only drive a 3D model would do nothing, so they go too. */
.no-3d .viewer canvas, .no-3d .viewer-tip, .no-3d .viewer-badge, .no-3d .viewer-readout,
.no-3d [data-viewer]:not([data-viewer="d20"]) .viewer-bar, .no-3d [data-replay] { display: none; }
.no-3d [data-viewer="d20"] .viewer-bar { border-top: 0; padding-top: 0; }
.viewer-fallback { display: none; padding: 20px; color: var(--muted); font-size: .9375rem; max-width: calc(52ch + 40px); }
.no-3d .viewer-fallback { display: block; order: -1; }
/* A viewer whose model failed to build falls back the same way. */
.viewer.is-failed { display: flex; flex-direction: column; }
.viewer.is-failed .viewer-stage { height: auto; min-height: 0; background: none; }
.viewer.is-failed canvas, .viewer.is-failed .viewer-tip, .viewer.is-failed .viewer-badge, .viewer.is-failed .viewer-readout,
.viewer.is-failed:not([data-viewer="d20"]) .viewer-bar { display: none; }
.viewer.is-failed .viewer-fallback { display: block; order: -1; }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-3); gap: 2px; }
.seg button { border: 0; background: none; cursor: pointer; padding: 6px 12px; border-radius: 999px; font-size: .8125rem; font-weight: 600; color: var(--muted); min-height: 32px; transition: background-color .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); }
.seg button:not([aria-pressed="true"]):hover { color: var(--ink); }
.swatches { display: inline-flex; gap: 6px; }
.swatch { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; background: var(--sw); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .875rem; font-weight: 600; background: none; border: 0; padding: 4px 0; }
.switch .track { width: 40px; height: 24px; border-radius: 999px; background: var(--track-off); position: relative; transition: background-color .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .25s var(--ease-out); }
.switch[aria-pressed="true"] .track { background: var(--switch-on); }
.switch[aria-pressed="true"] .track::after { transform: translateX(16px); }

/* article body */
/* the body shares the page head's two columns: text and modules under the title, the contents
   list under the spec card (never narrower than 640px for the demos) */
.body-grid { display: grid; grid-template-columns: minmax(min(100%, 640px), 1.5fr) minmax(220px, 1fr); gap: clamp(24px, 4vw, 56px); margin-top: clamp(40px, 6vw, 72px); }
@media (max-width: 1000px) { .body-grid { grid-template-columns: 1fr; } .toc { display: none; } }
.prose { min-width: 0; }
.prose :where(p, h2, h3, h4, ul, ol):not([class]) { max-width: 47ch; }
.prose .callout:not(.cta-box) { max-width: 54ch; }
.prose .chart-group h4 { max-width: none; }
.prose h2 { font-family: var(--font-display); font-weight: 800; font-variation-settings: "wdth" 110; font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.15rem); letter-spacing: -.02em; line-height: 1.05; margin: 0 0 16px; }
.prose section + section { margin-top: clamp(40px, 5vw, 64px); }
.prose h3 { font-size: 1.125rem; margin: 26px 0 8px; letter-spacing: -.01em; }
.prose :where(p, ul:not([class]) > li, ol:not([class]) > li) { color: var(--ink-2); text-wrap: pretty; }
:where(p, li, dd, figcaption, small) { text-wrap: pretty; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose :where(ul, ol):not([class]) { padding-left: 1.2em; margin: 0 0 1em; }
.prose :where(ul, ol):not([class]) > li { margin-bottom: .55em; }
.prose :where(ul, ol):not([class]) > li::marker { color: var(--accent); }
.prose .num { font-family: var(--font-mono); font-size: .92em; }
.prose code { font-family: var(--font-mono); font-size: .86em; background: var(--surface-3); padding: .12em .4em; border-radius: 5px; }
.prose a:not(.btn) { color: var(--accent-ink); font-weight: 600; }
.callout { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); padding: 16px 20px; border-radius: var(--radius-sm); margin: 20px 0; }
.callout p { margin: 0; color: var(--ink); max-width: 50ch; }
.callout .mono { color: var(--muted); display: block; margin-bottom: 6px; }
.cta-box { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; justify-content: space-between; }
.cta-box p { flex: 1 1 280px; }
.cta-box .btn { flex: none; }
.formula { font-family: var(--font-mono); font-size: clamp(1rem, .9rem + .6vw, 1.35rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 20px; margin: 16px 0 18px; overflow-x: auto; color: var(--ink); white-space: nowrap; }
.formula sup { font-size: .62em; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; margin: 12px 0 20px; }
.table th, .table td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-family: var(--font-mono); font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; text-wrap: balance; }
.table td { color: var(--ink-2); }
.table td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.prose .table-wrap { max-width: 54ch; }
.toc { position: sticky; top: calc(var(--head-h) + 24px); align-self: start; }
.toc p { color: var(--muted); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; text-decoration: none; color: var(--muted); font-size: .9375rem; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--ink); }
.toc a.is-on { color: var(--ink); border-left-color: var(--accent); font-weight: 600; }
.toc .toc-meta { margin-top: 24px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 4vw, 56px); margin-top: clamp(56px, 7vw, 96px); }
.pager a { display: block; padding: 16px 0 4px; border-top: 2px solid var(--ink); text-decoration: none; transition: border-color .2s, color .2s; }
.pager a:hover { border-top-color: var(--accent); color: var(--accent-ink); }
.pager .mono { color: var(--muted); display: block; margin-bottom: 4px; }
.pager b { font-family: var(--font-display); font-weight: 800; font-variation-settings: "wdth" 112; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem); letter-spacing: -.02em; line-height: 1.05; }
.pager .next { text-align: right; }
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager .next { text-align: left; } }

