/* ============================================================
   WorkGraph — Editorial design system ("The Issue")
   Ink-on-cream, Swiss-typographic. Fraunces (display + numerals),
   Newsreader (prose), JetBrains Mono (technical apparatus).
   Day edition (default) + Night edition via [data-theme="night"].
   ============================================================ */

:root {
    --paper:    #efe7d3;   /* aged parchment */
    --paper-2:  #f7f1e1;   /* raised cards */
    --paper-3:  #e7ddc5;   /* sunken wells */
    --ink:      #1b1714;
    --ink-2:    #5b534a;
    --ink-3:    #8d8475;
    --rule:     rgba(27, 23, 20, 0.16);
    --rule-2:   rgba(27, 23, 20, 0.08);
    --accent:   #d8381a;   /* vermilion */
    --accent-2: #b22d10;
    --accent-3: #c98a2b;   /* ochre — fallback for the morning neon tertiary */
    --ok:       #3f7a52;
    --shadow:   18px 18px 0 rgba(27, 23, 20, 0.05);
    --serif:    'Fraunces', Georgia, serif;
    --body:     'Newsreader', Georgia, serif;
    --mono:     'JetBrains Mono', ui-monospace, monospace;
    --gx:       #0bb3d6;   /* chromatic-glitch cyan companion */
    --gy:       #6fb600;   /* chromatic-glitch lime companion */
    /* RGB channels so Tailwind utilities (remapped in tailwind.config.js) get
       palette colors with alpha support, theme-adaptive. */
    --accent-rgb: 216 56 26;   --accent-2-rgb: 178 45 16;  --accent-3-rgb: 201 138 43;
    --ok-rgb: 63 122 82;       --gx-rgb: 11 179 214;
    --ink-rgb: 27 23 20;       --ink-2-rgb: 91 83 74;      --ink-3-rgb: 141 132 117;
    --paper-rgb: 239 231 211;  --paper-2-rgb: 247 241 225; --paper-3-rgb: 231 221 197;
    color-scheme: light;
}

/* Morning edition — light risograph paper + neon trio, glitchy overprint. */
html[data-theme="morning"] {
    --paper:    #f6f4ef;
    --paper-2:  #fffefb;
    --paper-3:  #ebe7dd;
    --ink:      #14130f;
    --ink-2:    #4a463f;
    --ink-3:    #837c70;
    --rule:     rgba(20, 18, 16, 0.20);
    --rule-2:   rgba(20, 18, 16, 0.09);
    --accent:   #ff2d55;   /* neon pink — primary */
    --accent-2: #0bb3d6;   /* cyan */
    --accent-3: #6fb600;   /* lime */
    --ok:       #2fae6a;
    --accent-rgb: 255 45 85;   --accent-2-rgb: 11 179 214;  --accent-3-rgb: 111 182 0;
    --ok-rgb: 47 174 106;      --gx-rgb: 11 179 214;
    --ink-rgb: 20 19 15;       --ink-2-rgb: 74 70 63;       --ink-3-rgb: 131 124 112;
    --paper-rgb: 246 244 239;  --paper-2-rgb: 255 254 251;  --paper-3-rgb: 235 231 221;
    --shadow:   18px 18px 0 rgba(20, 18, 16, 0.06);
    color-scheme: light;
}

html[data-theme="night"] {
    --paper:    #15110d;
    --paper-2:  #1d1812;
    --paper-3:  #100d0a;
    --ink:      #f3ece0;
    --ink-2:    #b9b0a0;
    --ink-3:    #837a6c;
    --rule:     rgba(243, 236, 224, 0.18);
    --rule-2:   rgba(243, 236, 224, 0.08);
    --accent:   #ff5a33;
    --accent-2: #ff7a59;
    --accent-3: #e0a64a;
    --ok:       #6fc08a;
    --accent-rgb: 255 90 51;   --accent-2-rgb: 255 122 89;  --accent-3-rgb: 224 166 74;
    --ok-rgb: 111 192 138;     --gx-rgb: 11 179 214;
    --ink-rgb: 243 236 224;    --ink-2-rgb: 185 176 160;    --ink-3-rgb: 131 122 108;
    --paper-rgb: 21 17 13;     --paper-2-rgb: 29 24 18;     --paper-3-rgb: 16 13 10;
    --shadow:   18px 18px 0 rgba(0, 0, 0, 0.22);
    color-scheme: dark;
}

/* Synchronised theme cross-fade — `theme-transition` is added to <html> only for
   the duration of a toggle (themeToggle.js), so every colour-bearing property on
   every element eases at once (CSS-variable changes don't transition otherwise).
   !important unifies elements that already have their own (differently-timed)
   transitions so nothing desyncs. */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color .45s ease, color .45s ease, border-color .45s ease,
                fill .45s ease, stroke .45s ease, box-shadow .45s ease,
                text-shadow .45s ease, outline-color .45s ease,
                text-decoration-color .45s ease !important;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-size: 17px;
    line-height: 1.62;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow: hidden;
    transition: background .5s ease, color .5s ease;
}
/* Aged-parchment grain that subtly "lives" — the tile drifts so the page
   breathes like a Daily Prophet illustration. */
body::before {
    content: ""; position: fixed; inset: -40px; z-index: 0; pointer-events: none;
    opacity: .06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: wg-grain 6s steps(6) infinite;
}
@keyframes wg-grain {
    0%{transform:translate(0,0)} 16%{transform:translate(-8px,4px)} 33%{transform:translate(6px,-6px)}
    50%{transform:translate(-4px,8px)} 66%{transform:translate(8px,2px)} 83%{transform:translate(-6px,-4px)} 100%{transform:translate(0,0)}
}
/* Faint vignette for an aged-paper edge. */
body::after {
    content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    box-shadow: inset 0 0 180px rgba(60, 44, 20, 0.10);
}
html[data-theme="night"] body::after { box-shadow: inset 0 0 200px rgba(0, 0, 0, 0.5); }
::selection { background: var(--accent); color: var(--paper-2); }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.05; }
.mono { font-family: var(--mono); }
.kicker { font-family: var(--mono); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3); }
.rule { height: 1px; background: var(--rule); border: 0; }

/* ── App shell ───────────────────────────────────────────── */
.ed-app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; }

/* Masthead */
.ed-masthead {
    display: flex; align-items: baseline; gap: 20px;
    padding: 18px 40px 14px;
    border-bottom: 1.5px solid var(--ink);
}
.ed-mark {
    font-family: var(--serif); font-size: 30px; font-weight: 500;
    letter-spacing: -.02em; line-height: 1;
}
.ed-mark em { font-style: italic; color: var(--accent); }
.ed-dateline { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2); }
.ed-mast-right { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.ed-live { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; }
.ed-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }

/* Three-column editorial grid */
.ed-grid { position: relative;
    flex: 1; min-height: 0;
    display: grid;
    grid-template-columns: var(--nav-w, 244px) minmax(0, 1fr) var(--feature-w, 720px);
    gap: 0;
    /* Delayed .15s so the column only narrows AFTER the labels finish fading —
       phase 1 = labels fade (nothing moves), phase 2 = column + icon glide. */
    transition: grid-template-columns .4s cubic-bezier(.45,0,.15,1) .15s;
}
/* No transition while dragging the feature resizer (would lag the pointer). */
body.wg-resizing .ed-grid { transition: none; }
/* Section index collapsed to an icon rail. Width is tuned so the index content
   box (nav − 48px padding − 1px border = 30px) exactly equals the icon box
   (18px icon + 12px item padding), so item shades, the toggle, AND the
   separators are all the same 30px box — no 1px mismatch. */
html.wg-nav-rail { --nav-w: 79px; }
/* Feature column closed (the ✕). */
html.wg-feature-collapsed .ed-grid { grid-template-columns: var(--nav-w, 244px) minmax(0, 1fr) 0; }
html.wg-feature-collapsed .ed-margin { display: none; }
.ed-col { min-height: 0; overflow-y: auto; }
.ed-index   { border-right: 1px solid var(--rule); padding: 30px 24px; overflow-x: hidden; display: flex; flex-direction: column; }
/* Pushes the bottom cluster (Collapse control + credit) to the panel bottom. */
.ed-index-push { margin-top: auto; }
/* Don't let the flex column squash its children — the 1px separators would
   shrink to 0 (vanish) when the nav overflows; let it scroll instead. */
.ed-index > * { flex-shrink: 0; }
.ed-main    { padding: 0; display: flex; flex-direction: column; }
.ed-margin  { border-left: 1px solid var(--rule); background: var(--paper-3); }

/* Section index (left) */
/* The collapse/expand control is a real nav-item row. Like every item it
   shrinks to its content (a <button> already does; items get it via
   align-items:flex-start on the group) so the hover shade HUGS the content
   instead of spanning the whole column. Expanded it reads "Sections ⟨" — label
   first, collapse icon to the right — and the whole tight button is pushed to
   the right edge (margin-left:auto). In the rail it returns to icon-left,
   aligned with the items. */
.ed-index-toggle { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; margin: 0 0 0 auto; }
.ed-index-toggle .ed-index-ico { order: 1; margin-left: 8px; color: var(--ink-3); transition: margin-left .4s cubic-bezier(.45,0,.15,1) .15s, color .2s ease; }
.ed-index-toggle:hover .ed-index-ico { color: var(--ink); }
.ed-index-toggle .ed-index-ico svg { filter: none; }   /* control icon stays crisp — the ink glitch is for the section icons */
/* It's a CONTROL, not a section: render its label as mono "apparatus" (small,
   uppercase, muted) so it reads distinctly from the serif section entries. */
.ed-index-toggle .ed-index-label { margin-left: 0; font-family: var(--mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.ed-index-toggle:hover .ed-index-label { color: var(--ink-2); }
.ed-index-group { display: flex; flex-direction: column; gap: 2px; }
/* Separators span the full item box width (margin 0) so their ends line up with
   the nav-item / toggle hover-shade rectangles in both expanded and rail modes. */
.ed-index-sep { height: 1px; background: var(--rule); margin: 12px 0; transition: margin .55s cubic-bezier(.45,0,.15,1); }
.ed-index-item {
    display: flex; align-items: center; gap: 0;
    padding: 9px 6px; cursor: pointer; color: var(--ink-2);
    border-radius: 7px; text-decoration: none;
    transition: color .2s ease, background .15s ease;
}
.ed-index-item:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.ed-index-item:active { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.ed-index-item.is-active { color: var(--ink); }
.ed-index-ico { width: 18px; height: 18px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.ed-index-ico svg { width: 17px; height: 17px; }
.ed-index-item:hover .ed-index-ico { color: var(--ink); }
.ed-index-item.is-active .ed-index-ico { color: var(--accent); filter: drop-shadow(1px 0 var(--accent)) drop-shadow(-1px 0 var(--gx)) drop-shadow(0 1px var(--gy)); }
.ed-index-label {
    font-family: var(--serif); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-left: 12px; max-width: 180px; opacity: 1;
    /* Phase 1: opacity fades fast (no delay). Phase 2: width + margin collapse,
       delayed until the fade is done — so the label fades in place, then the
       layout reflows (icon glides) with nothing visibly clipping. */
    transition: opacity .15s ease, max-width .4s cubic-bezier(.45,0,.15,1) .15s, margin-left .4s cubic-bezier(.45,0,.15,1) .15s;
}
.ed-index-item.is-active .ed-index-label { font-style: italic; color: var(--accent); text-shadow: 1px 0 var(--accent), -1px 0 var(--gx), 0 1px var(--gy); }
/* Footer credit — fades IN only after the panel has finished expanding
   (delay matches the .55s nav-width transition); fades out fast on collapse. */
.ed-index-foot { margin-top: 16px; opacity: 1; transition: opacity .4s ease .35s; text-align: right; }
.ed-index-author { font-family: var(--serif); font-size: 18px; margin-top: 4px; white-space: nowrap; }

/* Icon-rail mode — icons stay put; only labels collapse away smoothly. The
   toggle is itself a nav item, so it animates identically — no jump, no snap. */
html.wg-nav-rail .ed-index-foot { opacity: 0; pointer-events: none; transition: opacity .12s ease; }
html.wg-nav-rail .ed-index-label { max-width: 0; opacity: 0; margin-left: 0; }
/* In the rail the toggle's margin-left:auto resolves to 0 on its own (toggle
   width == column content width), so it GLIDES to icon-left as the column +
   label collapse — no override, no teleport. Only the icon's text-gap closes. */
html.wg-nav-rail .ed-index-toggle .ed-index-ico { margin-left: 0; }
/* In the rail, items hug their icon (content-width) exactly like the toggle, so
   every hover shade is the same 30px box at the same left edge. (Stretched items
   were 1px narrower than the icon box, which read as a misaligned shade.) */
html.wg-nav-rail .ed-index-group { align-items: flex-start; }
/* Separators run a touch longer than the icon box in the rail (past the 30px
   shade into the right margin); all stay a uniform 1px. */
html.wg-nav-rail .ed-index-sep { width: 44px; }

/* ── Conversation (center) as a typeset article ──────────── */
#chat-container { flex: 1; min-height: 0; overflow-y: auto; padding: 36px 56px 8px; }
.ed-thread { max-width: 64ch; margin: 0 auto; }

/* Intro / home — centered "cover", wider than the chat measure. */
.ed-intro { max-width: 960px; margin: 4vh auto 0; text-align: center; }
.ed-intro .kicker { display: block; }
.ed-intro h1 { font-size: clamp(34px, 4.8vw, 58px); letter-spacing: -.02em; }
.ed-intro h1 em { font-style: italic; color: var(--accent); }
.ed-lede { font-size: 19px; color: var(--ink-2); margin: 16px auto 24px; max-width: 56ch; }

/* Fullscreen intro splash — the logo plays large, then fades (soft zoom-out). */
#intro-splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--paper); transition: opacity 1s ease, transform 1s ease; }
#intro-splash.hidden { display: none; }
#intro-splash.fade { opacity: 0; transform: scale(1.05); pointer-events: none; }
#intro-logo { width: min(88vh, 88vw); height: min(88vh, 88vw); display: block; }

/* Hero held back until the splash finishes, then rises in gracefully. */
.ed-intro > * { opacity: 0; }
html.intro-revealed .ed-intro .kicker { animation: ed-rise .7s .15s ease both; }
html.intro-revealed .ed-intro h1 { animation: ed-rise .85s .35s ease both; }
html.intro-revealed .ed-intro .ed-lede { animation: ed-rise .85s .6s ease both; }
html.intro-revealed .ed-intro .ed-features { animation: ed-rise .85s .85s ease both; }
html.intro-revealed .ed-intro .ed-paths { animation: ed-rise .85s 1.05s ease both; }

/* Hero gently leaves (fade up) when the conversation begins. */
#home-actions.is-leaving { opacity: 0; transform: translateY(-10px); transition: opacity .6s ease, transform .6s ease; }

/* Feature descriptors (non-interactive) — single row */
.ed-features { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; justify-content: center; }
.ed-feature { padding: 6px 12px; font-size: 10px; }
.ed-feature {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink-2); padding: 6px 11px; border: 1px solid var(--rule); border-radius: 999px;
}
.ed-feature i, .ed-feature svg { width: 12px; height: 12px; }
.ed-feature svg { filter: url(#wg-ink); }

/* Two paths — Engineering / Recruitment (newspaper feature columns) */
.ed-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ed-path {
    text-align: left; cursor: pointer; background: var(--paper-2);
    border: 1px solid var(--rule); border-radius: 2px; padding: 20px 20px 18px;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
    display: flex; flex-direction: column; gap: 7px; position: relative;
}
.ed-path:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); }
.ed-path-eyebrow { font-family: var(--mono); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); }
.ed-path h3 { font-family: var(--serif); font-size: 24px; color: var(--ink); }
.ed-path p { font-family: var(--body); font-size: 14.5px; color: var(--ink-2); line-height: 1.5; flex: 1; }
.ed-path-cta { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-top: 6px; }
.ed-path-cta i, .ed-path-cta svg { width: 14px; height: 14px; transition: transform .2s ease; }
.ed-path:hover .ed-path-cta i, .ed-path:hover .ed-path-cta svg { transform: translateX(4px); }
@media (max-width: 620px) { .ed-paths { grid-template-columns: 1fr; } }

/* User question → editorial pull-quote */
.ed-user {
    margin: 30px 0 8px auto; padding-left: 0;
    max-width: 86%; width: fit-content; text-align: right;
    font-family: var(--serif); font-style: italic; font-size: 22px;
    line-height: 1.32; color: var(--ink);
}
.ed-user .ed-byline { display: block; font-family: var(--mono); font-style: normal; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-top: 8px; }

/* Agent turn */
.agent-bubble { margin: 18px 0 34px; }
.final-answer { margin-top: 6px; }
.final-answer-text { font-family: var(--body); font-size: 18px; line-height: 1.66; color: var(--ink); }
.final-answer-text > p:first-child::first-letter {
    font-family: var(--serif); font-weight: 500; float: left;
    font-size: 3.4em; line-height: .82; padding: 4px 10px 0 0; color: var(--accent);
    text-shadow: 2px 0 var(--accent), -2px 0 var(--gx), 0 2px var(--gy);
}
.final-answer-text strong { font-weight: 600; }
.final-answer-text a { color: var(--accent); text-underline-offset: 3px; }
.final-answer-text ul { padding-left: 1.1em; }
.final-answer-text code { font-family: var(--mono); font-size: .85em; background: var(--paper-3); padding: 1px 5px; border-radius: 4px; }

/* The "Ask" field — masthead-style, fixed at the foot of the column */
.ed-ask {
    border-top: 1px solid var(--rule); background: var(--paper);
    padding: 14px 56px 18px;
}
.ed-ask-inner { max-width: 64ch; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.ed-ask label { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
#user-input {
    flex: 1; border: 0; background: transparent; resize: none;
    font-family: var(--serif); font-size: 20px; color: var(--ink);
    padding: 6px 0; outline: none; line-height: 1.3; max-height: 96px;
}
#user-input::placeholder { color: var(--ink-3); font-style: italic; }
.ed-ask-send {
    border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
    font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
    padding: 8px 16px; border-radius: 999px; cursor: pointer; transition: all .2s ease;
}
.ed-ask-send:hover { background: var(--ink); color: var(--paper); }

/* Inline status / loader */
#loader-wrapper { padding: 4px 0; }
#loader-wrapper.hidden { display: none; }
#loader-text { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--ink-2); }
.agent-inline-status { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

/* ── Reasoning apparatus (trace) — collapsible disclosure ── */
.wg-trace { display: flex; flex-direction: column; }
.wg-trace .mono { font-family: var(--mono); }
.wg-trace-head {
    display: flex; align-items: baseline; gap: 10px; width: 100%;
    border: 0; border-top: 1px solid var(--rule); background: transparent;
    padding: 12px 0 12px; cursor: pointer; text-align: left;
    font-family: var(--mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
    color: var(--ink-3); transition: color .2s ease;
}
.wg-trace-head:hover { color: var(--ink); }
.wg-trace-chevron { width: 8px; height: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .3s ease; }
.wg-trace:not(.is-collapsed) .wg-trace-chevron { transform: rotate(45deg); }
.wg-trace-title { color: inherit; }
.wg-trace-count { margin-left: auto; color: var(--ink-3); letter-spacing: .12em; }
.wg-trace-body { display: flex; flex-direction: column; gap: 14px; padding-bottom: 6px; }
.wg-trace.is-collapsed .wg-trace-body { display: none; }

/* View switcher — editorial underline tabs */
.wg-trace-toolbar { display: flex; align-items: center; gap: 12px; }
.wg-expand { margin-left: auto; border: 1px solid var(--rule); background: transparent; color: var(--ink-3); border-radius: 6px; width: 27px; height: 24px; display: grid; place-items: center; cursor: pointer; transition: all .2s ease; flex: 0 0 auto; }
.wg-expand:hover { color: var(--ink); border-color: var(--ink); }
.wg-expand svg { width: 14px; height: 14px; }
.ed-reasoning-stage { flex: 1; min-height: 0; overflow: auto; padding: 30px 32px; background: var(--paper); }
#reasoning-overlay-body { min-width: min-content; }
.wg-seg { --i: 0; --n: 4; position: relative; display: flex; width: 100%; flex: 1; border-bottom: 1px solid var(--rule); }
.wg-seg-pill { position: absolute; bottom: -1px; left: 0; height: 2px; width: calc(100% / var(--n)); transform: translateX(calc(var(--i) * 100%)); background: var(--accent); transition: transform .4s cubic-bezier(.6,.2,.1,1); }
.wg-seg-btn { flex: 1 1 0; min-width: 0; border: 0; background: transparent; cursor: pointer; padding: 9px 4px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); transition: color .25s ease; }
.wg-seg-btn:hover { color: var(--ink-2); }
.wg-seg-btn.is-active { color: var(--ink); }
.wg-seg-btn .wg-ico { width: 13px; height: 13px; transition: transform .3s ease; }
.wg-seg-btn.is-active .wg-ico { color: var(--accent); }
.wg-seg-beta { align-self: flex-start; margin-left: 3px; padding: 0 3px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--rule)); border-radius: 3px; font-family: var(--mono); font-size: 6.5px; line-height: 1.5; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

/* Map layout sub-switcher — compact, right-aligned above the map canvas. */
.wg-map-bar { display: flex; justify-content: flex-end; padding: 2px 0 8px; }
.wg-map-seg { width: auto; flex: 0 0 auto; border-bottom: 0; gap: 2px; }
.wg-map-seg .wg-seg-pill { display: none; }
.wg-map-seg .wg-seg-btn { flex: 0 0 auto; padding: 4px 9px; font-size: 9px; gap: 5px; border-bottom: 2px solid transparent; }
.wg-map-seg .wg-seg-btn.is-active { border-bottom-color: var(--accent); }
.wg-map-seg .wg-seg-btn .wg-ico { width: 12px; height: 12px; }
.wg-overlay-seg { margin-left: 10px; }
.wg-tm-heat .wg-tm-ico {
    border-color: color-mix(in srgb, var(--accent) calc(var(--heat) * 100%), var(--rule));
    background: color-mix(in srgb, var(--accent) calc(var(--heat) * 22%), var(--paper-2));
    transform: scale(var(--heat-scale, 1));
    transition: transform .25s ease, background .25s ease, border-color .25s ease;
}

/* Shared trace meta — chips (rows), apparatus (detail), meters (quality). */
.wg-mchips { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.wg-mchip { font-family: var(--mono); font-size: 8.5px; letter-spacing: .02em; color: var(--ink-2);
    border: 1px solid var(--rule); border-radius: 5px; padding: 1px 4px; white-space: nowrap; }
.wg-mchip.is-bad { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--rule)); }
.wg-meta { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); }
.wg-meta-row { display: flex; gap: 10px; align-items: baseline; font-size: 11px; }
.wg-meta-k { flex: 0 0 64px; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.wg-meta-v { color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wg-meta-bad { color: var(--accent); }
.wg-meter { display: inline-flex; align-items: center; gap: 3px; }
.wg-meter-l { font-size: 8px; color: var(--ink-3); text-transform: uppercase; }
.wg-meter-track { width: 34px; height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.wg-meter-fill { display: block; height: 100%; background: var(--accent); }
.wg-tl-lane-cost { color: var(--ink-3); margin-left: 8px; }

/* Status dots */
.wg-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: 0 0 auto; background: var(--ink-3); }
.wg-dot-ok { background: var(--ok); }
.wg-dot-err { background: var(--accent); }
.wg-dot-run { background: var(--accent); animation: wg-pulse 1.1s ease-in-out infinite; }
@keyframes wg-pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Expandable detail */
.wg-detail { display: none; margin: 6px 0 4px; }
[data-trace-toggle].is-open + .wg-detail, [data-trace-toggle].is-open .wg-detail, .wg-log-row.is-open + .wg-log-detail { display: block; }
.wg-log-detail { display: none; padding-left: 22px; }
.wg-detail-reason { font-family: var(--body); font-style: italic; font-size: 14px; color: var(--ink-2); }
.wg-detail-io { font-family: var(--mono); font-size: 10px; line-height: 1.5; color: var(--ink-2); background: var(--paper-3); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; margin-top: 5px; overflow-x: auto; white-space: pre-wrap; }
[data-trace-toggle] { cursor: pointer; }

/* Timeline — a ruled column of entries */
/* Per-agent hand-inked glyphs */
.wg-agent-ico { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; flex: 0 0 auto; color: var(--ink-2); }
.wg-agent-ico svg { width: 14px; height: 14px; filter: url(#wg-ink); }
.wg-agent-ico-sm { width: 14px; height: 14px; }
.wg-agent-ico-sm svg { width: 12px; height: 12px; }

/* Timeline — horizontal time-axis Gantt. GUTTER = agent-name column. */
.wg-tl { --tl-gutter: 124px; }
.wg-tl-axis { position: relative; height: 15px; margin-left: var(--tl-gutter); border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
.wg-tl-tick { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--mono); font-size: 9px; color: var(--ink-3); }
.wg-tl-tick:first-child { transform: none; }
.wg-tl-tick:last-child { transform: translateX(-100%); }
.wg-tl-lanes { display: flex; flex-direction: column; gap: 3px; overflow: visible; }
.wg-tl-lane { display: grid; grid-template-columns: var(--tl-gutter) 1fr; align-items: center; min-height: 30px; overflow: visible; }
.wg-tl-lane-head { display: flex; align-items: center; gap: 7px; padding-right: 10px; overflow: hidden; }
.wg-tl-lane-name { font-family: var(--serif); font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-tl-lane-meta { margin-left: auto; font-size: 9px; color: var(--ink-3); flex: 0 0 auto; }
.wg-tl-track { position: relative; height: 28px; border-left: 1px solid var(--rule-2); overflow: visible; }
.wg-tl-bar {
    position: absolute; top: 4px; height: 20px; min-width: 4px; border-radius: 4px;
    cursor: pointer;
    background: color-mix(in srgb, var(--bar, var(--ink-3)) 18%, transparent);
    border-left: 2.5px solid var(--bar, var(--ink-3));
    transition: filter .15s ease;
}
.wg-tl-bar:hover { filter: brightness(1.06); }
.wg-tl-bar.wg-st-error { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
/* Details float above the bar on hover (bars themselves stay clean colour blocks). */
.wg-tl-pop {
    position: absolute; bottom: calc(100% + 6px); left: 0; min-width: 120px; max-width: 200px; z-index: 30;
    display: flex; flex-direction: column; gap: 1px; padding: 7px 10px;
    background: var(--paper-2); border: 1px solid var(--rule); border-radius: 7px;
    box-shadow: 0 8px 22px rgba(0,0,0,.16);
    opacity: 0; transform: translateY(4px); pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}
.wg-tl-bar:hover .wg-tl-pop { opacity: 1; transform: none; }
.wg-tl-pop-agent { font-family: var(--serif); font-size: 13px; color: var(--ink); }
.wg-tl-pop-sub { font-size: 9.5px; color: var(--ink-3); }
.wg-tl-pop-meta { font-size: 9.5px; color: var(--ink-2); }

/* Tree — refined hierarchy: inked agent medallions on soft elbow connectors. */
.wg-clusters { display: flex; flex-direction: column; gap: 1px; }
.wg-tree-row { position: relative; display: flex; align-items: center; gap: 11px; padding: 6px 8px; border-radius: 7px; transition: background .15s ease; }
.wg-tree-row:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.wg-tree-agent { font-family: var(--serif); font-size: 15.5px; color: var(--ink); white-space: nowrap; }
.wg-tree-label { font-family: var(--body); font-size: 13.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-tree-meta { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; }
.wg-tree-dur { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.wg-badge { font-family: var(--mono); font-size: 9px; font-weight: 600; background: var(--accent); color: var(--paper-2); border-radius: 999px; padding: 1px 7px; }

/* Agent node — rounded-square chip (organic branching ref) */
.wg-tree-row .wg-agent-ico { width: 24px; height: 24px; border: 1px solid var(--rule); border-radius: 7px; background: var(--paper-2); color: var(--ink-2); }
.wg-tree-row .wg-agent-ico svg { width: 13px; height: 13px; }

/* Measured SVG connectors (drawn by drawTreeConnectors) replace the old CSS
   spine/elbow/mask — curves land dead-centre on each medallion, no overshoot. */
.wg-clusters { gap: 4px; position: relative; }
.wg-tree-links { position: absolute; inset: 0; overflow: visible; pointer-events: none; z-index: 0; }
.wg-tree-links path { fill: none; stroke: var(--ink-3); stroke-width: 1.4; stroke-dasharray: 0.1 4.5; stroke-linecap: round; opacity: .55; }
.wg-tree-children { margin-left: 12px; padding-left: 26px; }   /* indent only */
.wg-tree-node { position: relative; }
.wg-tree-row { position: relative; z-index: 1; transition: background .15s ease; }
/* Folder-style collapse caret — a corner badge ON the medallion, revealed on
   hover (just suggests foldability); stays shown while collapsed. */
.wg-tree-medwrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.wg-tree-caret {
    position: absolute; right: -5px; bottom: -5px; width: 15px; height: 15px; padding: 0;
    display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--rule); border-radius: 50%; background: var(--paper-2); color: var(--ink-3);
    opacity: 0; transform: scale(.6);
    transition: opacity .15s ease, transform .15s ease, color .15s ease, border-color .15s ease;
}
.wg-tree-medwrap:hover .wg-tree-caret,
.wg-tree-node.is-collapsed > .wg-tree-row .wg-tree-caret { opacity: 1; transform: scale(1); }
.wg-tree-caret:hover { color: var(--accent); border-color: var(--accent); }
.wg-tree-caret svg { transition: transform .18s ease; transform: rotate(90deg); }   /* expanded → ▾ */
.wg-tree-node.is-collapsed > .wg-tree-row .wg-tree-caret svg { transform: rotate(0deg); } /* collapsed → ▸ */
.wg-tree-node.is-collapsed > .wg-tree-children { display: none; }
.wg-tree .wg-detail { padding-left: 38px; }
.wg-tree-node > .wg-detail { margin: 2px 0 10px; }
/* Cost/quality meta block aligns under the label (like .wg-detail), clearing the
   medallion column + dotted connector spine. */
.wg-tree-node > .wg-meta { padding-left: 38px; }

/* Map (diagram) view — curved SVG links + node chips */
.wg-map-scroll { overflow-x: auto; overflow-y: hidden; padding: 8px 0 14px; }
.wg-treemap { position: relative; }
.wg-tm-links { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.wg-tm-links path { fill: none; stroke-width: 1.5; }
.wg-tm-links .wg-link-tree { stroke: var(--rule); }                                      /* operator dispatch */
.wg-tm-links .wg-link-feed { stroke: var(--accent); stroke-dasharray: 2 5; opacity: .6; } /* symbolic contextualizes */
.wg-tm-links .wg-link-flow { stroke: var(--accent); stroke-width: 1.6; opacity: .85; }    /* primary dataflow */
.wg-tm-node { position: absolute; display: flex; align-items: center; gap: 9px; cursor: pointer; }
/* Icon-only medallion — the agent name / action / duration / output float in a
   popover on hover so the diagram reads as clean connected marks. */
.wg-tm-icononly { width: 26px; height: 26px; }
.wg-tm-pop {
    position: absolute; top: 32px; left: -8px; min-width: 118px; max-width: 150px; z-index: 20;
    display: flex; flex-direction: column; gap: 1px; padding: 7px 10px;
    background: var(--paper-2); border: 1px solid var(--rule); border-radius: 7px;
    box-shadow: 0 8px 22px rgba(0,0,0,.14);
    opacity: 0; transform: translateY(-4px); pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}
.wg-tm-icononly:hover .wg-tm-pop { opacity: 1; transform: none; }
.wg-tm-icononly:hover .wg-tm-ico { border-color: var(--accent); color: var(--accent); }
.wg-tm-pop-agent { font-family: var(--serif); font-size: 13px; color: var(--ink); }
.wg-tm-pop-sub { font-size: 9.5px; letter-spacing: .02em; color: var(--ink-3); }
.wg-tm-pop-meta { font-size: 9.5px; color: var(--ink-2); }
.wg-tm-ico { width: 26px; height: 26px; flex: 0 0 auto; border: 1px solid var(--rule); border-radius: 7px; background: var(--paper-2); color: var(--ink-2); transition: border-color .15s ease, color .15s ease; }
.wg-tm-ico svg { width: 13px; height: 13px; }
.wg-tm-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.08; }
.wg-tm-agent { font-family: var(--serif); font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-tm-sub { font-size: 9px; letter-spacing: .02em; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-tm-dur { font-size: 9px; color: var(--ink-3); flex: 0 0 auto; }
.wg-tm-node .wg-dot { flex: 0 0 auto; }
.wg-st-running .wg-tm-ico { border-color: var(--accent); color: var(--accent); }
.wg-st-error .wg-tm-ico { border-color: var(--accent); }
/* Terminal "Final Answer" node — the orange convergence point with sparks. */
.wg-tm-terminal { cursor: default; padding: 2px 8px 2px 2px; border: 1px solid var(--accent); border-radius: 8px;
    background: var(--accent-soft, color-mix(in srgb, var(--accent) 10%, transparent)); width: auto; min-width: 140px; }
.wg-tm-terminal .wg-tm-ico { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.wg-tm-terminal .wg-tm-agent { color: var(--accent); font-style: italic; }
.wg-tm-spark { flex: 0 0 auto; color: var(--accent); font-size: 12px; animation: wg-spark 1.8s ease-in-out infinite; }
@keyframes wg-spark { 0%,100% { opacity: .35; transform: scale(.85) rotate(0deg); } 50% { opacity: 1; transform: scale(1.15) rotate(20deg); } }
@media (prefers-reduced-motion: reduce) { .wg-tm-spark { animation: none; opacity: .8; } }

/* Vintage-ink details — curated reuse of the splash's hand-drawn wobble.
   Static #wg-ink on display type only. (NOT on the tiny 13px map icons — the
   displacement blobs them; and not on long thin rules — it segments them.) */
.ed-mark, .ed-intro h1 { filter: url(#wg-ink); }

/* Chromatic RGB-split glitch on the masthead wordmark — every edition.
   Primary offset tracks the palette accent; cyan/lime companions (--gx/--gy)
   give the riso-overprint look on cream and on dark alike. */
.ed-mark { text-shadow: 1.5px 0 var(--accent), -1.5px 0 var(--gx), 0 1.6px var(--gy); }
/* Reusable chromatic-glitch for artifact headings (e.g. the résumé name). */
.ed-glitch { color: var(--accent); text-shadow: 1.6px 0 var(--accent), -1.6px 0 var(--gx), 0 1.7px var(--gy); }
@media (prefers-reduced-motion: no-preference) {
    .ed-mark { animation: wg-glitch 5s steps(1) infinite; }
}
@keyframes wg-glitch {
    0%,92%,100% { text-shadow: 1.5px 0 var(--accent), -1.5px 0 var(--gx), 0 1.6px var(--gy); }
    94% { text-shadow: -2px 0 var(--accent), 2.5px 0 var(--gx), 0 -1.5px var(--gy); }
    96% { text-shadow: 2.5px 0 var(--gx), -2px 0 var(--accent), 0 2px var(--gy); }
}
/* Chromatic hero headline — every edition (NOT the small kicker; chromatic on
   tiny mono text is hard to read). */
.ed-intro h1 {
    text-shadow: 1.6px 0 var(--accent), -1.6px 0 var(--gx), 0 1.7px var(--gy);
}
html[data-theme="morning"] .ed-intro h1 em { color: var(--gx); }

/* Log — a footnotes apparatus */
.wg-log { display: flex; flex-direction: column; }
.wg-log-row { display: flex; align-items: center; gap: 9px; padding: 5px 0 5px calc(var(--d,0) * 16px); border-bottom: 1px solid var(--rule-2); }
.wg-log-seq { font-family: var(--mono); font-size: 10px; color: var(--accent); }
.wg-log-sym { font-family: var(--mono); font-size: 13px; width: 16px; text-align: center; color: var(--ink-2); flex: 0 0 auto; }
.wg-log-agent { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--ink-2); }
.wg-log-label { font-family: var(--body); font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-log-dur { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.wg-empty { font-family: var(--body); font-style: italic; color: var(--ink-3); padding: 10px 0; }

/* ── Feature canvas (right margin) — the artifact as a feature ── */
/* The column is a fixed grid track; never let legacy inline widths shrink it. */
#canvas-pane { width: auto !important; position: relative; }
.ed-margin-inner { padding: 30px 26px; position: relative; }
/* Canvas panel title — centered + highlighted, close floats top-right. */
.ed-canvas-close { position: absolute; top: 20px; right: 22px; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-family: var(--mono); font-size: 13px; line-height: 1; padding: 4px; transition: color .2s ease; }
.ed-canvas-close:hover { color: var(--accent); }
.ed-canvas-head { text-align: center; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.ed-canvas-kicker { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--accent); }
.ed-canvas-title { margin: 6px 0 0; font-family: var(--serif); font-size: 22px; letter-spacing: -.01em; color: var(--ink); }
/* Drag handle on the feature's left edge. */
.ed-feature-resizer { position: absolute; left: 0; top: 0; bottom: 0; width: 7px; margin-left: -3px; cursor: col-resize; z-index: 6; }
.ed-feature-resizer::before { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 1px; background: transparent; transition: background .15s ease; }
.ed-feature-resizer:hover::before, body.wg-resizing .ed-feature-resizer::before { background: var(--accent); }
body.wg-resizing { cursor: col-resize; user-select: none; }
#canvas-title { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
#canvas-content { font-family: var(--body); }
#canvas-content, #canvas-content * { max-width: 100%; overflow-wrap: anywhere; }
.ed-margin .kicker { display: block; margin-bottom: 4px; }
/* Composed artifact layout — scores sit in a row, sections full width. */
.ed-composed { display: flex; flex-wrap: wrap; gap: 16px 18px; align-items: flex-start; }
.ed-composed > * { flex: 1 1 100%; margin: 0; }
.ed-composed > .ed-score { flex: 1 1 26%; min-width: 82px; }
.ed-composed > .ed-score .ed-score-num { font-size: 46px; }

.ed-feature-empty { padding: 6px 0; }
.ed-feature-empty-rule { height: 2px; width: 40px; background: var(--accent); margin-bottom: 14px; }
.ed-feature-empty p { font-family: var(--body); font-style: italic; font-size: 15px; color: var(--ink-3); line-height: 1.5; }

/* ── Theme toggle — minimal time-of-day trio ──
   Bare glyphs (sunrise / sun / moon), no box; active glyph in the accent ink
   with a small dot beneath. Replaces the old full-bleed weather-scene toggle. */
.wg-theme-trio { display: inline-flex; align-items: center; gap: 19px; }
.wg-tod-btn {
    position: relative; appearance: none; border: 0; background: transparent; cursor: pointer;
    padding: 4px; color: var(--ink-3); transition: color .2s ease;
}
.wg-tod-btn:hover { color: var(--ink-2); }
.wg-tod-btn.on { color: var(--accent); }
.wg-tod-btn .wg-tod { width: 19px; height: 19px; display: block; }
.wg-tod-btn.on::after {
    content: ""; position: absolute; left: 50%; bottom: -5px;
    width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
    transform: translateX(-50%);
}

/* ── Tier-1 artifact components (editorial) ──────────────── */
.ed-score { margin-bottom: 22px; }
.ed-score-label { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.ed-score-num { font-family: var(--serif); font-size: 64px; font-weight: 400; line-height: .9; color: var(--ink); display: flex; align-items: baseline; gap: 4px; }
.ed-score-num span { font-family: var(--mono); font-size: 16px; color: var(--ink-3); }
.ed-section { margin: 20px 0; }
.ed-section-title { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); padding-bottom: 6px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.ed-req { padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.ed-req-top { display: flex; align-items: baseline; gap: 10px; }
.ed-req-name { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.ed-req-status { margin-left: auto; font-family: var(--mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.ed-req-status.strong { color: var(--ok); }
.ed-req-status.partial { color: var(--accent); }
.ed-req-status.gap { color: var(--ink-3); }
.ed-req-ev { font-family: var(--body); font-size: 14px; color: var(--ink-2); margin-top: 3px; }
.ed-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.ed-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink-2); }

/* ── Page transitions (one orchestrated load) ────────────── */
@keyframes ed-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ed-masthead { animation: ed-rise .6s ease both; }
.ed-index { animation: ed-rise .6s .06s ease both; }
.ed-main  { animation: ed-rise .6s .12s ease both; }
.ed-margin { animation: ed-rise .6s .18s ease both; }
.ed-user, .agent-bubble { animation: ed-rise .45s ease both; }

/* Scrollbars */
.ed-col::-webkit-scrollbar, #chat-container::-webkit-scrollbar { width: 9px; }
.ed-col::-webkit-scrollbar-thumb, #chat-container::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 0; }

/* ── Demo banner ─────────────────────────────────────────── */
#wg-demo-banner {
    position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90;
    display: flex; align-items: center; gap: 12px; padding: 9px 16px;
    background: var(--paper-2); border: 1px solid var(--ink);
    font-family: var(--mono); font-size: 11px; color: var(--ink-2); box-shadow: var(--shadow);
}
#wg-demo-banner b { color: var(--accent); letter-spacing: .12em; }
#wg-demo-replay { cursor: pointer; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; padding: 4px 11px; border-radius: 999px; }

/* ── Knowledge graph overlay (3D) ────────────────────────── */
.ed-graph-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(6px);
    display: grid; place-items: center; padding: 32px;
    animation: ed-rise .35s ease both;
}
.ed-graph-overlay.hidden { display: none; }
.ed-graph-frame {
    width: min(1200px, 94vw); height: min(800px, 88vh);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--paper-2); border: 1.5px solid var(--ink); box-shadow: var(--shadow);
}
.ed-graph-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--rule); }
.ed-graph-head-actions { display: flex; gap: 8px; }
.ed-graph-btn { border: 1px solid var(--ink); background: transparent; color: var(--ink); font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.ed-graph-btn:hover { background: var(--ink); color: var(--paper); }

/* Split stage: graph as a full-bleed "plate" + a real legend panel beside it. */
.ed-graph-stage { position: relative; display: flex; flex: 1; min-height: 0; overflow: hidden; }
.ed-graph-canvas-wrap { position: relative; flex: 1; min-width: 0; }
/* Light "engraving plate" — paper in both themes; the WebGL backgroundColor
   (knowledgeGraph.js) is the real surface, this is just a fallback. */
#3d-graph { position: absolute; inset: 0; width: 100%; height: 100%; background: #ece4ce; }
/* Legend / inspector — a right-aligned floating panel over the full-bleed graph,
   hidden by default (the "Legend" button reveals it). */
.ed-graph-side {
    position: absolute; top: 0; right: 0; bottom: 0; width: 256px; overflow-y: auto; z-index: 4;
    display: flex; flex-direction: column; gap: 12px;
    background: color-mix(in srgb, var(--paper-2) 92%, transparent);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    border-left: 1px solid var(--rule); padding: 18px 16px;
}
.ed-graph-frame.legend-hidden .ed-graph-side { display: none; }
.ed-graph-search { width: 100%; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 11px; padding: 8px 10px; }
.ed-graph-stats, .ed-graph-details { font-family: var(--mono); font-size: 10px; color: var(--ink-2); line-height: 1.6; }
.ed-graph-legend { font-family: var(--mono); font-size: 10px; color: var(--ink-2); display: flex; flex-direction: column; gap: 3px; }

/* Responsive — collapse to single column */
@media (max-width: 1100px) {
    .ed-grid { grid-template-columns: 1fr; }
    .ed-index, .ed-margin { display: none; }
}

/* Stray dispatcher hooks we keep in the DOM but don't surface in editorial. */
.agent-bubble > .trace-count, .agent-bubble > .agent-inline-status { display: none; }
#status-dot { display: none; }

/* ── Living-sketch layer (Daily Prophet) ─────────────────── */
/* Hand-drawn ink ONLY on small marks/icons — displacement breaks long thin
   lines into glitchy segments, so long rules stay crisp. The "living" motion
   lives in the animated parchment grain, not in wobbling rules. */
.wg-dot, .wg-seg-btn .wg-ico, .wg-theme-knob .wg-orb, .ed-index-ico svg { filter: url(#wg-ink); }
.ed-feature-empty-rule { filter: url(#wg-ink); }

/* Short accent bar on the question — on the RIGHT edge (questions align right). */
.ed-user { border-left: 0; position: relative; padding-right: 22px; }
.ed-user::before {
    content: ""; position: absolute; right: 0; top: 3px; bottom: 3px; width: 3px;
    background: var(--accent); filter: url(#wg-ink);
}

/* Newspaper nameplate masthead — crisp double rule (no filter). */
.ed-mark { font-weight: 600; letter-spacing: -.015em; }
.ed-masthead { position: relative; border-bottom: 1.5px solid var(--ink); padding-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
    body::before { animation: none; }
}

.hidden { display: none !important; }
[hidden] { display: none !important; }

/* ============================================================================
   Work portfolio section — grid of project cards + per-project feature.
   Renders inside the canvas (feature) pane; editorial, theme-variable driven.
   ========================================================================== */
.ed-portfolio { padding: 4px 2px 24px; }
.ed-portfolio-collection { margin-bottom: 26px; }
.ed-portfolio-collection-head {
    display: flex; align-items: baseline; gap: 10px;
    padding-bottom: 7px; margin-bottom: 12px;
    border-bottom: 1px solid var(--rule);
}
.ed-portfolio-collection-key {
    font-family: var(--mono); font-size: 11px; font-weight: 600;
    color: var(--accent); letter-spacing: .08em;
}
.ed-portfolio-collection-name {
    font-family: var(--mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .14em; color: var(--ink-3);
}
.ed-portfolio-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}
.ed-portfolio-card {
    display: block; width: 100%; text-align: left; cursor: pointer;
    background: var(--paper-2); border: 1px solid var(--rule);
    border-radius: 2px; padding: 13px 14px;
    font: inherit; color: inherit;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.ed-portfolio-card:hover {
    border-color: var(--ink-2); transform: translateY(-2px); box-shadow: var(--shadow);
}
.ed-portfolio-meta {
    display: flex; align-items: center; gap: 6px;
    font-family: var(--mono); font-size: 9px; text-transform: uppercase;
    letter-spacing: .12em; color: var(--ink-3); margin-bottom: 7px;
}
.ed-portfolio-star { color: var(--accent); font-size: 11px; letter-spacing: 0; }
.ed-portfolio-name {
    font-family: var(--serif); font-size: 17px; line-height: 1.15;
    color: var(--ink); margin: 0 0 6px;
}
.ed-portfolio-blurb {
    font-family: var(--body); font-size: 12.5px; line-height: 1.45;
    color: var(--ink-2); margin: 0;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* Per-project feature (composed layout) */
.ed-proj-head { padding: 2px 0 6px 12px; margin-bottom: 14px; }
.ed-proj-back {
    display: inline-block; background: none; border: none; cursor: pointer;
    font-family: var(--mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .12em; color: var(--ink-3); padding: 0 0 8px; margin: 0;
}
.ed-proj-back:hover { color: var(--accent); }
.ed-proj-title { font-family: var(--serif); font-size: 27px; line-height: 1.1; color: var(--ink); margin: 0; }
.ed-proj-meta {
    font-family: var(--mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .12em; color: var(--ink-3); margin-top: 6px;
}
.ed-proj-prose { margin: 12px 0 4px; }
.ed-proj-prose p {
    font-family: var(--body); font-size: 14px; line-height: 1.6; color: var(--ink-2); margin: 0 0 10px;
}
.ed-media { margin: 0 0 14px; }
.ed-media-el { width: 100%; display: block; border: 1px solid var(--rule); border-radius: 2px; }
.ed-media-cap {
    font-family: var(--mono); font-size: 10px; color: var(--ink-3);
    margin-top: 6px; letter-spacing: .04em;
}
.ed-media-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 14px; }
.ed-media-gitem { margin: 0; }
.ed-media-color { width: 100%; aspect-ratio: 16 / 9; border-radius: 2px; opacity: .82; margin: 0 0 14px; }

/* ============================================================================
   Work mode — the portfolio takes the main stage (center+right); conversation
   sits underneath, reachable via "← Conversation" or the left nav.
   ========================================================================== */
#work-surface { position: absolute; inset: 0 0 0 var(--nav-w, 244px); z-index: 15;
    background: var(--paper); overflow: auto; display: none; }
html.wg-work-mode #work-surface { display: block; }
html.wg-work-mode #canvas-pane { display: none; }
.ed-work-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 16px;
    padding: 15px 34px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.ed-work-back { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
    color: var(--ink-3); background: none; border: none; cursor: pointer; padding: 0; }
.ed-work-back:hover { color: var(--accent); }
.ed-work-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
#work-content { padding: 26px 34px 60px; max-width: 1180px; margin: 0 auto; }
/* wide grid on the main stage */
#work-content .ed-portfolio-grid { grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
#work-content .ed-portfolio-collection { margin-bottom: 34px; }
/* wide magazine feature — content uses the full column; prose keeps a readable measure */
#work-content .ed-composed { max-width: none; }
#work-content .ed-proj-title { font-size: 40px; }
#work-content .ed-proj-prose { max-width: 720px; }
#work-content .ed-proj-prose p { font-size: 15.5px; }
#work-content .ed-livemodel .ed-tags,
#work-content .ed-composed > .ed-section .ed-tags { max-width: 720px; }

/* Informative media figure (replaces the bare colour square when no live preview) */
.ed-media-figure { aspect-ratio: 16/9; border: 1px solid var(--rule); border-radius: 2px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
    background: var(--paper-2); margin: 0 0 14px; text-align: center; }
.ed-media-figure-dot { width: 12px; height: 12px; border-radius: 50%; }
.ed-media-figure-label { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.ed-media-figure-sub { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }

/* Live model serve — visual-dominant: big hero (3D/gallery/chart) then a compact
   metrics strip. (Renamed from .ed-live to avoid the inline "LIVE" badge collision.) */
.ed-livemodel { display: block; margin: 24px 0 6px; padding-top: 18px; border-top: 1px solid var(--rule); }
.ed-live-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.ed-live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto; }
.ed-live-dot.is-on { background: #3fae6b; box-shadow: 0 0 0 3px rgba(63,174,107,.18); }
.ed-live-dot.is-off { background: var(--ink-3); opacity: .5; }
.ed-live-title { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.ed-live-status { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.ed-live-label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
/* metrics = compact "by the numbers" strip, below the visual */
.ed-live-metrics { margin-top: 20px; }
.ed-metric-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-metric { flex: 0 0 auto; min-width: 116px; display: flex; flex-direction: column; gap: 1px; padding: 7px 12px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 2px; }
.ed-metric-k { font-family: var(--mono); font-size: 9px; letter-spacing: .05em; color: var(--ink-3); }
.ed-metric-v { font-family: var(--serif); font-size: 17px; color: var(--ink); }
/* hero visual — the star */
.ed-live-body { margin-top: 4px; }
.ed-live-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.ed-live-shot { margin: 0; }
.ed-live-shot img { width: 100%; display: block; border: 1px solid var(--rule); border-radius: 2px; background: var(--paper-2); }
.ed-live-3d { height: 460px; border: 1px solid var(--rule); border-radius: 2px; background: var(--paper-2); overflow: hidden; }
.ed-live-3d canvas { display: block; width: 100%; height: 100%; }

/* Per-project symbols */
.ed-portfolio-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ed-portfolio-top .ed-portfolio-meta { margin-bottom: 0; }
.ed-portfolio-ico i { width: 17px; height: 17px; }
.ed-proj-titlerow { display: flex; align-items: center; gap: 11px; }
.ed-proj-ico i { width: 24px; height: 24px; }

/* Project-card tech tags (map to CV skills) */
.ed-portfolio-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.ed-portfolio-tag { font-family: var(--mono); font-size: 9px; letter-spacing: .04em; text-transform: uppercase;
    color: var(--ink-2); background: var(--paper-3); border: 1px solid var(--rule); border-radius: 2px; padding: 2px 6px; }

/* ══════════════════════════════════════════════════════════════════════
   Editorial artifact spreads — "every artifact is a department of The Issue"
   Devices: folio, ledger, dot-leaders, pull-quote, plate figure, letter,
   stamp theater, wire-service fragments. All colors via theme vars.
   ══════════════════════════════════════════════════════════════════════ */

/* — Folio header: department slug · title · dateline · folio № — */
.ed-folio { width: 100%; padding-bottom: 12px; border-bottom: 2px solid var(--ink); margin-bottom: 6px; }
.ed-folio-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: .26em; text-transform: uppercase;
    color: var(--accent); margin-bottom: 6px; }
.ed-folio-title { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.15; color: var(--ink); margin: 0 0 8px; }
.ed-folio-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9px;
    letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.ed-folio-no { font-variant-numeric: oldstyle-nums; }

/* — Ledger: accounts-book career rows, period in the margin gutter — */
.ed-ledger { display: flex; gap: 14px; width: 100%; padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.ed-ledger-yr { flex: 0 0 74px; font-family: var(--serif); font-size: 15px; font-weight: 600;
    font-variant-numeric: oldstyle-nums; color: var(--accent); text-align: right; line-height: 1.35; }
.ed-ledger-body { flex: 1; min-width: 0; }
.ed-ledger-role { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--ink); }
.ed-ledger-org { font-weight: 400; font-style: italic; color: var(--ink-2); }
.ed-ledger-desc { font-family: var(--body); font-size: 14px; line-height: 1.5; color: var(--ink-2); margin-top: 3px; }
.ed-ledger .ed-tags { margin-top: 7px; }

/* — Dot leaders: tariffs, proficiency, by-the-numbers — */
.ed-leaders { width: 100%; }
.ed-leader { display: flex; align-items: baseline; gap: 6px; padding: 5px 0; }
.ed-leader-label { font-family: var(--body); font-size: 14.5px; color: var(--ink); white-space: nowrap; }
.ed-leader-dots { flex: 1; border-bottom: 2px dotted var(--rule); transform: translateY(-3px); min-width: 24px; }
.ed-leader-value { font-family: var(--serif); font-size: 15px; font-weight: 600;
    font-variant-numeric: oldstyle-nums; color: var(--ink); white-space: nowrap; }
.ed-leader-note { font-family: var(--mono); font-size: 9px; color: var(--ink-3); white-space: nowrap; flex: 0 0 auto; }
.ed-leader.is-emph .ed-leader-label { font-weight: 600; }
.ed-leader.is-emph .ed-leader-value { color: var(--accent); }

/* — Pull quote: the verdict — */
.ed-pull { margin: 10px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--accent); width: 100%; }
.ed-pull p { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.3; color: var(--ink); margin: 0; }
.ed-pull cite { display: block; margin-top: 6px; font-family: var(--mono); font-style: normal;
    font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }

/* — Plate figure: engraved diagram with numbered callouts — */
.ed-plate { width: 100%; margin: 8px 0; border: 1px solid var(--ink); padding: 14px; background: var(--paper-2); }
.ed-plate-label { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
    color: var(--accent); margin-bottom: 10px; }
.ed-plate-field { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ed-plate-node { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--ink);
    background: var(--paper); padding: 6px 10px; font-family: var(--serif); font-size: 13.5px; color: var(--ink); }
.ed-plate-num { font-family: var(--serif); color: var(--accent); font-size: 14px; }
.ed-plate-caption { border-top: 1px solid var(--rule); padding-top: 8px; }
.ed-plate-cap { font-family: var(--body); font-style: italic; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.ed-plate-leg { display: flex; gap: 7px; font-family: var(--mono); font-size: 10.5px; line-height: 1.6; color: var(--ink-2); }
.ed-plate-leg em { color: var(--ink-3); font-style: normal; }

/* — Boxed sheet: the lighter framed plate, shared device — */
.ed-boxed { border: 1px solid var(--ink); background: var(--paper-2); padding: 16px 18px; }

/* — The paper deliverable: every composed spread is ONE sheet on the desk — */
.ed-paper { background: var(--paper-2); border: 1px solid var(--ink); padding: 26px 26px 40px;
    box-shadow: 6px 7px 0 rgb(var(--ink-rgb) / .07); margin: 4px 8px 18px 2px; position: relative; }
.ed-paper .ed-boxed { background: var(--paper); }
/* night: the sheet reads brighter than the desk (a lit page, not a dark slab) */
html[data-theme="night"] .ed-paper { background: color-mix(in srgb, var(--paper-2), #fff 8%); }
html[data-theme="night"] .ed-paper .ed-boxed { background: color-mix(in srgb, var(--paper), #fff 12%); }
/* the sheet's folio IS the letterhead — no floating canvas masthead above it */
.wg-paper-mode .ed-canvas-head { display: none; }

/* — Letter: correspondence — */
.ed-letter { width: 100%; padding: 4px 0; }
.ed-letter.ed-boxed { padding: 20px 24px; }
.ed-letter-head { border-bottom: 1px solid var(--rule); padding-bottom: 8px; margin-bottom: 12px; }
.ed-letter-to { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.ed-letter-email { color: var(--ink-3); }
.ed-letter-subject { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); margin-top: 5px; }
.ed-letter-salutation { font-family: var(--body); font-size: 15.5px; color: var(--ink); margin-bottom: 8px; }
.ed-letter-body p { font-family: var(--body); font-size: 15px; line-height: 1.62; color: var(--ink); margin: 0 0 10px; }
.ed-letter-sig { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--ink);
    margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--rule-2); }

/* — Stamp theater — */
.ed-stamp { display: inline-block; width: max-content; max-width: 100%; flex: 0 0 auto; align-self: flex-end;
    transform: rotate(var(--stamp-angle, -35deg)); color: var(--accent); margin: 10px 0 0 auto; }
.ed-stamp svg { display: block; }
.ed-stamp.is-draft { opacity: 1; }
/* banner clears the rings without tinting the page: neutral under each blend */
.wg-stamp-banner { fill: none; }
.ed-stamp.is-preflight { opacity: 1; }
.ed-stamp-overlay { position: absolute; bottom: 30px; right: 46px; z-index: 6; pointer-events: none;
    animation: ed-stamp-thunk .45s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes ed-stamp-thunk {
    0% { transform: scale(1.6) rotate(calc(var(--stamp-angle, -6deg) - 8deg)); opacity: 0; }
    62% { transform: scale(.96) rotate(var(--stamp-angle, -6deg)); opacity: 1; }
    100% { transform: scale(1) rotate(var(--stamp-angle, -6deg)); opacity: 1; }
}

.wg-caret { color: var(--accent); font-style: normal; display: inline-block;
    animation: ed-caret-glitch .72s steps(1) infinite; }
@keyframes ed-caret-glitch {
    0%   { opacity: 1; transform: translate(0, 0);
           text-shadow: 1.5px 0 var(--gx), -1.5px 0 var(--gy); }
    14%  { opacity: .9; transform: translate(-1px, .5px);
           text-shadow: -2px 0 var(--accent), 2px 0 var(--gx); }
    27%  { opacity: 1; transform: translate(1px, -.5px);
           text-shadow: 2px .5px var(--gy), -1.5px -.5px var(--accent); }
    41%  { opacity: .35; transform: translate(0, 0) scaleY(.85);
           text-shadow: none; }
    52%  { opacity: 1; transform: translate(-1.5px, 0);
           text-shadow: 2.5px 0 var(--gx), -1px .5px var(--gy); }
    66%  { opacity: .85; transform: translate(.5px, 1px) scaleY(1.08);
           text-shadow: -2px .5px var(--gy), 1.5px -.5px var(--gx); }
    80%  { opacity: 1; transform: translate(0, -.5px);
           text-shadow: 1px 0 var(--gy), -2.5px 0 var(--accent); }
    92%  { opacity: .5; transform: translate(1px, 0);
           text-shadow: -1.5px 0 var(--gx); }
}
@media (prefers-reduced-motion: reduce) { .wg-caret { animation: none; } }

/* fragments rise like everything else on the page */
.ui-fragment { animation: ed-rise .45s ease both; }

/* — Wire-service fragments (Tier-2 ephemeral) — */
.ed-wire { width: 100%; margin: 16px 0 12px; padding: 12px 16px; background: var(--paper-2);
    border: 1px solid var(--rule); border-radius: 12px; font-family: var(--mono); }
html[data-theme="night"] .ed-wire { background: color-mix(in srgb, var(--paper-2), #fff 5%); }
.ed-wire-slug { display: flex; align-items: center; gap: 8px; font-size: 8.5px; letter-spacing: .3em;
    text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px; }
.ed-wire-slug::before, .ed-wire-slug::after { content: "· · ·"; letter-spacing: .2em; color: var(--rule); }
.ed-wire-row { display: flex; justify-content: space-between; gap: 12px; padding: 2.5px 0;
    font-size: 11px; color: var(--ink-2); border-bottom: 1px dotted var(--rule-2); }
.ed-wire-row:last-child { border-bottom: 0; }
.ed-wire-k { letter-spacing: .1em; text-transform: uppercase; font-size: 9.5px; color: var(--ink-3); }
.ed-wire-v { color: var(--ink); text-align: right; }
.ed-wire-bar { height: 7px; background: rgb(var(--ink-rgb) / .72); border-radius: 3px; }
.ed-wire-bartrack { background: var(--paper-3); border: 1px solid var(--rule-2); height: 9px; padding: 1px; flex: 1; }
.ed-wire-title { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink); margin-bottom: 6px; }
.ed-wire table { width: 100%; border-collapse: collapse; }
.ed-wire th { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
    text-align: left; padding: 3px 6px; border-bottom: 1px solid rgb(var(--ink-rgb) / .32); }
.ed-wire td { font-size: 11px; color: var(--ink-2); padding: 3.5px 6px; border-bottom: 1px dotted var(--rule-2); }
.ed-wire-gauge { display: flex; flex-direction: column; align-items: center; }
.ed-wire-gauge svg { width: 120px; }
.ed-wire-gauge-label { font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); margin-top: 2px; }
.ed-wire-tl { display: flex; gap: 4px; }
.ed-wire-tl-cell { flex: 1; min-width: 0; text-align: center; }
.ed-wire-tl-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid rgb(var(--ink-rgb) / .5); margin: 0 auto; background: var(--paper); }
.ed-wire-tl-cell.is-done .ed-wire-tl-dot { background: var(--ok); border-color: var(--ok); }
.ed-wire-tl-cell.is-active .ed-wire-tl-dot { background: var(--accent); border-color: var(--accent); }
.ed-wire-tl-cell.is-pending { opacity: .55; }
.ed-wire-tl-lbl { font-size: 9.5px; color: var(--ink-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-wire-tl-dur { font-size: 8.5px; color: var(--ink-3); }
.ed-wire-rule { height: 1px; background: var(--rule-2); flex: 1; transform: translateY(4.5px); }
.ed-wire-cursor::after { content: "▍"; color: var(--accent); animation: ed-cursor-blink 1s steps(2) infinite; }
@keyframes ed-cursor-blink { 50% { opacity: 0; } }

/* — First-visit guide: "How to read The Issue" — */
.ed-guide { position: fixed; inset: 0; z-index: 60; }
.ed-guide-backdrop { position: absolute; inset: 0; background: rgb(var(--ink-rgb) / .18); cursor: pointer; }
.ed-guide-plate { position: absolute; display: flex; gap: 14px; width: 360px; max-width: calc(100vw - 32px);
    background: var(--paper); border: 1px solid var(--ink); padding: 16px 18px;
    box-shadow: 6px 6px 0 rgb(var(--accent-rgb) / .22); transition: left .35s ease, top .35s ease;
    animation: ed-rise .4s ease both; }
.ed-guide-num { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--accent); }
.ed-guide-title { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.ed-guide-body p { font-family: var(--body); font-size: 13.5px; line-height: 1.5; color: var(--ink-2); margin: 0 0 12px; }
.ed-guide-actions { display: flex; justify-content: space-between; align-items: baseline; }
.ed-guide-actions button { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
    background: none; border: 0; cursor: pointer; padding: 2px 0; }
.ed-guide-skip { color: var(--ink-3); }
.ed-guide-next { color: var(--accent); border-bottom: 1px solid var(--accent) !important; }

/* — Work: cards ⇄ rows view toggle — */
.ed-portfolio-viewbar { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 4px; }
.ed-portfolio-viewbtn { font-family: var(--mono); font-size: 9px; letter-spacing: .18em;
    background: none; border: 1px solid var(--rule); color: var(--ink-3); padding: 3px 9px; cursor: pointer; }
.ed-portfolio-viewbtn.is-on { border-color: var(--accent); color: var(--accent); }
.ed-portfolio-rows { display: flex; flex-direction: column; gap: 10px; }
.ed-portfolio-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
    background: var(--paper); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
    padding: 13px 16px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.ed-portfolio-row:hover { transform: translateY(-2px); box-shadow: 3px 4px 0 rgb(var(--ink-rgb) / .07); }
.ed-portfolio-row-main { flex: 1; min-width: 0; }
.ed-portfolio-row-head { display: flex; align-items: center; gap: 9px; }
.ed-portfolio-row .ed-portfolio-ico { flex: 0 0 auto; }
.ed-portfolio-row-name { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); }
.ed-portfolio-row-meta { margin-left: auto; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-2); white-space: nowrap; }
.ed-portfolio-row .ed-portfolio-blurb { margin: 5px 0 0; }
.ed-portfolio-row .ed-portfolio-tags { margin-top: 8px; }
.ed-portfolio-row-arrow { color: var(--accent); font-size: 16px; flex: 0 0 auto; }

/* — Pressed stamp: the in-layout seal sits ON TOP of the sheet's content,
   bottom-right, ink-blended like a real impression — */
.ed-paper .ed-composed > .ed-stamp { position: absolute; bottom: 44px; right: 46px; margin: 0; z-index: 6; pointer-events: none; }

/* — Spread reel chip + end note — */
.ed-reel-chip { position: fixed; bottom: 16px; left: 16px; z-index: 65;
    font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
    background: var(--paper-3); border: 1px solid var(--accent); color: var(--accent);
    padding: 6px 12px; cursor: pointer; }
.ed-reel-end { margin: 26px 0 10px; text-align: center; font-family: var(--serif); font-style: italic;
    font-size: 17px; color: var(--ink-2); }

/* — Canvas page-turn v2: the old sheet arcs off the desk; the new one
   slides in and settles, its sections rising in reading order — */
.ed-paper-ghost { position: absolute; z-index: 5; pointer-events: none;
    transform-origin: 18% 100%;
    animation: ed-paper-lift .5s cubic-bezier(.5, 0, .82, .55) both; }
@keyframes ed-paper-lift {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 1;
        box-shadow: 6px 7px 0 rgb(var(--ink-rgb) / .07); }
    50% { opacity: .96; }
    100% { transform: translate(52px, -70px) rotate(5deg); opacity: 0;
        box-shadow: 24px 34px 26px rgb(var(--ink-rgb) / .16); }
}
.wg-paper-mode .ed-paper:not(.ed-paper-ghost) {
    animation: ed-paper-lay .48s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes ed-paper-lay {
    0% { transform: translateY(28px) rotate(.9deg); opacity: 0; }
    55% { opacity: 1; }
    100% { transform: translateY(0) rotate(0); opacity: 1; }
}
.wg-paper-mode .ed-paper:not(.ed-paper-ghost) .ed-composed > * { animation: ed-rise .4s ease both; }
.wg-paper-mode .ed-paper:not(.ed-paper-ghost) .ed-composed > *:nth-child(1) { animation-delay: .08s; }
.wg-paper-mode .ed-paper:not(.ed-paper-ghost) .ed-composed > *:nth-child(2) { animation-delay: .15s; }
.wg-paper-mode .ed-paper:not(.ed-paper-ghost) .ed-composed > *:nth-child(3) { animation-delay: .21s; }
.wg-paper-mode .ed-paper:not(.ed-paper-ghost) .ed-composed > *:nth-child(4) { animation-delay: .27s; }
.wg-paper-mode .ed-paper:not(.ed-paper-ghost) .ed-composed > *:nth-child(5) { animation-delay: .33s; }
.wg-paper-mode .ed-paper:not(.ed-paper-ghost) .ed-composed > *:nth-child(n+6) { animation-delay: .38s; }
/* the seal rides the folio: SAME rise curve/delay as section 1 (they move in
   lockstep — no relative drift), with rotation preserved in every keyframe */
.wg-paper-mode .ed-paper:not(.ed-paper-ghost) .ed-composed > .ed-stamp {
    animation-name: ed-stamp-rise; animation-delay: .08s; animation-duration: .4s; }
@keyframes ed-stamp-rise {
    from { opacity: 0; transform: translateY(10px) rotate(var(--stamp-angle, -35deg)); }
    to { opacity: 1; transform: translateY(0) rotate(var(--stamp-angle, -35deg)); }
}
@media (prefers-reduced-motion: reduce) {
    .wg-paper-mode .ed-paper, .wg-paper-mode .ed-paper .ed-composed > * { animation: none !important; }
}

/* — Reasoning map: React-Flow-style card DAG on a dotted drafting grid — */
.wg-dag-surface { background-image: radial-gradient(rgb(var(--ink-rgb) / .10) 1px, transparent 1px);
    background-size: 16px 16px; border-radius: 8px; }
.wg-dag-card { position: absolute; width: 168px; height: 58px; box-sizing: border-box;
    display: flex; flex-direction: column; justify-content: center; gap: 1px;
    background: var(--paper-2); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
    border-radius: 9px; padding: 6px 10px; cursor: pointer;
    box-shadow: 2px 3px 0 rgb(var(--ink-rgb) / .07); transition: transform .15s ease, box-shadow .15s ease; }
.wg-dag-card:hover { transform: translateY(-2px); box-shadow: 3px 5px 0 rgb(var(--ink-rgb) / .12); z-index: 3; }
.wg-dag-card.wg-st-error { border-left-color: #b3452e; }
.wg-dag-agent { display: flex; align-items: center; gap: 6px; font-family: var(--serif); font-size: 12.5px;
    font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-dag-ico { width: 13px; height: 13px; flex: 0 0 auto; color: var(--accent); }
.wg-dag-sub { font-size: 8.5px; letter-spacing: .06em; color: var(--ink-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-dag-meta { font-size: 8px; letter-spacing: .05em; color: var(--ink-3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-dag-terminal { border: 1.5px solid var(--accent); border-left-width: 3px; background: var(--paper); }
.wg-dag-terminal .wg-dag-agent { color: var(--accent); }
.wg-dag-link { fill: none; stroke: rgb(var(--ink-rgb) / .45); stroke-width: 1.4;
    stroke-dasharray: 2.5 4; color: rgb(var(--ink-rgb) / .45); }
.wg-dag-hier { stroke: rgb(var(--ink-rgb) / .22); color: rgb(var(--ink-rgb) / .22); stroke-dasharray: 1.5 5; }
.wg-dag-badge { position: absolute; transform: translate(-50%, -50%); z-index: 2;
    font-family: var(--mono); font-size: 8px; letter-spacing: .08em;
    background: var(--paper); border: 1px solid var(--accent); color: var(--accent);
    border-radius: 999px; padding: 1.5px 7px; white-space: nowrap; pointer-events: none; }
.wg-dag-heat { background: color-mix(in srgb, var(--paper-2), var(--accent) calc(var(--heat, 0) * 26%)); }

/* — Notes: collapsed marginalia, distinct from the instrument cards — */
.ed-note { margin: 16px 0 10px; font-family: var(--mono); border-left: 2px solid var(--rule);
    padding: 2px 0 2px 10px; }
.ed-note summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 8px;
    font-size: 8.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3); }
.ed-note summary::-webkit-details-marker { display: none; }
.ed-note-caret { font-size: 9px; transition: transform .18s ease; color: var(--accent); }
.ed-note[open] .ed-note-caret { transform: rotate(90deg); }
.ed-note-hint { letter-spacing: .03em; text-transform: none; color: var(--ink-3); opacity: .75;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-note[open] .ed-note-hint { display: none; }
.ed-note-body { padding: 6px 2px 2px; }
