/* base.css — Vertum Design Foundation */

/* Box model reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent font-size inflation on mobile */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
  scroll-padding-top: var(--space-16);
}

/* Core body defaults */
body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body, sans-serif);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

/* Improved media defaults */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Remove list styles on ul, ol with role="list" */
ul[role="list"], ol[role="list"] {
  list-style: none;
}

/* Consistent form elements */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}

/* Text wrap improvements */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.15;
}

p, li, figcaption {
  text-wrap: pretty;
  max-width: 72ch;
}

/* Selection styling */
::selection {
  background: oklch(from var(--color-primary) l c h / 0.25);
  color: var(--color-text);
}

/* Focus ring — visible, accessible, attractive */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Reduced motion: disable non-essential animation */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Remove default button styles */
button {
  cursor: pointer;
  background: none;
  border: none;
}

/* Table defaults */
table {
  border-collapse: collapse;
  width: 100%;
}

/* Accessible hidden — screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   TYPE SCALE — Fluid with 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);
}

/* ============================================
   4px SPACING SYSTEM
   ============================================ */
:root {
  --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;
}

/* ============================================
   VERTUM CUSTOM PALETTE — LIGHT MODE
   Near-Black + Deep Teal + Warm Amber
   ============================================ */
:root, [data-theme="light"] {
  /* --- Font families --- */
  --font-display: 'Space Grotesk', 'Arial', sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;

  /* --- Surfaces --- */
  --color-bg:               #F8FAFC;
  --color-surface:          #FFFFFF;
  --color-surface-2:        #F1F5F9;
  --color-surface-offset:   #E2E8F0;
  --color-surface-offset-2: #CBD5E1;
  --color-surface-dynamic:  #E2E8F0;
  --color-divider:          oklch(from #111827 l c h / 0.08);
  --color-border:           oklch(from #111827 l c h / 0.12);

  /* --- Text --- */
  --color-text:           #111827;
  --color-text-muted:     #6B7280;
  --color-text-faint:     #9CA3AF;
  --color-text-inverse:   #F8FAFC;

  /* --- Primary Accent (Deep Teal) --- */
  --color-primary:          #0F4C5C;
  --color-primary-hover:    #0A3A47;
  --color-primary-active:   #072B35;
  --color-primary-highlight: color-mix(in oklch, #0F4C5C 10%, #F8FAFC);

  /* --- CTA Accent (Warm Amber) --- */
  --color-accent:           #D97706;
  --color-accent-hover:     #B45309;
  --color-accent-active:    #92400E;
  --color-accent-highlight: color-mix(in oklch, #D97706 10%, #F8FAFC);

  /* --- Secondary Accent (Light Teal) --- */
  --color-secondary:        #14B8A6;
  --color-secondary-hover:  #0D9488;
  --color-secondary-active: #0F766E;

  /* --- Semantic --- */
  --color-success:  #16A34A;
  --color-error:    #DC2626;
  --color-warning:  #D97706;

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

  /* --- Shadows (cool-toned for slate surfaces) --- */
  --shadow-sm: 0 1px 2px oklch(0.15 0.01 240 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.15 0.01 240 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.15 0.01 240 / 0.12);

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

/* ============================================
   VERTUM DARK MODE
   ============================================ */
[data-theme="dark"] {
  --color-bg:               #0B1120;
  --color-surface:          #111827;
  --color-surface-2:        #1E293B;
  --color-surface-offset:   #1E293B;
  --color-surface-offset-2: #334155;
  --color-surface-dynamic:  #1E293B;
  --color-divider:          oklch(from #F8FAFC l c h / 0.08);
  --color-border:           oklch(from #F8FAFC l c h / 0.12);

  --color-text:           #E2E8F0;
  --color-text-muted:     #94A3B8;
  --color-text-faint:     #64748B;
  --color-text-inverse:   #111827;

  --color-primary:          #14B8A6;
  --color-primary-hover:    #2DD4BF;
  --color-primary-active:   #5EEAD4;
  --color-primary-highlight: color-mix(in oklch, #14B8A6 12%, #111827);

  --color-accent:           #F59E0B;
  --color-accent-hover:     #FBBF24;
  --color-accent-active:    #FCD34D;
  --color-accent-highlight: color-mix(in oklch, #F59E0B 12%, #111827);

  --color-secondary:        #2DD4BF;
  --color-secondary-hover:  #5EEAD4;
  --color-secondary-active: #99F6E4;

  --color-success:  #4ADE80;
  --color-error:    #F87171;
  --color-warning:  #FBBF24;

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

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:               #0B1120;
    --color-surface:          #111827;
    --color-surface-2:        #1E293B;
    --color-surface-offset:   #1E293B;
    --color-surface-offset-2: #334155;
    --color-surface-dynamic:  #1E293B;
    --color-divider:          oklch(from #F8FAFC l c h / 0.08);
    --color-border:           oklch(from #F8FAFC l c h / 0.12);
    --color-text:           #E2E8F0;
    --color-text-muted:     #94A3B8;
    --color-text-faint:     #64748B;
    --color-text-inverse:   #111827;
    --color-primary:          #14B8A6;
    --color-primary-hover:    #2DD4BF;
    --color-primary-active:   #5EEAD4;
    --color-primary-highlight: color-mix(in oklch, #14B8A6 12%, #111827);
    --color-accent:           #F59E0B;
    --color-accent-hover:     #FBBF24;
    --color-accent-active:    #FCD34D;
    --color-accent-highlight: color-mix(in oklch, #F59E0B 12%, #111827);
    --color-secondary:        #2DD4BF;
    --color-secondary-hover:  #5EEAD4;
    --color-secondary-active: #99F6E4;
    --color-success:  #4ADE80;
    --color-error:    #F87171;
    --color-warning:  #FBBF24;
    --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);
  }
}
