/* VSSGEO design round 2, lane "thread": the Geo conversation panel in the door layout.
   Covers the thread header, the message thread, "View Geo's thoughts", the area chips, the composer, suggested
   follow-ups, and the working / arrive / guide / rest states.
   Load AFTER vssgeo-theme.css, door/door.css and door/door-panels.css. The optional thread.js goes after door-brain.js.
   Everything is scoped to body.door and uses --vg-* tokens. The only new tokens are in the marked :root block below.
   Every colour is a token or a color-mix() of tokens, so it follows data-theme="light".
   Classes owned by this lane (set by thread.js; without the JS the CSS still works, only the states are missing):
     body.th-working          an answer call (/api/find|chat|agent|story|brief) is in flight
     .gm.th-new / .gm.th-seen a thread item that just arrived / one that was already on screen (a re-render)
     .gm.th-failed, .th-retry a failed answer and its plain message with "Try again" / "Edit question"
     .th-live                 the steps that tick in while Geo works
     .chip.th-guide           the ONE suggested next step after an answer
     .geo-sprite[data-state=idle|working|pointing|found|error]   Geo's avatar (the sprite-sheet hook)
     .th-link                 logos that take you home to the front door */

/* ══ tokens added by this lane (8-pt proposal from DESIGN-NORTH-STAR + lane-local values) ═════════════════ */
:root{
  --vg-s5:24px; --vg-s6:32px; --vg-s7:48px;          /* the 8-pt scale's missing steps (north star proposal) */
  --th-ctl:32px;                                     /* minimum clickable size, pointer */
  --th-hit:40px;                                     /* header / composer controls, and every control on touch */
  --th-ease:cubic-bezier(.2,.8,.2,1);
  --th-err:var(--vg-raise2);                         /* failed answer card (flat fallback) */
  --th-err-line:var(--vg-red);
}
@supports (color:color-mix(in srgb,red,blue)){
  :root{--th-err:color-mix(in srgb,var(--vg-red) 12%,var(--vg-raise));--th-err-line:color-mix(in srgb,var(--vg-red) 45%,var(--vg-rule))}
  :root[data-theme="light"]{--th-err:color-mix(in srgb,var(--vg-red) 7%,var(--vg-raise));--th-err-line:color-mix(in srgb,var(--vg-red) 35%,var(--vg-rule))}
}


/* ══ 1. header: back · Geo · title · (notes) · new · hide — 8-pt, 40 px targets ═════════════════════════════ */
body.door .dh{gap:var(--vg-s2);padding:var(--vg-s2);min-height:56px}
body.door .dh .dib{width:var(--th-hit);height:var(--th-hit)}
body.door .dtitle{padding:0 var(--vg-s1)}
/* the way back is the first thing you see: the back arrow wears a quiet outline at rest */
body.door .dh-thread .dback{border-color:var(--vg-rule)}
body.door .dh-thread .dback:hover{border-color:transparent}
/* Geo in the header (thread.js adds it): tells you Geo is working even when the thread is scrolled away */
body.door .dh-thread .th-hsprite{flex:none;width:24px;height:16px;margin:0 0 0 var(--vg-s1)}
/* the working line: the brand colours flow along the header's bottom edge while an answer is on its way */
body.door .dh-thread{position:relative}
body.door .dh-thread::after{content:"";position:absolute;left:var(--vg-s4);right:var(--vg-s4);bottom:0;height:2px;border-radius:var(--vg-pill);pointer-events:none;
  background:linear-gradient(90deg,var(--vg-gold),var(--vg-red),var(--vg-blue),var(--vg-gold)) 0 0/200% 100%;
  opacity:0;transform:scaleX(.4);transition:opacity .2s ease,transform .3s var(--th-ease)}
body.door.th-working .dh-thread::after{opacity:1;transform:none;animation:th-flow 1.6s linear infinite}
@keyframes th-flow{to{background-position:-200% 0}}
/* the logo is the way home: VSSGEO → the front door (thread.js makes it a link only when DOOR_FRONT is set) */
body.door .dlogo.th-link,body.door .dmi-logo.th-link{cursor:pointer;border-radius:0;transition:transform .25s var(--vg-spring),opacity .15s}
body.door .dlogo.th-link:hover,body.door .dmi-logo.th-link:hover{transform:translateY(-1px)}
body.door .dlogo.th-link:active,body.door .dmi-logo.th-link:active{transform:scale(.96)}
body.door .dlogo.th-link:focus-visible,body.door .dmi-logo.th-link:focus-visible{outline:2px solid var(--vg-accent);outline-offset:4px}


/* ══ 2. the thread: 8-pt rhythm, one gap everywhere ════════════════════════════════════════════════════════ */
body.door .gthr{padding:var(--vg-s4) var(--vg-s4) var(--vg-s2);gap:var(--vg-s4)}
body.door .gm.geo{gap:var(--vg-s2)}
body.door .gm.geo>p,body.door .gm.geo>div>p:first-child{padding:var(--vg-s2) var(--vg-s4)}
body.door .gm.you{padding-right:var(--vg-s6)}
body.door .gm.you>p{padding:var(--vg-s2) var(--vg-s4)}
body.door .gm.ctx{padding:var(--vg-s1) var(--vg-s4)}
/* light-mode legibility: gold-on-white fails contrast, so links and marks use the accent (gold in dark, red in light) */
body.door .gm.you small{margin-top:var(--vg-s1);font-size:12px;color:var(--vg-muted)}
body.door .gm.you small a{color:var(--vg-accent);text-decoration:underline;text-decoration-color:currentColor;text-underline-offset:2px;cursor:pointer}
body.door .gm.ctx i{color:var(--vg-accent)}
body.door .gm.ctx a{text-decoration-color:var(--vg-faint)}
body.door .gm.ctx a:hover{text-decoration-color:var(--vg-accent)}
body.door .gm.filec .ft{color:var(--vg-accent)}
body.door .gm.geo .gcost{display:block;margin-top:var(--vg-s1);font:500 11px var(--vg-font-mono);color:var(--vg-faint)}
/* suggested follow-ups: 32 px pills (40 on touch) */
body.door .gchips{gap:var(--vg-s2);margin-top:var(--vg-s2)}
body.door .gchips .chip{display:inline-flex;align-items:center;min-height:var(--th-ctl);padding:var(--vg-s1) var(--vg-s4);line-height:1.3;cursor:pointer}
/* "Helpful?" thumbs: real targets */
body.door .dreact{gap:var(--vg-s1);margin-top:var(--vg-s2)}
body.door .dreact button{min-width:var(--th-ctl);min-height:var(--th-ctl);display:inline-grid;place-items:center;padding:0}
/* "View Geo's thoughts": 32 px pill, 16-pt card */
body.door .dtrace{margin-top:var(--vg-s2)}
body.door .dtrace summary{min-height:var(--th-ctl);padding:0 var(--vg-s4) 0 var(--vg-s2)}
body.door .dt-body{margin-top:var(--vg-s2);padding:var(--vg-s4)}
body.door .dt-sec+.dt-sec,body.door .dt-cr{margin-top:var(--vg-s2);padding-top:var(--vg-s2)}
body.door .dt-h{margin-bottom:var(--vg-s1)}
/* keyboard: everything clickable in the thread shows where focus is */
body.door .gthr a[tabindex]:focus-visible,body.door .gchips .chip:focus-visible,body.door .dtrace summary:focus-visible,body.door .dreact button:focus-visible,
body.door .th-retry button:focus-visible,body.door .gacts a:focus-visible{outline:2px solid var(--vg-accent);outline-offset:2px}


/* ══ 3. REST: nothing loops when nothing is happening ══════════════════════════════════════════════════════
   Round 1 left three rings turning forever at rest. They now hold still and only move on hover or while Geo works. */
body.door .gcp.area::after,body.door .gcp.bnd::after{animation:none}                       /* area chip: ring on, still */
body.door #hist .sess.cur::after{animation:none}                                             /* current session: ring on, still */
body.door #hist .sess.cur:hover::after{animation:vg-spin 4.5s linear infinite}
body.door .dtrace[open] summary::before{animation:none}                                      /* open "thoughts": mark still */
body.door .dtrace summary:hover::before{animation:vg-spin 2.4s linear infinite}


/* ══ 4. WORKING: Geo visibly thinking while an answer is on its way ═══════════════════════════════════════
   The brand ring flows around the message box and the area chip, the header line flows, Geo animates,
   and the steps tick into the "thinking" bubble. All of it stops the moment the answer lands. */
body.door.th-working .gbox::after{opacity:1;padding:1.6px;animation:vg-spin 2.2s linear infinite}
body.door.th-working .gbox{box-shadow:0 0 34px var(--vg-accent-soft)}
body.door.th-working .gcp.area::after{animation:vg-spin 2.2s linear infinite}
/* the thinking bubble: Geo's avatar + "Geo is thinking…" + the live steps */
body.door .gm.geo.th-waiting>div{display:flex;flex-direction:column;align-items:flex-start;min-width:0}
body.door .th-live{list-style:none;margin:var(--vg-s2) 0 0;padding:0 0 0 var(--vg-s4);border-left:1px solid var(--vg-rule);font-size:12px;line-height:1.5;color:var(--vg-muted)}
body.door .th-live li{position:relative;padding:2px 0;animation:vg-in .2s var(--th-ease) both}
body.door .th-live li::before{content:"";position:absolute;left:-20px;top:8px;width:7px;height:7px;border-radius:50%;background:var(--vg-panel);border:1px solid var(--vg-accent)}
body.door .th-live li.pend::before{animation:th-blink .8s steps(2,jump-none) infinite}
body.door .th-live li.done::before{background:var(--vg-accent)}
body.door .th-live li.fail::before{background:var(--vg-red);border-color:var(--vg-red)}
body.door .th-live li i{font-style:normal;font-family:var(--vg-font-mono);font-size:11px;color:var(--vg-faint);margin-left:var(--vg-s2)}
body.door .th-live li.th-slow{color:var(--vg-ink)}
body.door .th-live li.th-slow::before{border-style:dashed}
@keyframes th-blink{0%{opacity:1}100%{opacity:.25}}


/* ══ 5. Geo, animated: the sprite hook ═════════════════════════════════════════════════════════════════════
   Contract: any element with .geo-sprite and data-state = idle | working | pointing | found | error.
   thread.js puts it on Geo's avatars in the thread (img.gav), the header octopus and the rail logo.
   TODAY (placeholder): the existing geo.svg moves in blocky steps (steps() timing = sprite-frame feel).
   LATER (Will's sprite sheet): uncomment the block at the end of this section, drop brand/geo-sprite.png in, and
   set --geo-row per state. Nothing else changes: the states are already wired. */
body.door .geo-sprite{image-rendering:pixelated;transform-origin:50% 90%}
body.door .geo-sprite[data-state="working"]{animation:th-geo-work .72s infinite}
body.door .geo-sprite[data-state="found"]{animation:th-geo-found .4s var(--vg-spring) both}
body.door .geo-sprite[data-state="pointing"]{transform:rotate(-8deg) translateX(1px);transition:transform .3s var(--vg-spring)}
body.door .geo-sprite[data-state="error"]{filter:grayscale(.7);opacity:.85;animation:th-geo-shake .3s ease both}
body.door .gm.you .dyou.geo-sprite{animation:none}                    /* the user's white octopus never animates */
@keyframes th-geo-work{                                                 /* 4 held frames: bob, lean, bob, rest */
  0%{transform:none;animation-timing-function:steps(1,end)}
  25%{transform:translateY(-2px) rotate(-6deg);animation-timing-function:steps(1,end)}
  50%{transform:translateY(-3px);animation-timing-function:steps(1,end)}
  75%{transform:translateY(-1px) rotate(6deg);animation-timing-function:steps(1,end)}
  100%{transform:none}}
@keyframes th-geo-found{0%{transform:none}45%{transform:translateY(-4px) scale(1.12)}100%{transform:none}}
@keyframes th-geo-shake{0%,100%{transform:none}25%{transform:translateX(-2px)}75%{transform:translateX(2px)}}
/* ── sprite sheet drop-in (inactive until Will exports the sheet) ──
body.door .geo-sprite{content:url("/vista100/brand/geo-sprite.png");object-fit:none;object-position:0 calc(var(--geo-row,0) * -18px);
  --geo-frames:6;width:27px;height:18px}
body.door .geo-sprite[data-state="idle"]{--geo-row:0;animation:none}
body.door .geo-sprite[data-state="working"]{--geo-row:1;animation:geo-frames .72s steps(var(--geo-frames)) infinite}
body.door .geo-sprite[data-state="pointing"]{--geo-row:2;animation:geo-frames .4s steps(var(--geo-frames)) 1 both}
body.door .geo-sprite[data-state="found"]{--geo-row:3;animation:geo-frames .4s steps(var(--geo-frames)) 1 both}
body.door .geo-sprite[data-state="error"]{--geo-row:4;animation:geo-frames .4s steps(var(--geo-frames)) 1 both}
@keyframes geo-frames{from{object-position:0 calc(var(--geo-row) * -18px)}to{object-position:calc(var(--geo-frames) * -27px) calc(var(--geo-row) * -18px)}}
── */


/* ══ 6. ARRIVE: what's new lands, what was already there stays put ═════════════════════════════════════════
   Evan's thRender rebuilds the whole thread on every turn, so door.css's pop replayed on EVERY bubble each time.
   thread.js tags items: .th-seen (already on screen: no motion) and .th-new (just arrived: pop, then its
   chips / actions / files land in a ≤400 ms stagger). */
body.door .gthr>.gm.th-seen{animation:none}
body.door .gthr>.gm.th-new{animation:vg-pop .24s var(--vg-spring) both}
body.door .gm.geo.th-new .gchips .chip,body.door .gm.geo.th-new .gacts a,body.door .gm.geo.th-new .gfiles>*{animation:vg-pop .22s var(--vg-spring) both;animation-delay:.1s}
body.door .gm.geo.th-new .gchips .chip:nth-child(2),body.door .gm.geo.th-new .gacts a:nth-child(2),body.door .gm.geo.th-new .gfiles>:nth-child(2){animation-delay:.14s}
body.door .gm.geo.th-new .gchips .chip:nth-child(n+3),body.door .gm.geo.th-new .gacts a:nth-child(n+3),body.door .gm.geo.th-new .gfiles>:nth-child(n+3){animation-delay:.18s}
/* "View Geo's thoughts" arrives once; the credit re-count (door.js rewrites it every few seconds) no longer re-pops it */
body.door .gthr .dtrace:not(.th-seen){animation:vg-in .22s var(--th-ease) both}
body.door .gthr .dtrace.th-seen .dt-body{animation:none}
body.door .gthr .dtrace:not(.th-seen)[open] .dt-steps li{animation:vg-in .2s var(--th-ease) both}
body.door .gthr .dtrace:not(.th-seen)[open] .dt-steps li:nth-child(2){animation-delay:.04s}
body.door .gthr .dtrace:not(.th-seen)[open] .dt-steps li:nth-child(3){animation-delay:.08s}
body.door .gthr .dtrace:not(.th-seen)[open] .dt-steps li:nth-child(n+4){animation-delay:.12s}
/* area chips: the chip bar is rebuilt on every change, so only a genuinely new chip pops */
body.door .gcp.th-seen{animation:none}


/* ══ 7. GUIDE: one suggested next step after an answer ════════════════════════════════════════════════════
   The first follow-up of the newest answer gets the ring (it fades in once, then holds still) and a filled pill;
   the others step back. Only one on screen at a time; it clears as soon as you send anything. */
body.door .gchips .chip.th-guide{background:var(--vg-accent-soft);border-color:transparent;font-weight:600}
body.door .gchips .chip.th-guide::after{opacity:1;animation:th-guide-in .4s var(--th-ease) both}
body.door .gchips .chip.th-guide.th-held::after{animation:none}
body.door .gchips .chip.th-guide:hover::after{animation:vg-spin 4.5s linear infinite}
body.door .gchips:has(.th-guide) .chip:not(.th-guide){color:var(--vg-muted)}
body.door .gchips:has(.th-guide) .chip:not(.th-guide):hover{color:var(--vg-ink)}
@keyframes th-guide-in{from{opacity:0;transform:scale(1.12)}to{opacity:1;transform:none}}


/* ══ 8. ERROR: a failed answer says so plainly, keeps the question, and offers the way forward ══════════════ */
body.door .gm.geo.th-failed>div>p:first-child,body.door .gm.geo.th-failed>p{background:var(--th-err);color:var(--vg-ink);box-shadow:none;border:1px solid var(--th-err-line)}
body.door .gm.geo.th-failed p b,body.door .gm.geo.th-failed p a{color:var(--vg-ink)}
body.door .th-retry{display:flex;flex-wrap:wrap;align-items:center;gap:var(--vg-s2);margin-top:var(--vg-s2);padding:var(--vg-s2) var(--vg-s2) var(--vg-s2) var(--vg-s4);
  border-radius:var(--vg-r);background:var(--th-err);border:1px solid var(--th-err-line);color:var(--vg-ink);font:13px/1.45 var(--vg-font-body);text-align:left;
  animation:vg-pop .24s var(--vg-spring) both}
body.door .gm.you .th-retry{align-self:flex-end;max-width:100%}
body.door .th-retry span{flex:1 1 160px;min-width:0}
body.door .th-retry button{min-height:var(--th-ctl);padding:0 var(--vg-s4);border-radius:var(--vg-pill);border:1px solid var(--vg-rule);background:var(--vg-raise);color:var(--vg-ink);
  font:600 12.5px/1 var(--vg-font-display);cursor:pointer;transition:transform .25s var(--vg-spring),background .15s,border-color .15s}
body.door .th-retry button:hover{transform:translateY(-1px);background:var(--vg-raise2)}
body.door .th-retry button:active{transform:scale(.96)}
body.door .th-retry .th-again{background:var(--vg-red);border-color:var(--vg-red);color:var(--vg-geo-ink)}
body.door .th-retry .th-again:hover{background:var(--vg-red);box-shadow:0 8px 24px color-mix(in srgb,var(--vg-red) 40%,transparent)}


/* ══ 9. composer: chips, box, + menu, octopus (boundary), send ══════════════════════════════════════════════ */
body.door .gcomp{padding:var(--vg-s2) var(--vg-s4) var(--vg-s4)}
body.door .gchipbar{gap:var(--vg-s2);padding:0 0 var(--vg-s2)}
body.door .gcp{height:var(--th-ctl);gap:var(--vg-s2);padding:0 var(--vg-s1) 0 var(--vg-s4)}
body.door .gcp button{width:24px;height:24px;position:relative}
body.door .gcp button::before{content:"";position:absolute;inset:-4px;border-radius:50%}   /* 32 px hit area around the 24 px × */
body.door .gbox{padding:var(--vg-s1) var(--vg-s2) var(--vg-s2)}
body.door .gcomp textarea{padding:var(--vg-s2) var(--vg-s2) var(--vg-s1)}
body.door .gcomp textarea::placeholder{color:var(--vg-muted);opacity:1}
body.door .gbrow{gap:var(--vg-s1)}
body.door .gbrow .gplus,body.door .gbrow .gbnd,body.door .gbrow .gsend{width:var(--th-hit);height:var(--th-hit)}
body.door .gplus:focus-visible,body.door .gbnd:focus-visible,body.door .gsend:focus-visible{outline:2px solid var(--vg-accent);outline-offset:2px}
/* Send says when it has nothing to send (Enter on an empty box does nothing) */
body.door .gbox:has(textarea:placeholder-shown) .gsend{opacity:.45;box-shadow:none;transform:none}
body.door .gbox:has(textarea:placeholder-shown) .gsend::after{animation:none}
/* the + menu: 8-pt rows, 32 px pills that react */
body.door .gmenu{padding:var(--vg-s2)}
body.door .grow{gap:var(--vg-s2);padding:var(--vg-s1) 0}
body.door .grow button{min-height:var(--th-ctl);padding:0 var(--vg-s4);cursor:pointer;transition:transform .25s var(--vg-spring),background .15s,border-color .15s}
body.door .grow button:hover{transform:translateY(-1px);background:var(--vg-accent-soft);border-color:transparent}
body.door .grow button:active{transform:scale(.96)}
body.door .grow button:focus-visible{outline:2px solid var(--vg-accent);outline-offset:2px}
body.door .gfoot{padding:var(--vg-s2) 0 0;gap:var(--vg-s2)}


/* ══ 10. touch: every control at least 40 px ══════════════════════════════════════════════════════════════ */
@media (pointer:coarse){
  body.door .gchips .chip,body.door .dtrace summary,body.door .th-retry button,body.door .grow button,body.door .gcp{min-height:var(--th-hit)}
  body.door .gcp{height:var(--th-hit)}
  body.door .dreact button{min-width:var(--th-hit);min-height:var(--th-hit)}
  body.door .gcp button::before{inset:-8px}
}


/* ══ 11. reduced motion: states still read (ring on, bar on, steps listed), nothing moves ═══════════════════ */
@media (prefers-reduced-motion:reduce){
  body.door .geo-sprite,body.door .th-live li,body.door .th-live li::before,body.door .th-retry,body.door .gthr>.gm.th-new,
  body.door .gm.geo.th-new .gchips .chip,body.door .gm.geo.th-new .gacts a,body.door .gm.geo.th-new .gfiles>*,
  body.door .gthr .dtrace,body.door .gthr .dtrace .dt-steps li,body.door .gchips .chip.th-guide::after,body.door .gcp{animation:none!important}
  body.door.th-working .dh-thread::after,body.door.th-working .gbox::after,body.door.th-working .gcp.area::after{animation:none!important}
  body.door .geo-sprite[data-state="pointing"]{transform:none}
}
/* PROTECTED: Will's logo and octopus are never clipped, rounded, masked or cropped - anywhere (lead, 2026-09-27) */
body.door :is(.dlogo,.dmi-logo,.gav,.geo-sprite,img[src*=vssgeo-],img[src*=geo.svg]){border-radius:0!important;clip-path:none!important;-webkit-mask:none!important;mask:none!important}
