/* ============================================================
   BASE.CSS — Magnolia Home Response
   Design tokens, reset, responsive framework
   ============================================================ */

/* --- DESIGN TOKENS --- */
:root {
  /* Type Scale (fluid clamp) */
  --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, 1.05rem + 0.5vw,  1.375rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 1.75rem);
  --text-2xl:  clamp(2rem,     1.5rem  + 2vw,    2.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;

  /* Font Families */
  --font-body:    'Plus Jakarta Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Helvetica Neue', Arial, sans-serif;

  /* Content Widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
}

/* --- LIGHT MODE (default) --- */
:root, [data-theme="light"] {
  /* Primary — Deep Navy */
  --color-primary:        #1B3A5C;
  --color-primary-hover:  #152E4A;
  --color-primary-active: #0F2238;
  --color-primary-light:  #E8EDF3;

  /* Accent — Warm Amber/Orange for CTAs */
  --color-accent:         #D97B0D;
  --color-accent-hover:   #C06A08;
  --color-accent-active:  #A35A06;
  --color-accent-light:   #FFF3E0;

  /* Surfaces */
  --color-bg:             #FFFFFF;
  --color-surface:        #F8F9FA;
  --color-surface-2:      #F1F3F5;
  --color-surface-offset: #EDF0F3;
  --color-divider:        #DEE2E6;
  --color-border:         #CED4DA;

  /* Text */
  --color-text:           #1A1A1A;
  --color-text-secondary: #4A5568;
  --color-text-muted:     #718096;
  --color-text-faint:     #A0AEC0;
  --color-text-inverse:   #FFFFFF;

  /* Semantic */
  --color-success:        #2D8A4E;
  --color-warning:        #D97B0D;
  --color-error:          #C53030;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg:  0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
}

/* --- DARK MODE --- */
[data-theme="dark"] {
  --color-primary:        #5B8DB8;
  --color-primary-hover:  #7BA8CC;
  --color-primary-active: #9BC3E0;
  --color-primary-light:  #1E2A38;

  --color-accent:         #F0A040;
  --color-accent-hover:   #F5B565;
  --color-accent-active:  #F8C78A;
  --color-accent-light:   #2A2318;

  --color-bg:             #111318;
  --color-surface:        #181B22;
  --color-surface-2:      #1F2330;
  --color-surface-offset: #252A38;
  --color-divider:        #2D3348;
  --color-border:         #3A4158;

  --color-text:           #E2E4E8;
  --color-text-secondary: #B0B8C4;
  --color-text-muted:     #8892A0;
  --color-text-faint:     #5A6478;
  --color-text-inverse:   #111318;

  --color-success:        #4CAF7A;
  --color-warning:        #F0A040;
  --color-error:          #E86060;

  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.15);
  --shadow-lg:  0 10px 25px rgba(0, 0, 0, 0.3), 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-primary:        #5B8DB8;
    --color-primary-hover:  #7BA8CC;
    --color-primary-active: #9BC3E0;
    --color-primary-light:  #1E2A38;

    --color-accent:         #F0A040;
    --color-accent-hover:   #F5B565;
    --color-accent-active:  #F8C78A;
    --color-accent-light:   #2A2318;

    --color-bg:             #111318;
    --color-surface:        #181B22;
    --color-surface-2:      #1F2330;
    --color-surface-offset: #252A38;
    --color-divider:        #2D3348;
    --color-border:         #3A4158;

    --color-text:           #E2E4E8;
    --color-text-secondary: #B0B8C4;
    --color-text-muted:     #8892A0;
    --color-text-faint:     #5A6478;
    --color-text-inverse:   #111318;

    --color-success:        #4CAF7A;
    --color-warning:        #F0A040;
    --color-error:          #E86060;

    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
    --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.15);
    --shadow-lg:  0 10px 25px rgba(0, 0, 0, 0.3), 0 4px 10px rgba(0, 0, 0, 0.2);
  }
}

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

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;
  scroll-padding-top: 80px;
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--color-text);
  background-color: var(--color-bg);
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

ul[role="list"], ol[role="list"] {
  list-style: none;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.2;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--color-text);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

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

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-hover);
}

::selection {
  background: rgba(27, 58, 92, 0.2);
  color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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

button {
  cursor: pointer;
  background: none;
  border: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

a, button, [role="button"], input, textarea, select {
  transition: color var(--transition-fast),
              background var(--transition-fast),
              border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

/* --- UTILITY CLASSES --- */
.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;
}

.container {
  width: 100%;
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-8);
  }
}

/* --- RESPONSIVE BREAKPOINTS REFERENCE ---
   Mobile:  < 640px
   Tablet:  640px - 1023px
   Desktop: 1024px+
   Wide:    1200px+
   ---------------------------------------- */
