/*
  Iveno design system — shared across every static page in public/.
  Restyles the existing element/class hooks in place (body, .card, button,
  .secondary, .danger, input/select/textarea, label, .badge, .muted, .error,
  .ok, .hidden, table) so page <script> blocks that toggle these classes
  keep working unchanged. Page files should only carry page-specific layout
  CSS after linking this file — no re-declaring tokens or component styles.
*/

:root {
  color-scheme: light dark;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale — one family, hierarchy from size/weight only */
  --text-display: 650 34px/1.15 var(--font-sans);
  --text-title-1: 650 26px/1.2 var(--font-sans);
  --text-title-2: 600 20px/1.25 var(--font-sans);
  --text-title-3: 600 17px/1.3 var(--font-sans);
  --text-headline: 600 15px/1.4 var(--font-sans);
  --text-body: 400 15px/1.55 var(--font-sans);
  --text-callout: 400 14px/1.45 var(--font-sans);
  --text-footnote: 400 13px/1.4 var(--font-sans);
  --text-caption: 590 12px/1.3 var(--font-sans);

  /* Color — Ink + Electric brand palette (logo package), replacing the retired
     navy/coral identity. Two token families that look similar but mean
     different things — keep them separate:

     --color-ink / -secondary / -tertiary: default TEXT colors. These flip
     under prefers-color-scheme (see below) — dark text in light mode,
     light text in dark mode.

     --color-brand-dark: the literal brand Ink (#0B0B12) used as a SURFACE —
     primary buttons, hero/nav bands, the admin sidebar. Deliberately never
     flips with theme: it's already dark, so it renders identically and
     correctly regardless of light/dark mode. Mixing this up with
     --color-ink would make every primary button and dark band invert to a
     near-white surface under dark mode — don't.

     --color-electric is the single accent (#3D5AFE). It clears AA on both
     white and as a white-on-electric button fill (~5.1:1 either direction)
     — see https://www.w3.org/TR/WCAG21/#contrast-minimum. It does NOT clear
     AA for small text sitting on --color-brand-dark (~3.8:1) — on dark
     surfaces use --color-electric-tint for text/links instead, and keep
     plain --color-electric for large elements, icons, and buttons that
     carry white text rather than colored text. */
  --color-bg: #f7f7f9;
  --color-surface: #ffffff;
  --color-ink: #0b0b12;
  --color-ink-secondary: #606065;
  --color-ink-tertiary: #858589;
  --color-border: #e4e4e9;
  --color-border-strong: #c7c7d1;

  --color-electric: #3d5afe;
  --color-electric-hover: #3751e2;
  --color-electric-subtle: #eff2ff;
  /* AA-safe (~5.0:1) tint of electric for text/links on --color-brand-dark;
     plain --color-electric only reaches ~3.8:1 there. */
  --color-electric-tint: #5a73fe;
  --color-focus-ring: rgba(61, 90, 254, 0.32);

  --color-brand-dark: #0b0b12;
  --color-brand-dark-hover: #28282e;

  /* Status system — one visual language for every state everywhere. Kept
     semantic and distinct from the brand on purpose: electric is
     brand/primary only, never repurposed as a status color. */
  --status-success-fg: #197a4c; --status-success-bg: #e7f6ee;
  --status-warning-fg: #92660c; --status-warning-bg: #fbf1de;
  --status-danger-fg:  #b3261e; --status-danger-bg:  #fbeae9;
  --status-neutral-fg: #5b6169; --status-neutral-bg: #eef0f2;
  --status-info-fg:    #2b6690; --status-info-bg:    #e9f2f8;

  /* Spacing — 4px base unit */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px;

  /* Radius — one scale for everything */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  /* Shadow — used sparingly, only for truly elevated surfaces (toast, dropdown) */
  --shadow-sm: 0 1px 2px rgba(20, 23, 26, 0.06);
  --shadow-md: 0 10px 28px rgba(20, 23, 26, 0.10), 0 2px 6px rgba(20, 23, 26, 0.05);
}

/* Dark mode: only the tokens that mean "page chrome" flip. --color-brand-dark
   and the status colors are deliberately absent here — they're already
   correct in both themes (see the comment above). */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0b0b12;
    --color-surface: #16161f;
    --color-ink: #ffffff;
    --color-ink-secondary: #c7c7d1;
    --color-ink-tertiary: #8e8e98;
    --color-border: #26262f;
    --color-border-strong: #35353f;

    --color-electric: #5a73fe;
    --color-electric-hover: #7b8dfe;
    --color-electric-subtle: rgba(61, 90, 254, 0.16);
    --color-focus-ring: rgba(90, 115, 254, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
  * { transition-property: color, background-color, border-color, box-shadow, opacity !important; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

::selection { background: var(--color-electric); color: #fff; }

body {
  margin: 0;
  font: var(--text-body);
  color: var(--color-ink);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: inherit; }
p { margin: 0; }

a { color: var(--color-electric); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--color-electric);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Typography helpers ---------- */
h1 { font: var(--text-title-1); letter-spacing: -0.01em; text-wrap: balance; }
h2 { font: var(--text-title-3); text-wrap: balance; }
.subtitle, .muted { font: var(--text-callout); color: var(--color-ink-secondary); }
.eyebrow {
  display: block;
  font: var(--text-caption);
  color: var(--color-ink-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Surfaces ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-4);
}

.hidden { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -100%; left: var(--space-4);
  background: var(--color-brand-dark); color: #fff; padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm); font: var(--text-callout); z-index: 100;
  transition: top 120ms ease-out;
}
.skip-link:focus { top: var(--space-2); }

/* ---------- Buttons ---------- */
button {
  font: var(--text-headline);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-brand-dark);
  background: var(--color-brand-dark);
  color: #fff;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease, transform 120ms ease-out;
}
button:hover { background: var(--color-brand-dark-hover); border-color: var(--color-brand-dark-hover); }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:disabled:hover { background: var(--color-brand-dark); border-color: var(--color-brand-dark); }

button.secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border-color: var(--color-border-strong);
}
button.secondary:hover { background: var(--color-surface); border-color: var(--color-ink); }

button.danger {
  background: var(--color-surface);
  color: var(--status-danger-fg);
  border-color: var(--status-danger-fg);
}
button.danger:hover { background: var(--status-danger-bg); }

/* text/tertiary action — used sparingly for low-emphasis links styled as buttons */
button.text {
  background: transparent;
  color: var(--color-ink-secondary);
  border-color: transparent;
  padding-left: 4px;
  padding-right: 4px;
}
button.text:hover { background: transparent; color: var(--color-ink); text-decoration: underline; }

/* ---------- Forms ---------- */
label {
  display: block;
  font: var(--text-caption);
  color: var(--color-ink);
  margin: var(--space-3) 0 var(--space-1);
}
label:first-of-type { margin-top: 0; }

select, textarea,
input[type="text"], input[type="number"], input[type="time"], input[type="email"],
input[type="password"], input[type="url"], input[type="date"], input[type="tel"],
input[type="datetime-local"] {
  width: 100%;
  padding: 9px 12px;
  font: var(--text-body);
  color: var(--color-ink);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { min-height: 72px; resize: vertical; }

select:focus, textarea:focus,
input[type="text"]:focus, input[type="number"]:focus, input[type="time"]:focus,
input[type="email"]:focus, input[type="password"]:focus, input[type="url"]:focus,
input[type="date"]:focus, input[type="tel"]:focus, input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--color-electric);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

::placeholder { color: var(--color-ink-tertiary); }

input:disabled, select:disabled, textarea:disabled {
  background: var(--color-bg);
  color: var(--color-ink-tertiary);
  cursor: not-allowed;
}

.hint { font-weight: 400; color: var(--color-ink-tertiary); }

.password-field { position: relative; }
.password-field > input { padding-right: 4.75rem; }
button.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  margin: 0;
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: var(--color-ink-secondary);
  font: var(--text-caption);
  font-weight: 600;
  line-height: 1.2;
}
button.password-toggle:hover {
  background: transparent;
  border-color: transparent;
  color: var(--color-ink);
}
button.password-toggle:active:not(:disabled) { transform: translateY(-50%); }
button.password-toggle:focus-visible {
  outline: 2px solid var(--color-electric);
  outline-offset: 2px;
}

/* ---------- Status text (JS sets className="ok"/"error" directly) ---------- */
.error, .msg.error { color: var(--status-danger-fg); font: var(--text-footnote); margin-top: var(--space-2); }
.ok, .msg.ok { color: var(--status-success-fg); font: var(--text-footnote); margin-top: var(--space-2); }

/* ---------- Badges / status pills — one system for every status word ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  font: var(--text-caption);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--status-neutral-bg);
  color: var(--status-neutral-fg);
}
.badge.confirmed, .badge.paid { background: var(--status-success-bg); color: var(--status-success-fg); }
.badge.held, .badge.pending { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.badge.cancelled, .badge.failed { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.badge.expired { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }
.badge.refunded { background: var(--status-info-bg); color: var(--status-info-fg); }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font: var(--text-callout); font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border); }
th { color: var(--color-ink-tertiary); font: var(--text-caption); text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:hover { background: var(--color-bg); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Empty / loading ---------- */
.empty { color: var(--color-ink-tertiary); font: var(--text-callout); padding: var(--space-6) 0; text-align: center; }
.loading { opacity: 0.55; pointer-events: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  background: var(--color-brand-dark);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font: var(--text-callout);
  box-shadow: var(--shadow-md);
  z-index: 50;
}

/* ---------- Shared page shell: slim top bar with wordmark ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.wordmark {
  font: var(--text-headline);
  color: var(--color-ink);
  letter-spacing: -0.01em;
}
.wordmark:hover { text-decoration: none; color: var(--color-ink); }
.wordmark img { display: block; height: 24px; width: auto; }

@media (max-width: 560px) {
  .site-header {
    flex-wrap: wrap;
    row-gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
  }
  .site-header .muted { font: var(--text-caption); white-space: normal; }
}

/* ---------- Shared auth-page shell: centered wordmark + single card ----------
   Used by signup/verify/forgot/reset (public/*.html) — previously each page
   redeclared the same .page/.wordmark/.subtitle/.footer-link/.msg rules
   locally; consolidated here so there's one definition, not four. */
.auth-page { max-width: 420px; margin: var(--space-10) auto 0; padding: 0 var(--space-4) var(--space-16); }
.auth-page .wordmark { display: block; margin-bottom: var(--space-8); }
.auth-page.centered { text-align: center; }
.auth-page.centered .wordmark { display: inline-block; }
.auth-page h1 { margin: 0 0 var(--space-2); }
.auth-page .subtitle { margin: 0 0 var(--space-6); }
.auth-page .card { padding: var(--space-6); margin-bottom: 0; }
.auth-page .msg { font: var(--text-footnote); margin-top: var(--space-3); min-height: 1.2em; }
.auth-page button[type="submit"] { width: 100%; margin-top: var(--space-5); }
.auth-footer-link { text-align: center; margin-top: var(--space-6); font: var(--text-callout); color: var(--color-ink-secondary); }
.auth-footer-link a { font-weight: 600; }
.auth-btn {
  display: inline-block; padding: 10px 22px; background: var(--color-brand-dark); color: #fff;
  border-radius: var(--radius-md); font-weight: 600; text-decoration: none;
}
.auth-btn:hover { background: var(--color-brand-dark-hover); text-decoration: none; }

/* ---------- Shared spinner (verify.html's loading state, reused anywhere) ---------- */
.spinner {
  display: inline-block; width: 28px; height: 28px;
  border: 3px solid var(--color-border); border-top-color: var(--color-electric);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Success icon circle (booking confirmed, email verified, etc.) ---------- */
.success-icon {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; margin: 0 auto var(--space-4);
  border-radius: var(--radius-full); background: var(--status-success-bg); color: var(--status-success-fg);
}

/* ---------- Step breadcrumb (book.html's 5-step flow) ---------- */
.step-breadcrumb { display: flex; align-items: center; gap: var(--space-1); margin-bottom: var(--space-5); flex-wrap: wrap; }
.step-breadcrumb .step {
  display: flex; align-items: center; gap: 6px; font: var(--text-caption); color: var(--color-ink-tertiary);
}
.step-breadcrumb .step.active { color: var(--color-ink); }
.step-breadcrumb .step.done { color: var(--color-ink-secondary); }
.step-breadcrumb .dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: var(--radius-full); font-weight: 700;
  background: var(--color-bg); color: var(--color-ink-tertiary); font-variant-numeric: tabular-nums;
}
.step-breadcrumb .step.active .dot { background: var(--color-electric); color: #fff; }
.step-breadcrumb .step.done .dot { background: var(--color-electric-subtle); color: var(--color-electric); }
.step-breadcrumb .sep { width: 12px; height: 1px; background: var(--color-border-strong); }

/* ---------- Review/summary card (book.html step 5) ---------- */
.summary-card { background: var(--color-bg); border-radius: var(--radius-md); padding: var(--space-4); }
.summary-card .summary-row { padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.summary-card .summary-row:last-child { border-bottom: none; }

/* ---------- Initial-letter avatar (staff picker, no photo available) ---------- */
.avatar-initial {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: var(--radius-full);
  color: #fff; font-weight: 700; font: var(--text-callout);
}

/* ---------- Disclosure (collapsed-by-default secondary info) ---------- */
.disclosure summary { cursor: pointer; font: var(--text-callout); color: var(--color-ink-secondary); font-weight: 600; }
.disclosure summary:hover { color: var(--color-ink); }
.disclosure[open] summary { margin-bottom: var(--space-2); }
.disclosure .copy-row {
  display: flex; align-items: center; gap: var(--space-2); background: var(--color-bg);
  border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-top: var(--space-1);
}
.disclosure .copy-row code { font: var(--text-footnote); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout utilities (replace inline style="" so CSP can drop
   style-src 'unsafe-inline' -- see security-audit-report.md MEDIUM-001) ---------- */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-10 { margin-top: var(--space-10); }
.mt-10px { margin-top: 10px; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.m-0 { margin: 0; }
.m-0-0-3 { margin: 0 0 var(--space-3); }
.p-0 { padding: 0; }
.py-4 { padding: var(--space-4) 0; }
.pad-hero { padding: var(--space-10) var(--space-6); }
.pt-4-border-top { padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.text-center { text-align: center; }
.text-secondary { color: var(--color-ink-secondary); }
.text-xs { font-size: 11px; }
.footnote { font: var(--text-footnote); }
.w-full { width: 100%; }
.flex { display: flex; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-none { flex: none; }
.items-center { align-items: center; }
.items-end { align-items: end; }
.justify-between { justify-content: space-between; }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.break-all { word-break: break-all; }
.max-w-140 { max-width: 140px; }
.max-w-240 { max-width: 240px; }
.max-w-280 { max-width: 280px; }
.inline-card {
  padding: 12px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
  background: var(--color-surface); margin-top: 4px;
}
