/* Shared UI tokens and controls for the walkthrough (index.html) and the
   component workbench (components.html). Patterns from Mobbin references:
   floating glass toolbars over a canvas (Krea, Zillow 3D Home), segmented
   controls and review panels (Air, Devin). */
:root {
  --bg: #0f1013;
  --surface: #17181c;
  --surface-2: #1f2025;
  --surface-3: #27292f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #ecebe8;
  --muted: #9b9ca3;
  --faint: #6c6e76;
  --accent: #d9b25b;          /* gold: active state only */
  --accent-ink: #1a1408;
  --glass: rgba(20, 21, 25, 0.72);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

/* Floating glass container (toolbars, readouts over a canvas). */
.glass {
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font: 500 13px/1 var(--font);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: rgba(255, 255, 255, 0.07); }
.btn:focus-visible, .seg button:focus-visible, .toggle:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--text); color: #111; }
.btn.primary:hover { background: #fff; }
.btn[aria-pressed="true"] { background: rgba(217, 178, 91, 0.16); color: var(--accent); }
.btn .val { color: var(--muted); font-variant-numeric: tabular-nums; }
.btn[aria-pressed="true"] .val { color: var(--accent); }
kbd {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px;
  border: 1px solid var(--line-strong); border-radius: 4px; color: var(--faint);
  font: 500 10.5px/1 var(--font); background: rgba(255, 255, 255, 0.03);
}
.sep { width: 1px; align-self: stretch; margin: 6px 2px; background: var(--line); }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.06); }
.seg button {
  height: 26px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent;
  color: var(--muted); font: 500 12.5px/1 var(--font); cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }

/* Toggle chip: a real checkbox styled as a pressable chip (JS reads .checked). */
.toggle {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font: 500 12.5px/1 var(--font); cursor: pointer; user-select: none;
}
.toggle:hover { color: var(--text); border-color: var(--line-strong); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .box { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--faint); display: grid; place-items: center; }
.toggle .box::after { content: ""; width: 7px; height: 4px; border: solid var(--accent-ink); border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.toggle:has(input:checked) { color: var(--text); background: rgba(217, 178, 91, 0.10); border-color: rgba(217, 178, 91, 0.35); }
.toggle:has(input:checked) .box { background: var(--accent); border-color: var(--accent); }
.toggle:has(input:checked) .box::after { opacity: 1; }

/* Status badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px;
  border-radius: 999px; font: 500 11px/1 var(--font); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.measured { background: rgba(80, 200, 120, 0.12); color: #7fd49c; }
.badge.approximate { background: rgba(230, 180, 80, 0.13); color: #e5bf6f; }
.badge.placeholder { background: rgba(255, 255, 255, 0.07); color: #a3a5ac; }

/* Range slider */
input[type="range"].range { -webkit-appearance: none; appearance: none; width: 140px; height: 4px; border-radius: 2px; background: var(--surface-3); cursor: pointer; }
input[type="range"].range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
input[type="range"].range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 0; }

/* The hidden attribute always wins over component display rules. */
[hidden] { display: none !important; }
.btn:disabled { opacity: 0.45; cursor: default; background: transparent; }

/* Text field */
.field {
  width: 100%; height: 32px; padding: 0 10px 0 30px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2) no-repeat 9px center / 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b9ca3' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  color: var(--text); font: 13px var(--font);
}
.field::placeholder { color: var(--faint); }
.field:focus { outline: none; border-color: rgba(217, 178, 91, 0.6); }
