/* =========================================================================
   EWA Base — reset, typography, container, grid utilities
   Vercel-inspired: shadow-as-border, gallery whitespace, Geist
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html:focus-within { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: var(--font-features);
  text-rendering: optimizeLegibility;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: var(--tracking-h1);
  color: var(--text-1);
}
h1 { font-size: var(--text-h1); letter-spacing: var(--tracking-h1); }
h2 { font-size: var(--text-h2); letter-spacing: var(--tracking-h2); line-height: 1.2; }
h3 { font-size: var(--text-h3); letter-spacing: -0.02em; line-height: 1.3; }
h4 { font-size: var(--text-h4); letter-spacing: -0.01em; line-height: 1.4; }
p { margin: 0; }
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
strong, b { font-weight: 600; color: var(--text-1); }
em { font-style: normal; }

::selection {
  background: var(--text-selection);
  color: var(--text-1);
}

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

/* ---- Layout primitives ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
.container-narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--section-pad-y); }
.section-tight { padding-block: var(--space-9); }

/* ---- Mono utility (industrial signature) ---- */
.mono {
  font-family: var(--font-mono);
  font-feature-settings: var(--font-features);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* ---- Section number / overline ---- */
.section-num {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: var(--tracking-mono);
  color: var(--text-3);
  text-transform: uppercase;
}

/* ---- Eyebrow / kicker (mono uppercase technical label) ---- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: var(--tracking-mono);
  color: var(--text-2);
  text-transform: uppercase;
}
.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--text-3);
}

/* ---- Grid system ---- */
.grid {
  display: grid;
  gap: var(--grid-gap);
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-12 { grid-template-columns: repeat(12, 1fr); }

/* ---- Surface / card (shadow-as-border) ---- */
.surface {
  background: var(--bg-card);
  box-shadow: var(--shadow-border);
  border-radius: var(--radius-lg);
  transition: box-shadow var(--dur-base) var(--ease-out);
}
.surface-2 {
  background: var(--bg-tint);
  box-shadow: var(--shadow-border-light);
  border-radius: var(--radius-lg);
}

/* ---- Pills (full-pill, tinted background) ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: var(--tracking-mono);
  background: var(--bg-tint);
  color: var(--text-2);
  text-transform: uppercase;
  box-shadow: var(--shadow-border);
}
.pill.mono { letter-spacing: 0; text-transform: none; }
.pill-accent {
  background: var(--badge-bg);
  color: var(--badge-text);
  box-shadow: none;
}

/* ---- Buttons (Vercel system: dark primary, ghost secondary) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  border: none;
  transition: background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 500;
  box-shadow: var(--shadow-border);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--bg-page);
  color: var(--text-1);
  box-shadow: var(--shadow-border);
}
.btn-secondary:hover {
  background: var(--bg-tint);
}
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding-inline: 10px;
  box-shadow: none;
}
.btn-ghost:hover { color: var(--text-1); }

.btn-lg {
  padding: 12px 22px;
  font-size: var(--text-body);
  border-radius: var(--radius-md);
}

/* ---- Text helpers ---- */
.text-accent { color: var(--text-1); font-weight: 600; }
.text-1 { color: var(--text-1); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-4 { color: var(--text-4); }
.text-mega {
  font-size: var(--text-mega);
  font-weight: 600;
  letter-spacing: var(--tracking-mega);
  line-height: 1.0;
}
.text-display {
  font-size: var(--text-display);
  font-weight: 600;
  letter-spacing: var(--tracking-display);
  line-height: 1.05;
}
.lede {
  font-size: var(--text-h4);
  color: var(--text-2);
  line-height: 1.6;
}

/* ---- Animated reveal ---- */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity var(--dur-slow) var(--ease-out),
                transform var(--dur-slow) var(--ease-out);
  }
  .reveal.in {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Mobile responsive grid fallback ---- */
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---- Focus visibility (Vercel blue ring) ---- */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}
