/* My Threads — investigation board. Namespaced .mt-*. Reads the host design tokens (styles.css :root).
   Tone: a historian's research table — brass thread on dark, archive-card pins. Not a red-yarn wall.
   Phase 2 adds: floating side-controls, suggestions strip, Board/Trail/Inquiry views, export/print. */

/* ----- header ingress pill ----- */
.mt-launcher{display:inline-flex;align-items:center;gap:7px;margin-left:14px;padding:7px 13px;border-radius:999px;cursor:pointer;
  background:var(--panel);border:1px solid var(--line);color:var(--ink-soft);font:inherit;font-size:12.5px;transition:border-color .15s,color .15s,background .15s}
.mt-launcher:hover{border-color:var(--brass);color:var(--brass-bright);background:rgba(201,162,75,.1)}
.mt-launcher svg{width:16px;height:16px;fill:var(--brass)}
.mt-launcher b{font-weight:700;font-variant-numeric:tabular-nums;color:var(--brass-bright);background:rgba(201,162,75,.16);border-radius:999px;padding:1px 7px;font-size:11px}

/* ----- Save / Go-to-board dock: two ROUND buttons, vertically CENTRED on the card's right,
         fading in at their final position (no center→right jump). ----- */
.mt-savedock{position:fixed;z-index:62;display:flex;flex-direction:column;align-items:center;gap:16px;transform:translateY(-50%);
  opacity:0;pointer-events:none;transition:opacity .22s ease}   /* opacity ONLY — position is set while hidden so it never slides/jumps */
.mt-savedock.is-shown{opacity:1;pointer-events:auto}
.mt-rbtn{display:flex;flex-direction:column;align-items:center;gap:6px;background:none;border:none;cursor:pointer;font:inherit;padding:0;color:var(--brass-bright)}
.mt-rbtn__ic{display:flex;align-items:center;justify-content:center;width:60px;height:60px;border-radius:50%;
  background:linear-gradient(180deg,var(--panel),var(--bg-2));border:1px solid rgba(201,162,75,.55);
  box-shadow:0 12px 30px -12px rgba(0,0,0,.85);transition:border-color .15s,background .15s,transform .1s}
.mt-rbtn:hover .mt-rbtn__ic{background:rgba(201,162,75,.14);transform:translateY(-2px)}
.mt-rbtn:active .mt-rbtn__ic{transform:translateY(0)}
.mt-rbtn__ic svg{width:26px;height:26px;fill:currentColor}
.mt-rbtn--go .mt-rbtn__ic svg{fill:var(--brass);stroke:var(--brass)}
.mt-rbtn__lbl{font-size:11.5px;font-weight:600;color:var(--ink-soft);white-space:nowrap;text-align:center;line-height:1.2}
.mt-rbtn__lbl b{color:var(--brass-bright);font-variant-numeric:tabular-nums}
.mt-rbtn--save.is-on .mt-rbtn__ic{background:rgba(201,162,75,.22);border-color:var(--brass-bright)}
.mt-rbtn--save.is-on .mt-rbtn__lbl{color:var(--brass-bright)}
/* mobile / no room: a horizontal dock centred at the bottom */
.mt-savedock--bottom{left:0!important;right:0;top:auto!important;bottom:0;transform:none;flex-direction:row;justify-content:center;gap:34px;
  padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px));background:linear-gradient(180deg,transparent,rgba(14,16,20,.92))}
.mt-savedock--bottom .mt-rbtn{flex-direction:row;gap:9px}
.mt-savedock--bottom .mt-rbtn__ic{width:44px;height:44px}
.mt-savedock--bottom .mt-rbtn__ic svg{width:21px;height:21px}

/* ----- toast ----- */
.mt-toast{position:fixed;left:50%;bottom:26px;transform:translate(-50%,16px);z-index:4000;max-width:min(440px,90vw);
  background:var(--bg-2);border:1px solid var(--line);border-radius:10px;box-shadow:0 18px 40px -14px rgba(0,0,0,.7);
  color:var(--ink);font-size:13px;line-height:1.45;padding:11px 15px;opacity:0;pointer-events:none;transition:opacity .25s,transform .25s}
.mt-toast.show{opacity:1;transform:translate(-50%,0)}

/* ====================================================================  the board  */
/* when the board is open, a card opened from a pin (#overlay, host z60) must rise ABOVE the board */
body.mt-board-open #overlay{z-index:2100}
.mt-board{position:fixed;inset:0;z-index:2000;display:flex;flex-direction:column;background:
  radial-gradient(1200px 800px at 50% 0%, rgba(40,48,64,.45), transparent 70%),
  var(--bg,#0d0f13)}
.mt-bar{display:flex;align-items:center;gap:14px;padding:11px 16px;border-bottom:1px solid var(--line);background:linear-gradient(180deg,rgba(14,16,20,.96),rgba(14,16,20,.86));backdrop-filter:blur(8px);flex:none}
.mt-bar__back{width:34px;height:34px;border-radius:8px;border:1px solid var(--line);background:var(--panel);color:var(--ink-soft);font-size:15px;cursor:pointer}
.mt-bar__back:hover{border-color:var(--brass);color:var(--brass-bright)}
.mt-bar__title{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.mt-titleinput{background:transparent;border:none;border-bottom:1px solid transparent;color:var(--ink);font-family:var(--font-d);font-size:19px;padding:2px 0;max-width:520px}
.mt-titleinput:hover{border-bottom-color:var(--line)}
.mt-titleinput:focus{outline:none;border-bottom-color:var(--brass)}
.mt-titleinput[readonly]{opacity:.8;cursor:default}
.mt-bar__sub{font-size:11.5px;color:var(--ink-mute)}
.mt-ro{color:#c98a4b;font-weight:600;font-variant:small-caps;letter-spacing:.03em}
.mt-savecopy{color:var(--brass-bright);text-decoration:underline;cursor:pointer}
.mt-bar__tools{display:flex;align-items:center;gap:9px;flex:none}
.mt-switch{background:var(--panel);border:1px solid var(--line);color:var(--ink-soft);border-radius:8px;padding:7px 10px;font:inherit;font-size:12.5px;max-width:230px}
.mt-tool{background:var(--panel);border:1px solid var(--line);color:var(--ink-soft);border-radius:8px;padding:7px 12px;font:inherit;font-size:12.5px;cursor:pointer}
.mt-tool:hover{border-color:var(--brass);color:var(--brass-bright)}
.mt-exports{display:inline-flex;gap:6px;padding-left:9px;margin-left:2px;border-left:1px solid var(--line)}
.mt-tool--help{width:32px;padding:0;font-weight:700;border-radius:50%}
/* help / instructions overlay on the board */
.mt-help{position:absolute;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;background:rgba(6,8,12,.62);backdrop-filter:blur(3px)}
.mt-help[hidden]{display:none}
.mt-help__card{position:relative;max-width:470px;margin:16px;background:var(--bg-2);border:1px solid var(--line);border-radius:14px;padding:20px 22px 22px;box-shadow:0 24px 60px -20px rgba(0,0,0,.85)}
.mt-help__card h3{font-family:var(--font-d);color:var(--brass-bright);margin:0 0 12px;font-size:17px}
.mt-help__card ul{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:9px}
.mt-help__card li{font-size:13px;color:var(--ink-soft);line-height:1.5}
.mt-help__card li b{color:var(--ink)}
.mt-help__x{position:absolute;top:12px;right:12px;width:28px;height:28px;border-radius:7px;border:1px solid var(--line);background:var(--panel);color:var(--ink-soft);cursor:pointer}
.mt-help__x:hover{border-color:var(--brass);color:var(--brass-bright)}

/* view toggle (Board / Trail / Inquiry) */
.mt-vt{display:inline-flex;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--panel)}
.mt-vt__b{font:inherit;font-size:12px;color:var(--ink-mute);background:transparent;border:none;border-right:1px solid var(--line);padding:7px 11px;cursor:pointer}
.mt-vt__b:last-child{border-right:none}
.mt-vt__b:hover:not(:disabled){color:var(--brass-bright)}
.mt-vt__b.is-on{background:rgba(201,162,75,.16);color:var(--brass-bright)}
.mt-vt__b:disabled{opacity:.4;cursor:not-allowed}

/* main region holds either the stage or the list */
.mt-main{position:relative;flex:1;display:flex;min-height:0}
.mt-stage{position:relative;flex:1;overflow:hidden;cursor:grab;
  background-image:radial-gradient(rgba(255,255,255,.025) 1px,transparent 1px);background-size:26px 26px}
.mt-stage.is-pan{cursor:grabbing}
.mt-vp{position:absolute;top:0;left:0;transform-origin:0 0;will-change:transform}
.mt-strings{position:absolute;top:0;left:0;overflow:visible;pointer-events:none}

/* threads */
.mt-string{fill:none;stroke-linecap:round}
.mt-string--direct{stroke:var(--brass-bright,#e3c074);stroke-width:2.4;opacity:.95}
.mt-string--conn{stroke:var(--brass,#c9a24b);stroke-width:1.7;opacity:.8}
.mt-string--hub{stroke:#6b7486;stroke-width:1;opacity:.5;stroke-dasharray:5 6}
.mt-string--bloom{stroke:#7fb0c8;stroke-width:1.3;opacity:.6;stroke-dasharray:2 6}
/* kin chains: same-kind pins chained chronologically — a CATEGORY, not a documented link (dashed + tinted) */
.mt-string--kin{stroke-width:1.6;opacity:.7;stroke-dasharray:6 7}
.mt-string--kin-disaster{stroke:#d98324}
.mt-string--kin-gunviolence{stroke:#c62828}
/* same-kind pins carry their category tint (opaque tint OVER the solid pin bg so nothing bleeds through) */
.mt-pin--k-disaster{border-color:rgba(217,131,36,.55);background:linear-gradient(rgba(217,131,36,.13),rgba(217,131,36,.13)),linear-gradient(180deg,#1d2330,#161b24)}
.mt-pin--k-gunviolence{border-color:rgba(198,40,40,.55);background:linear-gradient(rgba(198,40,40,.13),rgba(198,40,40,.13)),linear-gradient(180deg,#1d2330,#161b24)}
.mt-kdot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px;vertical-align:middle}
.mt-sg__morecount{font-size:11px;color:var(--ink-mute);align-self:center;padding:0 4px}
/* "Documented leads" chips: the relation word rides along, muted */
.mt-lead i{font-style:normal;font-size:10px;color:var(--ink-mute);margin-left:4px;letter-spacing:.02em}
.mt-lead:hover i{color:inherit}
/* Clear board: quiet until hovered, then reads as the destructive act it is */
.mt-tool--clear:hover{border-color:rgba(177,80,74,.65);color:#e0807a;background:rgba(177,80,74,.1)}

/* pins */
.mt-pin{position:absolute;transform:translate(-50%,-50%);width:158px;border-radius:10px;padding:9px 11px 8px;cursor:pointer;
  background:var(--panel-2,#1a1f2a);border:1px solid var(--line);box-shadow:0 8px 22px -12px rgba(0,0,0,.8);user-select:none}
.mt-pin:hover{border-color:rgba(201,162,75,.45)}
.mt-pin.is-drag{cursor:grabbing;z-index:30;box-shadow:0 16px 34px -12px rgba(0,0,0,.9)}
.mt-pin__name{font-family:var(--font-d);font-size:13.5px;line-height:1.25;color:var(--ink)}
.mt-pin__meta{font-size:10.5px;color:var(--ink-mute);margin-top:3px;line-height:1.35}
.mt-pin__meta b{color:var(--brass-bright);font-variant-numeric:tabular-nums}

/* Phase 2 — controls FLOAT OFF THE SIDE of the pin, revealed on hover (pin body stays clean) */
/* left:100% + padding-left BRIDGES the gap to the pin — moving onto the controls keeps :hover alive.
   A .35s hide-delay gives extra grace; show is immediate (transition-delay:0s on hover). */
.mt-pin__acts{position:absolute;left:100%;top:-2px;padding-left:9px;display:flex;flex-direction:column;align-items:flex-start;gap:5px;
  opacity:0;transform:translateX(-5px);transition:opacity .14s .35s,transform .14s .35s;z-index:6;pointer-events:none}
.mt-pin:hover .mt-pin__acts,.mt-pin.is-drag .mt-pin__acts,.mt-pin:focus-within .mt-pin__acts{opacity:1;transform:none;pointer-events:auto;transition-delay:0s}
.mt-pa{font:inherit;font-size:10.5px;color:var(--ink-mute);background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:2px 7px;cursor:pointer;white-space:nowrap;box-shadow:0 3px 10px -6px rgba(0,0,0,.8)}
.mt-pa:hover{border-color:var(--brass);color:var(--brass-bright)}
.mt-pa:disabled{opacity:.35;cursor:default}
.mt-pa--add:hover{border-color:#7fb0c8;color:#9fd0e8}
.mt-pa--x:hover{border-color:var(--oxblood,#b1504a);color:#e0807a}
.mt-pa--move{cursor:grab}
.mt-pa--move:active{cursor:grabbing}
.mt-badge{font-size:9px;letter-spacing:.05em;text-transform:uppercase;color:#d8a24a;border:1px solid rgba(216,162,74,.5);border-radius:4px;padding:0 4px;vertical-align:middle}

/* saved = brass + a brass tack; connector = teal accent; hub/orbit = faint */
.mt-pin--saved{border-color:rgba(201,162,75,.55);background:linear-gradient(180deg,#1d2330,#161b24)}
.mt-pin--saved.is-bloom{border-color:var(--brass-bright);box-shadow:0 0 0 1px rgba(227,192,116,.4),0 8px 22px -12px rgba(0,0,0,.8)}
.mt-pin__tack{position:absolute;top:-6px;left:50%;transform:translateX(-50%);width:11px;height:11px;border-radius:50%;
  background:radial-gradient(circle at 35% 30%,#f0d28a,#b8893a);box-shadow:0 2px 4px rgba(0,0,0,.5)}
.mt-pin--conn{width:150px;border-color:rgba(127,176,200,.5);background:linear-gradient(180deg,#172029,#141a22)}
.mt-pin--conn .mt-pin__name{font-size:12.5px}
.mt-pin--hub{border-color:var(--line-soft);opacity:.8}
.mt-pin--hub .mt-pin__name{color:var(--ink-soft)}
.mt-hubnote{color:#7e8696}
.mt-pin--orbit{width:138px;border-style:dashed;opacity:.92}
.mt-pin--orbit .mt-pin__name{font-size:12px}
.mt-pin--faint{opacity:.62}

.mt-empty{position:absolute;top:40%;left:50%;transform:translate(-50%,-50%);text-align:center;color:var(--ink-soft);font-size:18px;font-family:var(--font-d);line-height:1.6}
.mt-empty span{font-family:var(--font-b);font-size:13.5px;color:var(--ink-mute)}
.mt-empty b{color:var(--brass-bright)}
.mt-empty--list{position:static;transform:none;padding:60px 20px}

/* ----- deterministic suggestions strip (board view) ----- */
.mt-suggest{position:absolute;left:14px;top:14px;z-index:8;width:min(360px,44vw);max-height:calc(100% - 28px);overflow-y:auto;overscroll-behavior:contain;display:none;
  background:linear-gradient(180deg,rgba(22,26,34,.97),rgba(18,21,28,.97));border:1px solid rgba(201,162,75,.4);border-radius:12px;
  box-shadow:0 20px 46px -18px rgba(0,0,0,.85);backdrop-filter:blur(6px)}
.mt-suggest.is-open{display:block}
.mt-suggest__hd{display:flex;flex-direction:column;gap:1px;padding:10px 13px 8px;border-bottom:1px solid var(--line);
  font-family:var(--font-d);font-size:12.5px;color:var(--brass-bright);position:sticky;top:0;background:inherit}
.mt-suggest__hd span{font-family:var(--font-b);font-size:10px;color:var(--ink-mute);letter-spacing:.03em}
.mt-sg{padding:9px 13px;border-bottom:1px solid rgba(255,255,255,.05)}
.mt-sg:last-child{border-bottom:none}
.mt-sg__lead{font-size:11.5px;color:var(--ink-soft);line-height:1.45;margin-bottom:6px}
.mt-sg__lead b{color:var(--brass-bright);font-variant-numeric:tabular-nums}
.mt-sg__adds{display:flex;flex-wrap:wrap;gap:5px}
.mt-sgadd{font-size:10.5px}

/* ----- list views (Trail / Inquiry) ----- */
.mt-listwrap{flex:1;overflow:auto;display:none;padding:18px 16px 40px}
.mt-list{max-width:760px;margin:0 auto}
.mt-listtools{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.mt-listtools__hint{font-size:11px;color:var(--ink-mute)}
.mt-lgroup{font-family:var(--font-d);font-size:13px;color:var(--brass-bright);letter-spacing:.02em;margin:20px 0 8px;padding-bottom:5px;border-bottom:1px solid var(--line)}
.mt-lgroup span{color:var(--ink-mute);font-family:var(--font-b);font-size:11px;font-variant-numeric:tabular-nums}
.mt-lrow{display:flex;align-items:center;gap:12px;padding:9px 12px;border:1px solid var(--line);border-radius:9px;background:var(--panel-2,#1a1f2a);margin-bottom:7px}
.mt-lrow:hover{border-color:rgba(201,162,75,.4)}
.mt-lrow__main{flex:1;min-width:0}
.mt-lrow__name{font-family:var(--font-d);font-size:14px;color:var(--ink)}
.mt-lrow__meta{display:block;font-size:11px;color:var(--ink-mute);margin-top:2px}
.mt-lrow__acts{display:flex;gap:5px;flex:none}
.mt-lrow__acts .mt-pa{opacity:.55;transition:opacity .14s}
.mt-lrow:hover .mt-lrow__acts .mt-pa{opacity:1}

/* footer: the guardrail + legend */
.mt-foot{display:flex;align-items:center;gap:18px;flex-wrap:wrap;padding:9px 16px;border-top:1px solid var(--line);background:var(--bg-2);flex:none}
.mt-disc{font-size:11.5px;color:var(--ink-mute);line-height:1.4;flex:1;min-width:240px}
.mt-legend{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--ink-mute)}
.mt-k{display:inline-block;width:18px;height:0;border-top-width:2px;border-top-style:solid;margin:0 2px 0 8px;vertical-align:middle}
.mt-k--saved{border-top-color:var(--brass-bright)}
.mt-k--conn{border-top-color:var(--brass)}
.mt-k--hub{border-top-color:#6b7486;border-top-style:dashed}
.mt-k--kin{border-top-color:#d98324;border-top-style:dashed}

@media (max-width:760px){
  .mt-bar{flex-wrap:wrap;gap:8px}
  .mt-bar__tools{flex-wrap:wrap;gap:6px;width:100%}
  .mt-bar__tools .mt-switch{max-width:150px;flex:1}
  .mt-exports{padding-left:6px}
  .mt-titleinput{font-size:16px}
  .mt-foot .mt-legend{display:none}
  .mt-listwrap{padding:14px 12px 40px}
  /* on a phone the pin's side rail would run off-screen — stack it under the pin instead */
  .mt-pin__acts{position:static;flex-direction:row;flex-wrap:wrap;transform:none;margin-top:7px;opacity:1;pointer-events:auto}
}

/* ====================================================================  PRINT / PDF export
   reportHTML() renders into #mt-print-root; @media print hides the app and shows only that. */
#mt-print-root{display:none}
@media print{
  body > *{display:none !important}
  #mt-print-root{display:block !important;position:static;margin:0;padding:0;color:#111;background:#fff;
    font:12pt/1.5 Georgia,"Times New Roman",serif}
  #mt-print-root *{color:#111 !important;background:transparent !important;box-shadow:none !important}
  #mt-print-root h1{font-size:22pt;margin:0 0 2pt;border-bottom:2px solid #111;padding-bottom:6pt}
  #mt-print-root .mtp-count{font-size:10pt;color:#555 !important;margin:0 0 16pt}
  #mt-print-root .mtp-item{page-break-inside:avoid;margin:0 0 15pt;padding-bottom:11pt;border-bottom:1px solid #bbb}
  #mt-print-root .mtp-item h2{font-size:14pt;margin:0 0 4pt}
  #mt-print-root .mtp-yr{font-weight:normal;color:#555 !important}
  #mt-print-root .mtp-badge{font-size:8pt;letter-spacing:.05em;text-transform:uppercase;border:1px solid #111;border-radius:3px;padding:0 4px;vertical-align:middle}
  #mt-print-root p{margin:4pt 0}
  #mt-print-root .mtp-src{font-size:9.5pt;color:#333 !important}
  #mt-print-root .mtp-decl{font-size:10pt}
  #mt-print-root .mtp-assoc{font-size:9pt;font-style:italic;color:#555 !important}
  #mt-print-root .mtp-foot{margin-top:20pt;padding-top:8pt;border-top:2px solid #111;font-size:9pt;font-style:italic;color:#333 !important}
  @page{margin:2cm}
}
