/* frame.css — Simple Fusion Reactor v5 chrome (v4 P07; v5 W2-D, PLAN_v5 §3.8, §3.11, §4.3).
   Owns .stage, .frame-notice, .pal*, #tips, .pin*, .tour*, .glossary*, .welcome* (the .welcome-card recipe too), .errcard*.
   Requires tokens.css + components.css. Light only; no shadows; no CSS magnification property; no transitions beyond the
   button colours defined in components.css. Text colours ≥ 4.5:1 (never --iv-coral-deep or --iv-ink-faint on light
   surfaces); no text below var(--text-min). */

/* ========== STAGE — scale-to-fit host (B1, CH-10 S) ==========
   frame.js sizes the stage to 1280·s × 800·s and scales #frame with transform-origin top left;
   absolute inset + auto margins centre the sized stage in the viewport, so the frame is centred
   without flex centring (flex `center` would centre the UNSCALED 1280-px layout box and push the
   scaled visual off the left edge when s < 1). Until the first applyScale() the stage fills the
   viewport. Below the 0.6 floor (body.is-scroll) the stage is laid out in flow from the top-left so
   the body scrolls to every edge of the frame (auto margins centre it horizontally while it fits). */
.stage{position:absolute;inset:0;margin:auto;display:flex;justify-content:flex-start;align-items:flex-start;width:100%;height:100%;background:var(--iv-surface-3);overflow:hidden}
.stage>*{flex:none;transform-origin:top left}
body.is-scroll .stage{position:relative;inset:auto;margin:0 auto}

/* disabled tabs while the data load (CH-2): the tab recipe lives in components.css, only the muted state is here */
.stage .tab[aria-disabled="true"]{color:var(--iv-ink-subtle);cursor:default}

/* ========== STATUS NOTICE (appended when the frame is scaled below 85 %; frame.js SCALE_NOTICE_BELOW) ========== */
.frame-notice{color:var(--iv-ink-subtle);white-space:nowrap}

/* ========== ⌘K PALETTE — panes · actions · content ========== */
.pal{position:absolute;inset:0;z-index:6;display:flex;justify-content:center;align-items:flex-start;padding-top:108px}
.pal[hidden]{display:none}
.pal-card{width:440px;max-width:calc(100% - 32px);background:var(--iv-surface);border:1px solid var(--iv-ink);border-radius:var(--radius-control);padding:10px;display:flex;flex-direction:column;gap:8px}
.pal-input{flex:none}
.pal-input::placeholder{color:var(--iv-ink-subtle);opacity:1}
.pal-list{display:flex;flex-direction:column;gap:0;max-height:420px;overflow:auto;scrollbar-width:thin}
.pal-group{flex:none;padding:8px 8px 3px;font-family:var(--os-font-mono);font-weight:400;font-size:var(--text-min);letter-spacing:0.22em;text-transform:uppercase;color:var(--iv-ink-subtle)}
.pal-group:first-child{padding-top:2px}
.pal-item{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:var(--size-hit);margin:0;padding:5px 8px;border:0;background:transparent;color:var(--iv-ink);font-family:var(--os-font-mono);font-weight:400;font-size:10.5px;letter-spacing:0.14em;text-transform:uppercase;text-align:left;cursor:pointer;border-radius:var(--radius-control);appearance:none;-webkit-appearance:none;white-space:nowrap;flex:none}
.pal-item.is-active,.pal-item:hover{background:var(--iv-surface-hover)}
.pal-item:focus-visible{outline:2px solid var(--sfr-focus);outline-offset:-2px}
.pal-item--content{align-items:flex-start;text-transform:none;letter-spacing:0.02em}
.pal-main{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1}
.pal-title{font-family:var(--os-font-sans);font-weight:400;font-size:12.5px;letter-spacing:0;color:var(--iv-ink);overflow:hidden;text-overflow:ellipsis}
.pal-line{font-family:var(--os-font-mono);font-size:var(--text-min);letter-spacing:0.02em;color:var(--iv-ink-muted);overflow:hidden;text-overflow:ellipsis}
.pal-tag{flex:none;margin-top:2px;font-family:var(--os-font-mono);font-size:var(--text-min);letter-spacing:0.14em;text-transform:uppercase;color:var(--iv-ink-subtle)}
.pal-empty{padding:10px 8px;font-family:var(--os-font-mono);font-size:10.5px;letter-spacing:0.04em;color:var(--iv-ink-muted)}
/* a revealed content hit (glossary entry, Details row) is outlined for a moment */
.pal-hit{outline:2px solid var(--sfr-focus);outline-offset:2px}

/* ========== TOOLTIP LAYER (#tip, the explain pins and the tour panel; tooltip.js) ========== */
#tips{position:absolute;inset:0;pointer-events:none;z-index:5}

/* ---- explain pins (CH-1): 14-px ink badges, centres ≥ 24 px apart (tooltip.js PIN_SPACING). They are markers, not
   pointer targets (pointer-events none, aria-hidden): the tour is stepped with ←/→, its 24-px buttons, keyboard focus on
   a label or a click / tap on the label itself, so the pins add no hit target to the WCAG 2.5.8 census. ---- */
.pins{position:absolute;inset:0;pointer-events:none}
.pin{position:absolute;box-sizing:border-box;min-width:14px;height:14px;padding:0 3px;transform:translate(-50%,-50%);border:1px solid var(--iv-ink);border-radius:7px;background:var(--iv-ink);color:#fff;font-family:var(--os-font-mono);font-weight:400;font-size:var(--text-min);line-height:12px;letter-spacing:0;text-align:center;font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;outline:1px solid #fff;outline-offset:0}   /* the white ring keeps a pin legible over ink (the Q block) */
.pin.is-current{background:#fff;color:var(--iv-ink);outline:2px solid var(--iv-ink);outline-offset:0}

/* ---- the one tour panel (280 px): step, title, lines, prev / next, close ---- */
.tour{position:absolute;z-index:1;width:280px;box-sizing:border-box;background:var(--iv-ink);color:#fff;padding:8px 11px 9px;border-radius:var(--radius-control);font-family:var(--os-font-mono);font-weight:400;font-size:10.5px;line-height:1.45;letter-spacing:0.02em;font-variant-numeric:tabular-nums;pointer-events:auto}
.tour[hidden]{display:none}
.tour::before{content:"";position:absolute;left:-6px;top:14px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:6px solid var(--iv-ink)}
.tour--left::before{left:auto;right:-6px;border-right:0;border-left:6px solid var(--iv-ink)}
/* explain on a pane with no label to number: the panel opens under the centre head, with no arrow and no stepping */
.tour--free::before{display:none}
.tour--free .tour-foot{display:none}
.tour--free .tour-title:empty{display:none}
.tour--free:has(.tour-title:empty) .tour-head{margin-bottom:0}
.tour-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:4px}
.tour-step{font-size:var(--text-min);letter-spacing:0.14em;color:#fff}
.tour-title{font-family:var(--os-font-sans);font-weight:400;font-size:16px;letter-spacing:0;color:#fff;margin-bottom:4px}
.tour-lines>div{white-space:normal}
.tour-foot{display:flex;justify-content:space-between;gap:8px;margin-top:8px}
.tour-btn{min-height:var(--size-hit);padding:0 10px;background:transparent;color:#fff;border:1px solid rgba(255,255,255,0.6);border-radius:var(--radius-control);font-family:var(--os-font-mono);font-weight:400;font-size:var(--text-min);letter-spacing:0.1em;text-transform:uppercase;cursor:pointer;appearance:none;-webkit-appearance:none;white-space:nowrap}
.tour-btn:hover{background:rgba(255,255,255,0.12)}
.tour-btn:focus-visible{outline:2px solid var(--iv-coral);outline-offset:1px}

/* ========== GLOSSARY DRAWER (CH-7) — 280×736 over the plate ========== */
.glossary{position:absolute;left:1000px;top:40px;width:280px;height:736px;z-index:5;box-sizing:border-box;display:flex;flex-direction:column;background:var(--iv-surface);border-left:1px solid var(--iv-border)}
.glossary[hidden]{display:none}
.glossary-head{flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;height:var(--size-colhead);box-sizing:border-box;padding:0 8px 0 18px;border-bottom:1px solid var(--iv-hairline-2);background:var(--iv-surface-2)}
.glossary-title{font-family:var(--os-font-mono);font-weight:400;font-size:10px;letter-spacing:0.22em;text-transform:uppercase;color:var(--iv-ink-muted)}
.glossary-close{min-width:var(--size-hit)}
.glossary-list{flex:1;min-height:0;margin:0;padding:6px 18px 16px;overflow:auto;outline-offset:-2px}
.glossary-entry{padding:8px 0 7px;border-bottom:1px solid var(--iv-hairline)}
.glossary-entry dt{margin:0 0 2px;font-family:var(--os-font-mono);font-weight:400;font-size:10.5px;letter-spacing:0.04em;color:var(--iv-ink)}
.glossary-entry dd{margin:0;font-family:var(--os-font-sans);font-weight:300;font-size:12px;line-height:1.45;color:var(--iv-ink-muted)}

/* ========== WELCOME CARD (§4.5) — 420 wide, centred over the centre column (x 240–1000, body y 40–776) ==========
   .welcome-card is the recipe (surface, border, radius, padding, the column of title · lines · foot), shared since v5.1
   with the Operator pane's first-visit stability card (#fl-stab, placed by fly.css); .welcome places the frame's card. */
.welcome-card{box-sizing:border-box;display:flex;flex-direction:column;gap:10px;padding:16px 18px 14px;background:var(--iv-surface);border:1px solid var(--iv-border);border-radius:var(--radius-control)}
.welcome-card[hidden]{display:none}
.welcome{position:absolute;left:410px;top:408px;transform:translateY(-50%);width:420px;min-height:180px;z-index:5}
.welcome[hidden]{display:none}
.welcome-title{font-family:var(--os-font-sans);font-weight:300;font-size:20px;line-height:1.2;letter-spacing:-0.005em;color:var(--iv-ink)}
.welcome-lines{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:5px;font-family:var(--os-font-sans);font-weight:300;font-size:13px;line-height:1.45;color:var(--iv-ink)}
.welcome-lines li::marker{font-family:var(--os-font-mono);font-size:10.5px;color:var(--iv-ink-muted)}
.welcome-foot{display:flex;justify-content:flex-end;margin-top:auto}

/* ========== ERROR AND LOADING CARDS (CH-2) — centred over the centre column ========== */
.errcard{position:absolute;left:410px;top:408px;transform:translateY(-50%);width:420px;z-index:8;box-sizing:border-box;display:flex;flex-direction:column;gap:10px;padding:16px 18px 14px;background:var(--iv-surface);border:1px solid var(--iv-border);border-left:3px solid var(--sfr-alarm);border-radius:var(--radius-control)}
.errcard[hidden]{display:none}
.errcard--loading{border-left-color:var(--iv-border)}
.errcard-list{display:flex;flex-direction:column;gap:10px}
.errcard-entry{display:flex;flex-direction:column;gap:4px}
.errcard-title{font-family:var(--os-font-sans);font-weight:300;font-size:18px;line-height:1.25;color:var(--iv-ink)}
.errcard-detail{font-family:var(--os-font-mono);font-weight:400;font-size:10.5px;line-height:1.45;letter-spacing:0.02em;color:var(--iv-ink-muted);white-space:normal;overflow-wrap:anywhere}
.errcard-foot{display:flex;justify-content:flex-end}
.errcard-foot:has(> [hidden]:only-child){display:none}
