/* ============================================================
   COMPONENT LAB — experiment stage styles
   Stage + controls only. Header / nav / catalog live in the
   React chrome (app/lab). Migrated from the former
   "Components" design system.
   ============================================================ */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font-sans); background: var(--bg-base); color: var(--text); font-size: var(--text-base); line-height: 1.55; -webkit-font-smoothing: antialiased; overflow: hidden; -webkit-user-select: none; user-select: none; }
/* Text is not selectable/copyable in the experiments — but keep form fields editable. */
input, textarea, select { -webkit-user-select: text; user-select: text; }
a { color: inherit; text-decoration: none; }
.icon { width: 18px; height: 18px; flex: none; }
.sp { flex: 1; }

/* ---- Theme toggle (floating, top-right of the stage) ---- */
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 3px; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: var(--r-pill); box-shadow: var(--shadow-sm); }
.theme-toggle button { width: 30px; height: 28px; border: none; background: transparent; border-radius: var(--r-pill); display: grid; place-items: center; cursor: pointer; color: var(--text-subtle); transition: all var(--dur-fast) var(--ease); }
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.theme-toggle .icon { width: 16px; height: 16px; }
.lab-theme { position: fixed; top: 16px; right: 16px; z-index: 60; }

/* ---- Stage (fills the iframe viewport) ---- */
.cstage { position: fixed; inset: 0; min-width: 0; overflow: hidden; background:
   radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--primary) 8%, transparent), transparent 60%); }
.cstage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

/* controls panel */
.controls { position: absolute; left: var(--sp-5); bottom: var(--sp-5); width: 248px; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: var(--sp-4); z-index: 10; }
.controls .ct-h { font-size: var(--text-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-subtle); margin-bottom: var(--sp-3); }
.ctrl { margin-bottom: var(--sp-3); }
.ctrl:last-child { margin-bottom: 0; }
.ctrl .ct-row { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-sm); color: var(--text); margin-bottom: 6px; }
.ctrl .ct-row b { color: var(--text-strong); font-variant-numeric: tabular-nums; font-weight: var(--fw-semi); }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: var(--r-pill); background: var(--surface-hover); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); cursor: pointer; box-shadow: var(--shadow-sm); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--border-strong); position: relative; transition: background var(--dur-base) var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform var(--dur-base) var(--ease-out); box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* stage caption + orbiting labels */
.cstage-cap { position: absolute; top: var(--sp-5); left: var(--sp-5); z-index: 8; pointer-events: none; max-width: calc(100% - 120px); }
.cstage-cap .cc-t { font-size: var(--text-h3); font-weight: 800; letter-spacing: var(--tracking-tight); color: var(--text-strong); }
.cstage-cap .cc-d { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; max-width: 320px; }
.onode { position: absolute; top: 0; left: 0; transform: translate(-50%,-50%); display: flex; align-items: center; gap: 7px; white-space: nowrap; pointer-events: none; will-change: transform, opacity; }
.onode .on-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); flex: none; }
.onode .on-l { font-size: var(--text-xs); font-weight: var(--fw-semi); color: var(--text-strong); background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px 9px; backdrop-filter: blur(6px); }

@media (max-width: 720px) {
  .controls { left: var(--sp-3); right: var(--sp-3); width: auto; }
}
