/* ============================================================
   Base reset + global element styles
   Requires: tokens.css loaded first
   ============================================================ */

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* ── BODY ────────────────────────────────────────────────── */
body {
  font-family: var(--font-base);
  font-size: var(--text-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-relaxed);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── HEADINGS ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  color: var(--c-text);
  overflow-wrap: break-word;
}
h1 { font-size: var(--text-5xl); font-weight: var(--fw-extrabold); }
h2 { font-size: var(--text-4xl); font-weight: var(--fw-bold); }
h3 { font-size: var(--text-3xl); font-weight: var(--fw-bold); }
h4 { font-size: var(--text-2xl); font-weight: var(--fw-semibold); }
h5 { font-size: var(--text-xl);  font-weight: var(--fw-semibold); }
h6 { font-size: var(--text-lg);  font-weight: var(--fw-semibold); }

/* ── MEDIA ───────────────────────────────────────────────── */
img, picture, svg, video { display: block; max-width: 100%; height: auto; }

/* ── LINKS ───────────────────────────────────────────────── */
a {
  color: var(--c-primary);
  text-decoration: none;
  transition: color var(--ease-fast);
}
a:hover { color: var(--c-primary-dark); }

/* ── LAYOUT ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--mid    { max-width: var(--max-width-mid); }
.container--narrow { max-width: var(--max-width-narrow); }

/* ── SECTIONS ────────────────────────────────────────────── */
.section {
  padding-block: var(--section-pad);
}
.section--blue {
  background: var(--c-primary);
  color: var(--c-text-inv);
}
.section--blue :is(h1, h2, h3, h4, h5, h6) { color: var(--c-text-inv); }
.section--blue a { color: #fff; }
.section--surface { background: var(--c-surface); }
.section--surface-blue { background: var(--c-surface-blue); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--btn-pad);
  border-radius: var(--btn-radius);
  font-family: var(--font-base);
  font-size: var(--text-base);
  font-weight: var(--btn-fw);
  line-height: 1;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--ease-fast), color var(--ease-fast),
              box-shadow var(--ease-fast), transform var(--ease-fast);
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 3px;
}

/* CTA — жовта, головна дія (одна на екрані) */
.btn--cta {
  background: var(--c-accent);
  color: var(--c-accent-text);
  box-shadow: var(--shadow-accent);
}
.btn--cta:hover {
  background: var(--c-accent-dark);
  color: var(--c-accent-text);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(252,210,20,.55);
}

/* Primary — синя */
.btn--primary {
  background: var(--c-primary);
  color: var(--c-text-inv);
}
.btn--primary:hover {
  background: var(--c-primary-dark);
  color: var(--c-text-inv);
  box-shadow: var(--shadow-primary);
}

/* Ghost — прозора */
.btn--ghost {
  background: transparent;
  color: var(--c-primary);
  border-color: var(--c-primary);
}
.btn--ghost:hover {
  background: var(--c-surface-blue);
  color: var(--c-primary-dark);
}

/* Ghost on dark bg */
.btn--ghost-inv {
  background: transparent;
  color: var(--c-text-inv);
  border-color: rgba(255,255,255,.6);
}
.btn--ghost-inv:hover {
  background: rgba(255,255,255,.12);
  color: var(--c-text-inv);
  border-color: #fff;
}

/* Large variant */
.btn--lg { padding: var(--btn-pad-lg); font-size: var(--text-lg); }

/* Full-width (funnel) */
.btn--full { width: 100%; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
}
.badge--accent  { background: var(--c-accent); color: var(--c-accent-text); }
.badge--primary { background: var(--c-primary); color: var(--c-text-inv); }
.badge--surface { background: var(--c-surface); color: var(--c-text-2); }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow var(--ease-base), transform var(--ease-base);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card__body { padding: var(--sp-6); }
.card__body--lg { padding: var(--sp-8); }

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

/* ── UTILS ───────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted   { color: var(--c-text-muted); }
.text-inv     { color: var(--c-text-inv); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
  .section { padding-block: var(--section-pad-mobile); }
}
@media (max-width: 480px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
}

/* ── REDUCED MOTION ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
