/* ==========================================================================
   Kindling Insights — Design System
   Dark mode only. All tokens live on :root.
   See branding.md for usage rules and index.html for live examples.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&display=swap");

:root {
  color-scheme: dark;

  /* ------------------------------------------------------------------
     Brand colors (from the logo gradient — use as-is, never recolor)
     ------------------------------------------------------------------ */
  --brand-yellow: #ffda62; /* Spark   */
  --brand-orange: #ff6f00; /* Flame   */
  --brand-magenta: #a32393; /* Ember — PRIMARY */
  --brand-plum: #3b0049; /* Coal    */

  /* ------------------------------------------------------------------
     Gradients — the logo IS a gradient, so gradients are core brand.
     Always flow light-to-dark: yellow → orange → magenta → plum.
     Never reverse the order or add off-brand stops.
     ------------------------------------------------------------------ */

  /* Full logo gradient. Large decorative fills, bands, art. */
  --gradient-kindling: linear-gradient(
    135deg,
    #ffda62 0%,
    #ff6f00 35%,
    #a32393 70%,
    #3b0049 100%
  );

  /* Wordmark gradient (no plum — plum vanishes on dark bg).
     Gradient text, rules, borders, progress bars. 90deg = left to right. */
  --gradient-flame: linear-gradient(90deg, #ffda62 0%, #ff6f00 50%, #a32393 100%);
  /* Text version: ends on lifted magenta so every stop is ≥ 3:1 (display sizes only). */
  --gradient-flame-text: linear-gradient(90deg, #ffda62 0%, #ff6f00 50%, #b8309f 100%);

  /* Hot half — DARK text passes (≥ 7:1). Spark CTA, highlight chips. */
  --gradient-spark: linear-gradient(135deg, #ffda62 0%, #ff6f00 100%);

  /* Cool half — LIGHT text passes (≥ 4.6:1). Primary buttons, plum bands. */
  --gradient-ember: linear-gradient(135deg, #b8309f 0%, #a32393 45%, #7d1580 100%);
  --gradient-ember-hover: linear-gradient(135deg, #c63aad 0%, #b02a9f 45%, #8a1a8c 100%);

  /* Section backgrounds — light text safe over the whole area. */
  --gradient-dusk: linear-gradient(180deg, #3b0049 0%, #1b1020 100%);
  --gradient-hearth:
    radial-gradient(70% 90% at 50% 110%, rgba(255, 111, 0, 0.32) 0%, rgba(163, 35, 147, 0.22) 45%, rgba(59, 0, 73, 0) 75%),
    #1f0a26;

  /* Ambient glows — layer behind content, never behind body copy at full strength. */
  --gradient-glow: radial-gradient(60% 60% at 50% 0%, rgba(163, 35, 147, 0.28) 0%, rgba(59, 0, 73, 0) 100%);
  --gradient-glow-warm: radial-gradient(50% 50% at 80% 20%, rgba(255, 111, 0, 0.18) 0%, rgba(255, 111, 0, 0) 100%);
  /* Ember bed: warm light rising from a bottom edge (hero, under sparks). */
  --gradient-embers: radial-gradient(
    55% 60% at 50% 100%,
    rgba(255, 111, 0, 0.26) 0%,
    rgba(163, 35, 147, 0.16) 45%,
    rgba(59, 0, 73, 0) 80%
  );

  /* Film grain. Layer at ~0.05–0.08 opacity with mix-blend-mode: overlay. */
  --texture-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");

  /* Sequential data scale (heatmaps, choropleths, ordered categories).
     All steps ≥ 3:1 on --color-bg; plum excluded for that reason. */
  --seq-1: #ffda62;
  --seq-2: #ffa531;
  --seq-3: #ff6f00;
  --seq-4: #d1494a;
  --seq-5: #b8309f;
  --gradient-seq: linear-gradient(90deg, var(--seq-1), var(--seq-2), var(--seq-3), var(--seq-4), var(--seq-5));

  /* ------------------------------------------------------------------
     Backgrounds & surfaces (60% + 30%) — plum-tinted, never pure black
     ------------------------------------------------------------------ */
  --color-bg: #120a14;
  --color-surface: #1b1020;
  --color-surface-2: #25172b;
  --color-surface-plum: #3b0049; /* feature bands, footer */

  /* Borders — luminance borders, still tinted */
  --color-border: #3a2843;
  --color-border-strong: #5a4168;

  /* Text — warm off-white hierarchy (contrast vs --color-bg) */
  --color-text: #f6eef3; /* 17.1:1 */
  --color-text-2: #cdbacb; /* 10.6:1 */
  --color-text-muted: #a08a9f; /*  6.1:1 */
  --color-text-on-brand: #f6eef3; /* 5.7:1 on --color-brand */

  /* Brand roles (10%) */
  --color-brand: var(--brand-magenta); /* fills only — 2.98:1 as text, too low */
  --color-brand-hover: #b82da7; /* 4.6:1 with --color-text-on-brand */
  --color-brand-text: #e583d6; /* brand-colored text & links — 7.9:1 */
  --color-brand-subtle: #2c1231; /* badge / highlight background */
  --color-accent: var(--brand-orange); /* secondary highlight — 7.0:1 */
  --color-highlight: var(--brand-yellow); /* sparing emphasis — 14.3:1 */

  /* Interactive states */
  --color-hover: #22152a;
  --color-active: #2c1b35;
  --color-focus-ring: rgba(229, 131, 214, 0.55);

  /* Semantic */
  --color-success: #5bd9a0;
  --color-warning: #ffb547;
  --color-danger: #ff6f7f;

  /* Shadows — real depth + tinted luminance ring */
  --shadow-sm: 0 0 0 1px rgba(229, 131, 214, 0.08);
  --shadow-md: 0 4px 20px rgba(8, 2, 10, 0.45), 0 0 0 1px rgba(229, 131, 214, 0.07);
  --shadow-lg: 0 12px 48px rgba(8, 2, 10, 0.55), 0 0 0 1px rgba(229, 131, 214, 0.1);
  --shadow-glow: 0 8px 32px rgba(163, 35, 147, 0.35), 0 0 0 1px rgba(229, 131, 214, 0.18);

  /* ------------------------------------------------------------------
     Data visualization accents (all ≥ 6:1 on --color-bg)
     Order matters: brand-led first, cool contrast after.
     ------------------------------------------------------------------ */
  --accent-1: #ff7a1a; /* Flame    — 25°  */
  --accent-2: #e05acd; /* Ember    — 309° */
  --accent-3: #ffda62; /* Spark    — 45°  */
  --accent-4: #33cfe6; /* Sky      — 188° */
  --accent-5: #a587ff; /* Iris     — 255° */
  --accent-6: #62de9c; /* Mint     — 148° */
  --accent-7: #ff6f8e; /* Rose     — 347° */
  --accent-8: #5f95ff; /* Cobalt   — 220° */

  --accent-1-fill: rgba(255, 122, 26, 0.15);
  --accent-2-fill: rgba(224, 90, 205, 0.15);
  --accent-3-fill: rgba(255, 218, 98, 0.15);
  --accent-4-fill: rgba(51, 207, 230, 0.15);
  --accent-5-fill: rgba(165, 135, 255, 0.15);
  --accent-6-fill: rgba(98, 222, 156, 0.15);
  --accent-7-fill: rgba(255, 111, 142, 0.15);
  --accent-8-fill: rgba(95, 149, 255, 0.15);

  /* ------------------------------------------------------------------
     Typography — Montserrat only, Regular (400) + Semibold (600)
     ------------------------------------------------------------------ */
  --font-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;

  --text-xs: 0.75rem; /* 12 — labels, eyebrows */
  --text-sm: 0.875rem; /* 14 — captions, meta */
  --text-base: 1rem; /* 16 — body */
  --text-lg: 1.25rem; /* 20 — lead / h5 */
  --text-xl: 1.5rem; /* 24 — h4 */
  --text-2xl: 2rem; /* 32 — h3 */
  --text-3xl: 2.5rem; /* 40 — h2 */
  --text-4xl: 3.25rem; /* 52 — h1 */
  --text-display: clamp(2.25rem, 1.5rem + 2.5vw, 3.75rem); /* 36–60 — display headlines (sentence-length) */
  --text-hero: clamp(2.75rem, 1.5rem + 4vw, 5rem); /* 44–80 — statement type, ≤ 5 words only */

  --leading-display: 1.04;
  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  --weight-normal: 400;
  --weight-semibold: 600;

  --tracking-tighter: -0.035em; /* hero-size type only */
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.12em; /* uppercase eyebrows, like the wordmark */

  /* ------------------------------------------------------------------
     Spacing — 8px grid (--space-N = N × 4px)
     ------------------------------------------------------------------ */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 760px;
  --prose-max: 65ch;
  --gutter: clamp(var(--space-4), 4vw, var(--space-8));
  --section-y: clamp(var(--space-16), 10vw, var(--space-32));

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
}

/* Small screens: step headings down so long titles don't dominate. */
@media (max-width: 560px) {
  :root {
    --text-4xl: 2.5rem; /* 40 — h1 */
    --text-3xl: 2rem; /* 32 — h2 */
    --text-2xl: 1.625rem; /* 26 — h3 */
    --text-xl: 1.375rem; /* 22 — h4 */
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text-2);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-relaxed);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4,
h5,
.h1,
.h2,
.h3,
.h4,
.h5 {
  margin: 0 0 var(--space-4);
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1,
.h1 {
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
}
h2,
.h2 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
}
h3,
.h3 {
  font-size: var(--text-2xl);
}
h4,
.h4 {
  font-size: var(--text-xl);
}
h5,
.h5 {
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-normal);
}

p {
  margin: 0 0 var(--space-4);
  text-wrap: pretty;
}

a {
  color: var(--color-brand-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover {
  color: var(--color-text);
}

strong {
  color: var(--color-text);
  font-weight: var(--weight-semibold);
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-12) 0;
}

/* ==========================================================================
   Layout
   ========================================================================== */

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

.section {
  padding-block: var(--section-y);
}
.section--surface {
  background: var(--color-surface);
}
.section--plum {
  background: var(--color-surface-plum);
}
.section--glow {
  background: var(--gradient-glow), var(--color-bg);
}
.section--dusk {
  background: var(--gradient-dusk);
}
.section--hearth {
  background: var(--gradient-hearth);
}

/* Full logo gradient as a fill. Decorative only — no text directly on it
   (no single text color passes across all four stops). Put text in a
   .card on top instead. */
.bg-kindling {
  background: var(--gradient-kindling);
}

.prose {
  max-width: var(--prose-max);
}

.stack > * + * {
  margin-top: var(--space-4);
}
.stack--lg > * + * {
  margin-top: var(--space-8);
}

.grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

/* ==========================================================================
   Typography helpers
   ========================================================================== */

.display {
  font-size: var(--text-display);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

.lead {
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  color: var(--color-text-2);
}

.eyebrow {
  display: inline-block;
  margin-bottom: var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-accent);
}

/* Display/heading sizes only (≥ 24px). Never body copy. */
.text-gradient {
  background: var(--gradient-flame-text);
  -webkit-box-decoration-break: clone; /* full gradient on every wrapped line */
  box-decoration-break: clone;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.text-primary {
  color: var(--color-text);
}
.text-secondary {
  color: var(--color-text-2);
}
.text-muted {
  color: var(--color-text-muted);
}
.text-brand {
  color: var(--color-brand-text);
}
.text-accent {
  color: var(--color-accent);
}
.text-highlight {
  color: var(--color-highlight);
}
.text-sm {
  font-size: var(--text-sm);
}
.text-xs {
  font-size: var(--text-xs);
}
.font-semibold {
  font-weight: var(--weight-semibold);
}

.bg-page {
  background: var(--color-bg);
}
.bg-surface {
  background: var(--color-surface);
}
.bg-surface-2 {
  background: var(--color-surface-2);
}
.bg-plum {
  background: var(--color-surface-plum);
}

/* ==========================================================================
   Buttons — primary / secondary / ghost
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}
.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--gradient-ember);
  color: var(--color-text-on-brand);
  box-shadow: var(--shadow-glow);
}
.btn--primary:hover {
  background: var(--gradient-ember-hover);
  color: var(--color-text-on-brand);
}

/* Spark — hottest CTA. Max one per page (hero or final CTA). */
.btn--spark {
  background: var(--gradient-spark);
  color: var(--color-bg);
  box-shadow: 0 8px 32px rgba(255, 111, 0, 0.3), 0 0 0 1px rgba(255, 218, 98, 0.3);
}
.btn--spark:hover {
  color: var(--color-bg);
  box-shadow: 0 10px 40px rgba(255, 111, 0, 0.45), 0 0 0 1px rgba(255, 218, 98, 0.5);
}

.btn--secondary {
  background: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn--secondary:hover {
  border-color: var(--color-brand-text);
  background: var(--color-hover);
  color: var(--color-text);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-2);
  padding-inline: var(--space-4);
}
.btn--ghost:hover {
  background: var(--color-hover);
  color: var(--color-text);
}

.btn--sm {
  min-height: 36px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}
.btn--lg {
  min-height: 56px;
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

/* ==========================================================================
   Cards — elevated / flat / inset
   ========================================================================== */

.card {
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text-2);
}
.card > :last-child {
  margin-bottom: 0;
}

.card--elevated {
  box-shadow: var(--shadow-md);
}
.card--flat {
  border: 1px solid var(--color-border);
}
.card--inset {
  background: var(--color-surface-2);
}
.card--feature {
  position: relative;
  border: 1px solid var(--color-border);
  transition:
    border-color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}
.card--feature:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-lg);
}

/* Gradient hairline border — for the one card that matters most. */
.card--gradient {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
    var(--gradient-flame) border-box;
  box-shadow: var(--shadow-glow);
}

/* Warm hairline — soft, lamp-lit edge for repeating card sets.
   A low-opacity Spark→Flame→Ember border brightest at the top-left (as if lit
   by a fire), plus a faint ember wash in that corner. Warm, never neon. */
.card--warm {
  border: 1px solid transparent;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 140, 50, 0.07), transparent 60%) padding-box,
    linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
    linear-gradient(
        150deg,
        rgba(255, 218, 98, 0.32),
        rgba(255, 111, 0, 0.16) 40%,
        rgba(163, 35, 147, 0.12) 75%,
        rgba(163, 35, 147, 0.06)
      )
      border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 218, 98, 0.05),
    0 12px 32px -16px rgba(255, 111, 0, 0.18);
}

/* Flame top rule — quieter gradient accent for card sets. */
.card--topline {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.card--topline::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--gradient-flame);
}

.card__icon {
  display: grid;
  place-items: center;
  width: var(--space-12);
  height: var(--space-12);
  margin-bottom: var(--space-6);
  border-radius: var(--radius-md);
  background: var(--color-brand-subtle);
  color: var(--color-brand-text);
}
.card__icon--gradient {
  background: var(--gradient-kindling);
  color: var(--color-text);
}
.card__icon--gold {
  /* Matte amber: tonal chip, no gradient or glow. Icon 8:1 on chip. */
  border: 1px solid rgba(255, 190, 100, 0.14);
  background: #3a2420;
  color: #e9b96a;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-brand-subtle);
  color: var(--color-brand-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-normal);
}
.badge--outline {
  background: transparent;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-2);
}
.badge--flame {
  background: var(--gradient-spark);
  color: var(--color-bg);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.field {
  display: grid;
  gap: var(--space-2);
}

.label {
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.hint {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  transition:
    border-color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}
.textarea {
  min-height: 128px;
  resize: vertical;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--color-text-muted);
}
.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--color-text-muted);
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--color-brand-text);
  box-shadow: 0 0 0 4px var(--color-brand-subtle);
}
.input:user-invalid,
.textarea:user-invalid {
  border-color: var(--color-danger);
}

/* ==========================================================================
   Marketing patterns
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--color-border);
  background: rgba(18, 10, 20, 0.82);
  backdrop-filter: blur(12px);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: 72px;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav__link {
  color: var(--color-text-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}
.nav__link:hover,
.nav__link[aria-current="page"] {
  color: var(--color-text);
}

.hero {
  padding-block: clamp(var(--space-20), 14vw, 160px) var(--section-y);
  background: var(--gradient-glow), var(--color-bg);
}

.divider-flame {
  height: 2px;
  margin: 0;
  border: 0;
  background: var(--gradient-flame);
}

.progress {
  height: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-flame);
}

.list-check {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.list-check li {
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
}
.list-check li::before {
  content: "";
  flex: none;
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-accent);
  transform: translateY(-2px);
}

.footer {
  padding-block: var(--space-16);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

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