/* Continuous Discovery — production styles.
   Design language locked in .agents/context/DESIGN.md:
   dark tinted-neutral ground, semantic colour per OST layer, glow as the elevation
   language, mono for instrument labels and numbers, motion that serves comprehension.

   Every colour and every gap comes from a token below. The layer colours are also read
   at runtime by assets/js/util.js, so this block is the single source of truth for them. */

:root{
  /* Tinted neutrals — never pure black or white. */
  --bg:#070a0d;
  --bg-2:#090c10;
  --bg-3:#0a0e12;
  --surface:#0c1116;
  --panel:#0e1319e6;
  --hover:#141b22;
  --track:#1a222b;
  --line:#1b232c;
  --line-2:#2a343f;
  --line-3:#3c4855;
  --edge:#33404d;
  --ink:#eef3f7;
  --dim:#a3b0bd;
  --faint:#7d8b9a;

  /* Semantic colour, one role per OST layer. */
  --outcome:#3dd7a6;
  --evidence:#f5c25b;
  --opportunity:#f07fa5;
  --solution:#9f8bf0;
  --assumption_test:#40cfd6;
  --dormant:#4a5560;

  /* Signal types, from the harvest buckets. */
  --pain:#f0883e;
  --bug:#f85149;
  --feature_request:#7fb0ff;
  --praise:#3dd7a6;

  /* Glow is the elevation language; these are its two intensities. */
  --glow-soft:#f07fa530;
  --glow-lift:#f07fa540;

  --mono:"JetBrains Mono",ui-monospace,"SF Mono",Menlo,monospace;
  --sans:"Schibsted Grotesk",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;

  /* Spacing scale, 4px base. Nothing in this file uses an off-scale gap. */
  --s0:2px; --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; --s7:48px;

  /* Radii: pill for badges and the CTA, r2 for feed rows, r3 for raised surfaces. */
  --r1:6px; --r2:9px; --r3:12px; --rp:999px;

  --side-w:344px;
}

*{box-sizing:border-box}

html,body{
  margin:0;height:100%;
  background:var(--bg);color:var(--ink);
  font-family:var(--sans);
  -webkit-font-smoothing:antialiased;
  overflow:hidden;
}
svg{display:block}
button{font-family:inherit}

.skiplink{position:absolute;left:-9999px;top:0;z-index:200;background:var(--surface);color:var(--ink);
  padding:var(--s2) var(--s4);border:1px solid var(--line-2);border-radius:0 0 var(--r2) 0}
.skiplink:focus{left:0}

/* ---------- shared atoms ---------- */
.kick{font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--faint)}
.muted{color:var(--dim)}
.tiny{font-size:11px}
.num{font-variant-numeric:tabular-nums}
.sp{flex:1}
.warn{color:var(--assumption_test)}

.app{height:100vh;height:100dvh;display:flex;flex-direction:column;overflow:hidden}
.stack{flex:1;min-height:0;display:flex;flex-direction:column}

/* ---------- honest-framing marker ---------- */
.marker{
  flex:0 0 auto;display:flex;gap:var(--s3);align-items:center;
  padding:var(--s2) var(--s4);font-size:12px;line-height:1.45;
  background:#0a0d10ee;border-bottom:1px solid var(--line);color:var(--dim);z-index:60;
}
.marker b{color:var(--ink);font-weight:600}
.marker code{font-family:var(--mono);background:#ffffff10;color:var(--evidence);
  padding:1px var(--s1);border-radius:var(--r1);font-size:11px}
.dotpulse{width:7px;height:7px;border-radius:50%;background:var(--outcome);box-shadow:0 0 10px var(--outcome);
  animation:pulse 2.4s infinite;flex:0 0 auto}
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}

/* ---------- view routing ---------- */
.view{flex:1;min-height:0;display:none;flex-direction:column}
.view.on{display:flex}
.stage{flex:1;position:relative;min-height:0}

/* ---------- graph typography ---------- */
/* A ground-coloured halo keeps labels legible where they pass near a node's glow. */
.nlabel{font-size:11.5px;fill:var(--ink);font-family:var(--sans);
  paint-order:stroke fill;stroke:var(--bg);stroke-width:2.5px;stroke-linejoin:round}
.nsub{font-size:9.5px;fill:var(--faint);font-family:var(--mono)}
.edge{fill:none;stroke:var(--edge);stroke-width:1;opacity:.5}
.band-title{font-family:var(--mono);font-size:10.5px;letter-spacing:.16em;text-transform:uppercase}

/* ---------- overview: hero ---------- */
.herohead{padding:var(--s5) var(--s7) var(--s1)}
.herohead .eyebrow{font-family:var(--mono);font-size:11px;letter-spacing:.16em;text-transform:uppercase;
  color:var(--outcome);display:flex;gap:var(--s2);align-items:center;margin:0}
.herohead h1{font-size:clamp(27px,3.6vw,46px);line-height:1.04;margin:var(--s3) 0 var(--s3);font-weight:800;
  letter-spacing:-.03em;max-width:17ch}
.herohead h1 .accent{color:var(--opportunity)}
.herohead .sub{color:var(--dim);max-width:58ch;font-size:14.5px;line-height:1.62;margin:0}
.herohead .row{display:flex;align-items:flex-end;gap:var(--s6);margin-top:var(--s4);flex-wrap:wrap}
.herohead .stats{display:flex;flex-wrap:wrap;gap:var(--s3) var(--s5);font-family:var(--mono);
  font-size:12px;color:var(--faint)}
.herohead .stats span{display:flex;flex-direction:column}
.herohead .stats b{color:var(--ink);font-size:15px}

.cta{display:inline-flex;align-items:center;gap:var(--s2);
  background:linear-gradient(90deg,var(--opportunity),var(--evidence));
  color:#0a0d10;font-weight:650;font-size:13px;border:0;border-radius:var(--rp);
  padding:var(--s3) var(--s5);cursor:pointer;box-shadow:0 6px 22px var(--glow-lift)}
.cta:hover{filter:brightness(1.08)}
.cta:active{transform:translateY(1px)}
.cta-arrow{display:inline-block;transition:transform .22s cubic-bezier(.2,.8,.2,1)}
.cta:hover .cta-arrow{transform:translateX(3px)}

.narrowhint{display:none;font-family:var(--mono);font-size:11px;letter-spacing:.06em;
  color:var(--faint);padding:var(--s4) var(--s4) 0;line-height:1.6;margin:0}

/* narration strip: a numbered 4-beat sequence, deliberately not an icon-card grid */
.cards{position:absolute;left:0;right:0;bottom:0;display:grid;grid-template-columns:repeat(4,1fr);
  gap:1px;background:var(--line);border-top:1px solid var(--line);height:172px}
.card{background:var(--bg-3);padding:var(--s3) var(--s4);overflow:hidden;position:relative}
.card .cn{font-family:var(--mono);font-size:10px;letter-spacing:.1em;color:var(--faint);
  margin:0 0 var(--s2);display:flex;gap:var(--s2);align-items:center}
.card .cdot{width:7px;height:7px;border-radius:50%;flex:0 0 auto}
.card h2{margin:0 0 var(--s1);font-size:13px;font-weight:600;line-height:1.35}
.card .q{font-size:12px;color:var(--dim);font-style:italic;line-height:1.45;margin:0}
.card .kv{font-size:11px;color:var(--dim);margin:var(--s2) 0 0;display:flex;
  justify-content:space-between;gap:var(--s3)}
.card .strong{color:var(--evidence);font-weight:600}

/* ---------- explorer chrome ---------- */
.expnav{flex:0 0 auto;display:flex;align-items:center;gap:var(--s4);padding:var(--s2) var(--s4);
  border-bottom:1px solid var(--line);background:var(--bg-2)}
.btn{background:transparent;border:1px solid var(--line-2);color:var(--ink);border-radius:var(--r2);
  padding:var(--s2) var(--s3);cursor:pointer;font-size:13px;display:inline-flex;gap:var(--s2);
  align-items:center;text-decoration:none;transition:background .18s,border-color .18s}
.btn:hover{background:var(--hover);border-color:var(--line-3)}
.btn:active{transform:translateY(1px)}
.crumb{font-family:var(--mono);font-size:11px;color:var(--faint);letter-spacing:.04em}
.crumb b{color:var(--ink)}
.expbody{flex:1;min-height:0;display:flex;flex-direction:column}

/* ---------- week rail: the time spine ---------- */
.rail{flex:0 0 auto;display:flex;gap:var(--s3);padding:var(--s3) var(--s4);overflow-x:auto;
  border-bottom:1px solid var(--line);background:var(--bg-2);scrollbar-width:thin;align-items:stretch}
/* Cards stretch to the tallest in the rail, so their content is top-anchored rather
   than floating in the middle of the extra height. */
.wkcard{flex:0 0 186px;border:1px solid var(--line-2);border-radius:var(--r3);padding:var(--s3);
  background:var(--surface);cursor:pointer;text-align:left;color:inherit;
  display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;
  transition:border-color .18s,box-shadow .18s,background .18s}
.wkcard:hover{border-color:var(--line-3);background:var(--hover)}
.wkcard.on{border-color:var(--opportunity);box-shadow:0 0 0 1px var(--opportunity),0 0 22px var(--glow-lift)}
.wkcard.on:hover{background:var(--surface)}
.wkcard.ghost{opacity:.4;border-style:dashed;cursor:default;background:transparent}
.wkcard .w{font-family:var(--mono);font-size:10px;color:var(--faint);display:flex;
  justify-content:space-between;gap:var(--s2);align-items:center}
.wkcard .d{font-weight:700;font-size:15px;margin:var(--s1) 0 var(--s2);letter-spacing:-.01em;display:block}
.wkcard .dl{font-size:11px;line-height:1.62;color:var(--dim);display:block}
.wkcard .dl i{display:inline-block;width:6px;height:6px;border-radius:50%;margin-right:var(--s1)}
.wkcard .why{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
  margin-top:var(--s2);padding-top:var(--s2);border-top:1px dashed var(--line-2);
  font-size:11px;line-height:1.5;color:var(--dim);font-style:italic}

.badge{font-family:var(--mono);font-size:9px;letter-spacing:.06em;text-transform:uppercase;
  border:1px solid var(--line-2);border-radius:var(--rp);padding:1px var(--s1);color:var(--faint);
  white-space:nowrap;display:inline-block}
.badge.human{color:var(--assumption_test);border-color:#2c4a50}
.badge.agent{color:var(--faint)}

/* ---------- workspace ---------- */
.bbody{flex:1;display:grid;grid-template-columns:1fr var(--side-w);min-height:0}
.btree{position:relative;overflow:hidden;min-width:0}
.wscap{position:absolute;left:var(--s4);top:var(--s3);z-index:2;display:flex;gap:var(--s3);
  align-items:baseline;flex-wrap:wrap;max-width:calc(100% - var(--s6))}
.wscap .cap{font-family:var(--mono);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--faint)}
.wscap .cap b{color:var(--ink)}
.wscap .note{font-size:11.5px;color:var(--dim);font-style:italic;max-width:52ch}
.diffdot{display:inline-block;width:6px;height:6px;border-radius:50%;margin:0 var(--s1) 0 var(--s2)}

.bside{display:grid;grid-template-rows:1fr 1fr;min-height:0;border-left:1px solid var(--line);background:var(--bg-2)}
.bpanel{overflow:auto;padding:var(--s3) var(--s4);min-height:0;scrollbar-width:thin}
.bpanel+.bpanel{border-top:1px solid var(--line)}
.bpanel h2{margin:0 0 var(--s3);font-size:12px;font-weight:600;display:flex;justify-content:space-between;
  align-items:center;gap:var(--s3);position:sticky;top:calc(var(--s3) * -1);background:var(--bg-2);
  padding:var(--s0) 0 var(--s2);z-index:1}

.feed{border:1px solid var(--line);border-radius:var(--r2);padding:var(--s2) var(--s3);
  margin-bottom:var(--s2);background:var(--surface);font-size:12px;line-height:1.45;
  transition:border-color .18s,box-shadow .18s,background .18s;
  width:100%;text-align:left;color:inherit;display:block;cursor:pointer}
.feed:hover{border-color:var(--line-3)}
.feed.hi{border-color:var(--opportunity);box-shadow:0 0 0 1px var(--opportunity),0 0 18px var(--glow-soft);
  background:#140f13}
.feed.plain{cursor:default}
.feed.plain:hover{border-color:var(--line)}
.feed .st{font-family:var(--mono);font-size:9.5px;text-transform:uppercase;letter-spacing:.05em}
.st.pain{color:var(--pain)}
.st.bug{color:var(--bug)}
.st.feature_request{color:var(--feature_request)}
.st.praise{color:var(--praise)}
.feed a{color:var(--dim)}
.rc{display:inline-block;font-family:var(--mono);font-size:9.5px;padding:1px var(--s1);
  border:1px solid var(--line-2);border-radius:var(--r2);color:var(--dim);margin:var(--s1) var(--s1) 0 0}
.rc.feature{color:var(--outcome);border-color:#22483c}
.rc.fix{color:var(--pain);border-color:#4a3423}
.rc.breaking{color:var(--bug);border-color:#4d2626}
.rc.infra{color:var(--dim)}

/* Empty panels say what would fill them, and when. */
.emptyline{font-size:12px;line-height:1.6;color:var(--faint);margin:var(--s1) 0 0;
  border:1px dashed var(--line-2);border-radius:var(--r2);padding:var(--s3)}

/* ---------- node detail ---------- */
.detail{position:absolute;left:var(--s4);bottom:var(--s4);width:326px;max-height:68%;overflow:auto;
  background:var(--panel);border:1px solid var(--line-2);border-radius:var(--r3);
  padding:var(--s4);backdrop-filter:blur(9px);box-shadow:0 16px 50px #000a;display:none;scrollbar-width:thin}
.detail.show{display:block;animation:rise .22s cubic-bezier(.2,.8,.2,1)}
@keyframes rise{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.detail h3{margin:var(--s1) 0 var(--s2);font-size:15px;line-height:1.35;font-weight:600}
.detail .kick{margin:0;display:flex;gap:var(--s2);align-items:center;flex-wrap:wrap}
.drow{display:flex;justify-content:space-between;gap:var(--s3);font-size:12px;padding:var(--s1) 0;
  border-bottom:1px dashed var(--line)}
/* Dormancy is a first-class state, not a footnote: it gets its own recessive block. */
.dormantbox{border:1px dashed var(--line-2);border-radius:var(--r2);padding:var(--s2) var(--s3);
  margin:0 0 var(--s3);background:#ffffff06}
.dormantbox p{margin:0;line-height:1.5}
.dormantbox p+p{margin-top:var(--s1)}
.dormantbox b{color:var(--ink);font-weight:600}

.strengthbar{height:5px;border-radius:3px;background:var(--track);overflow:hidden;margin-top:var(--s1)}
.strengthbar i{display:block;height:100%;background:linear-gradient(90deg,var(--opportunity),var(--evidence))}
.close{float:right;background:transparent;border:1px solid var(--line-2);color:var(--ink);
  border-radius:var(--r1);padding:var(--s1) var(--s2);cursor:pointer;font-size:12px}
.close:hover{background:var(--hover)}

/* ---------- boot / degraded states ---------- */
/* Below the marker's z-index on purpose: the honest-framing strip stays visible while
   the tree loads and when it cannot be reached. This screen is still this site. */
.boot{position:fixed;inset:0;display:grid;place-items:center;background:var(--bg);z-index:50;
  transition:opacity .3s;padding:var(--s5)}
.boot.gone{opacity:0;pointer-events:none}
.boot-inner{display:flex;gap:var(--s3);align-items:center;font-family:var(--mono);font-size:12px;
  letter-spacing:.08em;text-transform:uppercase;color:var(--faint)}
.errbox{max-width:56ch;text-align:left;font-family:var(--sans);text-transform:none;letter-spacing:0;
  font-size:14px;line-height:1.62;color:var(--dim)}
.errbox h2{font-size:19px;color:var(--ink);margin:0 0 var(--s3);font-weight:700;letter-spacing:-.01em}
.errbox p{margin:0 0 var(--s3)}
.errbox p:last-of-type{margin-bottom:0}
.errbox code{font-family:var(--mono);font-size:12px;color:var(--evidence);background:#ffffff10;
  padding:1px var(--s1);border-radius:var(--r1);word-break:break-all}
.errbox .actions{display:flex;gap:var(--s3);align-items:center;flex-wrap:wrap;margin-top:var(--s5)}
.errbox .detailtext{font-family:var(--mono);font-size:11px;color:var(--faint);margin-top:var(--s3)}

.noscript{padding:var(--s5);font-size:14px;line-height:1.6;color:var(--dim);max-width:60ch}
.noscript code{font-family:var(--mono);font-size:12px;color:var(--evidence)}

/* ---------- focus + motion ---------- */
.cta:focus-visible,.btn:focus-visible,.close:focus-visible,.wkcard:focus-visible,
.feed:focus-visible,.skiplink:focus-visible{outline:2px solid var(--opportunity);outline-offset:2px;
  border-radius:var(--r2)}
g.node:focus,g.node:focus-visible{outline:none}
g.node:focus-visible circle.hit{stroke:var(--opportunity);stroke-width:2;stroke-dasharray:2 2}

@media (prefers-reduced-motion:reduce){
  .dotpulse{animation:none!important}
  *{animation-duration:.001ms!important;transition-duration:.001ms!important}
}

/* Touch targets reach 44px where a finger is the pointer. */
@media (pointer:coarse){
  .btn,.close,.cta{min-height:44px}
  .feed{padding:var(--s3)}
  .wkcard{padding:var(--s4) var(--s3)}
}

/* ---------- narrow screens ----------
   The explorer is a large-screen workspace. Below 1000px the side panels move under the
   tree and the app scrolls rather than pretending to fit. */
@media (max-width:1180px){
  :root{--side-w:300px}
  .herohead{padding:var(--s5) var(--s5) var(--s1)}
}
@media (max-width:1000px){
  /* Hand scrolling back to the document, so the page scrolls normally and the
     sticky marker anchors to the viewport instead of an inner scroll container. */
  html,body{height:auto;overflow:visible}
  /* overflow:hidden on an ancestor would trap the sticky marker in a non-scrolling box. */
  .app{height:auto;min-height:100dvh;overflow:visible}
  .marker{position:sticky;top:0;flex-wrap:wrap}
  .marker-note{display:none}
  .view{min-height:0}
  /* Definite height for the same reason as .btree: the SVG measures its own pane. */
  .stage{height:clamp(420px,70vh,620px)}
  .cards{position:static;grid-template-columns:repeat(2,1fr);height:auto}
  .bbody{grid-template-columns:1fr;grid-template-rows:auto auto}
  /* A definite height, not min-height: the SVG is sized from the pane, and an
     auto-height pane would feed its own growth. */
  .btree{height:clamp(420px,66vh,640px)}
  .bside{border-left:0;border-top:1px solid var(--line);grid-template-rows:auto auto}
  .bpanel{max-height:360px}
  .detail{position:static;width:auto;max-height:none;margin:var(--s3) var(--s4) var(--s4)}
}
@media (max-width:640px){
  .cards{grid-template-columns:1fr}
  .herohead{padding:var(--s4) var(--s4) var(--s1)}
  .herohead .row{gap:var(--s5)}
  /* A four-band flow graph is not legible at phone width. Rather than ship an
     unreadable version, the hero drops to its narration and says so. */
  #hsvg{display:none}
  .stage{height:auto}
  .narrowhint{display:block}
  .btree{height:clamp(380px,60vh,520px)}
  .expnav{flex-wrap:wrap;gap:var(--s2) var(--s3)}
  .crumb{order:3;flex-basis:100%}
}
