/* =============================================================================
   PENNY FINANCE — Brand-Aligned Landing Page
   Warm neutrals, pink accents ("pink is the spice, not the meal")
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Variables — Penny Brand Tokens
   ----------------------------------------------------------------------------- */
:root {
  /* Foundations (70%) */
  --cream: #FFF8F4;
  --linen: #F5EDE7;
  --sand: #E8DDD5;
  --warm-gray: #9C9490;
  --charcoal: #2D2926;

  /* Penny Pink (15%) */
  --penny-light: #F8D4DE;
  --penny: #F0A8B8;
  --penny-bold: #E8587A;
  --penny-deep: #B03040;

  /* Semantic (10%) */
  --growth-green: #5B9E6F;
  --growth-light: #E2F0E5;
  --alert-amber: #D4943A;
  --alert-light: #FDF2E0;
  --down-red: #C4554D;
  --down-light: #FAEAE8;

  /* Extended (5%) */
  --sage: #8BA888;
  --sky: #7BAAC4;
  --lavender: #A894B8;
  --terracotta: #C47D5A;
  --gold: #D4A84B;

  /* Generic aliases (legal.css compatibility) */
  --white: var(--cream);
  --primary: var(--penny-bold);
  --primary-dark: var(--penny-deep);
  --text: var(--charcoal);
  --text-secondary: var(--warm-gray);
  --text-muted: var(--warm-gray);
  --border: var(--sand);

  /* Footer — stays dark in both modes */
  --footer-bg: #2D2926;
  --footer-text: #F0E8E2;
  --footer-muted: #9C9490;

  /* Effects */
  --shadow-sm: 0 1px 3px rgba(45, 41, 38, 0.06);
  --shadow-md: 0 4px 12px rgba(45, 41, 38, 0.08);
  --shadow-lg: 0 12px 32px rgba(45, 41, 38, 0.1);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-full: 50px;
}

/* Dark mode overrides */
[data-theme="dark"] {
  --cream: #1A1614;
  --linen: #252120;
  --sand: #3D3632;
  --warm-gray: #8A8480;
  --charcoal: #F0E8E2;

  --growth-green: #6DB87F;
  --growth-light: #1E2E22;
  --alert-amber: #E0A54A;
  --alert-light: #2E2518;
  --down-red: #D4665E;
  --down-light: #2E1E1C;

  --white: var(--cream);
  --text: var(--charcoal);
  --text-secondary: var(--warm-gray);
  --text-muted: var(--warm-gray);
  --border: var(--sand);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.3);
}

/* -----------------------------------------------------------------------------
   Reset & Base
   ----------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--charcoal);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 800;
  color: var(--charcoal);
}

h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.2rem; }

a {
  color: var(--penny-bold);
  text-decoration: none;
  transition: color 0.2s ease-out;
}

a:hover {
  color: var(--penny-deep);
}

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

/* -----------------------------------------------------------------------------
   Container
   ----------------------------------------------------------------------------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* -----------------------------------------------------------------------------
   Scroll Animations
   ----------------------------------------------------------------------------- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children */
.stagger > .fade-in:nth-child(1) { transition-delay: 0s; }
.stagger > .fade-in:nth-child(2) { transition-delay: 0.08s; }
.stagger > .fade-in:nth-child(3) { transition-delay: 0.16s; }
.stagger > .fade-in:nth-child(4) { transition-delay: 0.24s; }
.stagger > .fade-in:nth-child(5) { transition-delay: 0.32s; }
.stagger > .fade-in:nth-child(6) { transition-delay: 0.4s; }

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 28px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out;
  text-decoration: none;
  line-height: 1.2;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--penny-bold);
  color: var(--cream);
  border-color: var(--penny-bold);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: var(--penny-deep);
  border-color: var(--penny-deep);
  box-shadow: var(--shadow-lg);
  color: var(--cream);
}

.btn-outline {
  background: transparent;
  color: var(--charcoal);
  border-color: var(--sand);
}

.btn-outline:hover {
  border-color: var(--penny-bold);
  color: var(--penny-bold);
  background: rgba(232, 88, 122, 0.04);
}

.btn-inverted {
  background: var(--cream);
  color: var(--penny-bold);
  border-color: var(--cream);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .btn-inverted {
  background: #FFF8F4;
  color: var(--penny-bold);
  border-color: #FFF8F4;
}

.btn-inverted:hover {
  box-shadow: var(--shadow-lg);
  color: var(--penny-deep);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Section utility — scoped to landing page sections, not legal page sections */
main > section,
.hero {
  padding: 80px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-header h2 {
  margin-bottom: 12px;
}

.section-subtitle {
  color: var(--warm-gray);
  font-size: 1.1rem;
  font-weight: 600;
  max-width: 520px;
  margin: 0 auto;
}

/* -----------------------------------------------------------------------------
   Page Header — Nav Bar with Theme Toggle
   ----------------------------------------------------------------------------- */
.page-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 248, 244, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sand);
  padding: 0 24px;
  transition: background 0.3s ease-out, border-color 0.3s ease-out;
}

[data-theme="dark"] .page-header {
  background: rgba(26, 22, 20, 0.85);
}

.page-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.page-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.page-header-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.page-header-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--charcoal);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  appearance: none;
  -webkit-appearance: none;
  background: var(--linen);
  border: 1px solid var(--sand);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease-out, border-color 0.2s ease-out;
  color: var(--charcoal);
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--penny);
  background: var(--penny-light);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }

[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* Spacer for fixed header */
.header-spacer {
  height: 56px;
}

/* -----------------------------------------------------------------------------
   Hero Section
   ----------------------------------------------------------------------------- */
.hero {
  background: linear-gradient(180deg, var(--cream) 0%, rgba(232, 88, 122, 0.04) 100%);
  padding: 64px 24px 80px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--penny-light) 0%, transparent 70%);
  opacity: 0.3;
  pointer-events: none;
}

.hero-content {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.hero-tagline {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--penny-bold);
  margin-bottom: 20px;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--warm-gray);
  margin-bottom: 32px;
  line-height: 1.7;
  font-weight: 500;
  max-width: 520px;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Hero Mascot */
.hero-mascot {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.hero-mascot-canvas {
  width: 300px;
  height: 300px;
}

.mascot-fallback {
  width: 280px;
  height: 280px;
  background: var(--penny-light);
  border-radius: 50%;
  display: none;
}

.mascot-fallback.active {
  display: block;
}

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

  .hero-description {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-buttons {
    justify-content: center;
  }

  .hero-mascot {
    order: -1;
  }

  .hero-mascot-canvas {
    width: 220px;
    height: 220px;
  }

  .mascot-fallback {
    width: 200px;
    height: 200px;
  }
}

@media (max-width: 600px) {
  .hero {
    padding: 40px 24px 60px;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-buttons .btn {
    width: 100%;
  }
}

/* -----------------------------------------------------------------------------
   Features Section
   ----------------------------------------------------------------------------- */
.features {
  background: var(--cream);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--linen);
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: transform 0.25s ease-out, border-color 0.25s ease-out, box-shadow 0.25s ease-out;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--penny-light);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.feature-icon svg {
  width: 22px;
  height: 22px;
}

.feature-icon.terracotta { background: rgba(196, 125, 90, 0.15); color: var(--terracotta); }
.feature-icon.lavender { background: rgba(168, 148, 184, 0.15); color: var(--lavender); }
.feature-icon.gold { background: rgba(212, 168, 75, 0.15); color: var(--gold); }
.feature-icon.sky { background: rgba(123, 170, 196, 0.15); color: var(--sky); }
.feature-icon.sage { background: rgba(139, 168, 136, 0.15); color: var(--sage); }
.feature-icon.penny-lt { background: rgba(248, 212, 222, 0.5); color: var(--penny-bold); }

.feature-card h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.feature-card p {
  color: var(--warm-gray);
  font-weight: 500;
  line-height: 1.6;
  font-size: 0.95rem;
}

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

@media (max-width: 600px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

/* -----------------------------------------------------------------------------
   How It Works Section
   ----------------------------------------------------------------------------- */
.how-it-works {
  background: var(--linen);
}

.steps {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  max-width: 900px;
  margin: 0 auto;
}

.step {
  flex: 1;
  text-align: center;
  padding: 0 24px;
  max-width: 280px;
}

.step-icon {
  width: 72px;
  height: 72px;
  background: var(--penny-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  position: relative;
}

.step-number {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 28px;
  height: 28px;
  background: var(--penny-bold);
  color: var(--cream);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
}

[data-theme="dark"] .step-number {
  color: #FFF8F4;
}

.step-icon svg {
  width: 28px;
  height: 28px;
  color: var(--penny-bold);
}

.step h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.step p {
  color: var(--warm-gray);
  font-weight: 500;
  font-size: 0.95rem;
}

.step-connector {
  width: 48px;
  height: 2px;
  background: var(--sand);
  flex-shrink: 0;
  margin-top: 36px;
  border-radius: 1px;
}

@media (max-width: 900px) {
  .steps {
    flex-direction: column;
    align-items: center;
    gap: 32px;
  }

  .step {
    max-width: 320px;
  }

  .step-connector {
    width: 2px;
    height: 32px;
    margin-top: 0;
  }
}

/* -----------------------------------------------------------------------------
   Pricing Section
   ----------------------------------------------------------------------------- */
.pricing {
  background: var(--cream);
}

.pricing-card {
  max-width: 420px;
  margin: 0 auto;
  background: var(--linen);
  border: 2px solid var(--penny);
  border-radius: var(--radius);
  padding: 36px 32px;
  text-align: center;
  position: relative;
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.pricing-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--penny-bold);
  color: #FFF8F4;
  padding: 5px 18px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.pricing-card h3 {
  font-size: 1.5rem;
  margin-bottom: 4px;
  margin-top: 8px;
}

.pricing-card .price-subtitle {
  font-size: 1rem;
  color: var(--warm-gray);
  margin-bottom: 24px;
  font-weight: 600;
}

.pricing-divider {
  height: 1px;
  background: var(--sand);
  margin-bottom: 24px;
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 28px;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.pricing-check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--growth-green);
}

/* -----------------------------------------------------------------------------
   FAQ Section
   ----------------------------------------------------------------------------- */
.faq {
  background: var(--linen);
}

.faq-list {
  max-width: 720px;
  margin: 0 auto;
}

.faq-item {
  background: var(--cream);
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid var(--sand);
  overflow: hidden;
  transition: border-color 0.25s ease-out;
}

.faq-item[open] {
  border-color: var(--penny-bold);
}

.faq-item summary {
  padding: 18px 20px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1rem;
  transition: color 0.2s ease-out;
  -webkit-user-select: none;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::marker {
  display: none;
  content: '';
}

.faq-icon {
  width: 40px;
  height: 40px;
  background: var(--linen);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.faq-icon svg {
  width: 20px;
  height: 20px;
  color: var(--warm-gray);
}

.faq-question {
  flex: 1;
}

.faq-toggle {
  width: 28px;
  height: 28px;
  background: var(--sand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.25s ease-out, transform 0.25s ease-out;
}

.faq-toggle svg {
  width: 14px;
  height: 14px;
  color: var(--warm-gray);
  transition: color 0.25s ease-out;
}

.faq-item[open] .faq-toggle {
  background: var(--penny-bold);
  transform: rotate(45deg);
}

.faq-item[open] .faq-toggle svg {
  color: #FFF8F4;
}

.faq-answer {
  padding: 0 20px 18px;
  padding-left: 74px;
}

.faq-answer p {
  color: var(--warm-gray);
  line-height: 1.7;
  font-weight: 500;
  font-size: 0.95rem;
}

@media (max-width: 600px) {
  .faq-answer {
    padding-left: 20px;
  }
}

/* -----------------------------------------------------------------------------
   CTA Section
   ----------------------------------------------------------------------------- */
.cta {
  background: linear-gradient(135deg, var(--penny-bold), var(--penny-deep));
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -30%;
  width: 160%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(255, 248, 244, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.cta-content {
  position: relative;
  z-index: 1;
}

.cta-mascot-canvas {
  width: 180px;
  height: 180px;
  margin: 0 auto 24px;
}

.cta-mascot-fallback {
  width: 160px;
  height: 160px;
  background: rgba(248, 212, 222, 0.25);
  border-radius: 50%;
  margin: 0 auto 24px;
  display: none;
}

.cta-mascot-fallback.active {
  display: block;
}

.cta h2 {
  color: #FFF8F4;
  margin-bottom: 12px;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
}

.cta p {
  color: rgba(255, 248, 244, 0.85);
  margin-bottom: 32px;
  font-size: 1.1rem;
  font-weight: 500;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

/* fix: reapply bottom margin after auto centering */
.cta p {
  margin-bottom: 32px;
}

/* -----------------------------------------------------------------------------
   Footer
   ----------------------------------------------------------------------------- */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 48px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}

.footer-brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--footer-text);
  margin-bottom: 6px;
}

.footer-tagline {
  color: var(--footer-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.footer-column h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--footer-muted);
  margin-bottom: 14px;
}

.footer-column ul {
  list-style: none;
}

.footer-column li {
  margin-bottom: 8px;
}

.footer-column a {
  color: var(--footer-muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.2s ease-out;
  text-decoration: none;
}

.footer-column a:hover {
  color: var(--penny);
}

.footer-divider {
  height: 1px;
  background: rgba(255, 248, 244, 0.1);
  margin-bottom: 24px;
}

.copyright {
  text-align: center;
  color: var(--footer-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

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

/* -----------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------------- */
@media (max-width: 600px) {
  main > section,
  .hero {
    padding: 60px 0;
  }

  .btn {
    padding: 14px 22px;
    font-size: 0.9rem;
  }

  .section-header {
    margin-bottom: 40px;
  }
}

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

  .fade-in {
    opacity: 1;
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}
