/* ==========================================================================
   Base — Reset, Typography, Utilities
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: var(--c-text-link);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

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

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--c-text);
}

h1 { font-size: var(--fs-5xl); font-weight: var(--fw-extrabold); }
h2 { font-size: var(--fs-4xl); }
h3 { font-size: var(--fs-3xl); }
h4 { font-size: var(--fs-2xl); }
h5 { font-size: var(--fs-xl); }
h6 { font-size: var(--fs-lg); }

p { margin-bottom: var(--sp-4); color: var(--c-text-secondary); }
p:last-child { margin-bottom: 0; }

ul, ol { padding-left: var(--sp-6); }
li { margin-bottom: var(--sp-2); color: var(--c-text-secondary); }

::selection {
  background: var(--c-primary-200);
  color: var(--c-primary-900);
}

/* ── Skip Link ─────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: calc(var(--z-toast) + 1);
  padding: var(--sp-3) var(--sp-6);
  background: var(--c-primary-700);
  color: var(--c-text-inverse);
  font-weight: var(--fw-semibold);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus {
  top: 0;
  outline: 3px solid var(--c-primary-500);
  outline-offset: 2px;
}

/* ── Focus Visible ─────────────────────────────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--c-primary-500);
  outline-offset: 2px;
}

/* ── 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: 0;
}

/* ── Container ─────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-5);
}

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

/* ── Section ───────────────────────────────────────────────────────────── */
.section {
  padding: var(--section-py-mobile) 0;
}

@media (min-width: 1024px) {
  .section { padding: var(--section-py) 0; }
}

/* ── Grid ──────────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ── Section Header ────────────────────────────────────────────────────── */
.section-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto var(--sp-12);
}

.section-header__tag {
  display: inline-block;
  padding: var(--sp-1) var(--sp-4);
  background: var(--c-primary-50);
  color: var(--c-primary-600);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  border-radius: var(--radius-full);
  margin-bottom: var(--sp-4);
}

.section-header h2 {
  margin-bottom: var(--sp-4);
}

.section-header p {
  font-size: var(--fs-lg);
  color: var(--c-text-secondary);
  line-height: var(--lh-relaxed);
}

/* ── Text Utilities ────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-muted { color: var(--c-text-muted); }
.text-primary { color: var(--c-primary-500); }
.text-inverse { color: var(--c-text-inverse); }
.text-sm { font-size: var(--fs-sm); }
.text-lg { font-size: var(--fs-lg); }
.text-xl { font-size: var(--fs-xl); }

/* ── Spacing Utilities ─────────────────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--sp-4); }
.mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-8 { margin-bottom: var(--sp-8); }

/* ── Flex Utilities ────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

/* ── Animation ─────────────────────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-in, .fade-in-left, .fade-in-right {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
