/* page heads */
.page-head { padding: 32px 0 14px; }
.page-head h1 { margin-bottom: 20px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 14px; }
.tools .field { flex: 1 1 260px; width: auto; }
.tools .dd { flex: 0 0 200px; }
.tools .dd .field { width: 100%; }
/* styled dropdown (lib/select.js) over a hidden native select */
.dd { position: relative; }
.dd-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; font-weight: 500; cursor: pointer; transition: box-shadow 0.15s; }
.dd-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn::after { content: ''; flex: none; width: 9px; height: 9px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: translateY(-3px) rotate(45deg); transition: transform 0.15s; }
.dd-btn:hover { box-shadow: inset 0 -5px 0 var(--peach); }
.dd-btn[aria-expanded='true'] { box-shadow: inset 0 -5px 0 var(--cobalt); }
.dd-btn[aria-expanded='true']::after { transform: translateY(2px) rotate(-135deg); }
.dd-list { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: 300px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: var(--card); border: 2px solid var(--line); border-radius: 6px 22px 6px 6px; box-shadow: var(--shadow); animation: pop 0.15s; }
.dd-list:focus { outline: none; }
.dd-list:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.dd-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 4px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.dd-list li::before { content: ''; flex: none; width: 12px; height: 12px; border: 2px solid var(--line); border-radius: 2px 6px 2px 2px; }
.dd-list li.act { background: var(--blush); }
.dd-list li[aria-selected='true'] { font-weight: 700; }
.dd-list li[aria-selected='true']::before { background: var(--cobalt); }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--card); }
.seg button { border: 0; background: none; padding: 0 18px; font-weight: 700; min-height: 42px; }
.seg button + button { border-left: 2px solid var(--line); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.seg-sm button { min-height: 32px; padding: 0 12px; font-size: 0.85rem; }
.sec-head { margin-bottom: 26px; }
.sec-head h2 { margin-bottom: 8px; }
.empty { padding: 50px 0; text-align: center; color: var(--muted); }
.count { color: var(--muted); margin: 0 0 12px; }

/* legend chips */
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 0; }
.leg { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 2px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 500; font-size: 0.92rem; }
.leg i { width: 12px; height: 12px; border-radius: 50%; background: var(--tc); border: 1.5px solid var(--line); }
.leg[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.leg[aria-pressed='true'] i { border-color: var(--paper); }

/* ---------- home: diagonal split stage (one screen) ---------- */
.stage { position: relative; height: clamp(620px, calc(100svh - 66px), 900px); overflow: hidden; border-bottom: 2px solid var(--line); }
.stage-art { position: absolute; inset: 0; --y0: 90%; --y1: 10%; --h: 44px; --ts: 70px; opacity: 0; transition: opacity 0.3s; }
.stage-art.ready { opacity: 1; }
.stage-art > i { position: absolute; inset: 0; }
.tint { background: linear-gradient(160deg, var(--tint), color-mix(in srgb, var(--tint) 60%, var(--paper)));
  clip-path: polygon(0 calc(var(--y0) + var(--h) + 10px), 100% calc(var(--y1) + var(--h) + 10px), 100% 100%, 0 100%); }
.band-peach { background: var(--peach); clip-path: polygon(0 calc(var(--y0) - var(--h) - 12px), 100% calc(var(--y1) - var(--h) - 12px), 100% calc(var(--y1) - var(--h)), 0 calc(var(--y0) - var(--h))); }
.band-cobalt { background: var(--cobalt); clip-path: polygon(0 calc(var(--y0) - var(--h)), 100% calc(var(--y1) - var(--h)), 100% calc(var(--y1) + var(--h)), 0 calc(var(--y0) + var(--h))); }
.band-ink { background: var(--ink); clip-path: polygon(0 calc(var(--y0) + var(--h)), 100% calc(var(--y1) + var(--h)), 100% calc(var(--y1) + var(--h) + 10px), 0 calc(var(--y0) + var(--h) + 10px)); }
.chain { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chain line { stroke: #fff6f1; stroke-width: 3; stroke-dasharray: 2 11; stroke-linecap: round; opacity: 0.75; animation: flow 1.3s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -26; } }
/* synthesis spark: one pass every 8s (LOOP in home.js), start/end points set by JS */
.stage-art > .spark { inset: auto; left: 0; top: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff6f1; box-shadow: 0 0 0 5px rgba(255, 246, 241, 0.22), 0 0 26px 10px rgba(255, 154, 98, 0.75); animation: run 8s linear infinite; }
@keyframes run { from { transform: translate(var(--sx), var(--sy)); } to { transform: translate(var(--ex), var(--ey)); } }
.word-tile { position: absolute; display: grid; place-items: center; width: var(--ts); height: calc(var(--ts) * 1.1); border: 2px solid #26102f; border-radius: 6px calc(var(--ts) * 0.42) 6px 6px; background: var(--tc); color: var(--tf); font: 800 calc(var(--ts) * 0.52)/1 var(--font-display); box-shadow: inset 0 -7px 0 rgba(38, 16, 47, 0.88); animation: drop 0.5s both, lift 8s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms), var(--ld, 0s); }
@keyframes lift { 0%, 12%, 100% { translate: 0 0; } 5% { translate: 0 -14px; } }
.word-tile small { position: absolute; top: 4px; left: 6px; font-size: 0.6rem; opacity: 0.8; }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } }
.stage-copy { position: absolute; z-index: 2; left: max(var(--gut), (100% - var(--wrap)) / 2); top: clamp(22px, 4.5vh, 56px); width: min(500px, 42%); }
.stage-copy h1 { font-size: clamp(2.4rem, min(5vw, 7.2vh), 4.4rem); margin-bottom: 14px; }
.stage-copy .lede { font-size: clamp(1rem, 2.2vh, 1.2rem); margin-bottom: 0; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 14px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); margin: 0; }
.stats b { color: var(--ink); font: 800 1.25rem var(--font-display); margin-right: 4px; }
.deck { position: absolute; z-index: 2; right: max(var(--gut), (100% - var(--wrap)) / 2); bottom: clamp(16px, 3vh, 30px); width: min(620px, 46%); height: clamp(330px, 48%, 350px); display: flex; flex-direction: column; background: var(--card); border: 2px solid var(--line); border-radius: 6px 44px 6px 6px; box-shadow: var(--shadow); overflow: hidden; }
.deck-tabs { display: flex; border-bottom: 2px solid var(--line); padding-right: 30px; flex: none; }
.deck-tabs button { flex: 1 1 auto; border: 0; background: none; padding: 10px 12px; min-height: 44px; font: 700 0.92rem var(--font-display); color: var(--muted); border-right: 2px solid var(--soft); }
.deck-tabs button[aria-selected='true'] { color: var(--ink); background: var(--blush); box-shadow: inset 0 -5px 0 var(--cobalt); }
.deck-tabs button:hover { color: var(--ink); }
.deck-pane { flex: 1; min-height: 0; padding: 14px 16px; overflow: auto; }
.deck-pane[hidden] { display: none; }
.deck-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.deck-link { display: inline-flex; align-items: center; gap: 6px; font: 700 0.88rem var(--font-display); color: var(--cobalt); text-decoration: none; }
.deck-link:hover { text-decoration: underline; }
.deck-link svg { width: 16px; height: 16px; }
.state-mini { display: grid; gap: 6px; justify-items: start; padding: 20px 4px; color: var(--muted); }
.state-mini b { color: var(--ink); font-family: var(--font-display); }
.state-mini.is-err b { color: var(--danger); }

/* home: periodic preview with "heat by reads" colouring */
.mini-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.heat-cell { position: relative; }
.tile.tile-mini { aspect-ratio: 1 / 0.84; padding: 6px 8px 10px; }
.tile.tile-mini::before { width: 28px; height: 28px; }
.tile.tile-mini:hover::before, .tile.tile-mini:focus-visible::before { width: 36px; height: 36px; }
.tile-mini .t-num { top: 1px; right: 2px; font-size: 0.56rem; }
.tile-mini .t-code { font-size: clamp(1.2rem, 2vw, 1.6rem); padding-top: 8px; margin: auto 0 0; }
.tile-mini .t-title { display: none; }
.tile-more { display: grid; place-content: center; text-align: center; aspect-ratio: 1 / 0.84; border: 2px dashed var(--line); border-radius: 6px; text-decoration: none; }
.tile-more b { font: 800 1.3rem var(--font-display); }
.heat-bar, .heat-rank { display: none; }
.is-heat .tile { opacity: calc(0.32 + var(--heat) * 0.68); filter: saturate(calc(0.25 + var(--heat))); }
.is-heat .heat-bar { display: block; position: absolute; left: 4px; bottom: 3px; height: 4px; width: calc((100% - 8px) * var(--heat)); background: var(--peach); border-radius: 2px; }
.is-heat .heat-rank { display: block; position: absolute; left: -4px; top: -6px; padding: 0 5px; border: 2px solid var(--line); border-radius: 999px; background: var(--peach); color: #26102f; font-size: 0.62rem; z-index: 2; }
.peek-line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 10px 0 0; font-size: 0.92rem; }
.peek-line .mono { color: var(--muted); font-size: 0.7rem; }
.peek-line a { font-weight: 700; color: var(--ink); }

/* home: pull a letter + ground rules */
.pull { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 14px; align-items: start; }
.pull-card { display: flex; gap: 14px; align-items: flex-start; }
.pull-card .insp-letter { width: 64px; height: 74px; font-size: 2.4rem; }
.pull-card h3 { font-size: 1.1rem; margin-bottom: 4px; }
.pull-card p { font-size: 0.9rem; margin-bottom: 4px; }
.pull-card .kicker { margin-bottom: 6px; }
.pull-side { display: grid; gap: 8px; }
.pull-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.pull-pick button { min-height: 36px; border: 2px solid var(--line); border-radius: 4px 12px 4px 4px; background: var(--tc); color: var(--tf); font: 800 0.95rem var(--font-display); padding: 0; }
.pull-pick button[aria-pressed='true'] { outline: 3px solid var(--ink); outline-offset: 1px; }
.ground { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ground li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding-bottom: 10px; border-bottom: 2px solid var(--soft); }
.ground li:last-child { border-bottom: 0; padding-bottom: 0; }
.ground b { color: var(--cobalt); padding-top: 3px; }
.ground h3 { font-size: 1.02rem; margin-bottom: 2px; }
.ground p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

/* ---------- sequence reader ---------- */
.reader { background: var(--card); border: 2px solid var(--line); border-radius: 6px 40px 6px 6px; box-shadow: var(--shadow); padding: clamp(18px, 3vw, 34px); }
.reader-strip { overflow-x: auto; overscroll-behavior-x: contain; padding: 12px 6px 6px; margin: 0 -6px; }
.strip-row { --n: 9; --gap: clamp(4px, 1vw, 12px); position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(44px, 1fr)); gap: var(--gap); padding-top: 54px; min-width: calc(var(--n) * 44px + (var(--n) - 1) * var(--gap)); }
.res { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1 / 1.15; min-height: 48px; border: 2px solid var(--line); border-radius: 5px 16px 5px 5px; background: var(--tc); color: var(--tf); padding: 0 0 4px; box-shadow: inset 0 -5px 0 rgba(38, 16, 47, 0.85); transition: transform 0.18s, opacity 0.2s; animation: pop 0.3s both; animation-delay: calc(var(--i) * 30ms); }
.res b { font: 800 clamp(1.3rem, 4vw, 3rem)/1 var(--font-display); }
.res small { font: 500 clamp(0.58rem, 1.2vw, 0.75rem) var(--font-mono); opacity: 0.85; text-transform: uppercase; }
.res:hover { transform: translateY(-4px); }
.res.on { transform: translateY(-8px); outline: 3px solid var(--ink); outline-offset: 2px; }
.res.dim { opacity: 0.18; }
.bridge { position: absolute; top: 4px; height: 46px; left: calc((var(--a) + 0.5) * (100% + var(--gap)) / var(--n)); width: calc((var(--b) - var(--a)) * (100% + var(--gap)) / var(--n)); overflow: visible; }
.bridge path { stroke: var(--ink); stroke-width: 3; stroke-dasharray: 7 6; vector-effect: non-scaling-stroke; }
.bridge-label { position: absolute; top: -11px; left: calc((var(--a) + (var(--b) - var(--a)) / 2 + 0.5) * (100% + var(--gap)) / var(--n)); transform: translateX(-50%); padding: 0 4px; font-size: 0.68rem; line-height: 1; white-space: nowrap; }
.reader-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 22px 0; }
.seq-in { flex: 1 1 200px; min-width: 0; height: 42px; padding: 0 14px; border: 2px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: 500 1.05rem var(--font-mono); letter-spacing: 0.25em; text-transform: uppercase; }
.insp { display: flex; gap: 22px; align-items: flex-start; padding: 20px; border: 2px dashed var(--soft); border-radius: var(--r); background: var(--paper); min-height: 150px; }
.insp h3 { margin-bottom: 6px; }
.insp p { margin-bottom: 6px; }
.insp-letter { flex: none; display: grid; place-items: center; width: 96px; height: 110px; border: 2px solid var(--line); border-radius: 6px 30px 6px 6px; background: var(--tc); color: var(--tf); font: 800 4rem var(--font-display); box-shadow: inset 0 -7px 0 rgba(38, 16, 47, 0.85); }
.insp-hint { color: var(--muted); font-size: 0.92rem; }
.reader-stat { margin: 14px 0 0; color: var(--muted); }
.reader-sec { padding-top: 8px; }
.reader-foot { margin-top: 14px; }
.reader-foot a { display: inline-flex; align-items: center; gap: 6px; color: var(--cobalt); font-weight: 700; }
.reader-foot svg { width: 16px; height: 16px; }
.reader-compact { border: 0; box-shadow: none; padding: 0; background: none; border-radius: 0; }
.reader-compact .strip-row { padding-top: 38px; }
.reader-compact .bridge { height: 30px; }
.reader-compact .res b { font-size: clamp(1.2rem, 2.4vw, 2rem); }
.reader-compact .bridge-label { font-size: 0.72rem; }
.reader-compact .reader-bar { margin: 12px 0 6px; gap: 8px; }
.reader-compact .seq-in { height: 38px; font-size: 0.95rem; }
.reader-compact .reader-stat { margin: 4px 0 8px; font-size: 0.7rem; min-height: 2.4em; }

/* ---------- periodic tiles: "quarter-disc" Bauhaus tile ----------
   Flat colour block, 2px ink outline, quarter disc cut from the top-right corner holding the element number,
   heavy ink foot bar. Hover: the quarter disc swells and the foot bar thickens (no lift, no offset shadow). */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; justify-content: flex-end; aspect-ratio: 1 / 1.08; padding: 12px 14px 18px; border: 2px solid var(--line); border-radius: 6px; background: var(--tc); color: var(--tf); text-decoration: none; overflow: hidden; box-shadow: inset 0 -8px 0 rgba(38, 16, 47, 0.88); transition: box-shadow 0.2s, opacity 0.25s, filter 0.25s; animation: pop 0.35s both; animation-delay: calc(var(--i) * 30ms); }
.tile::before { content: ''; position: absolute; top: -2px; right: -2px; width: 46px; height: 46px; background: var(--paper); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); border-bottom-left-radius: 100%; transition: width 0.22s, height 0.22s; }
.tile:hover, .tile:focus-visible { box-shadow: inset 0 -14px 0 rgba(38, 16, 47, 0.88); }
.tile:hover::before, .tile:focus-visible::before { width: 62px; height: 62px; }
.tile.dim { opacity: 0.16; filter: grayscale(0.6); }
.t-num { position: absolute; top: 5px; right: 6px; z-index: 1; color: var(--ink); font-weight: 500; }
.t-min { position: absolute; top: 10px; left: 14px; opacity: 0.85; }
.t-code { font: 800 clamp(2.4rem, 5vw, 3.5rem)/1 var(--font-display); letter-spacing: -0.04em; margin-bottom: auto; margin-top: auto; padding-top: 22px; }
.t-title { font: 700 0.9rem/1.2 var(--font-body); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 22px 0 0; }
.pager button { min-width: 44px; min-height: 44px; border: 2px solid var(--line); border-radius: 6px; background: var(--card); font-weight: 700; }
.pager button[aria-current='page'] { background: var(--ink); color: var(--paper); }

/* list rows */
.lrows { display: grid; gap: 8px; }
.lrow { display: flex; gap: 16px; align-items: center; padding: 12px 14px; border: 2px solid var(--line); border-radius: 6px; background: var(--card); text-decoration: none; transition: box-shadow 0.15s; }
.lrow:hover { box-shadow: inset 6px 0 0 var(--tc, var(--cobalt)); }
.lr-main { flex: 1; min-width: 0; display: grid; }
.lr-main span { color: var(--muted); font-size: 0.95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lr-meta { text-align: right; color: var(--muted); flex: none; }

/* alphabet */
.alpha { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.alpha-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.alpha-grid .res b { font-size: 2.4rem; }
.insp-side { position: sticky; top: 88px; flex-direction: column; background: var(--card); border-style: solid; border-color: var(--line); box-shadow: var(--shadow); }

/* glossary deck */
.gdeck { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; align-items: start; }
.gcard { border: 2px solid var(--line); border-radius: 6px 26px 6px 6px; background: var(--card); overflow: hidden; }
.g-t { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 14px 16px; font: 700 1.12rem var(--font-display); }
.g-t::after { content: '+'; float: right; font-family: var(--font-mono); color: var(--muted); }
.g-t[aria-expanded='true']::after { content: '−'; }
.g-d { margin: 0; padding: 0 16px 14px; font-size: 0.97rem; line-height: 1.5; }
.gcard.open { background: var(--peach); color: #26102f; }
.gcard.open .g-t::after { color: #26102f; }
.gcard[hidden] { display: none; }

/* ---------- article ---------- */
.art-head { padding-top: 30px; }
.back { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; margin-bottom: 22px; color: var(--muted); }
.back svg { width: 16px; height: 16px; }
.art-id { display: flex; gap: 24px; align-items: flex-end; margin-bottom: 18px; }
.art-id h1 { font-size: clamp(2rem, 5.2vw, 3.8rem); max-width: 18em; }
.id-tile { position: relative; flex: none; display: flex; flex-direction: column; justify-content: flex-end; width: clamp(96px, 13vw, 140px); aspect-ratio: 1 / 1.08; padding: 10px 14px 16px; border: 2px solid var(--line); border-radius: 6px; background: var(--tc); color: var(--tf); overflow: hidden; box-shadow: inset 0 -9px 0 rgba(38, 16, 47, 0.88); }
.id-tile::before { content: ''; position: absolute; top: -2px; right: -2px; width: 44%; aspect-ratio: 1; background: var(--paper); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); border-bottom-left-radius: 100%; }
.id-tile .mono { position: absolute; top: 6px; right: 8px; z-index: 1; color: var(--ink); }
.id-tile b { font: 800 clamp(2.2rem, 4.6vw, 3.4rem)/1 var(--font-display); letter-spacing: -0.04em; }
.art-head .lede { margin-bottom: 8px; }
.byline { color: var(--muted); margin: 0 0 18px; }
/* cover sits at the top of the text column, same left edge and width as the prose */
.art-cover { display: block; width: 100%; margin: 0 0 1.4em; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid var(--line); border-radius: 6px 48px 6px 6px; background: var(--blush); }
.art-body { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 30px; margin-top: 30px; }
.rail { position: sticky; top: 88px; align-self: start; display: flex; flex-direction: column; gap: 22px; padding-left: 4px; max-height: calc(100vh - 110px); }
.rail-line { position: absolute; left: 17px; top: 14px; bottom: 14px; width: 4px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.rail-line i { display: block; width: 100%; height: 0; background: var(--cobalt); }
.bead { position: relative; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--muted); }
.bead b { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 2px solid var(--line); border-radius: 50%; background: var(--paper); font: 700 0.85rem var(--font-mono); color: var(--ink); transition: background 0.2s, color 0.2s, transform 0.2s; }
.bead span { font-size: 0.8rem; line-height: 1.2; opacity: 0.85; }
.bead.done b { background: var(--ink); color: var(--paper); }
.bead.on b { background: var(--cobalt); color: #fff; transform: scale(1.18); }
.bead.on span { color: var(--ink); font-weight: 700; opacity: 1; }
.art-body .prose { max-width: 940px; }
.art-body .prose > * { max-width: 680px; }
.art-body .prose > .note-pair { max-width: none; display: grid; grid-template-columns: minmax(0, 680px) minmax(180px, 220px); column-gap: 36px; align-items: start; margin-bottom: 1.2em; }
.note-pair > :first-child { margin-bottom: 0; }
.side-note { margin: 0 0 1em; padding: 12px 14px 14px; border: 2px solid var(--line); border-radius: 6px 26px 6px 6px; background: var(--peach); color: #26102f; font: 700 0.98rem/1.35 var(--font-display); box-shadow: inset 0 -6px 0 rgba(38, 16, 47, 0.88); position: relative; }
.note-pair .side-note { margin: 0; }
.note-pair .side-note::before { content: ''; position: absolute; left: -38px; top: 22px; width: 36px; border-top: 2px dashed var(--line); }
.sources { margin-top: 2.4em; padding-top: 1em; border-top: 2px dashed var(--soft); }
.sources h2 { margin-top: 0; font-size: 1.3rem; }
.sources ol { font-size: 0.95rem; }
.sources a { word-break: break-all; }
.art-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 28px; padding-top: 18px; border-top: 2px dashed var(--soft); }
.art-tools .muted { margin-left: auto; }
/* two equal columns: label row + two cards each, so tops and bottoms line up */
.art-next { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 26px; align-items: stretch; }
.el-pair { display: grid; gap: 10px; grid-template-rows: auto; grid-auto-rows: 1fr; align-content: start; }
.el-pair .kicker { margin-bottom: 0; }
.el-card { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px; border: 2px solid var(--line); border-radius: 6px 30px 6px 6px; background: var(--card); text-decoration: none; box-shadow: inset 8px 0 0 var(--tc); padding-left: 18px; transition: box-shadow 0.2s; }
.el-card:hover { box-shadow: inset 14px 0 0 var(--tc); }
.el-card img { width: 132px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid var(--line); border-radius: 4px; }
.el-main { display: grid; gap: 2px; min-width: 0; }
.el-main .mono { color: var(--muted); font-size: 0.68rem; }
.el-main strong { font: 700 1rem/1.25 var(--font-display); }
.el-ex { color: var(--muted); font-size: 0.88rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rel { display: grid; gap: 10px; grid-template-rows: auto; grid-auto-rows: 1fr; align-content: start; }
.rel .kicker { margin-bottom: 0; }
.to-top { position: fixed; right: 16px; bottom: 18px; z-index: 40; display: grid; place-items: center; width: 46px; height: 46px; border: 2px solid var(--line); border-radius: 50%; background: var(--ink); color: var(--paper); font: 800 1.2rem var(--font-display); text-decoration: none; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.to-top.show { opacity: 1; pointer-events: auto; }

/* static pages */
.prose-page { max-width: 760px; margin-left: max(calc((100% - var(--wrap)) / 2), var(--gut)); }
.prose-page .prose { display: block; }
.nf { padding: 80px 0; }
.nf-tile { position: relative; display: inline-flex; flex-direction: column; width: 140px; padding: 10px 14px 18px; border: 2px solid var(--line); border-radius: 6px 44px 6px 6px; background: var(--pink); color: #26102f; box-shadow: inset 0 -9px 0 rgba(38, 16, 47, 0.88); margin-bottom: 24px; transform: rotate(-4deg); }
.nf-tile b { font: 800 4rem/1 var(--font-display); }
.nf .lede { margin: 16px 0 22px; }

/* admin */
.auth { display: grid; place-items: center; padding: 60px 0; }
.auth-card { width: min(420px, 100%); padding: 30px; border: 2px solid var(--line); border-radius: 6px 40px 6px 6px; background: var(--card); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 2.6rem; margin-bottom: 14px; }
.lib-head { padding: 50px 0 20px; }
.lib-head h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.tiles { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.tiles > div { min-width: 150px; padding: 14px 18px; border: 2px solid var(--line); border-radius: var(--r); background: var(--card); }
.tiles b { display: block; font: 800 2rem var(--font-display); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { padding: 7px 16px; border: 2px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 700; }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.adm .acts { white-space: nowrap; }
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; padding-bottom: 40px; }
.ed-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ed-checks { display: flex; gap: 22px; margin: 16px 0 0; }
.ed-actions { display: flex; gap: 10px; margin-top: 20px; }
.ed-preview { padding: 22px; border: 2px solid var(--line); border-radius: var(--r); background: var(--card); max-height: 85vh; overflow-y: auto; position: sticky; top: 84px; }
.ed-preview .prose { display: block; font-size: 1rem; }

/* wide screens: the header uses the body grid, so the element tile sits over the section rail and the title, lede, byline and cover share the text column's left edge */
@media (min-width: 1001px) {
  .art-head { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 30px; }
  .art-head > .back { grid-column: 1 / -1; }
  .art-id { display: contents; }
  .art-head .id-tile { grid-column: 1; grid-row: 2 / span 3; align-self: start; width: 140px; }
  .art-id > div { grid-column: 2; grid-row: 2; margin-bottom: 14px; }
  .art-head .lede { grid-column: 2; grid-row: 3; }
  .art-head .byline { grid-column: 2; grid-row: 4; margin-bottom: 0; }
}
@media (max-width: 1000px) {
  .art-body { grid-template-columns: minmax(0, 1fr); margin-top: 28px; }
  .rail { position: sticky; top: 64px; z-index: 5; flex-direction: row; gap: 10px; padding: 10px 0; max-height: none; background: var(--paper); overflow-x: auto; border-bottom: 2px solid var(--soft); }
  .rail-line { display: none; }
  .bead span { display: none; }
  .bead.on span { display: inline; white-space: nowrap; }
  .art-body .prose > .note-pair { display: block; }
  .note-pair > :first-child { margin-bottom: 0.8em; }
  .note-pair .side-note::before { display: none; }
  .alpha { grid-template-columns: 1fr; }
  .insp-side { position: static; flex-direction: row; }
  .editor { grid-template-columns: 1fr; }
  .ed-preview { position: static; }
}

/* home below 900px: copy, then the diagonal band as its own strip, then the segment deck */
@media (max-width: 899px) {
  .stage { height: auto; display: flex; flex-direction: column; padding: 18px var(--gut) 20px; overflow: visible; }
  .stage-copy { position: static; width: auto; order: 1; }
  .stage-copy h1 { font-size: clamp(2.2rem, 10vw, 3.2rem); }
  .stage-art { position: relative; order: 2; height: 150px; margin: 10px calc(var(--gut) * -1) 12px; }
  .tint { display: none; }
  .deck { position: static; order: 3; width: auto; height: auto; min-height: 320px; }
  .hero-cta { margin: 14px 0 10px; }
  .hero-cta .btn { height: 44px; padding: 0 18px; }
}
@media (max-width: 760px) {
  .art-next { grid-template-columns: 1fr; }
  .art-id { flex-direction: column; align-items: flex-start; gap: 14px; }
  .insp { flex-direction: column; }
  .lr-meta { display: none; }
  .table-grid { grid-template-columns: repeat(2, 1fr); }
  .reader { padding: 14px; }
  .strip-row { --gap: 6px; }
  .pull { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .deck-tabs button { font-size: 0.8rem; padding: 8px 6px; }
  .tools .dd { flex: 1 1 160px; }
  .el-card { grid-template-columns: 96px minmax(0, 1fr); }
  .el-card img { width: 96px; }
  .art-tools .muted { margin-left: 0; width: 100%; }
}

/* home is one screen: the footer follows the stage directly */
body:has(#stage) #foot { margin-top: 0; }
