/* ============================================
   BAUVIA DESIGN SYSTEM
   Custom warm palette: sandstone surfaces, 
   slate blue primary, forest green accent.
   ============================================ */

/* --- Type Scale (Fluid) --- */
: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 grid) --- */
  --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;

  /* --- Font families --- */
  --font-display: 'DM Serif Display', 'Georgia', serif;
  --font-body: 'Plus Jakarta Sans', 'Helvetica Neue', sans-serif;

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

  /* --- 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);
}

/* ============================================
   LIGHT MODE — Warm Sandstone
   ============================================ */
:root, [data-theme="light"] {
  /* --- Surfaces (Warm Sandstone) --- */
  --color-bg:               #f5f0e8;
  --color-surface:          #faf6f0;
  --color-surface-2:        #fdfbf7;
  --color-surface-offset:   #ede7dc;
  --color-surface-offset-2: #e6dfcf;
  --color-surface-dynamic:  #ddd5c5;
  --color-divider:          #d4cbb8;
  --color-border:           #c9bfa8;

  /* --- Text (Warm Brown) --- */
  --color-text:             #2a2319;
  --color-text-muted:       #7a7060;
  --color-text-faint:       #b5ab98;
  --color-text-inverse:     #faf6f0;

  /* --- Primary (Slate Blue — construction, trust) --- */
  --color-primary:          #2b4c6f;
  --color-primary-hover:    #1e3a56;
  --color-primary-active:   #152c42;
  --color-primary-highlight: #d4dde8;

  /* --- Accent (Forest Green — CTA, growth) --- */
  --color-accent:           #3d7a4f;
  --color-accent-hover:     #2d6140;
  --color-accent-active:    #204a31;
  --color-accent-highlight: #d2e5d7;

  /* --- Semantic: Warning (Amber) --- */
  --color-warning:          #b5710d;
  --color-warning-highlight: #f0e0c4;

  /* --- Semantic: Error (Terracotta) --- */
  --color-error:            #b04a34;
  --color-error-highlight:  #f0d5cc;

  /* --- Shadows (tone-matched warm) --- */
  --shadow-sm: 0 1px 2px oklch(0.25 0.02 70 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.25 0.02 70 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.25 0.02 70 / 0.12);
}

/* ============================================
   DARK MODE — Warm Charcoal
   ============================================ */
[data-theme="dark"] {
  /* --- Surfaces (Dark Warm) --- */
  --color-bg:               #18160f;
  --color-surface:          #1f1c14;
  --color-surface-2:        #252118;
  --color-surface-offset:   #1c1912;
  --color-surface-offset-2: #28241b;
  --color-surface-dynamic:  #33302a;
  --color-divider:          #2e2b24;
  --color-border:           #3e3a31;

  /* --- Text (Cream tones) --- */
  --color-text:             #d9d0c0;
  --color-text-muted:       #8a8274;
  --color-text-faint:       #5e574c;
  --color-text-inverse:     #1f1c14;

  /* --- Primary (Light Slate Blue) --- */
  --color-primary:          #6a9cc8;
  --color-primary-hover:    #5188b8;
  --color-primary-active:   #3d73a1;
  --color-primary-highlight: #2a3440;

  /* --- Accent (Light Green) --- */
  --color-accent:           #5daa6f;
  --color-accent-hover:     #48944c;
  --color-accent-active:    #357a3d;
  --color-accent-highlight: #253d2a;

  /* --- Semantic: Warning (Amber) --- */
  --color-warning:          #d4973a;
  --color-warning-highlight: #3a3020;

  /* --- Semantic: Error (Light Terracotta) --- */
  --color-error:            #d47a62;
  --color-error-highlight:  #3e2b24;

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

/* System preference fallback (when no data-theme is set) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:               #18160f;
    --color-surface:          #1f1c14;
    --color-surface-2:        #252118;
    --color-surface-offset:   #1c1912;
    --color-surface-offset-2: #28241b;
    --color-surface-dynamic:  #33302a;
    --color-divider:          #2e2b24;
    --color-border:           #3e3a31;
    --color-text:             #d9d0c0;
    --color-text-muted:       #8a8274;
    --color-text-faint:       #5e574c;
    --color-text-inverse:     #1f1c14;
    --color-primary:          #6a9cc8;
    --color-primary-hover:    #5188b8;
    --color-primary-active:   #3d73a1;
    --color-primary-highlight: #2a3440;
    --color-accent:           #5daa6f;
    --color-accent-hover:     #48944c;
    --color-accent-active:    #357a3d;
    --color-accent-highlight: #253d2a;
    --color-warning:          #d4973a;
    --color-warning-highlight: #3a3020;
    --color-error:            #d47a62;
    --color-error-highlight:  #3e2b24;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  }
}
