/* Voos Presenter — shared tokens and primitives. Components only reference tokens.
   Follows Halvr's design standard (creos: src/lib/app-design.ts, after Apple's HIG): neutral ground with white
   cards, one tint, four radii (22 / 14 / 10 / round), a 4px grid, 44px touch targets, press feedback, brief motion. */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light dark;

  /* surfaces & text */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #ececf0;
  --surface-hover: #e4e4e9;
  --material: rgb(255 255 255 / 0.8);
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #e2e2e7;
  --line-strong: #8b93a0;            /* >= 3:1 on surface: control borders */
  --stage: #0d0f12;                  /* letterbox behind a slide */

  /* brand & roles (one colour = one meaning) */
  /* Hazl's colours (hazl-skill globals.css): pink is the one tint, blue marks the client's side. */
  --accent: #cc0052;                 /* primary action, presenter voice (white on it: 4.84:1) */
  --accent-hover: #a80044;
  --accent-ink: #ffffff;
  --accent-soft: #ffeaf2;
  --client: #0077a8;                 /* the client's own voice / words */
  --client-soft: #e6f6fd;
  --focus: #0077a8;

  /* semantic */
  --ok: #15803d;      --ok-soft: #e8f5ec;
  --warn: #a04a08;    --warn-soft: #fdf3e4;
  --bad: #b91c1c;     --bad-soft: #fcebeb;
  --info: #1d4ed8;    --info-soft: #e9effd;
  --neutral-soft: #eef0f3;

  /* spacing (4-pt) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  /* radius */
  --r-sm: 10px; --r-md: 10px; --r-lg: 14px; --r-xl: 22px; --r-pill: 999px;
  /* type scale */
  --fs-xs: 0.75rem; --fs-sm: 0.8125rem; --fs-md: 0.9375rem; --fs-lg: 1.125rem; --fs-xl: 1.5rem; --fs-2xl: 2rem;
  /* controls */
  --control-h: 36px;
  --control-h-lg: 44px;
  --control-h-xl: 50px;
  /* elevation */
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 28px rgb(0 0 0 / 0.08);
  --shadow-2: 0 2px 6px rgb(16 24 40 / 0.08), 0 24px 48px rgb(16 24 40 / 0.16);
  /* motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press: 160ms;
  --dur-hover: 150ms;
  --dur-enter: 220ms;
  --dur-modal: 260ms;
  --dur-slide: 420ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-hover: #3a3a3c;
    --material: rgb(28 28 30 / 0.75);
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --line: #38383a;
    --line-strong: #5f6876;
    --stage: #050607;
    --accent: #ff2f86;
    --accent-hover: #ff5a9f;
    --accent-ink: #1f000e;
    --accent-soft: #3a0f22;
    --client: #36bdf2;
    --client-soft: #0c2a38;
    --focus: #36bdf2;
    --ok: #4ade80;   --ok-soft: #132a1c;
    --warn: #fbbf24; --warn-soft: #2d2410;
    --bad: #f87171;  --bad-soft: #321a1a;
    --info: #93b4fd; --info-soft: #18223a;
    --neutral-soft: #242830;
    --shadow-1: none; /* in the dark, the lighter surface is the depth */
    --shadow-2: 0 2px 6px rgb(0 0 0 / 0.4), 0 24px 48px rgb(0 0 0 / 0.5);
  }
}
@media (prefers-contrast: more) {
  :root { --line: #8a919c; --line-strong: #5a616c; --muted: #3f4652; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root { --line: #6b7380; --line-strong: #9aa2ae; --muted: #c4cad4; }
}
@media (pointer: coarse) {
  :root { --control-h: 44px; }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: var(--fs-md) / 1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); }
svg { flex: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: var(--fs-sm); }

:where(a, button, select, input, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
:where([tabindex="-1"]):focus { outline: none; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--control-h); padding: 0 var(--sp-3);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; line-height: 1.2;
  color: var(--text); background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-hover) ease, border-color var(--dur-hover) ease, color var(--dur-hover) ease, opacity var(--dur-hover) ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.btn-lg { min-height: var(--control-h-lg); padding: 0 var(--sp-4); font-size: var(--fs-md); border-radius: var(--r-lg); }
.btn-xl { min-height: var(--control-h-xl); padding: 0 var(--sp-5); font-size: var(--fs-md); border-radius: var(--r-lg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger-outline { color: var(--bad); background: var(--bad-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-icon { width: var(--control-h-lg); min-height: var(--control-h-lg); padding: 0; }
.btn-icon svg { width: 20px; height: 20px; }
.btn-block { width: 100%; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: var(--surface-hover); }
  .btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn-danger-outline:hover:not(:disabled) { background: var(--bad-soft); border-color: var(--bad); }
  .btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
}
.spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

/* ---------------------------------------------------------------- form controls */
select, input:not([type="checkbox"], [type="radio"], [type="file"]), textarea {
  font: inherit; font-size: var(--fs-sm); color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  min-height: var(--control-h); padding: 0 var(--sp-3); max-width: 100%;
  transition: border-color var(--dur-hover) ease;
}
@media (pointer: coarse) { select, input, textarea { font-size: 16px !important; } } /* no iOS zoom on focus */
textarea { padding: var(--sp-2) var(--sp-3); resize: vertical; width: 100%; line-height: 1.5; display: block; }
select {
  cursor: pointer; padding-right: var(--sp-6); appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
::placeholder { color: var(--muted); opacity: 0.8; }
.field { position: relative; display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.field > label, .field > .label { font-size: var(--fs-sm); font-weight: 600; }
.field input, .field select { width: 100%; }

/* switch (button role=switch) */
.switch {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  min-height: var(--control-h-lg); padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-sm); color: var(--text); cursor: pointer; text-align: left;
  -webkit-tap-highlight-color: transparent; border-radius: var(--r-sm);
}
.switch-track {
  position: relative; width: 40px; height: 24px; flex: none; border-radius: var(--r-pill);
  background: var(--line-strong); transition: background-color var(--dur-hover) ease;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform var(--dur-enter) var(--ease-out);
}
.switch[aria-checked="true"] .switch-track { background: var(--accent); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(16px); }
.switch:disabled { cursor: not-allowed; opacity: 0.55; }

/* ---------------------------------------------------------------- chips & notices */
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: var(--fs-xs); font-weight: 650; line-height: 1;
  padding: 5px 9px; border-radius: var(--r-pill);
  background: var(--neutral-soft); color: var(--muted);
}
.chip[data-tone="good"] { background: var(--ok-soft); color: var(--ok); }
.chip[data-tone="warn"] { background: var(--warn-soft); color: var(--warn); }
.chip[data-tone="bad"] { background: var(--bad-soft); color: var(--bad); }
.chip[data-tone="info"] { background: var(--info-soft); color: var(--info); }
.chip[data-tone="accent"] { background: var(--accent-soft); color: var(--accent); }
.chip[data-dot]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip[data-dot="live"]::before { animation: pulse 1.4s ease-in-out infinite; }

.notice {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  background: var(--neutral-soft); color: var(--text); font-size: var(--fs-sm);
}
.notice svg { width: 18px; height: 18px; margin-top: 1px; }
.notice[data-tone="warn"] { background: var(--warn-soft); }
.notice[data-tone="warn"] svg { color: var(--warn); }
.notice[data-tone="bad"] { background: var(--bad-soft); }
.notice[data-tone="bad"] svg { color: var(--bad); }
.notice[data-tone="good"] { background: var(--ok-soft); }
.notice[data-tone="good"] svg { color: var(--ok); }
.notice[data-tone="info"] { background: var(--info-soft); }
.notice[data-tone="info"] svg { color: var(--info); }
.notice-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.notice-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------------------------------------------------------------- dialog */
dialog.modal {
  width: min(440px, calc(100vw - 2 * var(--sp-4))); padding: var(--sp-5);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-2);
  opacity: 0; transform: scale(0.96);
  transition: opacity var(--dur-modal) var(--ease-out), transform var(--dur-modal) var(--ease-out), overlay var(--dur-modal) allow-discrete, display var(--dur-modal) allow-discrete;
}
dialog.modal[open] { opacity: 1; transform: none; }
@starting-style { dialog.modal[open] { opacity: 0; transform: scale(0.96); } }
dialog.modal::backdrop { background: rgb(8 10 14 / 0.5); }
.modal-title { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }
.modal-body { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-5); flex-wrap: wrap; }

/* ---------------------------------------------------------------- skeleton */
.skel {
  border-radius: var(--r-md); background: var(--neutral-soft);
  animation: skel 1.4s ease-in-out infinite;
}
@keyframes skel { 50% { opacity: 0.5; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .spinner { animation-duration: 1.2s !important; animation-iteration-count: infinite !important; }
  .btn:active:not(:disabled) { transform: none; }
  dialog.modal { transform: none; }
}
