/* ==========================================================================
   1. FONTS — self-hosted, variable, latin subset only (zero external requests)
   ========================================================================== */

@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url('../assets/fonts/Baloo2-Variable.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 380 720;
  font-display: swap;
  src: url('../assets/fonts/Inter-Variable.woff2') format('woff2');
}

/* ==========================================================================
   2. DESIGN TOKENS — Convita Color System (authoritative, exact hex)
   ========================================================================== */

:root {
  /* Brand */
  --color-brand: #1B8A5A;          /* Sprout Green — primary buttons, large/bold headings, icons */
  --color-brand-text: #187D52;     /* Sprout Green, darkened for small/regular text — clears 4.5:1 AA on cream/white/mist (base #1B8A5A only clears AA-large) */
  --color-brand-tint: #E6F7EF;     /* Sprout Mist — card backgrounds, selected fills */
  --color-accent: #FF6B35;         /* Papaya — CTA highlights, icons/large text ONLY */
  --color-gamify: #7C3AED;         /* Zest Purple — badge/achievement moments */
  --color-badge-gold: #FBBF24;     /* Trophy Gold — badge bg/border only, never text */
  --color-fits: #2FA84F;           /* Fits Green — positive/"fits" state */
  --color-caution: #D97706;        /* Caution Amber */
  --color-alert: #DC2626;          /* Alert Red */

  /* Neutrals */
  --color-bg: #FEFBE8;             /* Warm Cream — page background */
  --color-surface: #FFFFFF;        /* Pure White — cards/sheets */
  --color-text: #1F2937;           /* Charcoal — body text, ~14:1 on Warm Cream */
  --color-text-secondary: #6B7280; /* Slate — secondary/meta text */
  --color-border: #E5E7EB;         /* Mist Gray — dividers, borders */

  /* Logo-mark accents (echoed sparingly outside the PNGs themselves) */
  --color-logo-leaf: #718C5F;
  --color-logo-heart: #EE784A;

  /* Typography */
  --font-display: 'Baloo 2', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --text-display: 700 2rem/2.5rem var(--font-display);
  --text-h1: 700 1.75rem/2.125rem var(--font-display);
  --text-h2: 600 1.375rem/1.75rem var(--font-display);
  --text-h3: 700 1.125rem/1.5rem var(--font-body);
  --text-body: 400 1rem/1.5rem var(--font-body);
  --text-body-sm: 400 0.875rem/1.25rem var(--font-body);
  --text-caption: 500 0.75rem/1rem var(--font-body);

  /* Spacing — 4px base grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  /* Shape */
  --radius-card: 16px;
  --radius-button: 12px;
  --radius-pill: 999px;

  /* Effects */
  --shadow-card: 0 1px 2px rgba(31, 41, 55, 0.04), 0 8px 24px rgba(31, 41, 55, 0.06);
}

/* ==========================================================================
   3. RESET
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, picture, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, button, textarea, select { font: inherit; }

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

/* ==========================================================================
   4. BASE TYPOGRAPHY
   ========================================================================== */

html, body {
  overflow-x: hidden;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

h1 { font: var(--text-h1); }
h2 { font: var(--text-h2); }
h3 { font: var(--text-h3); }
p { font: var(--text-body); }

.eyebrow {
  font: var(--text-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-brand-text);
}

/* ==========================================================================
   5. LAYOUT PRIMITIVES
   ========================================================================== */

.container {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section {
  padding-block: var(--space-12);
}

.section--tight { padding-block: var(--space-8); }

.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--space-4); }

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

.grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

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

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

.text-center { text-align: center; }
.text-secondary { color: var(--color-text-secondary); }

/* Visually hidden until focused (skip link) */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 100;
  background: var(--color-brand);
  color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-button);
  font: var(--text-body-sm);
  font-weight: 600;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: var(--space-4);
}

/* Focus visibility across the site */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--color-gamify);
  outline-offset: 2px;
  border-radius: var(--radius-button);
}

/* ==========================================================================
   6. COMPONENTS
   ========================================================================== */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-button);
  font: var(--text-body);
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn--primary {
  background: var(--color-brand);
  color: #fff;
}
.btn--primary:hover { background: #157048; }

.btn--outline {
  background: transparent;
  color: var(--color-brand-text);
  border: 1.5px solid var(--color-brand);
}
.btn--outline:hover { background: var(--color-brand-tint); }

/* --- Site header / nav --- */
.site-header {
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
}

.nav__brand img.logo-mark { height: 36px; width: auto; }
.nav__brand img.wordmark { height: 22px; width: auto; }

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav__links a {
  font: var(--text-body-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--color-brand-text); }

/* --- Hero --- */
.hero {
  padding-block: var(--space-16) var(--space-12);
  text-align: center;
}

.hero__mark {
  width: 72px;
  height: auto;
  margin-inline: auto;
  margin-bottom: var(--space-6);
}

.tagline {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font: var(--text-caption);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand-text);
  margin-bottom: var(--space-4);
}

.tagline .dot {
  color: var(--color-accent);
  font-weight: 700;
}

.hero h1 {
  font: var(--text-display);
  max-width: 20ch;
  margin-inline: auto;
  margin-bottom: var(--space-4);
}

.hero__sub {
  font: var(--text-body);
  color: var(--color-text-secondary);
  max-width: 56ch;
  margin-inline: auto;
  margin-bottom: var(--space-8);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
}

/* --- Store badges (placeholder links) --- */
.store-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-2) var(--space-4);
  background: var(--color-text);
  color: #fff;
  border-radius: var(--radius-button);
}

.store-badge__icon { width: 22px; height: 22px; flex-shrink: 0; }

.store-badge__label {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.15;
}

.store-badge__label small { font-size: 0.65rem; color: #D1D5DB; }
.store-badge__label strong { font-size: 0.95rem; font-weight: 600; }

.coming-soon-note {
  font: var(--text-caption);
  color: var(--color-text-secondary);
  margin-top: var(--space-3);
}

/* --- Pillar cards --- */
.pillar-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
}

.pillar-card__icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-button);
  background: var(--color-brand-tint);
  color: var(--color-brand);
  margin-bottom: var(--space-4);
}

.pillar-card h3 { margin-bottom: var(--space-2); }
.pillar-card p { color: var(--color-text-secondary); }
.pillar-card p + p { margin-top: var(--space-2); }

.pillar-card strong { color: var(--color-text); }

/* --- Carousel (progressive enhancement over the pillar cards) ---
   No-JS fallback: track wraps like a normal card grid. JS adds
   .carousel--active, which switches the track to a sliding single-card view. */
.carousel__track {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.carousel__slide {
  flex: 1 1 260px;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

/* Flat, fairly strong overlay (not a gradient) so text stays readable
   everywhere on the card regardless of how bright the photo underneath is. */
.carousel__slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(31, 37, 33, 0.65);
  z-index: 0;
}

.carousel__slide > * {
  position: relative;
  z-index: 1;
}

.carousel__slide h3,
.carousel__slide strong {
  color: #FFFFFF;
}

.carousel__slide p {
  color: rgba(255, 255, 255, 0.92);
}

.carousel__slide:nth-child(1) { background-image: url('../assets/carousel/security.jpg'); }
.carousel__slide:nth-child(2) { background-image: url('../assets/carousel/customize.jpg'); }
.carousel__slide:nth-child(3) { background-image: url('../assets/carousel/track.jpg'); }
.carousel__slide:nth-child(4) { background-image: url('../assets/carousel/trusted-data.jpg'); }

.carousel__nav { display: none; }

.carousel--active .carousel__viewport {
  overflow: hidden;
}

.carousel--active .carousel__track {
  flex-wrap: nowrap;
  gap: 0;
  transition: transform 0.4s ease;
}

.carousel--active .carousel__slide {
  flex: 0 0 100%;
  padding-inline: var(--space-2);
}

.carousel--active .carousel__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.carousel__arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-brand-text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}
.carousel__arrow:hover { background: var(--color-brand-tint); }

.carousel__dots {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.carousel__dot {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.carousel__dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background-color 0.2s ease, width 0.2s ease;
}

.carousel__dot[aria-selected="true"]::before {
  background: var(--color-brand);
  width: 20px;
  border-radius: var(--radius-pill);
}

@media (min-width: 640px) {
  .carousel--active .carousel__slide { padding-inline: var(--space-8); }
}

/* --- How it works --- */
.steps {
  counter-reset: step;
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

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

.step {
  position: relative;
  padding-top: var(--space-12);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-brand);
  color: #fff;
  font: var(--text-body-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step p { color: var(--color-text-secondary); }

/* --- Trust / privacy section --- */
.trust-section {
  background: var(--color-brand-tint);
  border-radius: var(--radius-card);
  padding: var(--space-8);
}

.trust-section h2 { margin-bottom: var(--space-4); }
.trust-section p { color: var(--color-text); margin-bottom: var(--space-3); max-width: 65ch; }
.trust-section p:last-of-type { margin-bottom: 0; }

/* --- Disclaimer callout --- */
.disclaimer-callout {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-left: 4px solid var(--color-brand);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  text-align: center;
}

.disclaimer-callout p {
  font-weight: 600;
  max-width: 50ch;
  margin-inline: auto;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-8);
}

.footer__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.footer__wordmark { height: 20px; width: auto; }

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.footer__links a {
  font: var(--text-body-sm);
  color: var(--color-text-secondary);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.footer__links a:hover { color: var(--color-brand-text); }

.footer__meta {
  font: var(--text-caption);
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-6);
}
.footer__meta p + p { margin-top: var(--space-1); }

/* ==========================================================================
   7. LEGAL PAGES (privacy.html, terms.html)
   ========================================================================== */

.legal-page__header {
  padding-block: var(--space-12) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.legal-page__header h1 { margin-bottom: var(--space-2); }
.legal-page__meta { color: var(--color-text-secondary); font: var(--text-body-sm); }

.legal-page__body {
  padding-block: var(--space-8) var(--space-12);
  max-width: 72ch;
}

.legal-page__body section + section { margin-top: var(--space-8); }

.legal-page__body h2 {
  margin-bottom: var(--space-3);
  color: var(--color-brand);
}

.legal-page__body p { margin-bottom: var(--space-3); color: var(--color-text); }
.legal-page__body p:last-child { margin-bottom: 0; }

.legal-page__body ul {
  list-style: disc;
  padding-left: 1.25em;
  margin-bottom: var(--space-3);
}
.legal-page__body ul li + li { margin-top: var(--space-1); }

.legal-page__body a { color: var(--color-brand-text); text-decoration: underline; }

.legal-page__body .callout {
  background: var(--color-brand-tint);
  border-radius: var(--radius-card);
  padding: var(--space-4) var(--space-6);
  margin-top: var(--space-4);
}

/* ==========================================================================
   8. RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (min-width: 640px) {
  .hero h1 { max-width: 24ch; }
}

@media (max-width: 639px) {
  .nav__links { flex-wrap: wrap; gap: var(--space-3) var(--space-4); }
  .footer__top { flex-direction: column; align-items: flex-start; }
}
