/* =========================================================================
   Design-system tokens (--ds-*): the one contract the shell primitives and components code against.
   Temple Dawn (parchment) is the default; Temple Dark is `:root.dark` (or data-theme="dark"). Hex values live ONLY in
   this file and in packs under ./packs/. tools/tests/ds-contrast-gate.php parses the colour blocks below (keep one
   declaration per line) and fails any text pair under WCAG AA 4.5:1.
   Note: assets/css/tokens.css also defines a few --ds-* names (--ds-surface, --ds-space-*); load this file after
   it so these values win on pages that use the shell.
   ========================================================================= */

/* ------------------------------------------------------------ Temple Dawn (light, default) */
:root, .ds-theme-light {
  --ds-surface: #FBF8F1;
  --ds-surface-raised: #FFFDF8;
  --ds-surface-sunken: #F3EDE0;
  --ds-text: #1C1917;
  --ds-text-muted: #57534E;
  --ds-accent: #A94A08;
  --ds-accent-contrast: #FCFBF7;
  --ds-action: #881337;
  --ds-action-contrast: #FCFBF7;
  --ds-border: rgba(180, 83, 9, .26);
  --ds-focus: #0E7490;
  --ds-neural: #0E7490;
  --ds-neural-soft: rgba(14, 116, 144, .1);
  --ds-success: #15803D;
  --ds-warning: #92400E;
  --ds-danger: #B91C1C;
  --ds-dawn: linear-gradient(135deg, rgba(245, 158, 11, .14), rgba(136, 19, 55, .08) 60%, rgba(251, 248, 241, 0));
}

/* ------------------------------------------------------------ Temple Dark */
:root.dark, :root[data-theme="dark"], .ds-theme-dark {
  --ds-surface: #161311;
  --ds-surface-raised: #1F1B18;
  --ds-surface-sunken: #0D0B09;
  --ds-text: #FCFBF7;
  --ds-text-muted: #B5AA9C;
  --ds-accent: #F59E0B;
  --ds-accent-contrast: #0D0B09;
  --ds-action: #881337;
  --ds-action-contrast: #FCFBF7;
  --ds-border: rgba(217, 119, 6, .2);
  --ds-focus: #22D3EE;
  --ds-neural: #22D3EE;
  --ds-neural-soft: rgba(34, 211, 238, .1);
  --ds-success: #4ADE80;
  --ds-warning: #FBBF24;
  --ds-danger: #F87171;
  --ds-dawn: linear-gradient(135deg, rgba(217, 119, 6, .22), rgba(136, 19, 55, .18) 60%, rgba(13, 11, 9, 0));
}

/* ------------------------------------------------------------ Always-dark overlay colours (text panels over photographs and the walk-through stage; the same in both themes) */
:root {
  --ds-overlay-surface: #0D0B09;
  --ds-overlay-text: #FCFBF7;
  --ds-overlay-muted: #D9CFC2;
  --ds-overlay-accent: #F59E0B;
  --ds-overlay-border: rgba(217, 119, 6, .35);
}

/* ------------------------------------------------------------ Scales shared by every theme and pack */
:root {
  /* type: Cormorant Garamond for headings, Mukta for the interface; fluid between 320px and 1920px */
  --ds-font-display: var(--font-display, "Cormorant Garamond", "Cormorant Fallback", Georgia, serif);
  --ds-font-ui: "Mukta", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ds-text-xs: clamp(0.75rem, 0.7375rem + 0.0625vw, 0.8125rem);
  --ds-text-sm: clamp(0.875rem, 0.8625rem + 0.0625vw, 0.9375rem);
  --ds-text-md: clamp(1rem, 0.975rem + 0.125vw, 1.125rem);
  --ds-text-lg: clamp(1.125rem, 1.075rem + 0.25vw, 1.375rem);
  --ds-text-xl: clamp(1.375rem, 1.3rem + 0.375vw, 1.75rem);
  --ds-text-2xl: clamp(1.75rem, 1.625rem + 0.625vw, 2.375rem);
  --ds-text-3xl: clamp(2.125rem, 1.9rem + 1.125vw, 3.25rem);
  --ds-text-4xl: clamp(2.625rem, 2.25rem + 1.875vw, 4.5rem);
  --ds-leading-tight: 1.15;
  --ds-leading-normal: 1.55;

  /* space: 4px base */
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-7: 32px;
  --ds-space-8: 40px;
  --ds-space-9: 48px;
  --ds-space-10: 64px;
  --ds-space-11: 80px;
  --ds-space-12: 96px;

  --ds-radius-sm: 8px;
  --ds-radius-md: 14px;
  --ds-radius-lg: 22px;
  --ds-radius-pill: 999px;

  --ds-shadow-1: 0 1px 2px rgba(28, 25, 23, .08), 0 2px 8px -2px rgba(28, 25, 23, .1);
  --ds-shadow-2: 0 4px 12px -2px rgba(28, 25, 23, .14), 0 12px 28px -12px rgba(28, 25, 23, .18);
  --ds-shadow-3: 0 12px 32px -8px rgba(28, 25, 23, .22), 0 28px 64px -24px rgba(28, 25, 23, .3);
  --ds-blur-sm: 8px;
  --ds-blur-md: 20px;

  --ds-z-base: 0;
  --ds-z-sticky: 100;
  --ds-z-rail: 200;
  --ds-z-header: 300;
  --ds-z-sheet: 400;
  --ds-z-overlay: 500;
  --ds-z-dialog: 600;
  --ds-z-toast: 700;

  --ds-dur-fast: 120ms;
  --ds-dur-base: 200ms;
  --ds-dur-slow: 400ms;
  --ds-ease-gentle: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ds-ease-snappy: cubic-bezier(0.3, 0.7, 0.2, 1);

  --ds-width-marketing: 1200px;
  --ds-width-member: 1100px;
  --ds-header-h: 64px;
  --ds-rail-w: 248px;
  --ds-rail-w-collapsed: 72px;
  --ds-tabbar-h: 60px;
}
:root.dark, :root[data-theme="dark"], .ds-theme-dark {
  --ds-shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 8px -2px rgba(0, 0, 0, .5);
  --ds-shadow-2: 0 4px 12px -2px rgba(0, 0, 0, .55), 0 12px 28px -12px rgba(0, 0, 0, .7);
  --ds-shadow-3: 0 12px 32px -8px rgba(0, 0, 0, .6), 0 28px 64px -24px rgba(0, 0, 0, .8);
}

/* ------------------------------------------------------------ High density (the workspace): smaller space steps */
[data-density="compact"] {
  --ds-space-2: 6px;
  --ds-space-3: 8px;
  --ds-space-4: 12px;
  --ds-space-5: 16px;
  --ds-space-6: 20px;
  --ds-space-7: 24px;
  --ds-space-8: 32px;
  --ds-space-9: 40px;
  --ds-space-10: 48px;
  --ds-space-11: 64px;
  --ds-space-12: 80px;
  --ds-header-h: 52px;
  --ds-text-md: clamp(0.9375rem, 0.9125rem + 0.1vw, 1.0625rem);
}

/* ------------------------------------------------------------ Reduced motion: every duration off, in one place */
@media (prefers-reduced-motion: reduce) {
  :root {
    --ds-dur-fast: 0ms;
    --ds-dur-base: 0ms;
    --ds-dur-slow: 0ms;
  }
}

/* ------------------------------------------------------------ Aliases (read-only references to existing app tokens; never override them) */
:root {
  --ds-alias-canvas: var(--c-canvas, var(--ds-surface));
  --ds-alias-ink: var(--c-ink, var(--ds-text));
  --ds-alias-muted: var(--c-muted, var(--ds-text-muted));
  --ds-alias-line: var(--c-line, var(--ds-border));
}
