/* ==========================================================================
   Xedeshin Viewer — Design System Tokens
   Typography scale, spacing scale, liquid glass colors & motion curves
   ========================================================================== */

:root {
  /* Fonts */
  --font-sans: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --user-font-size: 16px;
  --user-font-weight: 400;

  /* Spacing tokens (strict scale) */
  --space-0: 0px;
  --space-25: 2px;
  --space-50: 4px;
  --space-75: 8px;
  --space-100: 12px;
  --space-200: 16px;
  --space-300: 24px;
  --space-400: 32px;
  --space-500: 40px;
  --space-600: 48px;
  --space-700: 64px;
  --space-800: 80px;
  --space-900: 96px;

  /* Corner radii (Tailwind scale + nested formulas) */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-3xl: 24px;
  --radius-sculpt-a: 28px;
  --radius-sculpt-b: 44px;
  --radius-full: 9999px;

  /* Motion */
  --ease-liquid: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-hover: 300ms;
  --duration-layout: 500ms;
  --duration-reveal: 650ms;

  /* Dark Theme (Default) */
  --bg-canvas: #000000;
  --bg-surface-1: #181818;
  --bg-surface-2: #1F1F1F;
  --bg-surface-3: #272727;
  --bg-surface-4: #313131;
  --bg-surface-warm: #131209;

  --glass-bg: rgba(24, 24, 24, 0.68);
  --glass-bg-elevated: rgba(31, 31, 31, 0.78);
  --glass-bg-interactive: rgba(39, 39, 39, 0.72);
  --glass-bg-strong: rgba(20, 20, 22, 0.98);
  --glass-pill-active: rgba(49, 49, 49, 0.88);
  --glass-blur: blur(28px) saturate(165%);
  --glass-blur-heavy: blur(40px) saturate(175%);

  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.28);
  --border-focus: rgba(255, 255, 255, 0.65);

  --specular-top: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --specular-bottom: inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  --glass-shadow: 0 24px 64px rgba(0, 0, 0, 0.56);
  --glass-shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.42);

  --text-primary: #FFFFFF;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --heading-gradient-start: #FFFFFF;
  --heading-gradient-end: #9B9B9B;

  /* Semantic Accents (restrained, high-contrast) */
  --accent-silver: #E4E4E7;
  --accent-edit: #34D399;
  --accent-edit-bg: rgba(52, 211, 153, 0.12);
  --accent-edit-border: rgba(52, 211, 153, 0.28);
  --accent-warn: #FBBF24;
  --accent-warn-bg: rgba(251, 191, 36, 0.12);
  --accent-warn-border: rgba(251, 191, 36, 0.28);
  --accent-danger: #F87171;
  --accent-danger-bg: rgba(248, 113, 113, 0.12);
  --accent-danger-border: rgba(248, 113, 113, 0.28);
  --accent-info: #93C5FD;
  --accent-info-bg: rgba(147, 197, 253, 0.12);
  --accent-info-border: rgba(147, 197, 253, 0.28);

  /* Caustic liquid blobs (subtle monochrome refraction) */
  --caustic-a: rgba(255, 255, 255, 0.08);
  --caustic-b: rgba(180, 196, 220, 0.07);
  --caustic-c: rgba(255, 255, 255, 0.05);

  /* Document Paper Surface */
  --paper-bg: #181818;
  --paper-border: rgba(255, 255, 255, 0.10);
  --checker-a: rgba(255, 255, 255, 0.04);
  --checker-b: rgba(255, 255, 255, 0.015);
}

[data-theme="light"] {
  --bg-canvas: #F2F3F5;
  --bg-surface-1: #FFFFFF;
  --bg-surface-2: #F7F7F9;
  --bg-surface-3: #ECEEF2;
  --bg-surface-4: #E2E4E9;
  --bg-surface-warm: #F9F8F4;

  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-elevated: rgba(255, 255, 255, 0.84);
  --glass-bg-interactive: rgba(247, 247, 249, 0.82);
  --glass-bg-strong: rgba(255, 255, 255, 0.98);
  --glass-pill-active: rgba(255, 255, 255, 0.96);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.14);
  --border-strong: rgba(0, 0, 0, 0.24);
  --border-focus: rgba(0, 0, 0, 0.65);

  --specular-top: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --specular-bottom: inset 0 -1px 0 rgba(0, 0, 0, 0.04);
  --glass-shadow: 0 20px 56px rgba(15, 23, 42, 0.10);
  --glass-shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.07);

  --text-primary: #09090B;
  --text-secondary: #52525B;
  --text-muted: #71717A;
  --heading-gradient-start: #000000;
  --heading-gradient-end: #666666;

  --accent-silver: #18181B;
  --accent-edit: #059669;
  --accent-edit-bg: rgba(5, 150, 105, 0.10);
  --accent-edit-border: rgba(5, 150, 105, 0.26);
  --accent-warn: #D97706;
  --accent-warn-bg: rgba(217, 119, 6, 0.10);
  --accent-warn-border: rgba(217, 119, 6, 0.26);
  --accent-danger: #DC2626;
  --accent-danger-bg: rgba(220, 38, 38, 0.10);
  --accent-danger-border: rgba(220, 38, 38, 0.24);
  --accent-info: #2563EB;
  --accent-info-bg: rgba(37, 99, 235, 0.09);
  --accent-info-border: rgba(37, 99, 235, 0.24);

  --caustic-a: rgba(0, 0, 0, 0.045);
  --caustic-b: rgba(100, 116, 139, 0.06);
  --caustic-c: rgba(0, 0, 0, 0.03);

  --paper-bg: #FFFFFF;
  --paper-border: rgba(0, 0, 0, 0.08);
  --checker-a: rgba(0, 0, 0, 0.05);
  --checker-b: rgba(0, 0, 0, 0.015);
}

/* ==========================================================================
   Named Typography Styles (strict Tailwind scale steps, no italics, max 700)
   ========================================================================== */

.heading-1 { font-size: 3.75rem; line-height: 1; font-weight: 600; letter-spacing: -0.03em; text-wrap: balance; }
.heading-2 { font-size: 3rem; line-height: 1; font-weight: 600; letter-spacing: -0.025em; text-wrap: balance; }
.heading-3 { font-size: 2.25rem; line-height: 2.5rem; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
.heading-4 { font-size: 1.875rem; line-height: 2.25rem; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
.heading-5 { font-size: 1.5rem; line-height: 2rem; font-weight: 600; letter-spacing: -0.015em; text-wrap: balance; }
.heading-6 { font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }

.title-1 { font-size: 1.25rem; line-height: 1.75rem; font-weight: 500; text-wrap: balance; }
.title-2 { font-size: 1.125rem; line-height: 1.75rem; font-weight: 500; text-wrap: balance; }
.title-3 { font-size: 1rem; line-height: 1.5rem; font-weight: 500; }
.title-4 { font-size: 0.875rem; line-height: 1.25rem; font-weight: 500; }
.title-5 { font-size: 0.75rem; line-height: 1rem; font-weight: 500; }

.body-1 { font-size: 1rem; line-height: 1.5rem; font-weight: 600; text-wrap: pretty; }
.body-2 { font-size: 1rem; line-height: 1.5rem; font-weight: 500; text-wrap: pretty; }
.body-3 { font-size: var(--user-font-size, 1rem); line-height: 1.5; font-weight: var(--user-font-weight, 400); text-wrap: pretty; }
.body-4 { font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; text-wrap: pretty; }
.body-5 { font-size: 0.875rem; line-height: 1.25rem; font-weight: 500; text-wrap: pretty; }
.body-6 { font-size: calc(var(--user-font-size, 16px) - 2px); line-height: 1.45; font-weight: var(--user-font-weight, 400); text-wrap: pretty; }

.button-lg { font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; }
.button-md { font-size: 1rem; line-height: 1.5rem; font-weight: 600; }
.button-sm { font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; }
.button-xsm { font-size: 0.75rem; line-height: 1rem; font-weight: 600; }

.caption-1 { font-size: 0.875rem; line-height: 1.25rem; font-weight: 500; }
.caption-2 { font-size: 0.875rem; line-height: 1.25rem; font-weight: 400; }
.caption-3 { font-size: 0.75rem; line-height: 1rem; font-weight: 600; }
.caption-4 { font-size: 0.75rem; line-height: 1rem; font-weight: 500; }
.caption-5 { font-size: 0.75rem; line-height: 1rem; font-weight: 400; }

@media (max-width: 640px) {
  .heading-1 { font-size: 2.25rem; line-height: 2.5rem; }
  .heading-2 { font-size: 1.875rem; line-height: 2.25rem; }
}
