/* ============================================
   1. CSS Custom Properties (Design Tokens)
   ============================================ */

:root {
  /* Colors */
  --color-canvas: #FBFAF9;
  --color-stone: #F2F0ED;
  --color-ember: #FF3E00;
  --color-gold: #FFB800;
  --color-midnight: #121212;
  --color-graphite: #2D2D2D;
  --color-white: #FFFFFF;
  --color-text-muted: #6B6B6B;

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-section: clamp(4rem, 8vw, 7.5rem);
  --space-card: 2rem;
  --space-container: clamp(1rem, 5vw, 2rem);

  /* Radii */
  --radius-card: 16px;
  --radius-pill: 9999px;

  /* Shadows (nav only — sole exception to no-shadow rule) */
  --shadow-nav: 0 1px 3px rgba(0, 0, 0, 0.06);

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 200ms;
  --duration-medium: 300ms;
  --duration-slow: 600ms;
}

/* ============================================
   2. Reset & Base
   ============================================ */

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

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

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-graphite);
  background: var(--color-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}

p {
  max-width: 75ch;
}

a {
  color: inherit;
  text-decoration: none;
}

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

ul {
  list-style: none;
}

/* Skip to content */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--color-graphite);
  color: var(--color-canvas);
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  z-index: 1000;
  transition: top var(--duration-fast);
}

.skip-link:focus {
  top: 1rem;
}

/* ============================================
   3. Layout
   ============================================ */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-container);
}

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

.bg-cream {
  background: var(--color-canvas);
}

.bg-stone {
  background: var(--color-stone);
}

.bg-midnight {
  background: var(--color-midnight);
  color: var(--color-canvas);
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  margin-bottom: 0.75rem;
}

.section-header p {
  margin: 0 auto;
  color: var(--color-text-muted);
  font-size: 1.125rem;
}

/* Section divider */
.section-divider {
  position: relative;
  height: 80px;
  overflow: hidden;
  background: var(--color-canvas);
}

.section-divider svg {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 80px;
}

/* ============================================
   4. Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 2rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: #CC3100;
  color: var(--color-canvas);
}

.btn-primary:hover {
  background: #B02A00;
}

.btn-ghost {
  background: transparent;
  color: var(--color-graphite);
  border: 1px solid var(--color-stone);
}

.btn-ghost:hover {
  border-color: var(--color-ember);
  color: var(--color-ember);
}

.btn-dark-pill {
  background: var(--color-midnight);
  color: var(--color-canvas);
  font-size: 1.125rem;
  padding: 1rem 2.5rem;
}

.btn-dark-pill:hover {
  background: #2A2A2A;
}

/* ============================================
   5. Navigation
   ============================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 0;
  transition: background var(--duration-medium), box-shadow var(--duration-medium);
}

.nav.scrolled {
  background: var(--color-canvas);
  box-shadow: var(--shadow-nav);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-graphite);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-graphite);
  transition: color var(--duration-fast);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-ember);
  transition: width var(--duration-fast);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-cta {
  min-height: 40px;
  padding: 0.5rem 1.5rem;
  font-size: 0.9375rem;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px;
  min-width: 48px;
  min-height: 48px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-graphite);
  transition: transform var(--duration-medium), opacity var(--duration-medium);
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile overlay */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-canvas);
  z-index: 99;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.nav-overlay.active {
  display: flex;
}

.nav-overlay a {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-graphite);
  min-height: 48px;
  display: flex;
  align-items: center;
}

/* ============================================
   6. Hero
   ============================================ */

.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  background: var(--color-canvas);
  padding-top: 80px;
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-content {
  max-width: 540px;
}

.hero-content h1 {
  margin-bottom: 1.25rem;
}

.hero-content p {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.hero-image {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-image svg {
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: var(--radius-card);
}

/* ============================================
   7. How It Works
   ============================================ */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.step {
  text-align: center;
  padding: var(--space-card);
}

.step-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-canvas);
  border-radius: 50%;
}

.step:nth-child(1) .step-icon { background: #FFF0EB; }
.step:nth-child(2) .step-icon { background: #FFF5EB; }
.step:nth-child(3) .step-icon { background: #FFEBE5; }

.step-icon svg {
  width: 40px;
  height: 40px;
}

.step h3 {
  margin-bottom: 0.75rem;
}

.step p {
  margin: 0 auto;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* ============================================
   8. Cards
   ============================================ */

/* Story cards */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card-story {
  background: var(--color-white);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--color-stone);
  transition: transform var(--duration-medium) var(--ease-out-expo);
}

.card-story:hover {
  transform: scale(1.02);
}

.card-story-image {
  aspect-ratio: 4 / 3;
  background: var(--color-stone);
  overflow: hidden;
}

.card-story-image svg {
  width: 100%;
  height: 100%;
  display: block;
}

.card-story-body {
  padding: 1.25rem;
}

.card-story-body h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.card-story-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.story-link {
  display: inline-block;
  margin-top: 2rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-ember);
  transition: opacity var(--duration-fast);
}

.story-link:hover {
  opacity: 0.7;
}

/* Feature cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.card-feature {
  text-align: center;
  padding: var(--space-card);
}

.card-feature-image {
  margin: 0 auto 1.5rem;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--color-stone);
}

.card-feature-image svg {
  width: 100%;
  height: auto;
  display: block;
}

.card-feature:nth-child(1) .card-feature-image { max-width: 200px; }
.card-feature:nth-child(2) .card-feature-image { max-width: 160px; }
.card-feature:nth-child(3) .card-feature-image { max-width: 220px; }

.card-feature:nth-child(1) { background: linear-gradient(180deg, #FFF8F5 0%, transparent 100%); }
.card-feature:nth-child(2) { background: linear-gradient(180deg, #FFFBF5 0%, transparent 100%); }
.card-feature:nth-child(3) { background: linear-gradient(180deg, #FFF5F8 0%, transparent 100%); }

.card-feature h3 {
  margin-bottom: 0.75rem;
}

.card-feature p {
  margin: 0 auto;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* Testimonial cards */
.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.card-testimonial {
  background: var(--color-white);
  border-radius: var(--radius-card);
  padding: 2rem;
  box-shadow: inset 0 0 0 1px var(--color-stone);
}

.card-testimonial blockquote {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--color-graphite);
  margin-bottom: 1.5rem;
}

.card-testimonial blockquote::before {
  content: '\201C';
  font-size: 2.5rem;
  line-height: 0;
  vertical-align: -0.3em;
  margin-right: 0.1em;
}

.card-testimonial:nth-child(1) blockquote::before { color: var(--color-ember); }
.card-testimonial:nth-child(2) blockquote::before { color: var(--color-gold); }
.card-testimonial:nth-child(3) blockquote::before { color: #0090FF; }

.card-testimonial cite {
  font-style: normal;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.card-testimonial cite strong {
  display: block;
  color: var(--color-graphite);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

/* Pricing cards */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.card-premium {
  background: var(--color-white);
  border-radius: var(--radius-card);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--color-stone);
  position: relative;
}

.card-premium.featured {
  box-shadow: inset 0 0 0 2px var(--color-gold);
}

.save-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-gold);
  color: var(--color-midnight);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.card-premium h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.card-premium .price {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.price-period {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.card-premium ul {
  text-align: left;
  margin-bottom: 1.5rem;
}

.card-premium li {
  padding: 0.4rem 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-premium li::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--color-ember);
  border-radius: 50%;
  flex-shrink: 0;
}

.cancel-note {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
}

/* ============================================
   9. Download CTA
   ============================================ */

.download {
  text-align: center;
}

.download h2 {
  margin-bottom: 1rem;
}

.download p {
  margin: 0 auto 2rem;
  color: var(--color-text-muted);
  font-size: 1.125rem;
}

.download-badges {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.download-badges a {
  display: inline-block;
  transition: opacity var(--duration-fast);
}

.download-badges a:hover {
  opacity: 0.8;
}

.store-badge svg {
  height: 48px;
  width: auto;
  display: block;
}

.privacy-reassurance {
  margin-top: 3.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.privacy-reassurance a {
  color: var(--color-ember);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.privacy-reassurance a:hover {
  opacity: 0.7;
}

/* ============================================
   10. Footer
   ============================================ */

.footer {
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.footer-tagline {
  font-size: 0.9375rem;
  color: rgba(251, 250, 249, 0.6);
  max-width: 280px;
}

.footer-heading {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  color: rgba(251, 250, 249, 0.5);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  font-size: 0.9375rem;
  color: rgba(251, 250, 249, 0.7);
  transition: color var(--duration-fast);
}

.footer-links a:hover {
  color: var(--color-canvas);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(251, 250, 249, 0.1);
  font-size: 0.8125rem;
  color: rgba(251, 250, 249, 0.4);
}

.footer-bottom .download-badges {
  margin-top: 0;
}

.footer-bottom .store-badge svg {
  height: 36px;
}

/* ============================================
   11. Scroll Reveal Animations
   ============================================ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger-1 { transition-delay: 0ms; }
.reveal-stagger-2 { transition-delay: 100ms; }
.reveal-stagger-3 { transition-delay: 200ms; }
.reveal-stagger-4 { transition-delay: 300ms; }

/* ============================================
   12. Image Error Fallback
   ============================================ */

.img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-stone);
  min-height: 200px;
}

.img-fallback::after {
  content: '';
  display: block;
  width: 48px;
  height: 48px;
  background: var(--color-text-muted);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ============================================
   13. Responsive
   ============================================ */

@media (max-width: 1024px) {
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-content {
    max-width: 100%;
  }

  .hero-content p {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-image {
    order: -1;
  }

  .hero-image svg {
    max-width: 100%;
    max-height: 350px;
  }

  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .testimonial-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 700px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .hero {
    min-height: auto;
    padding-top: 100px;
    padding-bottom: 3rem;
  }

  .hero-image svg {
    max-width: 100%;
    max-height: 280px;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .story-grid {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .testimonial-grid {
    grid-template-columns: 1fr;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .card-feature:nth-child(1) .card-feature-image,
  .card-feature:nth-child(2) .card-feature-image,
  .card-feature:nth-child(3) .card-feature-image {
    max-width: 200px;
  }
}

/* ============================================
   14. Reduced Motion
   ============================================ */

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

  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .card-story:hover {
    transform: none;
  }
}

/* ============================================
   15. Focus Visible
   ============================================ */

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

/* ============================================
   16. Print
   ============================================ */

@media print {
  .nav,
  .nav-overlay,
  .download-badges,
  .section-divider {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  .section {
    padding: 1rem 0;
    break-inside: avoid;
  }

  .bg-stone,
  .bg-midnight {
    background: #fff;
    color: #000;
  }

  a {
    text-decoration: underline;
  }
}
