/* ============================================================
   XperServe — Design Tokens & Base Stylesheet
   Palette: Judicial navy + warm cream + teal accent
   Brand mark: red location pin w/ white checkmark (spot color)
   ============================================================ */

:root, [data-theme="light"] {
  /* 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(3rem, 0.5rem + 7vw, 6.5rem);

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

  /* Surfaces — warm cream */
  --color-bg:               #faf7f1;
  --color-surface:          #ffffff;
  --color-surface-2:        #f4efe6;
  --color-surface-offset:   #ebe4d4;
  --color-surface-offset-2: #ddd4bf;
  --color-divider:          #e3dccb;
  --color-border:           #cfc6b1;

  /* Text — deep ink */
  --color-text:         #1a2233;
  --color-text-muted:   #5c6377;
  --color-text-faint:   #9aa0b0;
  --color-text-inverse: #faf7f1;

  /* Primary — judicial navy */
  --color-primary:        #1a2c5b;
  --color-primary-hover:  #0f1d42;
  --color-primary-active: #091331;
  --color-primary-highlight: #d4d9e6;

  /* Accent — XperServe crimson (matches Serve wordmark) */
  --color-accent:        #B91C1C;
  --color-accent-hover:  #991818;
  --color-accent-active: #7C1313;
  --color-accent-highlight: #f4d5d5;

  /* Brand mark spot color — unified with crimson accent */
  --color-brand-pin: #B91C1C;

  /* Status colors */
  --color-success: #2f6b3c;
  --color-warning: #b8741b;
  --color-error:   #a52836;

  /* Gold (trust/certification highlights) */
  --color-gold: #b88824;

  /* Radius */
  --radius-sm: 0.25rem;
  --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 */
  --shadow-sm: 0 1px 2px rgba(26, 34, 51, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 34, 51, 0.10);
  --shadow-lg: 0 12px 32px rgba(26, 34, 51, 0.14);
  --shadow-xl: 0 24px 60px rgba(26, 34, 51, 0.20);

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

  /* Fonts */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body:    'Inter', 'Helvetica Neue', sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', monospace;
}

[data-theme="dark"] {
  --color-bg:               #0e1422;
  --color-surface:          #131a2c;
  --color-surface-2:        #1a2236;
  --color-surface-offset:   #1f2840;
  --color-surface-offset-2: #29324c;
  --color-divider:          #232c44;
  --color-border:           #364162;

  --color-text:         #e9e6dc;
  --color-text-muted:   #9aa0b8;
  --color-text-faint:   #5e6584;
  --color-text-inverse: #0e1422;

  --color-primary:           #6f8ed1;
  --color-primary-hover:     #8aa6e0;
  --color-primary-active:    #aabde9;
  --color-primary-highlight: #2a3759;

  --color-accent:        #E04545;
  --color-accent-hover:  #ec6464;
  --color-accent-active: #f28585;
  --color-accent-highlight: #4a1a1a;

  --color-brand-pin: #E04545;

  --color-gold: #d9a747;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:               #0e1422;
    --color-surface:          #131a2c;
    --color-surface-2:        #1a2236;
    --color-surface-offset:   #1f2840;
    --color-surface-offset-2: #29324c;
    --color-divider:          #232c44;
    --color-border:           #364162;
    --color-text:         #e9e6dc;
    --color-text-muted:   #9aa0b8;
    --color-text-faint:   #5e6584;
    --color-text-inverse: #0e1422;
    --color-primary:           #6f8ed1;
    --color-primary-hover:     #8aa6e0;
    --color-primary-active:    #aabde9;
    --color-primary-highlight: #2a3759;
    --color-accent:        #E04545;
    --color-accent-hover:  #ec6464;
    --color-accent-active: #f28585;
    --color-accent-highlight: #4a1a1a;
    --color-brand-pin: #E04545;
    --color-gold: #d9a747;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
    --shadow-xl: 0 24px 60px rgba(0,0,0,0.6);
  }
}

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

html {
  -webkit-text-size-adjust: none;
  -moz-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: var(--space-20);
  hanging-punctuation: first last;
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* room for sticky mobile CTA */
  padding-bottom: 64px;
}
@media (min-width: 768px) { body { padding-bottom: 0; } }

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 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.1;
  text-wrap: balance;
  color: var(--color-text);
}
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: var(--color-accent-highlight); color: var(--color-text); }

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

button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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