/* style.css — ColdCaseIndex Design Tokens & Component Styles */

/* ── Type Scale (fluid clamp) ── */
:root {
  --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.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1rem    + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
  --text-hero: clamp(3rem,     0.5rem  + 7vw,    8rem);

  /* ── Spacing (4px base) ── */
  --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: 1rem;
  --radius-full: 9999px;

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

  /* ── Content widths ── */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;

  /* ── Font families ── */
  --font-display: 'IBM Plex Serif', 'Georgia', serif;
  --font-body: 'IBM Plex Sans', 'Helvetica Neue', sans-serif;
}

/* ── DARK MODE (default identity) ── */
:root, [data-theme="dark"] {
  /* Surfaces — near-black layered */
  --color-bg:               #0d0d0f;
  --color-surface:          #141416;
  --color-surface-2:        #1a1a1d;
  --color-surface-offset:   #1e1e22;
  --color-surface-offset-2: #242428;
  --color-surface-dynamic:  #2a2a2f;
  --color-divider:          #2e2e34;
  --color-border:           #38383f;

  /* Text */
  --color-text:           #e0ddd5;
  --color-text-muted:     #8a877f;
  --color-text-faint:     #55534e;
  --color-text-inverse:   #0d0d0f;

  /* Primary Accent — Cold amber/gold */
  --color-primary:          #c9a44a;
  --color-primary-hover:    #ddb85a;
  --color-primary-active:   #a88a3a;
  --color-primary-highlight: #2a2620;

  /* Error / Unsolved — Desaturated red */
  --color-error:            #8b3a3a;
  --color-error-hover:      #a34a4a;
  --color-error-active:     #6e2e2e;
  --color-error-highlight:  #2a1e1e;

  /* Success — Muted green */
  --color-success:          #4a7a3a;
  --color-success-hover:    #5a8a4a;
  --color-success-active:   #3a6a2a;
  --color-success-highlight: #1e2a1e;

  /* Warning — Amber */
  --color-warning:          #b8862a;
  --color-warning-hover:    #c89a3a;
  --color-warning-active:   #a07020;
  --color-warning-highlight: #2a2418;

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
}

/* ── LIGHT MODE ── */
[data-theme="light"] {
  --color-bg:               #f5f3ee;
  --color-surface:          #eae7e0;
  --color-surface-2:        #e0ddd5;
  --color-surface-offset:   #d6d3cb;
  --color-surface-offset-2: #ccc9c1;
  --color-surface-dynamic:  #c2bfb7;
  --color-divider:          #b8b5ad;
  --color-border:           #a8a59d;

  --color-text:           #1a1815;
  --color-text-muted:     #5a5850;
  --color-text-faint:     #8a877f;
  --color-text-inverse:   #f5f3ee;

  --color-primary:          #8a7030;
  --color-primary-hover:    #6a5520;
  --color-primary-active:   #504015;
  --color-primary-highlight: #e8e0c8;

  --color-error:            #7a3030;
  --color-error-hover:      #5a2020;
  --color-error-active:     #3a1010;
  --color-error-highlight:  #e8d0d0;

  --color-success:          #3a6a2a;
  --color-success-hover:    #2a5a1a;
  --color-success-active:   #1a4a0a;
  --color-success-highlight: #d0e8c8;

  --color-warning:          #8a6a20;
  --color-warning-hover:    #6a5010;
  --color-warning-active:   #504005;
  --color-warning-highlight: #e8dcc0;

  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.08);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.1);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.14);
}

/* System preference fallback */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg:               #f5f3ee;
    --color-surface:          #eae7e0;
    --color-surface-2:        #e0ddd5;
    --color-surface-offset:   #d6d3cb;
    --color-surface-offset-2: #ccc9c1;
    --color-surface-dynamic:  #c2bfb7;
    --color-divider:          #b8b5ad;
    --color-border:           #a8a59d;
    --color-text:           #1a1815;
    --color-text-muted:     #5a5850;
    --color-text-faint:     #8a877f;
    --color-text-inverse:   #f5f3ee;
    --color-primary:          #8a7030;
    --color-primary-hover:    #6a5520;
    --color-primary-active:   #504015;
    --color-primary-highlight: #e8e0c8;
    --color-error:            #7a3030;
    --color-error-hover:      #5a2020;
    --color-error-active:     #3a1010;
    --color-error-highlight:  #e8d0d0;
    --color-success:          #3a6a2a;
    --color-success-hover:    #2a5a1a;
    --color-success-active:   #1a4a0a;
    --color-success-highlight: #d0e8c8;
    --color-warning:          #8a6a20;
    --color-warning-hover:    #6a5010;
    --color-warning-active:   #504005;
    --color-warning-highlight: #e8dcc0;
    --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.08);
    --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.1);
    --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.14);
  }
}
