/* ============================================================
   CORE.CSS — design tokens, reset, layout utilities
   Every template loads this first, then components.css,
   then (optionally) overrides tokens in its own <style> block.
   Theming: override the --c-* variables. theme.js can also
   set them live from URL params or postMessage.
   ============================================================ */

:root {
  /* ---- Color tokens (default: neutral SaaS blue) ---- */
  --c-primary: #2563eb;
  --c-secondary: #3b82f6;
  --c-cta: #f97316;
  --c-bg: #f8fafc;
  --c-text: #1e293b;

  /* ---- Derived colors (auto-computed from the 5 above) ---- */
  --c-surface: color-mix(in srgb, var(--c-bg) 60%, white);
  --c-surface-2: color-mix(in srgb, var(--c-bg) 88%, var(--c-text));
  --c-muted: color-mix(in srgb, var(--c-text) 62%, var(--c-bg));
  --c-border: color-mix(in srgb, var(--c-text) 14%, var(--c-bg));
  --c-primary-soft: color-mix(in srgb, var(--c-primary) 12%, var(--c-bg));
  --c-primary-dark: color-mix(in srgb, var(--c-primary) 80%, black);
  --c-cta-dark: color-mix(in srgb, var(--c-cta) 82%, black);
  --c-on-primary: #ffffff;
  --c-on-cta: #ffffff;

  /* ---- Typography ---- */
  --font-head: "Outfit", system-ui, sans-serif;
  --font-body: "Work Sans", system-ui, sans-serif;

  /* ---- Shape & depth ---- */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.08);
  --shadow: 0 8px 30px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 20px 50px rgb(0 0 0 / 0.16);

  /* ---- Rhythm ---- */
  --container: 1160px;
  --section-pad: clamp(4rem, 9vw, 7rem);
  --nav-h: 74px;
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
ul[class], ol[class] { list-style: none; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2.4rem, 5.5vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }

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

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--c-primary) 60%, transparent);
  outline-offset: 2px;
}

/* ============ Layout utilities ============ */
.container {
  width: min(var(--container), 100% - 3rem);
  margin-inline: auto;
}
.container--narrow { width: min(760px, 100% - 3rem); margin-inline: auto; }

.section { padding-block: var(--section-pad); }
.section--tight { padding-block: calc(var(--section-pad) * 0.55); }
.section--alt { background: var(--c-surface-2); }
.section--primary { background: var(--c-primary); color: var(--c-on-primary); }
.section--dark {
  background: color-mix(in srgb, var(--c-text) 94%, var(--c-primary));
  color: var(--c-bg);
}

.grid { display: grid; gap: 1.75rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

.flex { display: flex; gap: 1rem; }
.flex--center { align-items: center; }
.flex--between { justify-content: space-between; align-items: center; }
.flex--wrap { flex-wrap: wrap; }

.text-center { text-align: center; }
.text-muted { color: var(--c-muted); }
.text-primary { color: var(--c-primary); }

/* ============ Buttons & badges ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.9rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
  white-space: nowrap;
}
.btn--primary { background: var(--c-primary); color: var(--c-on-primary); }
.btn--primary:hover { background: var(--c-primary-dark); box-shadow: var(--shadow); }
.btn--cta { background: var(--c-cta); color: var(--c-on-cta); }
.btn--cta:hover { background: var(--c-cta-dark); box-shadow: var(--shadow); }
.btn--outline { border-color: currentColor; background: transparent; }
.btn--outline:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.btn--ghost { background: color-mix(in srgb, var(--c-primary) 10%, transparent); color: var(--c-primary); }
.btn--ghost:hover { background: color-mix(in srgb, var(--c-primary) 18%, transparent); }
.btn--lg { padding: 1.05rem 2.4rem; font-size: 1.08rem; border-radius: var(--radius-sm); }
.btn--sm { padding: 0.5rem 1.1rem; font-size: 0.9rem; }
.btn .icon { width: 1.15em; height: 1.15em; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--c-primary-soft);
  color: var(--c-primary);
}
.badge--cta { background: color-mix(in srgb, var(--c-cta) 14%, var(--c-bg)); color: var(--c-cta-dark); }
.badge--inverse { background: rgb(255 255 255 / 0.16); color: currentColor; }

/* ============ Icon helper ============ */
.icon { width: 24px; height: 24px; flex-shrink: 0; }
.icon--lg { width: 32px; height: 32px; }

/* ============ Scroll reveal ============ */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.12s; }
.reveal[data-delay="2"] { transition-delay: 0.24s; }
.reveal[data-delay="3"] { transition-delay: 0.36s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
