/* ============================================================
   Forge Suite — core.css (FUNCTIONAL ONLY, no visual identity)
   Reset + the few components shared JS needs: modal, toast, lock pill.
   Each site brings its OWN complete design in its own stylesheet.
   Sites may override every variable below.
   ============================================================ */
:root {
  --core-modal-bg: #14161c; --core-modal-fg: #e8eaf0; --core-modal-border: rgba(255,255,255,.12);
  --core-accent: #6366f1; --core-up: #22c55e; --core-down: #ef4444; --core-warn: #f59e0b;
  --core-radius: 12px; --core-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --suite-h: 36px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, canvas, svg, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
.hide { display: none !important; }
.chart { width: 100%; height: 300px; display: block; }
.chart.sm { height: 160px; } .chart.xs { height: 60px; } .chart.lg { height: 420px; } .chart.fill { height: 100%; }

/* ---- fullscreen demo mode (body[data-fullscreen]) ---- */
body[data-fullscreen] { height: 100vh; height: 100dvh; overflow: hidden; }
.demo-pill {
  position: fixed; right: 14px; top: 14px; z-index: 900; display: flex; align-items: center; gap: .6rem;
  padding: .45rem .55rem .45rem .9rem; border-radius: 999px; font: 600 .8rem/1 var(--core-font);
  background: rgba(10,12,18,.82); color: #e8eaf0; border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
}
.demo-pill .lbl { opacity: .8; font-weight: 500; }
/* Touch targets: these measured 69x19, 117x19 and 17.6x22.4 on a 390 px phone,
   on all eight demos. 24x24 is the AA minimum, and these are the only controls
   a visitor has for leaving the demo or reaching the product. Height comes from
   min-height plus centring so the pill itself does not grow. */
.demo-pill a {
  color: #e8eaf0; text-decoration: none; padding: .38rem .7rem; border-radius: 999px;
  background: rgba(255,255,255,.08); white-space: nowrap;
  display: inline-flex; align-items: center; min-height: 24px;
}
.demo-pill a:hover { background: rgba(255,255,255,.16); }
.demo-pill a.go { background: var(--core-accent); color: #fff; }
.demo-pill .x {
  background: none; border: 0; color: inherit; cursor: pointer; opacity: .6;
  font-size: 1rem; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; min-height: 24px;
}
.demo-pill .x:hover { opacity: 1; }
.demo-pill.min { padding: .45rem .7rem; }
.demo-pill.min a { display: none; }  /* the "Demo · simulated data" label stays visible when minimised */
@media (max-width: 640px) { .demo-pill { top: auto; bottom: 14px; right: 10px; left: 10px; justify-content: space-between; } }

/* ---- modal (used by UI.modal, UI.buy, DemoLock) ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 1000; padding: 1rem; }
.modal-backdrop.open { display: grid; }
.modal { background: var(--core-modal-bg); color: var(--core-modal-fg); border: 1px solid var(--core-modal-border); border-radius: var(--core-radius); width: min(560px, 100%); box-shadow: 0 24px 60px rgba(0,0,0,.5); animation: core-pop .18s ease; max-height: 90vh; overflow: auto; font-family: var(--core-font); }
.modal.lg { width: min(860px, 100%); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--core-modal-border); }
.modal__head h3 { margin: 0; font-size: 1.1rem; }
.modal__close { background: none; border: 0; color: inherit; font-size: 1.4rem; cursor: pointer; line-height: 1; opacity: .85; }
.modal__close:hover { opacity: 1; }
.modal__body { padding: 1.25rem; line-height: 1.55; }
.modal__body p { margin: 0 0 .9rem; }
.modal__foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.25rem; border-top: 1px solid var(--core-modal-border); flex-wrap: wrap; }
.modal .kv { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 0; }
/* opacity:.7 on the modal ground measured 3.96:1 — under the 4.5 body floor,
   on every demo that uses this modal. Dimming is now carried by a colour that
   can be measured instead of an alpha that cannot. */
.modal .kv dt { color: color-mix(in srgb, currentColor 78%, transparent); }
.modal .kv dd { margin: 0; font-weight: 600; }
.modal .check-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.modal .check-list li::before { content: "✓ "; color: var(--core-up); font-weight: 800; }
.modal .callout { border-left: 3px solid var(--core-accent); padding: .6rem .9rem; background: rgba(255,255,255,.05); border-radius: 8px; font-size: .9rem; }
.modal .mb-0{margin-bottom:0}.modal .mb-2{margin-bottom:1rem}.modal .mb-3{margin-bottom:1.5rem}.modal .small{font-size:.85rem}.modal .muted{opacity:.7}
.modal .switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.modal .switch input { opacity: 0; width: 0; height: 0; }
.modal .switch span { position: absolute; inset: 0; background: rgba(255,255,255,.25); border-radius: 999px; cursor: pointer; transition: .15s; }
.modal .switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.modal .switch input:checked + span { background: var(--core-accent); }
.modal .switch input:checked + span::after { transform: translateX(18px); }
/* buttons inside modals (sites style their own .btn elsewhere; this is the fallback) */
.modal .btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1.05rem; border-radius: 9px; font-weight: 600; font-size: .92rem; border: 1px solid var(--core-modal-border); background: rgba(255,255,255,.08); color: inherit; cursor: pointer; text-decoration: none; }
.modal .btn:hover { background: rgba(255,255,255,.14); }
.modal .btn.primary { background: var(--core-accent); border-color: var(--core-accent); color: #fff; }
.modal .btn.ghost { background: transparent; border-color: transparent; opacity: .8; }
@keyframes core-pop { from { transform: translateY(8px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---- toasts ---- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 1100; }
.toast__n { margin-left: .35rem; font-style: normal; font-weight: 600; opacity: .75; font-variant-numeric: tabular-nums; }
.toast { background: var(--core-modal-bg); color: var(--core-modal-fg); border: 1px solid var(--core-modal-border); padding: .7rem 1rem; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.4); font: .9rem/1.4 var(--core-font); display: flex; gap: .6rem; align-items: center; animation: core-pop .18s ease; max-width: 360px; }
.toast.up { border-left: 4px solid var(--core-up); } .toast.down { border-left: 4px solid var(--core-down); } .toast.warn { border-left: 4px solid var(--core-warn); } .toast.info { border-left: 4px solid var(--core-accent); }

/* ---- generic tab panels (UI.initTabs) ---- */
.tab-panel { display: none; } .tab-panel.active { display: block; }

/* ---- interactive chart overlay (Charts.interactive) ---- */
.chart-wrap { position: relative; }
.chart-overlay { position: absolute; pointer-events: none; }
.chart-tip { position: absolute; pointer-events: none; font: 11px/1.45 var(--font-mono, monospace); background: rgba(10,12,18,.9); color: #e8eaf0; border: 1px solid rgba(255,255,255,.14); border-radius: 6px; padding: .35rem .55rem; white-space: nowrap; z-index: 5; }
.chart-hint { position: absolute; right: 8px; top: 6px; font: 10px/1 var(--core-font); color: rgba(255,255,255,.45); pointer-events: none; }

/* ---- tidy scrollbars for internal panels (add class="nice-scroll") ---- */
.nice-scroll { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nice-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.nice-scroll::-webkit-scrollbar-track { background: transparent; }
.nice-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 999px; }
.nice-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.32); }
[data-theme="light"] .nice-scroll { scrollbar-color: rgba(0,0,0,.22) transparent; }
[data-theme="light"] .nice-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.22); }
