/* ======================================================================
   THE RULER AND THE REMAINDER — fierce editorial
   A statement object. High-contrast display, oversized type, thick rules,
   manifesto cadence. Tilda-Swinton severe, not journal-tasteful.
   Visual spine: the measure (ruler) and what it leaves out (remainder).
   ====================================================================== */

:root {
  --paper: #f4f0e6;
  --paper-2: #ebe6d7;
  --ink: #0e0d0a;
  --ink-soft: #34302a;
  --muted: #6c6557;
  --faint: #a9a18b;
  --rule: #cfc7b1;
  --measure: #e2300c;      /* fierce vermillion — the ruler's red */
  --remainder: #2f4a47;    /* the deep leftover */
  --maxw: 39rem;
  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --mono: "Space Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 20px; line-height: 1.6;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(rgba(14,13,10,0.02) 1px, transparent 1px);
  background-size: 4px 4px;
  overflow-wrap: break-word;
}
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--measure); }

::selection { background: var(--measure); color: var(--paper); }

.skip { position: absolute; left: -9999px; top: 0.5rem; z-index: 200; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; font-family: var(--mono); font-size: 0.78rem; text-transform: lowercase; letter-spacing: 0.06em; }
.skip:focus { left: 0.5rem; }

/* all lowercase, as a vibe — forces it regardless of source casing */
.cover h1.title, .dept-head h2, .piece h1, .feature h3, .item h3, .dbrow a,
.prose h1, .prose h2, .prose h3, .topbar .home, .verdict strong { text-transform: lowercase; }

#measure { position: fixed; top: 0; left: 0; height: 4px; width: 0%; background: var(--measure); z-index: 100; transition: width 0.08s linear; }

/* left tick-ruler */
.ruler-gutter {
  position: fixed; top: 0; left: 0; bottom: 0; width: 36px; z-index: 5;
  border-right: 2px solid var(--ink);
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 23px, var(--rule) 23px, var(--rule) 24px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 119px, var(--ink) 119px, var(--ink) 120px);
  pointer-events: none;
}
.ruler-gutter::after {
  content: "remainder"; position: absolute; bottom: 1.5rem; left: 50%;
  transform: rotate(180deg); writing-mode: vertical-rl;
  font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.34em;
  text-transform: lowercase; color: var(--faint);
}
@media (max-width: 980px) { .ruler-gutter { display: none; } }

/* ---------- masthead bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap;
  padding: 0.85rem clamp(1.1rem, 5vw, 3rem) 0.85rem calc(36px + clamp(1.1rem, 5vw, 3rem));
  border-bottom: 2px solid var(--ink); position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px);
}
.topbar .home { font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; text-decoration: none; color: var(--ink); text-transform: lowercase; }
.topbar .home small { font-family: var(--mono); font-weight: 400; font-size: 0.56rem; letter-spacing: 0.2em; text-transform: lowercase; color: var(--measure); display: block; margin-top: 1px; }
.topbar nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.topbar nav a { font-family: var(--mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: lowercase; color: var(--ink); text-decoration: none; }
.topbar nav a:hover { color: var(--measure); }

main { padding-left: 36px; }
@media (max-width: 980px) { main { padding-left: 0; } }

/* ---------- COVER — the statement ---------- */
.cover { max-width: 64rem; margin: 0 auto; padding: clamp(1.5rem, 5vh, 3.5rem) clamp(1.1rem, 5vw, 3rem) 1.5rem; }
.issueline {
  font-family: var(--mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em; text-transform: lowercase;
  color: var(--ink); display: flex; gap: 0.8rem; flex-wrap: wrap; align-items: center;
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 0.6rem 0; margin-bottom: 2.5rem;
}
.issueline .dot { color: var(--measure); }
.cover h1.title {
  font-family: var(--display); font-weight: 700; font-size: clamp(2.3rem, 7.5vw, 5rem);
  line-height: 0.96; letter-spacing: -0.02em; margin: 0 0 1.8rem; text-transform: lowercase;
  max-width: 100%;
}
.cover h1.title .amp { color: var(--measure); font-style: italic; font-weight: 700; }
/* long division: the remainder is the dividend under the division house */
.cover h1.title .longdiv { display: inline-block; border-top: 0.055em solid var(--measure); padding-top: 0.06em; margin-left: 0.12em; }
.cover h1.title .longdiv::before { content: ")"; color: var(--measure); font-weight: 400; margin-right: 0.03em; }
.cover .statement .thesis { font-family: var(--display); font-weight: 600; color: var(--ink); }
.cover .statement {
  font-family: var(--serif); font-weight: 400; font-style: normal;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem); line-height: 1.5; max-width: 34rem; color: var(--ink-soft); margin: 0 0 2rem;
}
.cover .manifesto { font-family: var(--mono); font-size: 0.8rem; font-weight: 700; line-height: 2.1; letter-spacing: 0.1em; text-transform: lowercase; color: var(--ink); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 1rem 0; margin: 0 0 2rem; }
.cover .manifesto .r { color: var(--measure); }
.cover .enter { font-family: var(--mono); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.2em; text-transform: lowercase; color: var(--ink); }
.cover .enter a { color: var(--ink); text-decoration: none; }
.cover .enter a:hover { color: var(--measure); }

/* ---------- departments / contents ---------- */
.contents { max-width: 64rem; margin: 0 auto; padding: 1rem clamp(1.1rem, 5vw, 3rem) 5rem; }
.dept { margin: 4rem 0 0; }
.dept-head { display: flex; align-items: baseline; gap: 0.9rem; border-bottom: 1px solid var(--ink); padding-bottom: 0.5rem; margin-bottom: 1.6rem; }
.dept-head .no { font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1; color: var(--measure); }
.dept-head h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 3.4vw, 2rem); letter-spacing: -0.01em; margin: 0; }
.dept-head .gloss { font-family: var(--mono); font-size: 0.66rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.1em; color: var(--muted); margin-left: auto; text-align: right; }

.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.item { background: var(--paper); padding: 1.4rem 1.4rem 1.6rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 0.4rem; transition: background 0.15s; }
.item:hover { background: var(--paper-2); }
.item:hover h3 { color: var(--measure); }
.item .kicker { font-family: var(--mono); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.12em; text-transform: lowercase; color: var(--measure); }
.item h3 { font-family: var(--display); font-weight: 700; font-size: 1.25rem; line-height: 1.12; margin: 0; letter-spacing: -0.01em; transition: color 0.15s; }
.item p { font-size: 0.85rem; line-height: 1.4; color: var(--muted); margin: 0.1rem 0 0; font-family: var(--serif); }

.features { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.feature { background: var(--paper-2); border: 1px solid var(--rule); padding: 2.6rem 2.2rem 2.9rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; transition: border-color 0.15s, background 0.15s; }
.feature:hover { background: var(--paper); border-color: var(--measure); }
.feature:hover h3 { color: var(--measure); }
.feature .kicker { font-family: var(--mono); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.14em; text-transform: lowercase; color: var(--measure); }
.feature h3 { font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 3.4vw, 2.2rem); line-height: 1.04; letter-spacing: -0.02em; margin: 0.7rem 0 1rem; transition: color 0.15s; }
.feature p { font-size: 0.95rem; line-height: 1.58; color: var(--muted); margin: 0 0 1.4rem; font-family: var(--serif); }
.feature .read { margin-top: auto; }
.feature .read { font-family: var(--mono); font-size: 0.7rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.08em; }
@media (max-width: 680px) { .features { grid-template-columns: 1fr; } }

.tiernote, .by { font-family: var(--mono); font-size: 0.78rem; line-height: 1.6; color: var(--muted); }
.by a { color: var(--ink); }

/* ---------- article / piece ---------- */
.piece { max-width: var(--maxw); margin: 0 auto; padding: clamp(2rem,6vh,4rem) clamp(1.1rem,5vw,2rem) 5rem; }
.piece .back, .piece .foot a { font-family: var(--mono); font-size: 0.7rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.08em; color: var(--muted); text-decoration: none; }
.piece .head { border-bottom: 1px solid var(--ink); padding-bottom: 1.4rem; margin: 1.2rem 0 2.2rem; }
.piece .head .kicker { font-family: var(--mono); font-size: 0.7rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.12em; color: var(--measure); }
.piece h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2.1rem, 5.5vw, 3.4rem); line-height: 1.0; letter-spacing: -0.02em; margin: 0.6rem 0 0; }
.genre-note { font-family: var(--mono); font-size: 0.7rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.08em; color: var(--remainder); margin: 0.9rem 0 0; }
.downloads { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 2rem; }
.downloads a { color: var(--measure); text-decoration: none; }
.downloads a:hover { text-decoration: underline; }

.prose { font-size: 1.08rem; }
.prose h2 { font-family: var(--display); font-weight: 800; font-size: 1.7rem; letter-spacing: -0.01em; margin: 2.8rem 0 0.7rem; }
.prose h3 { font-family: var(--display); font-weight: 700; font-size: 1.28rem; margin: 2rem 0 0.5rem; }
.prose p { margin: 0 0 1.25rem; }
.prose ul, .prose ol { margin: 0 0 1.35rem; padding-left: 1.35rem; }
.prose li { margin-bottom: 0.5rem; }
.prose li > p { margin: 0 0 0.35rem; }
.prose a { color: var(--measure); }
.prose blockquote { margin: 1.7rem 0; padding-left: 1.3rem; border-left: 4px solid var(--measure); font-style: italic; color: var(--ink-soft); font-size: 1.12rem; }
/* section break = a small long-division house (the recurring motif) */
/* section break drawn as a long-division bracket: the divisor's curve + the dividend's overbar */
.prose hr { border: none; width: 2.4em; height: 1.1em; margin: 3rem auto; position: relative; overflow: visible; }
.prose hr::before { content: ")"; position: absolute; left: 0; top: 50%; transform: translateY(-50%) scaleX(0.72); transform-origin: left center; color: var(--measure); font-family: var(--serif); font-weight: 400; font-size: 1.7em; line-height: 0; }
.prose hr::after { content: ""; position: absolute; left: 0.46em; right: 0; top: calc(50% - 0.55em); height: 1.5px; background: var(--measure); }
.prose code { font-family: var(--mono); font-size: 0.82em; background: var(--paper-2); padding: 0.1em 0.35em; }
.prose pre { font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; background: var(--ink); color: #efe9d8; padding: 1rem 1.2rem; overflow-x: auto; margin: 1.4rem 0; }
.prose pre.calc, .bookprose pre.calc {
  background: var(--paper-2); color: var(--ink-soft); border-left: 3px solid var(--measure);
  padding: 0.85rem 1.15rem; font-size: 0.84rem; line-height: 1.58; box-shadow: inset 0 0 0 1px var(--rule);
}
.prose pre.calc code, .bookprose pre.calc code { background: none; padding: 0; color: inherit; }
.prose pre code { background: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--serif); font-size: 0.92rem; margin: 1.7rem 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-family: var(--mono); font-size: 0.68rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.06em; }
.prose img { max-width: 100%; height: auto; }
.prose sup.fn a { font-family: var(--mono); font-size: 0.7em; color: var(--measure); text-decoration: none; }
.footnotes { margin-top: 3.5rem; padding-top: 1.4rem; border-top: 1px solid var(--ink); font-size: 0.86rem; color: var(--ink-soft); }
.footnotes h4 { font-family: var(--mono); font-size: 0.68rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.12em; color: var(--measure); margin: 0 0 0.8rem; }
.footnotes ol { padding-left: 1.4rem; } .footnotes li { margin-bottom: 0.5rem; } .footnotes .mono { font-family: var(--mono); }
.piece .foot { margin-top: 3.5rem; padding-top: 1.4rem; border-top: 1px solid var(--ink); }

/* autotheory (Our Relationship) — # Part dividers, ## chapter sections */
.autotheory .prose > p:first-of-type::first-letter { font-family: var(--display); font-weight: 900; float: left; font-size: 3.4rem; line-height: 0.74; padding: 0.4rem 0.5rem 0 0; color: var(--measure); }
.autotheory .prose h1 { font-family: var(--display); font-weight: 900; font-size: clamp(1.4rem,3.2vw,1.9rem); letter-spacing: 0.01em; line-height: 1.05; margin: 5.5rem 0 0; padding-top: 2.4rem; border-top: 2px solid var(--ink); color: var(--measure); }
.autotheory .prose h2 { font-family: var(--display); font-weight: 800; font-size: clamp(1.6rem,4vw,2.3rem); letter-spacing: -0.02em; line-height: 1.04; margin: 3.2rem 0 1.1rem; }

/* ---------- corpus essays: substack / "opening a file" ---------- */
.doc .head { border-bottom: 1px solid var(--rule); }
.doc .filemeta { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.03em; color: var(--muted); margin: 0.9rem 0 0; }
.doc .filemeta::before { content: "▢ "; color: var(--measure); }
.doc .prose { font-size: 1.12rem; line-height: 1.72; max-width: 36rem; }
.doc .prose p { margin: 0 0 1.3rem; }
.doc .prose h2 { margin-top: 2.6rem; margin-bottom: 0.85rem; }
.doc .prose h3 { margin-top: 1.8rem; margin-bottom: 0.55rem; font-size: 1.15rem; }
.doc .prose table { font-size: 0.86rem; display: block; overflow-x: auto; }

/* ---------- book reading mode: two-page flip reader ---------- */
.book-wrap { max-width: 33rem; margin: 0 auto; padding: clamp(1.4rem,5vh,3rem) clamp(1.1rem,5vw,2rem) 6rem; }
.book-wrap > .back, .book-wrap .foot a { font-family: var(--mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); text-decoration: none; }

/* reader shell */
.reader { max-width: 72rem; padding: clamp(0.9rem,2.6vh,1.6rem) clamp(1rem,4vw,2.6rem) 1.4rem; }
.reader > .back { display: inline-block; margin-bottom: 0.7rem; }
.reader .viewport { position: relative; }
.reader.paged .viewport { overflow: hidden; padding: 0 clamp(1.2rem,3vw,2.6rem); cursor: default; }

/* the column engine — width/height/columns are set inline by the pager */
.reader.paged .pages {
  column-fill: auto;
  column-rule: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
  transform: translateX(0);
  transition: transform 0.42s cubic-bezier(.4,0,.15,1);
  will-change: transform;
  padding: clamp(1.4rem,4vh,2.6rem) 0;
}
.reader.paged .pages > h1 { break-before: column; }
.reader.paged .pages h1, .reader.paged .pages h2, .reader.paged .pages h3,
.reader.paged .pages blockquote, .reader.paged .pages table,
.reader.paged .pages pre, .reader.paged .pages figure, .reader.paged .pages li,
.reader.paged .cover { break-inside: avoid; }
.reader.paged .pages pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.reader.paged .pages img, .reader.paged .pages table { max-width: 100%; }
.reader.paged .pages h1 { margin-top: 0; padding-top: 0.4rem; }

/* the cover page */
.reader .cover { text-align: center; padding: clamp(2rem,7vh,4.5rem) 0.5rem; border-bottom: 1px solid var(--rule); margin-bottom: 2.4rem; }
.reader.paged .cover { break-after: column; break-inside: avoid; border-bottom: none; margin: 0; padding: clamp(3rem,13vh,7rem) 0 0; }
.reader .cover p { text-indent: 0; }
.reader .cover .kicker { font-family: var(--mono); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; color: var(--measure); }
.reader .cover .booktitle { font-family: var(--display); font-weight: 700; font-size: clamp(2rem,5vw,3rem); line-height: 1.0; letter-spacing: -0.02em; margin: 1rem 0 0.8rem; color: var(--ink); }
.reader .cover .byline { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.1em; color: var(--ink); margin: 0 0 1.2rem; }
.reader .cover .bookdek { font-family: var(--serif); font-size: 1rem; line-height: 1.5; color: var(--muted); max-width: 24rem; margin: 0 auto 1.2rem; text-indent: 0; }
.reader .cover .downloads { margin: 0; }

/* pager controls */
.pager { display: flex; align-items: center; justify-content: center; gap: 1.4rem; margin-top: 0.9rem; }
.pager[hidden] { display: none; }
.pg-btn { font-family: var(--mono); font-size: 1rem; font-weight: 700; background: var(--paper-2); color: var(--ink); border: 1px solid var(--ink); width: 2.4rem; height: 2.4rem; cursor: pointer; line-height: 1; padding: 0; }
.pg-btn:hover:not(:disabled) { background: var(--measure); color: var(--paper); }
.pg-btn:disabled { opacity: 0.28; cursor: default; }
.pg-status { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em; color: var(--muted); min-width: 7rem; text-align: center; }
.reader.paged .foot { display: none; }
@media (max-width: 759px) { .reader { padding-left: 1rem; padding-right: 1rem; } .reader.paged .pages { column-rule: none; } }

.bookprose { font-size: 1.08rem; line-height: 1.78; }
.bookprose p { margin: 0; }
.bookprose p + p { text-indent: 1.4em; }
.bookprose h1 { text-align: center; font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem,4vw,2rem); letter-spacing: 0.03em; color: var(--measure); margin: 5.5rem 0 2.5rem; padding-top: 3rem; border-top: 1px solid var(--ink); }
.bookprose h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.45rem,4vw,1.95rem); line-height: 1.06; letter-spacing: -0.01em; margin: 4rem 0 1.3rem; }
.bookprose h3 { font-family: var(--display); font-weight: 600; font-size: 1.12rem; color: var(--ink-soft); margin: 2.2rem 0 0.5rem; }
.bookprose h1 + p, .bookprose h2 + p, .bookprose h3 + p, .bookprose > p:first-of-type, .bookprose blockquote + p, .bookprose hr + p, .bookprose ul + p, .bookprose ol + p, .bookprose table + p, .bookprose pre + p { text-indent: 0; }
.bookprose ul, .bookprose ol { margin: 0.5rem 0 1.3rem; padding-left: 1.45rem; text-indent: 0; }
.bookprose li { margin-bottom: 0.4rem; text-indent: 0; }
.bookprose pre { margin: 1.3rem 0; text-indent: 0; }
.bookprose h2 + p::first-letter, .bookprose > p:first-of-type::first-letter { font-family: var(--display); font-weight: 700; float: left; font-size: 3rem; line-height: 0.78; padding: 0.3rem 0.5rem 0 0; color: var(--measure); }
/* chapter-mode: cap only true chapter openers, never front-matter/appendices */
.bookprose.caps-chapter h2 + p::first-letter, .bookprose.caps-chapter > p:first-of-type::first-letter { font: inherit; float: none; padding: 0; color: inherit; }
.bookprose.caps-chapter p.chapter-open::first-letter { font-family: var(--display); font-weight: 700; float: left; font-size: 3rem; line-height: 0.78; padding: 0.3rem 0.5rem 0 0; color: var(--measure); }
.bookprose blockquote { text-indent: 0; margin: 1.5rem 0; }

/* ---------- happy face cell ---------- */
.facecell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; background: var(--paper-2); text-align: center; min-height: 9rem; }
.facecell .face { font-family: var(--display); font-size: 2.6rem; font-weight: 700; color: var(--measure); letter-spacing: 0.05em; }
.facecell .facenote { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; color: var(--muted); }

/* ---------- reality check (bring-your-own-key) ---------- */
.keyrow { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.keyrow .keyfield { flex: 1 1 16rem; margin: 0; }
.keyrow .modelfield { flex: 0 0 12rem; margin: 0; }
#key, #model { width: 100%; font-family: var(--mono); font-size: 0.84rem; padding: 0.7rem; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); }
#key:focus, #model:focus { outline: none; border-color: var(--measure); }
#model { cursor: pointer; }
.remember { display: flex; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 0.72rem; color: var(--muted); margin: 0.8rem 0 0; }
.reality { font-family: var(--serif); font-size: 1.05rem; }
.reality h3 { font-family: var(--display); font-weight: 700; font-size: 1.12rem; margin: 1.9rem 0 0.6rem; color: var(--ink); border-bottom: 1px solid var(--rule); padding-bottom: 0.3rem; }
.reality p { margin: 0 0 0.9rem; line-height: 1.62; }
.reality ul { margin: 0 0 0.9rem; padding-left: 1.2rem; }
.reality li { margin-bottom: 0.4rem; line-height: 1.55; }
.reality strong { font-weight: 600; }
.tierflag { font-family: var(--mono); font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.1rem 0.35rem; background: var(--paper-2); color: var(--remainder); white-space: nowrap; }
.tierflag.t-established { color: #3c5a37; } .tierflag.t-exploratory { color: #8a6d1f; } .tierflag.t-speculative { color: var(--measure); }

/* ---------- index page head (was falling back to serif) ---------- */
.dbwrap .back { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); text-decoration: none; }
.dbwrap .head { border-bottom: 1px solid var(--ink); padding-bottom: 1rem; margin: 1.2rem 0 1.6rem; }
.dbwrap .head .kicker { font-family: var(--mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; color: var(--measure); }
.dbwrap .head h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2rem,5vw,3rem); letter-spacing: -0.02em; text-transform: lowercase; margin: 0.5rem 0 0; }
.searchbox::placeholder { font-style: normal; }

/* ---------- live AI news dashboard (reality check) ---------- */
.feedwrap { margin: 1.4rem 0 2rem; }
.feedhead { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--ink); padding-bottom: 0.5rem; margin-bottom: 1rem; }
.feedhead button { font-family: var(--mono); font-size: 0.64rem; cursor: pointer; border: 1px solid var(--rule); background: transparent; color: var(--muted); padding: 0.2rem 0.55rem; }
.feedhead button:hover { border-color: var(--measure); color: var(--measure); }
.feedgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.feeditem { background: var(--paper); padding: 0.9rem 1rem; text-align: left; cursor: pointer; border: none; display: flex; flex-direction: column; gap: 0.45rem; font: inherit; transition: background 0.12s; }
.feeditem:hover { background: var(--paper-2); }
.feeditem .src { display: flex; align-items: center; gap: 0.45rem; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.03em; color: var(--measure); }
.feeditem .src img { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 2px; }
.feeditem h4 { font-family: var(--display); font-weight: 600; font-size: 0.92rem; line-height: 1.22; margin: 0; color: var(--ink); }
.feeditem .when { font-family: var(--mono); font-size: 0.58rem; color: var(--faint); margin-top: auto; }
@media (max-width: 640px) { .feedgrid { grid-template-columns: 1fr; } }

/* composed marks — a long-division plate per card (see markSVG in reality.js) */
.antihype { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--measure); text-transform: lowercase; letter-spacing: -0.01em; margin: 0.25rem 0 0; }

.cardmark { background: var(--paper-2); line-height: 0; overflow: hidden; }
.cardmark svg { width: 100%; height: 100%; display: block; }
.cardmark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feeditem .cardmark { height: 96px; margin: -0.9rem -1rem 0; border-bottom: 1px solid var(--rule); }
.ledgeritem .cardmark { height: 58px; margin: -1rem -1.1rem 0; border-bottom: 1px solid var(--rule); }
.verdictmark { height: 90px; margin: 0 0 1.6rem; border: 1px solid var(--rule); }

/* feed cards are no longer one big button — they carry two actions */
.feeditem { cursor: default; }
.cardbtns { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.55rem; }
.mini { font-family: var(--mono); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.03em; text-transform: lowercase; cursor: pointer; border: 1px solid var(--ink); background: transparent; color: var(--ink); padding: 0.34rem 0.55rem; text-decoration: none; line-height: 1; }
.mini:hover { border-color: var(--measure); color: var(--measure); }
.runmini { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.runmini:hover { background: var(--measure); border-color: var(--measure); color: var(--paper); }

/* the public ledger — recently checked stories */
.ledger { margin-top: 2.6rem; border-top: 2px solid var(--ink); padding-top: 1.6rem; }
.ledgergrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.ledgeritem { background: var(--paper); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.55rem; }
.ledgeritem .lmeta { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.03em; }
.ledgeritem .lsrc { color: var(--measure); text-transform: uppercase; }
.ledgeritem .lmeta .when { color: var(--faint); }
.ledgeritem .lstory { font-family: var(--display); font-weight: 600; font-size: 0.9rem; line-height: 1.28; margin: 0; color: var(--ink); }
.ledgeritem .lverdict { font-family: var(--serif); font-size: 0.85rem; line-height: 1.5; margin: 0; color: var(--muted); }
@media (max-width: 640px) { .ledgergrid { grid-template-columns: 1fr; } }

/* ---------- index / search ---------- */
.dbwrap { max-width: 50rem; margin: 0 auto; padding: clamp(2rem,6vh,4rem) clamp(1.1rem,5vw,2rem) 5rem; }
.searchbox { width: 100%; font-family: var(--display); font-weight: 700; font-size: 1.6rem; padding: 0.6rem 0; border: none; border-bottom: 1px solid var(--ink); background: transparent; color: var(--ink); }
.searchbox:focus { outline: none; border-color: var(--measure); }
.searchbox::placeholder { color: var(--faint); font-style: italic; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0; }
.filters button { font-family: var(--mono); font-size: 0.68rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.06em; cursor: pointer; border: 2px solid var(--ink); background: transparent; color: var(--ink); padding: 0.3rem 0.7rem; }
.filters button.active { background: var(--ink); color: var(--paper); }
.dbcount { font-family: var(--mono); font-size: 0.7rem; text-transform: lowercase; letter-spacing: 0.06em; color: var(--muted); margin: 0.5rem 0 1.5rem; }
.dbrow { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.dbrow.hidden { display: none; }
.dbrow .meta { font-family: var(--mono); font-size: 0.64rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.08em; color: var(--measure); }
.dbrow a { font-family: var(--display); font-weight: 700; font-size: 1.3rem; color: var(--ink); text-decoration: none; display: inline-block; margin: 0.15rem 0; }
.dbrow a:hover { color: var(--measure); }
.dbrow .dek { font-size: 0.92rem; color: var(--muted); line-height: 1.45; }

/* ---------- instrument (wide dashboard, not the reading column) ---------- */
.piece.toolpage { max-width: 62rem; }
.toolpage .lede, .toolpage .privacy { max-width: 46rem; }
#story, #copy, #arch { min-height: 9.5rem; }
#story { min-height: 12rem; }
.twofields { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
.twofields .field { margin: 1.1rem 0 0; }
@media (max-width: 760px) { .twofields { grid-template-columns: 1fr; } }
.toolpage .lede { font-family: var(--display); font-weight: 400; font-size: 1.3rem; line-height: 1.35; color: var(--ink); }
.toolpage .lede strong { font-weight: 800; }
.toolpage .privacy { font-family: var(--mono); font-size: 0.72rem; line-height: 1.7; text-transform: lowercase; letter-spacing: 0.04em; color: var(--muted); border-left: 2px solid var(--measure); padding-left: 0.9rem; margin: 1.2rem 0 2rem; }
.toolpage .privacy a { text-transform: none; letter-spacing: 0; color: var(--measure); }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0 0 0.9rem; }
.examples span { font-family: var(--mono); font-size: 0.68rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.06em; color: var(--muted); }
.examples button, .run { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.04em; cursor: pointer; border: 2px solid var(--ink); background: transparent; color: var(--ink); padding: 0.4rem 0.85rem; }
.examples button:hover { border-color: var(--measure); color: var(--measure); }
.field { display: block; margin: 1rem 0; }
.field .fk { display: block; font-family: var(--mono); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: lowercase; color: var(--measure); margin-bottom: 0.4rem; }
#copy, #arch, #input, #story, #say { width: 100%; font-family: var(--mono); font-size: 0.88rem; line-height: 1.5; padding: 1rem; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); resize: vertical; }
#copy:focus, #arch:focus, #input:focus, #story:focus, #say:focus { outline: none; border-color: var(--measure); }
#copy::placeholder, #arch::placeholder, #input::placeholder, #story::placeholder, #say::placeholder { color: var(--faint); font-style: normal; }

/* THE WALK — a web-app game. Duolingo for the corpus; the dramaturg is the guide. */
body.walkgame { overflow-x: hidden; }
.walkgame #main { padding: 0; max-width: none; }
.walkgame .ruler-gutter { display: none; }
.game { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; max-width: 52rem; margin: 0 auto; padding: 0 1.4rem; touch-action: manipulation; }
/* kill the iOS double-tap-to-zoom that makes rapid walk taps "zoom in and out" */
.cont, .gback, .stage, .chamber-walk { touch-action: manipulation; }

/* top bar: mascot · progress · escape */
.gamebar { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 0 0.4rem; }
.mascot { width: 46px; height: 52px; flex: 0 0 auto; }
.mascot svg { width: 100%; height: 100%; overflow: visible; animation: mbob 3.2s ease-in-out infinite; }
.mascot .eye { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
.mascot.talk svg { animation: mtalk 0.5s ease; }
@keyframes mbob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes mtalk { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-5px) scale(1.06); } 100% { transform: translateY(0) scale(1); } }
@keyframes blink { 0%,92%,100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
.progress { flex: 1; height: 12px; background: var(--paper-2); border: 1.5px solid var(--ink); border-radius: 99px; overflow: hidden; }
.pbar { height: 100%; width: 0; background: var(--measure); border-radius: 99px; transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1); }

/* the stage — one screen at a time, centered, big */
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 2rem 0; }
.screen { width: 100%; }
.big { font-family: var(--serif); font-weight: 600; font-size: clamp(2rem, 5.4vw, 3.6rem); line-height: 1.1; letter-spacing: -0.015em; color: var(--ink); margin: 0 0 1.6rem; text-wrap: balance; }
.big.book { color: var(--measure); font-style: italic; }
.big i { font-style: italic; }
.big b { color: var(--measure); font-weight: 600; }
.line { font-family: var(--serif); font-size: clamp(1.15rem, 2.6vw, 1.6rem); line-height: 1.45; color: var(--ink-soft); margin: 0 0 0.9rem; max-width: 36rem; }
.line.sub { font-family: var(--mono); font-size: 0.9rem; color: var(--muted); }
.line b { color: var(--ink); font-weight: 600; }
.line i { font-style: italic; }
.line a, .finlinks a { color: var(--measure); }

/* unit-intro screens */
.unit-screen { text-align: left; }
.unit-no { font-family: var(--mono); font-size: 1rem; font-weight: 700; letter-spacing: 0.3em; color: var(--measure); }
.unit-title { font-family: var(--serif); font-weight: 600; font-size: clamp(2.4rem, 7vw, 4.4rem); line-height: 1; letter-spacing: -0.02em; text-transform: lowercase; color: var(--ink); margin: 0.4rem 0 0; }

/* the three tiers, as a traffic light */
.tiers { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.4rem; max-width: 34rem; }
.tile { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 0.7rem; border: 2px solid var(--ink); padding: 0.7rem 0.9rem; }
.tile .dot { width: 16px; height: 16px; border-radius: 99px; }
.tile b { font-family: var(--mono); font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.tile p { margin: 0; font-family: var(--serif); font-size: 0.98rem; color: var(--ink-soft); }
.tile.g { border-color: #3c5a37; } .tile.g .dot { background: #3c5a37; } .tile.g b { color: #3c5a37; }
.tile.y { border-color: #8a6d1f; } .tile.y .dot { background: #8a6d1f; } .tile.y b { color: #8a6d1f; }
.tile.r { border-color: var(--measure); } .tile.r .dot { background: var(--measure); } .tile.r b { color: var(--measure); }

/* reveal */
.rin { animation: rin 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
@keyframes rin { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* foot: back · the big continue button */
.gamefoot { display: flex; align-items: center; gap: 1rem; padding: 1rem 0 1.8rem; border-top: 2px solid var(--ink); }
.gback { font-family: var(--mono); font-size: 1.1rem; cursor: pointer; border: 2px solid var(--rule); background: transparent; color: var(--muted); padding: 0.55rem 0.9rem; line-height: 1; }
.gback:hover { border-color: var(--ink); color: var(--ink); }
.cont { margin-left: auto; font-family: var(--display); font-weight: 700; font-size: 1rem; text-transform: lowercase; letter-spacing: 0.01em; cursor: pointer; border: none; background: var(--ink); color: var(--paper); padding: 0.85rem 2.2rem; box-shadow: 0 4px 0 var(--measure); transition: transform 0.08s, box-shadow 0.08s; }
.cont:hover { background: var(--measure); box-shadow: 0 4px 0 var(--ink); }
.cont:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.final-screen .finlinks { font-family: var(--mono); font-size: 0.78rem; margin-top: 1.4rem; }
@media (max-width: 600px) { .gamebar { gap: 0.7rem; } .mascot { width: 38px; height: 44px; } }

/* the conversation surface (the final screen) */
.log { display: flex; flex-direction: column; gap: 1.4rem; margin: 1.6rem 0; }
.turn { display: flex; flex-direction: column; gap: 0.4rem; }
.turn .who { font-family: var(--mono); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.turn.you { align-items: flex-end; }
.turn.you .who { color: var(--faint); }
.turn.you .ubody { background: var(--ink); color: var(--paper); padding: 0.7rem 0.95rem; max-width: 82%; font-family: var(--mono); font-size: 0.8rem; line-height: 1.55; white-space: pre-wrap; }
.turn.dram .who { color: var(--measure); }
.turn.dram .who .bymodel { color: var(--faint); font-weight: 400; letter-spacing: 0.04em; }
.turn.dram .reality { font-size: 1rem; }
.turn.dram .thinking { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); margin: 0.2rem 0; }
.thinking { animation: think-pulse 1.4s ease-in-out infinite; }
@keyframes think-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
/* watch it think — the reasoning streams in, collapsible like Claude */
.thinkblock { margin: 0 0 0.7rem; border-left: 2px solid var(--rule); padding-left: 0.85rem; }
.thinkblock summary { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); cursor: pointer; list-style: none; outline: none; }
.thinkblock summary::-webkit-details-marker { display: none; }
.thinkblock summary::before { content: "▸ "; }
.thinkblock[open] summary::before { content: "▾ "; }
.thinktext { font-family: var(--mono); font-size: 0.76rem; line-height: 1.55; color: var(--faint); white-space: pre-wrap; margin-top: 0.45rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.1rem; }
.chip { font-family: var(--mono); font-size: 0.68rem; cursor: pointer; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); padding: 0.45rem 0.7rem; text-align: left; line-height: 1.2; }
.chip:hover { border-color: var(--measure); color: var(--measure); }
/* tools: one reveal of everything the dramaturg can do, in the one workspace */
.toolsrow { margin: 0.1rem 0 0.7rem; }
.toolsbtn { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.05em; text-transform: lowercase; color: var(--measure); background: none; border: 1px solid var(--rule); padding: 0.32rem 0.75rem; cursor: pointer; }
.toolsbtn:hover { border-color: var(--measure); }
.toolsbtn[aria-expanded="true"] { background: var(--measure); color: var(--paper); border-color: var(--measure); }
.localbtn[aria-pressed="true"] { background: var(--measure); color: var(--paper); border-color: var(--measure); }
.localbtn[disabled] { opacity: 0.5; cursor: default; }
.toolspanel { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.55rem; }
.toolspanel[hidden] { display: none; }
.toolspanel .chip.tool { color: var(--ink); }
.toolspanel .chip.tool:hover { color: var(--measure); border-color: var(--measure); }

/* THE WORKSPACE CHAT (chatonly) — a solid brick: the conversation scrolls INSIDE
   it, the composer is pinned, and it never auto-scrolls. Scoped to chatonly so the
   walkthrough itself is never touched. */
html:has(body.chatonly), body.chatonly { height: 100%; }
body.chatonly { overflow: hidden; }
/* …except the agentic workstation, which scrolls the page so the corpus footer
   lives as its own section below the full-screen chat (the .ws-shell sizes the
   chat to the viewport on its own, so the body no longer needs the 100% lock). */
html:has(body.agentic.chatonly), body.agentic.chatonly { height: auto; }
body.agentic.chatonly { overflow: visible; overflow-x: hidden; }
body.chatonly #main { height: 100%; min-height: 0; }
body.chatonly .game { height: 100%; min-height: 0; max-width: 52rem; }
body.chatonly .gamebar, body.chatonly .gamefoot { display: none; } /* dramaturg bar above already brands + exits */
body.chatonly .stage { flex: 1 1 auto; min-height: 0; padding: 0; justify-content: flex-start; }
body.chatonly .final-screen { display: flex; flex-direction: column; height: 100%; min-height: 0; }
body.chatonly .final-screen .big { flex: 0 0 auto; font-size: clamp(1.3rem, 3vw, 1.8rem); margin: 1.1rem 0 0.2rem; }
body.chatonly .final-screen .line { display: none; } /* the opening chat message carries the welcome — no fixed intro wall */
body.chatonly #log { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0.7rem 0 0.6rem; padding-right: 0.35rem; }
body.chatonly #chips, body.chatonly .toolsrow, body.chatonly .sayrow { flex: 0 0 auto; }
body.chatonly .sayrow { margin-bottom: 1rem; }

/* the workspace greeting — Claude-like: a calm, time-aware hello that rotates a
   short welcome while the conversation is empty. It stands in for the walk's locked
   final heading INSIDE the workspace only; the walk itself is never touched. */
body.chatonly .final-screen .big { display: none; }
body.chatonly .greet { flex: 0 0 auto; padding: 1.3rem 0 0.5rem; }
.greet[hidden] { display: none; }
.greet-tod { font-family: var(--display); font-weight: 600; font-size: clamp(1.45rem, 3.4vw, 2.1rem); letter-spacing: -0.01em; color: var(--ink); margin: 0 0 0.25rem; }
.greet-rot { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.03em; color: var(--measure); margin: 0; min-height: 1.2em; }
.greet-rot.in { animation: greet-fade 0.5s ease; }
@keyframes greet-fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* answer footer: copy + the plain-language routing note (legibility is the point) */
.ansbar { display: flex; align-items: center; gap: 0.85rem; margin: 0.6rem 0 0.1rem; flex-wrap: wrap; }
.ans-act { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: none; border: 1px solid var(--rule); padding: 0.22rem 0.55rem; cursor: pointer; }
.ans-act:hover { color: var(--measure); border-color: var(--measure); }
.routed { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.01em; color: var(--faint); }

/* completion floor: an answer that was cut off, dropped, or errored says so plainly
   and looks different from a clean one — never a finished answer in disguise. */
.finish-note {
  font-family: var(--mono); font-size: 0.68rem; line-height: 1.5; letter-spacing: 0.01em;
  margin: 0.7rem 0 0.1rem; padding: 0.5rem 0.7rem; border-left: 2px solid var(--rule);
  background: var(--paper-2); color: var(--muted); border-radius: 0 4px 4px 0;
  overflow-wrap: break-word;
}
.finish-note::before { content: "⚠ "; font-weight: 700; }
.finish-note.warn { border-left-color: #b8860b; color: #6b5418; background: color-mix(in srgb, #b8860b 9%, var(--paper)); }
.finish-note.err { border-left-color: var(--measure); color: var(--measure); background: color-mix(in srgb, var(--measure) 8%, var(--paper)); }
.finish-note.muted { color: var(--faint); }
.finish-note.muted::before { content: ""; }

/* receipts: the corpus passages + web pages an answer actually stood on */
.sources { margin: 0.55rem 0 0.1rem; }
.sources summary { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); cursor: pointer; list-style: none; outline: none; }
.sources summary::-webkit-details-marker { display: none; }
.sources summary::before { content: "▸ "; }
.sources[open] summary::before { content: "▾ "; }
.sources ul { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.sources li { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.86rem; }
.sources a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
.sources a:hover { color: var(--measure); border-color: var(--measure); }
.src-k { font-family: var(--mono); font-size: 0.54rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }

/* links, inline code, ordered lists, and quotes inside Dorothy's prose */
.reality a { color: var(--measure); text-decoration: none; border-bottom: 1px solid currentColor; }
.reality a:hover { color: var(--ink); }
.reality code { font-family: var(--mono); font-size: 0.86em; background: var(--paper-2); padding: 0.05rem 0.3rem; border-radius: 2px; overflow-wrap: anywhere; }
/* fenced code blocks in chat: scroll horizontally rather than stretch the bubble;
   on small screens, wrap so nothing overflows the viewport. */
.reality pre { font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; background: var(--ink); color: #efe9d8; padding: 0.85rem 1rem; border-radius: 6px; overflow-x: auto; margin: 0 0 0.9rem; max-width: 100%; }
.reality pre code { background: none; padding: 0; font-size: inherit; border-radius: 0; white-space: pre; overflow-wrap: normal; }
/* a long bare URL or token must never push the layout sideways */
.reality a, .reality p { overflow-wrap: anywhere; }
.reality ol { margin: 0 0 0.9rem; padding-left: 1.3rem; }
.reality ol li { margin-bottom: 0.4rem; line-height: 1.55; }
.reality blockquote { margin: 0 0 0.9rem; padding-left: 0.9rem; border-left: 2px solid var(--measure); color: var(--muted); }

/* composer: send doubles as stop while streaming; the textarea grows with content */
body.chatonly .sayrow #say { resize: none; overflow-y: auto; max-height: 168px; }
.run.stopping { background: var(--measure); border-color: var(--measure); }
.run.stopping:hover { background: var(--ink); border-color: var(--ink); }

/* multimodal: attach an image for a vision read */
.sayrow .clip { flex: 0 0 auto; align-self: stretch; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.05em; text-transform: lowercase; color: var(--muted); background: none; border: 1px solid var(--rule); padding: 0 0.65rem; cursor: pointer; white-space: nowrap; }
.sayrow .clip:hover { color: var(--measure); border-color: var(--measure); }
.attach { display: flex; gap: 0.5rem; margin: 0 0 0.5rem; }
.attach[hidden] { display: none; }
.attach .thumb { position: relative; display: inline-block; }
.attach .thumb img { height: 64px; width: auto; max-width: 120px; object-fit: cover; border: 1px solid var(--rule); display: block; }
.attach .thumb-x { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font-size: 0.82rem; line-height: 1; cursor: pointer; padding: 0; }
.attach .thumb-x:hover { color: var(--measure); border-color: var(--measure); }
.turn.you .uimg { max-width: 220px; max-height: 220px; border: 1px solid var(--rule); margin-bottom: 0.4rem; display: block; }

/* AI news tool — a live feed that develops in the conversation, story by story */
.newsfeed { display: flex; flex-direction: column; gap: 0.7rem; margin: 0.3rem 0; }
.newscard { border: 1px solid var(--rule); background: var(--paper); overflow: hidden; }
.newscard .nc-img { height: 150px; background-size: cover; background-position: center; border-bottom: 1px solid var(--rule); }
.nc-body { padding: 0.8rem 1rem 1rem; }
.nc-src { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--measure); }
.nc-title { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; line-height: 1.25; margin: 0.25rem 0 0.4rem; color: var(--ink); }
.nc-sum { font-family: var(--serif); font-size: 0.92rem; line-height: 1.45; color: var(--ink-soft); margin: 0 0 0.6rem; }
.nc-actions { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.nc-btn { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.04em; text-transform: lowercase; border: 1.5px solid var(--measure); background: var(--measure); color: var(--paper); padding: 0.4rem 0.8rem; cursor: pointer; }
.nc-btn:hover { background: var(--ink); border-color: var(--ink); }
.nc-link { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.03em; color: var(--muted); text-decoration: none; }
.nc-link:hover { color: var(--measure); }
.nc-read { margin-top: 0.8rem; padding-top: 0.7rem; border-top: 1px solid var(--rule); font-size: 0.98rem; }

.sayrow { display: flex; gap: 0.6rem; align-items: stretch; }
.sayrow #say { flex: 1; }
.sayrow .run { margin-top: 0; flex: 0 0 auto; align-self: stretch; }
.field select, #model { width: 100%; font-family: var(--mono); font-size: 0.82rem; padding: 0.7rem 0.8rem; border: 2px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); cursor: pointer; }
.field select:focus, #model:focus { outline: none; border-color: var(--measure); }
.run { margin-top: 0.9rem; background: var(--ink); color: var(--paper); padding: 0.6rem 1.3rem; }
.run:hover { background: var(--measure); border-color: var(--measure); }
.results { margin-top: 2rem; }
.section-h { font-family: var(--mono); font-size: 0.76rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.1em; color: var(--ink); border-bottom: 1px solid var(--ink); padding-bottom: 0.5rem; margin: 2.5rem 0 1.2rem; }
.section-h em { font-style: italic; text-transform: none; letter-spacing: 0; color: var(--muted); font-family: var(--serif); font-size: 1rem; }
.verdict { font-family: var(--display); display: flex; flex-direction: column; gap: 0.2rem; padding: 1rem 1.2rem; border: 2px solid var(--ink); margin-bottom: 1.5rem; }
.verdict strong { font-weight: 800; font-size: 1.25rem; }
.verdict span { font-family: var(--mono); font-size: 0.68rem; text-transform: lowercase; letter-spacing: 0.05em; color: var(--muted); }
.v-fires { border-color: var(--measure); border-width: 3px; }
.tier { margin: 1.5rem 0; }
.tier h3 { font-family: var(--mono); font-size: 0.76rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.06em; display: flex; align-items: baseline; gap: 0.6rem; margin: 0 0 0.8rem; }
.tier h3 em { font-style: normal; color: var(--muted); }
.badge { font-family: var(--mono); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; padding: 0.2rem 0.5rem; color: var(--paper); }
.tier-fires .badge { background: var(--measure); } .tier-partial .badge { background: #8a6d1f; }
.tier-check .badge { background: var(--remainder); } .tier-clear .badge { background: #3c5a37; }
.finding { border: 2px solid var(--rule); padding: 1rem 1.1rem; margin-bottom: 0.8rem; background: var(--paper); }
.finding.billf { border-color: var(--measure); border-left-width: 4px; }
.finding p { margin: 0 0 0.7rem; font-size: 0.96rem; line-height: 1.5; }
.finding p:last-child { margin-bottom: 0; }
.finding .k { display: block; font-family: var(--mono); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: lowercase; color: var(--muted); margin-bottom: 0.25rem; }
.finding .probe { font-family: var(--mono); font-size: 0.74rem; font-weight: 700; text-transform: lowercase; letter-spacing: 0.04em; color: var(--ink); }
.finding mark { background: #f4cf6a; padding: 0 0.1em; }
.finding .ev blockquote { font-family: var(--mono); font-size: 0.82rem; line-height: 1.5; margin: 0.3rem 0 0; padding: 0.5rem 0.7rem; background: var(--paper-2); border-left: 2px solid var(--remainder); }
.empty, .discipline { font-family: var(--mono); font-size: 0.78rem; line-height: 1.7; color: var(--muted); }
.discipline { border-top: 2px solid var(--ink); padding-top: 1.2rem; margin-top: 2rem; }
.discipline a { color: var(--measure); }

/* ---------- footer / colophon ---------- */
footer { border-top: 1px solid var(--ink); margin-top: 4rem; padding: 2.5rem clamp(1.1rem,5vw,3rem) 3.5rem calc(36px + clamp(1.1rem,5vw,3rem)); }
footer .colophon { max-width: 64rem; margin: 0 auto; font-family: var(--mono); font-size: 0.72rem; line-height: 1.9; letter-spacing: 0.02em; color: var(--muted); text-transform: lowercase; }
footer .colophon a { color: var(--ink); text-transform: none; }
footer .colophon .lead { color: var(--measure); font-weight: 700; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  body { font-size: 18px; }
  .topbar { padding: 0.65rem 1rem; gap: 0.4rem 1rem; }
  .topbar .home { font-size: 0.9rem; }
  .topbar .home small { font-size: 0.5rem; }
  .topbar nav { gap: 0.6rem 0.85rem; }
  .topbar nav a { font-size: 0.6rem; }
  .cover { padding: 1.4rem 1.1rem 1rem; }
  .cover h1.title { font-size: clamp(2.1rem, 12.5vw, 3.2rem); line-height: 1.0; }
  .cover .statement { font-size: 1.12rem; }
  .issueline { font-size: 0.62rem; letter-spacing: 0.08em; flex-direction: column; align-items: flex-start; gap: 0.15rem; }
  .issueline .dot { display: none; }
  .contents, .dbwrap { padding-left: 1.1rem; padding-right: 1.1rem; }
  .dept-head .no { font-size: 1.2rem; }
  .dept-head .gloss { display: none; }
  .dept-head h2 { font-size: 1.5rem; }
  .feature { padding: 1.4rem 1.2rem 1.6rem; }
  .feature h3 { font-size: 1.6rem; }
  .piece h1 { font-size: clamp(1.8rem, 9vw, 2.4rem); }
  .autotheory .prose h1 { font-size: clamp(1.6rem, 7vw, 2.1rem); }
  footer { padding-left: 1.1rem; padding-right: 1.1rem; }
  .searchbox { font-size: 1.3rem; }

  /* every focusable text field ≥16px so iOS Safari never zooms in on focus
     (the chat composer was ~14px, which forced the tap-to-zoom in the screenshots) */
  #copy, #arch, #input, #story, #say, .field select, #model { font-size: 16px; }

  /* composer, restructured for phones: the textarea takes the full width and the
     controls sit on a tidy row beneath it, instead of three cramped columns */
  .sayrow { flex-wrap: wrap; gap: 0.5rem; }
  .sayrow #say { order: 0; flex: 1 1 100%; min-height: 3rem; line-height: 1.45; padding: 0.8rem; }
  .sayrow .clip { order: 1; align-self: auto; flex: 0 0 auto; padding: 0.65rem 0.9rem; font-size: 0.72rem; }
  .sayrow .run { order: 2; align-self: auto; flex: 1 1 auto; padding: 0.7rem 1rem; font-size: 0.82rem; }
  body.chatonly .sayrow #say { max-height: 40vh; }

  /* tighten the workspace chrome so the conversation gets the room on small screens */
  body.chatonly .greet { padding: 0.9rem 0 0.4rem; }
  .greet-tod { font-size: clamp(1.5rem, 8vw, 1.9rem); }
  body.chatonly #log { margin: 0.5rem 0 0.5rem; }
  .chips { gap: 0.45rem; margin-bottom: 0.8rem; }
  .chip { font-size: 0.78rem; padding: 0.55rem 0.75rem; }
}

/* ---------- motion ---------- */
/* hiding only applies when JS is present (html.js); no-JS = always visible */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .js .reveal { opacity: 1; transform: none; transition: none; } #measure { transition: none; } }

/* ====================================================================== */
/* PANDORA'S BOX — Dorothy workspace. One chamber unlocks the next.       */
/* Walk → Ask → Shape → Remember → Ground → Act → Archive               */
/* ====================================================================== */

body.pandora { margin: 0; background: var(--ink); color: var(--paper); font-family: var(--display); overflow-x: hidden; }
body.pandora:has(.pandora-workspace.is-open),
body.pandora:has(.ws-shell.is-open) { min-height: 100dvh; }
body.pandora .skip { background: var(--measure); }

/* ── Walk chamber (sealed box) ── */
body.pandora .chamber-walk { min-height: 100vh; min-height: 100dvh; background: var(--paper); color: var(--ink); transition: opacity 0.55s cubic-bezier(0.4, 0, 0.7, 1), transform 0.55s cubic-bezier(0.4, 0, 0.7, 1); }
body.pandora .chamber-walk.is-sealed { opacity: 0; transform: scale(0.98); pointer-events: none; position: absolute; inset: 0; z-index: 0; }
body.pandora .walk-label { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.14em; text-transform: lowercase; color: var(--muted); white-space: nowrap; }

/* ── Workspace shell ── */
.pandora-workspace { display: flex; flex-direction: column; height: 100dvh; opacity: 0; transform: translateY(12px); transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.pandora-workspace.is-open { opacity: 1; transform: none; }

.pandora-bar {
  display: flex; align-items: center; gap: 0.75rem 1rem; flex-wrap: wrap;
  padding: 0 1rem; height: 52px; flex-shrink: 0;
  background: var(--ink); border-bottom: 1px solid #2a2823; z-index: 10;
}
.pandora-hamb { display: none; appearance: none; background: none; border: 0; color: var(--paper); font-size: 1.05rem; cursor: pointer; padding: 0.2rem; line-height: 1; }
.pandora-brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--paper); }
.pandora-brand .face { width: 22px; height: 26px; flex-shrink: 0; }
.pandora-brand span { display: flex; flex-direction: column; line-height: 1.05; }
.pandora-brand b { font-weight: 700; font-size: 0.94rem; letter-spacing: -0.01em; }
.pandora-brand small { font-family: var(--mono); font-size: 0.48rem; letter-spacing: 0.14em; text-transform: lowercase; color: #8a8478; margin-top: 2px; }

.pandora-exits { margin-left: auto; display: flex; gap: 0.85rem; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em; }
.pandora-exits a { color: #b7b0a0; text-decoration: none; }
.pandora-exits a:hover { color: var(--measure); }
.pandora-exits a.is-open, .pandora-exits a[data-unlock].is-open { display: inline; }

/* ── Body grid: nav | panels | chat | panels ── */
.pandora-body {
  flex: 1; display: block; min-height: 0; position: relative;
}

.pandora-nav {
  position: fixed; top: 52px; left: 0; bottom: 0; width: 0; overflow: hidden;
  background: #16150f; border-right: 1px solid #2a2823; z-index: 20;
  display: flex; flex-direction: column; transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s;
}
.pandora-nav.has-history { width: 248px; }
.pandora-new {
  margin: 0.75rem; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.05em;
  color: var(--paper); background: var(--measure); border: 1px solid var(--measure);
  padding: 0.55rem 0.75rem; cursor: pointer; text-align: left; white-space: nowrap;
}
.pandora-new:hover { background: #c52908; }
.pandora-nav-label { font-family: var(--mono); font-size: 0.52rem; letter-spacing: 0.14em; text-transform: uppercase; color: #75705f; padding: 0.5rem 1rem 0.25rem; white-space: nowrap; }
.pandora-hist { flex: 1; overflow-y: auto; padding: 0 0.45rem 1rem; min-height: 0; }
.hist-empty { font-family: var(--mono); font-size: 0.62rem; color: #75705f; padding: 0.5rem; line-height: 1.5; }
.hist-row { display: flex; align-items: stretch; border-radius: 3px; }
.hist-row:hover { background: #201e16; }
.hist-it { flex: 1; min-width: 0; text-align: left; border: 0; background: none; cursor: pointer; padding: 0.5rem 0.55rem; color: #cfc8b8; }
.hist-it b { display: block; font-weight: 500; font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-it time { font-family: var(--mono); font-size: 0.52rem; color: #75705f; }
.hist-del { appearance: none; background: none; border: 0; color: #75705f; cursor: pointer; padding: 0 0.5rem; opacity: 0; font-size: 1rem; }
.hist-row:hover .hist-del { opacity: 1; }
.hist-del:hover { color: var(--measure); }
.pandora-scrim { display: none; }

.pandora-core {
  position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--paper); color: var(--ink);
  margin-left: 0; transition: margin-left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
body.pandora .pandora-nav.has-history ~ .pandora-scrim ~ .panel-context ~ .pandora-core,
body.pandora .pandora-nav.has-history ~ .pandora-scrim ~ .pandora-core { margin-left: 248px; }

.pandora-chat-root {
  display: flex; flex-direction: column; height: 100%; min-height: 0;
  max-width: 42rem; margin: 0 auto; width: 100%; padding: 0 1rem 1rem;
}
body.pandora .pandora-chat-root .big, body.pandora .pandora-chat-root .line { display: none; }
body.pandora #log { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0.6rem 0; padding-right: 0.25rem; }
body.pandora .greet { padding: 1.2rem 0 0.35rem; }
body.pandora .greet-tod { font-family: var(--display); font-weight: 600; font-size: clamp(1.35rem, 3.2vw, 1.85rem); letter-spacing: -0.01em; margin: 0 0 0.2rem; }
body.pandora .sayrow { flex-shrink: 0; margin-bottom: 0.25rem; }

/* side panels — chambers */
.pandora-panel {
  position: fixed; top: 52px; bottom: 0; width: min(280px, 88vw); z-index: 8;
  background: var(--paper-2); border: 1px solid var(--rule); padding: 1rem 1.1rem;
  overflow-y: auto; opacity: 0; pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.pandora-panel.is-open { opacity: 1; pointer-events: auto; }
.panel-context { left: 0; transform: translateX(-100%); border-left: 3px solid var(--remainder); }
.panel-context.is-open { transform: translateX(0); }
.panel-sources { right: 0; transform: translateX(100%); border-right: 3px solid var(--remainder); max-height: calc(100dvh - 52px); }
.panel-sources.is-open { transform: translateX(0); }
.panel-head { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--measure); margin-bottom: 0.85rem; }
.panel-copy { font-family: var(--serif); font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft); margin: 0 0 0.75rem; }
.panel-act {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.05em; text-transform: lowercase;
  border: 1px solid var(--ink); background: transparent; color: var(--ink); padding: 0.4rem 0.7rem; cursor: pointer; margin-top: 0.5rem;
}
.panel-act:hover { background: var(--ink); color: var(--paper); }
.panel-link { display: inline-block; text-decoration: none; margin-top: 1rem; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em; color: var(--measure); border-bottom: 1px solid var(--measure); }
.source-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.source-list li { font-size: 0.82rem; line-height: 1.35; }
.source-list a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
.source-list a:hover { color: var(--measure); border-color: var(--measure); }
.source-list .src-tag { font-family: var(--mono); font-size: 0.5rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-left: 0.35rem; }

/* corpus chamber */
.pandora-corpus {
  flex-shrink: 0; background: var(--paper); color: var(--ink); border-top: 3px solid var(--measure);
  padding: clamp(2.5rem, 8vw, 5rem) 1.4rem; text-align: center;
  min-height: 48vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(20px); transition: opacity 0.55s, transform 0.55s;
}
.pandora-corpus.is-open { opacity: 1; transform: none; }
.corpus-kicker { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em; text-transform: lowercase; color: var(--muted); margin: 0 0 0.65rem; }
.corpus-door {
  display: inline-block; text-decoration: none; color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 4.5vw, 2.4rem);
  letter-spacing: -0.01em; line-height: 1.05; border-bottom: 3px solid var(--measure); padding-bottom: 0.12rem;
}
.corpus-door:hover { color: var(--measure); }
.corpus-sub { margin: 1rem auto 0; max-width: 32rem; font-family: var(--serif); font-size: 0.95rem; line-height: 1.45; color: var(--muted); }

/* unlock toast */
.unlock-toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%) translateY(12px);
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: lowercase;
  background: var(--ink); color: var(--paper); padding: 0.55rem 1rem; border-left: 3px solid var(--measure);
  opacity: 0; pointer-events: none; z-index: 100; transition: opacity 0.3s, transform 0.3s;
}
.unlock-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .pandora-hamb { display: block; }
  .pandora-brand small { display: none; }
  .pandora-nav.has-history { width: 0; transform: translateX(-100%); }
  body.pandora.nav-open .pandora-nav.has-history { width: min(280px, 85vw); transform: none; }
  body.pandora.nav-open .pandora-scrim { display: block; position: fixed; inset: 52px 0 0; background: rgba(14,13,10,0.45); z-index: 15; }
  body.pandora .pandora-nav.has-history ~ .pandora-scrim ~ .panel-context ~ .pandora-core,
  body.pandora .pandora-nav.has-history ~ .pandora-scrim ~ .pandora-core { margin-left: 0; }
  .pandora-panel { width: min(260px, 92vw); }
}

@media (prefers-reduced-motion: reduce) {
  .pandora-workspace, .ws-shell, .chamber-walk, .pandora-panel, .pandora-corpus, .unlock-toast { transition: none; }
  /* the walk's reveal + mascot motion off for anyone who asked for less */
  .rin, .mascot svg, .mascot.talk svg, .mascot .eye { animation: none; }
  .rin { opacity: 1; transform: none; }
}

/* ====================================================================== */
/* AGENTIC WORKSTATION — Dorothy's command center                         */
/* ====================================================================== */

/* iconic type, scoped to the workstation: Bricolage for display, a clean
   grotesque mono for the chrome, Newsreader for what Dorothy actually says. */
body.agentic {
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* the chat fills the first screen; the corpus is its own section below the fold,
   reached by scrolling the page — so the shell no longer locks body scroll. */
body.agentic:has(.ws-shell.is-open) { min-height: 100dvh; }

.ws-shell {
  /* --app-h is set from window.visualViewport on iOS so the composer rides above
     the on-screen keyboard (iOS won't shrink 100dvh when the keyboard opens).
     Everywhere else --app-h is unset and it falls back to 100dvh. */
  display: flex; flex-direction: column; height: var(--app-h, 100dvh); position: relative;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1), transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.ws-shell.is-open { opacity: 1; transform: none; }

.ws-alert {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.04em; text-transform: lowercase;
  padding: 0.45rem 1rem; background: #2a2823; color: #cfc8b8; border-bottom: 1px solid #3a3830;
}
.ws-alert[data-tone="error"] { background: #3a1810; color: #f4c4b8; border-color: var(--measure); }

/* top bar */
.ws-topbar {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: nowrap;
  min-height: 60px; padding: 0 1.1rem; flex-shrink: 0;
  background: var(--ink); border-bottom: 1px solid #26241d; z-index: 12;
}
.ws-hamb {
  display: grid; place-items: center; width: 34px; height: 34px; appearance: none;
  background: none; border: 1px solid transparent; border-radius: 7px; color: #cfc8b8;
  font-size: 1rem; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.ws-hamb:hover { background: #221f18; border-color: #34302a; color: var(--paper); }
.ws-brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--paper); flex-shrink: 0; }
.ws-brand .face { width: 22px; height: 26px; }
.ws-brand span { display: flex; flex-direction: column; line-height: 1.05; }
.ws-brand b { font-family: var(--display); font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.ws-brand small { font-family: var(--mono); font-size: 0.46rem; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: #8a8478; margin-top: 1px; }

.ws-spacer { flex: 1; }

/* top-right nav: a single button system for sources / tools / corpus / walk */
.ws-nav { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.ws-navbtn {
  font-family: var(--mono); font-size: 0.62rem; font-weight: 500; letter-spacing: 0.04em;
  text-transform: lowercase; padding: 0.44rem 0.8rem; border-radius: 8px; cursor: pointer;
  border: 1px solid #34302a; background: #1b1913; color: #cfc8b8; text-decoration: none;
  white-space: nowrap; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ws-navbtn:hover { border-color: #57514a; background: #262219; color: var(--paper); }
.ws-navbtn[aria-pressed="true"], .ws-navbtn[aria-expanded="true"] { background: var(--measure); border-color: var(--measure); color: var(--paper); }
.ws-tools-wrap { position: relative; display: inline-flex; z-index: 50; }

.ws-stop {
  font-family: var(--mono); font-size: 0.62rem; font-weight: 500; letter-spacing: 0.04em;
  text-transform: lowercase; padding: 0.44rem 0.8rem; border-radius: 8px; cursor: pointer;
  background: #2a1414; border: 1px solid #5a2a2a; color: #f4a898; transition: background 0.15s;
}
.ws-stop:hover { background: var(--measure); border-color: var(--measure); color: var(--paper); }
.ws-stop[hidden] { display: none; }

/* 3-pane grid */
.ws-grid {
  flex: 1; display: grid; min-height: 0;
  grid-template-columns: 0 minmax(0, 1fr) 0;
  transition: grid-template-columns 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.ws-shell.has-inspector .ws-grid { grid-template-columns: 0 minmax(0, 1fr) 360px; }
.ws-rail.has-history ~ .ws-scrim ~ .ws-center { /* center only */ }

.ws-rail {
  position: absolute; top: 64px; left: 0; bottom: 0; width: 0; overflow: hidden; z-index: 20;
  background: #16150f; border-right: 1px solid #2a2823;
  display: flex; flex-direction: column;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.ws-rail.has-history { width: 280px; }
.ws-new {
  margin: 0.85rem; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.05em;
  color: var(--paper); background: var(--measure); border: none; padding: 0.6rem 0.85rem; cursor: pointer; text-align: left;
}
.ws-rail-label { font-family: var(--mono); font-size: 0.52rem; letter-spacing: 0.14em; text-transform: uppercase; color: #75705f; padding: 0 1rem 0.35rem; }
.ws-hist { flex: 1; overflow-y: auto; padding: 0 0.5rem 1rem; }
.hist-it .status-pill { display: block; font-family: var(--mono); font-size: 0.48rem; letter-spacing: 0.08em; text-transform: uppercase; color: #75705f; margin-top: 0.15rem; }
.ws-scrim { display: none; }

.ws-center {
  grid-column: 2; display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--paper); color: var(--ink);
  margin-left: 0; transition: margin-left 0.35s;
}
.ws-rail.has-history ~ .ws-scrim ~ .ws-center { margin-left: 280px; }

.mission-header { flex-shrink: 0; padding: 1rem 1.5rem 0.5rem; border-bottom: 1px solid var(--rule); }
.mission-title {
  margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  letter-spacing: -0.02em; line-height: 1.15;
}
.mission-meta { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; margin-top: 0.35rem; }
.route-note { font-family: var(--mono); font-size: 0.58rem; color: var(--measure); }

body.agentic .pandora-chat-root { flex: 1; max-width: none; padding: 0 1.5rem 1rem; min-height: 0; }
body.agentic .ws-thread { flex: 1; min-height: 0; overflow-y: auto; }

/* system / tool event rows in thread */
.turn.system .who { color: var(--muted); }
.turn.system .sysbody {
  font-family: var(--mono); font-size: 0.72rem; line-height: 1.5; color: var(--ink-soft);
  border-left: 2px solid var(--rule); padding: 0.35rem 0 0.35rem 0.75rem; max-width: 100%;
}
.turn.system .sysbody.tool { border-left-color: var(--measure); }

/* right inspector */
.ws-inspector {
  grid-column: 3; display: flex; flex-direction: column; min-height: 0;
  background: var(--paper-2); border-left: 1px solid var(--rule); overflow: hidden;
}
.ws-shell:not(.has-inspector) .ws-inspector { display: none; }

.insp-head-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.1rem 0.7rem; border-bottom: 1px solid var(--rule); flex-shrink: 0;
}
.insp-close {
  appearance: none; border: 0; background: none; color: var(--muted);
  font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 0.2rem;
}
.insp-close:hover { color: var(--measure); }
.insp-body { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; }
.insp-head { font-family: var(--mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--measure); margin: 0; }
.insp-copy { font-family: var(--serif); font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft); margin: 0 0 0.65rem; }
.insp-copy.muted { color: var(--muted); }

.status-pill {
  font-family: var(--mono); font-size: 0.5rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .ws-shell.has-inspector .ws-grid { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .ws-inspector {
    position: fixed; right: 0; top: auto; bottom: 0; left: 0; height: 45vh; z-index: 25;
    grid-column: auto; border-left: none; border-top: 2px solid var(--measure);
  }
}

@media (max-width: 720px) {
  .ws-hamb { display: grid; }
  .ws-rail.has-history { width: 0; }
  body.agentic.nav-open .ws-rail.has-history { width: min(280px, 88vw); }
  body.agentic.nav-open .ws-scrim { display: block; position: fixed; inset: 64px 0 0; background: rgba(14,13,10,0.45); z-index: 15; }
  .ws-rail.has-history ~ .ws-scrim ~ .ws-center { margin-left: 0; }
  .mission-header { padding-left: 1rem; padding-right: 1rem; }
  body.agentic .pandora-chat-root { padding: 0 1rem 1rem; }
}

/* ---------------------------------------------------------------------- */
/* workstation polish — composer, tools popover, chips, thread            */
/* ---------------------------------------------------------------------- */
body.agentic .mission-header { padding: 1.1rem 1.6rem 0.75rem; }
body.agentic .mission-title { font-weight: 800; font-size: clamp(1.2rem, 2.4vw, 1.6rem); }
body.agentic .route-note { font-size: 0.6rem; letter-spacing: 0.05em; }
body.agentic .greet-tod { font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.5rem); }
body.agentic .greet-rot { font-size: 0.74rem; }

/* starter chips → soft pills */
body.agentic .chips { gap: 0.45rem; margin-bottom: 0.9rem; }
body.agentic .chip {
  font-size: 0.74rem; border-radius: 999px; border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper-2) 55%, transparent);
  padding: 0.5rem 0.9rem; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
body.agentic .chip:hover { background: var(--paper); border-color: var(--measure); color: var(--measure); }

/* tools → a dropdown from the top-right nav (closes on click-out / Esc) */
body.agentic #toolsbtn::before { content: "⊕ "; color: var(--measure); }
body.agentic #toolsbtn[aria-expanded="true"]::before { color: var(--paper); }
body.agentic .toolspanel {
  position: absolute; top: calc(100% + 0.55rem); right: 0; left: auto; z-index: 40;
  display: flex; flex-direction: column; gap: 0; min-width: 300px; margin: 0;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 16px 48px rgba(14,13,10,0.28); padding: 0.4rem; overflow: hidden;
}
body.agentic .toolspanel[hidden] { display: none; }
body.agentic .toolspanel .chip.tool {
  border: 0; border-radius: 8px; background: none; width: 100%; font-size: 0.8rem; color: var(--ink);
  padding: 0.6rem 0.7rem; text-transform: none; letter-spacing: 0; font-family: var(--serif);
}
body.agentic .toolspanel .chip.tool:hover { background: var(--paper-2); color: var(--measure); }

/* empty-state welcome card — clear, centered, with numbered example questions */
body.agentic.fresh #log { flex: 0 0 auto; }
body.agentic.fresh .greet { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: 1rem 0 1.4rem; }
.ws-welcome { max-width: 40rem; margin: 0 auto; width: 100%; }
.ws-welcome-kicker { font-family: var(--mono); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--measure); margin: 0 0 0.85rem; }
.ws-welcome-title { font-family: var(--display); font-weight: 800; font-size: clamp(1.9rem, 4.6vw, 2.9rem); letter-spacing: -0.025em; line-height: 1.02; margin: 0 0 0.65rem; color: var(--ink); }
.ws-welcome-sub { font-family: var(--serif); font-size: 1.02rem; line-height: 1.5; color: var(--muted); margin: 0 0 1.7rem; max-width: 33rem; }
.ws-examples { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.ws-example {
  display: flex; gap: 1rem; align-items: baseline; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--rule); padding: 0.95rem 0.35rem; cursor: pointer;
  font-family: var(--serif); font-size: 1rem; line-height: 1.4; color: var(--ink);
  transition: background 0.14s, padding 0.14s, color 0.14s;
}
.ws-example:hover { background: var(--paper-2); padding-left: 0.75rem; color: var(--measure); }
.ws-example-n { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.05em; color: var(--faint); flex-shrink: 0; }
.ws-example:hover .ws-example-n { color: var(--measure); }
@media (max-width: 720px) { .ws-welcome-title { font-size: clamp(1.6rem, 8vw, 2.1rem); } }

/* composer → one rounded field, send affordance inside */
body.agentic .ws-composer {
  align-items: center; gap: 0.5rem; background: var(--paper);
  border: 1.5px solid var(--rule); border-radius: 16px; padding: 0.35rem 0.45rem 0.35rem 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
body.agentic .ws-composer:focus-within {
  border-color: var(--measure);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--measure) 14%, transparent);
}
body.agentic .ws-composer #say {
  border: 0; padding: 0.55rem 0.2rem; background: none; font-family: var(--serif);
  font-size: 1rem; line-height: 1.5; resize: none;
}
body.agentic .ws-composer #say:focus { outline: none; }
body.agentic .ws-composer .clip {
  align-self: center; border: 1px solid var(--rule); border-radius: 999px;
  padding: 0.42rem 0.7rem; font-size: 0.58rem; color: var(--muted);
}
body.agentic .ws-composer .clip:hover { border-color: var(--measure); color: var(--measure); }
body.agentic .ws-composer .run {
  align-self: center; border: 0; border-radius: 11px; background: var(--measure); color: var(--paper);
  padding: 0.62rem 1.2rem; font-weight: 700; font-size: 0.72rem; margin: 0;
}
body.agentic .ws-composer .run:hover { background: var(--ink); }
body.agentic .ws-composer .run.stopping { background: var(--ink); }

body.agentic .ws-thread { padding-right: 0.3rem; }
body.agentic .turn.you .who, body.agentic .turn.dram .who {
  font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint);
}

/* ====================================================================== */
/* MOBILE — the workstation as a phone-native chat, not a shrunk desktop  */
/* ====================================================================== */

/* nothing may push the layout sideways; ws-topbar excluded so its dropdown isn't clipped */
body.agentic, .ws-shell, .ws-center { max-width: 100vw; overflow-x: hidden; }
/* while the keyboard is open and the user is typing, pin the page so the composer
   can't be scrolled out from under the thumb; page scroll (to the corpus) returns on blur. */
body.agentic.kb-open { overflow: hidden; }

@media (max-width: 720px) {
  /* touch targets: 44px+ where a thumb lands */
  .ws-hamb { width: 44px; height: 44px; }
  .ws-navbtn { padding: 0.6rem 0.72rem; }
  body.agentic .ws-composer .run { padding: 0.72rem 1.05rem; font-size: 0.78rem; }
  body.agentic .ws-composer .clip { padding: 0.58rem 0.82rem; font-size: 0.62rem; }
  /* resize handle is invisible and mis-tappable on phones — remove it */
  #say { resize: none; }

  /* the nav can never break the bar — it scrolls horizontally if it must */
  .ws-nav { gap: 0.32rem; min-width: 0; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
  .ws-nav::-webkit-scrollbar { display: none; }

  /* composer rides above the home indicator + on-screen keyboard */
  body.agentic .pandora-chat-root { padding: 0 0.9rem calc(0.9rem + env(safe-area-inset-bottom)); }
  /* 16px input = iOS never zoom-jumps on focus */
  body.agentic .ws-composer #say { font-size: 16px; }

  /* long answers, URLs, and pasted text wrap instead of overflowing */
  body.agentic .turn.you .ubody { max-width: 88%; }
  body.agentic .reality, body.agentic .ubody, body.agentic .sysbody { overflow-wrap: break-word; }

  /* iOS rubber-band scroll on the thread must not bounce the whole page out from under
     the composer — contain it to the thread's own scroll container. */
  body.agentic .ws-thread { overscroll-behavior: contain; }

  /* while the keyboard is open, --app-h already accounts for it so safe-area padding
     at the bottom is gone (the keyboard sits where it was). When the keyboard is closed
     the padding comes back via the normal rule above. */
  body.agentic.kb-open .pandora-chat-root { padding-bottom: 0.5rem; }

  /* last bubble must not clip behind the composer — a small extra pad gives it air */
  body.agentic .ws-thread > :last-child { margin-bottom: 0.5rem; }
}

@media (max-width: 480px) {
  /* the wordmark would crowd the nav — collapse the brand to the bowtie */
  .ws-topbar { gap: 0.4rem; padding: 0 0.7rem; }
  .ws-brand span { display: none; }
  /* secondary nav lives elsewhere on a phone: corpus is the footer below,
     walk is a rare replay — keep sources / tools / local / stop inline */
  .ws-nav a.ws-navbtn[href="/corpus"], .ws-nav a.ws-navbtn[href="/?walk=1"] { display: none; }
  #runlocal { display: none; } /* the run-local panel is a desktop affordance */
  /* sources sheet taller for reading on a phone */
  .ws-inspector { height: 62vh; }
  /* corpus footer: gentler on a short screen */
  .pandora-corpus { min-height: auto; padding: 2.6rem 1.1rem; }
}

/* ---- local-first: toggle dot + run-local modal ---- */
.localtoggle { display: inline-flex; align-items: center; gap: 0.4rem; }
.localtoggle.is-localonly { background: var(--measure); border-color: var(--measure); color: var(--paper); }
.localdot { width: 7px; height: 7px; border-radius: 999px; flex: 0 0 auto; background: #6a655a; }
.localdot[data-state="online"] { background: #46c37b; box-shadow: 0 0 0 2px rgba(70,195,123,0.22); }
.localdot[data-state="offline"] { background: #d9a441; }
.localdot[data-state="none"] { background: #6a655a; }
.localdot[data-state="checking"] { background: #6a655a; animation: think-pulse 1.1s ease-in-out infinite; }

.localsetup {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(14,13,10,0.6); padding: 1rem;
}
.localsetup[hidden] { display: none; }
.localsetup-card { width: 100%; max-width: 34rem; background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; box-shadow: 0 24px 60px rgba(14,13,10,0.4); }
.localsetup-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--rule); }
.ls-kicker { font-family: var(--mono); font-size: 0.56rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--measure); margin: 0 0 0.3rem; }
.ls-title { font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; margin: 0; }
.ls-close { appearance: none; border: 0; background: none; font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); cursor: pointer; padding: 0.4rem; }
.ls-close:hover { color: var(--measure); }
.localsetup-body { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.9rem; }
.ls-status { display: flex; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 0.72rem; color: var(--muted); margin: 0; }
.ls-copy { font-family: var(--serif); font-size: 0.94rem; line-height: 1.5; color: var(--ink-soft); margin: 0; }
.ls-cmdrow { position: relative; }
.ls-cmd { font-family: var(--mono); font-size: 0.74rem; background: var(--ink); color: var(--paper); border-radius: 8px; padding: 0.85rem 4.5rem 0.85rem 0.9rem; margin: 0; overflow-x: auto; white-space: pre; }
.ls-copybtn { position: absolute; right: 0.5rem; top: 0.5rem; font-family: var(--mono); font-size: 0.56rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--paper); background: transparent; border: 1px solid #3a382f; border-radius: 6px; padding: 0.4rem 0.6rem; cursor: pointer; }
.ls-copybtn:hover { border-color: var(--measure); color: var(--measure); }
.ls-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.ls-dl { font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); text-decoration: none; }
.ls-dl:hover { color: var(--measure); }
.ls-models { font-family: var(--mono); font-size: 0.56rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ls-note { font-family: var(--serif); font-size: 0.8rem; line-height: 1.5; color: var(--muted); margin: 0; border-top: 1px solid var(--rule); padding-top: 0.8rem; }
.ls-note code { font-family: var(--mono); font-size: 0.74rem; color: var(--ink); }
