/* Layer Logic Web — Design Tokens */

:root {
  /* Type scale (fluid) */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);
  --text-hero: clamp(2.75rem, 0.5rem + 6vw, 6.5rem);

  /* 4px spacing system */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 1040px;
  --content-wide: 1240px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Typography */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

/* Light mode (default) — paper ink, deep ink, single saxon-blue accent */
:root,
[data-theme='light'] {
  --color-bg: #f4f1ea;            /* warm paper */
  --color-surface: #fbf8f1;       /* slightly lifted paper */
  --color-surface-2: #ffffff;
  --color-surface-offset: #ece8df;
  --color-surface-offset-2: #e3ded2;
  --color-divider: #d9d3c3;
  --color-border: #c9c2b0;

  --color-text: #1a1c22;          /* near-black ink with cool tilt */
  --color-text-muted: #5e6068;
  --color-text-faint: #9b9c9f;
  --color-text-inverse: #f6f3ec;

  /* Accent: Saxon Blue — restrained, editorial */
  --color-primary: #1f3a8a;
  --color-primary-hover: #16306f;
  --color-primary-active: #11264f;
  --color-primary-highlight: #d6dcec;

  /* Warm secondary used very sparingly (highlight strokes only) */
  --color-accent-warm: #b35e1a;

  --shadow-sm: 0 1px 2px rgba(26, 28, 34, 0.06);
  --shadow-md: 0 6px 18px rgba(26, 28, 34, 0.08);
  --shadow-lg: 0 18px 40px rgba(26, 28, 34, 0.12);
}

[data-theme='dark'] {
  --color-bg: #14161b;
  --color-surface: #191c22;
  --color-surface-2: #1f232a;
  --color-surface-offset: #1c1f25;
  --color-surface-offset-2: #232730;
  --color-divider: #2a2e36;
  --color-border: #353a44;

  --color-text: #e7e5df;
  --color-text-muted: #9a9c9f;
  --color-text-faint: #5e6168;
  --color-text-inverse: #1a1c22;

  --color-primary: #8aa3e5;
  --color-primary-hover: #a5b8ee;
  --color-primary-active: #c0cef3;
  --color-primary-highlight: #2a3252;

  --color-accent-warm: #e29457;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #14161b;
    --color-surface: #191c22;
    --color-surface-2: #1f232a;
    --color-surface-offset: #1c1f25;
    --color-surface-offset-2: #232730;
    --color-divider: #2a2e36;
    --color-border: #353a44;
    --color-text: #e7e5df;
    --color-text-muted: #9a9c9f;
    --color-text-faint: #5e6168;
    --color-text-inverse: #1a1c22;
    --color-primary: #8aa3e5;
    --color-primary-hover: #a5b8ee;
    --color-primary-active: #c0cef3;
    --color-primary-highlight: #2a3252;
    --color-accent-warm: #e29457;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.55);
  }
}
