/* ============================================================
   PencilIQ Marketing Site — Design System & Styles
   Phase 1: Foundation
   ============================================================ */

/* --- Design Tokens: Dark Theme (Default) --- */
:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-elevated: #1a1a28;
  --bg-overlay: rgba(10, 10, 15, 0.8);

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #8a8a9a;
  --text-muted: rgba(240, 240, 245, 0.5);

  /* Accents */
  --accent: #8f5bf3;
  --accent-hover: #a37af5;
  --accent-subtle: rgba(143, 91, 243, 0.12);
  --accent-strong: #f777d8;
  --accent-strong-subtle: rgba(247, 119, 216, 0.12);

  /* Borders */
  --border: rgba(240, 240, 245, 0.12);
  --border-subtle: rgba(240, 240, 245, 0.06);
  --border-strong: rgba(240, 240, 245, 0.20);

  /* Surfaces */
  --surface-card: rgba(255, 255, 255, 0.03);
  --surface-glass: rgba(10, 10, 15, 0.6);
  --surface-input: rgba(10, 10, 15, 0.6);

  /* Component-specific */
  --header-bg: rgba(10, 10, 15, 0.8);
  --footer-bg: #060610;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);

  /* Gradients */
  --gradient-hero: radial-gradient(circle at 20% -20%, rgba(247, 119, 216, 0.35), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(143, 91, 243, 0.30), transparent 50%),
    linear-gradient(135deg, #07070d, #05060a 70%);
  --gradient-accent: linear-gradient(120deg, var(--accent), var(--accent-strong));

  /* Spacing Scale */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;
  --space-4xl: 8rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 999px;

  /* Typography Scale (Fluid) */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
  --text-4xl: clamp(2.5rem, 1.8rem + 3.5vw, 4.25rem);
}

/* --- Design Tokens: Light Theme --- */
:root[data-theme="light"] {
  color-scheme: light;

  --bg-primary: #f6f7fb;
  --bg-secondary: #ffffff;
  --bg-elevated: #edeef5;
  --bg-overlay: rgba(246, 247, 251, 0.9);

  --text-primary: #11121d;
  --text-secondary: #5a5b6a;
  --text-muted: rgba(17, 18, 29, 0.65);

  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-subtle: rgba(124, 58, 237, 0.10);
  --accent-strong: #d946a8;
  --accent-strong-subtle: rgba(217, 70, 168, 0.10);

  --border: rgba(17, 18, 29, 0.12);
  --border-subtle: rgba(17, 18, 29, 0.06);
  --border-strong: rgba(17, 18, 29, 0.20);

  --surface-card: rgba(255, 255, 255, 0.8);
  --surface-glass: rgba(255, 255, 255, 0.85);
  --surface-input: rgba(255, 255, 255, 0.95);

  --header-bg: rgba(246, 247, 251, 0.85);
  --footer-bg: #e9ecf6;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);

  --gradient-hero: radial-gradient(circle at 20% -20%, rgba(247, 119, 216, 0.15), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(143, 91, 243, 0.15), transparent 50%),
    linear-gradient(135deg, #fdfdff, #eef0ff 70%);
  --gradient-accent: linear-gradient(120deg, var(--accent), var(--accent-strong));
}

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

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

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

ul, ol {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-weight: 600;
  color: var(--text-primary);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-4xl);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-3xl);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--text-xl);
  line-height: 1.3;
}

h4 {
  font-size: var(--text-lg);
  line-height: 1.4;
}

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

/* --- Layout --- */
.container {
  width: min(1200px, 90vw);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

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

/* --- Component: Tag --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
}

/* --- Component: Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Component: Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  border: none;
  border-radius: var(--radius-full);
  padding: 0.85rem 1.6rem;
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

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

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn.primary {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(143, 91, 243, 0.4);
}

.btn.primary:hover {
  box-shadow: 0 12px 28px rgba(143, 91, 243, 0.5);
}

.btn.secondary {
  background: var(--surface-card);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn.secondary:hover {
  border-color: var(--accent);
}

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

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

.btn-sm {
  padding: 0.6rem 1.2rem;
  font-size: var(--text-xs);
}

/* --- Component: Section Heading --- */
.section-heading {
  max-width: 640px;
  margin-bottom: var(--space-2xl);
}

.section-heading h2 {
  margin-bottom: var(--space-sm);
}

.section-heading p {
  font-size: var(--text-lg);
}

/* --- Component: Section Placeholder --- */
.section-placeholder {
  text-align: center;
  font-size: var(--text-lg);
  color: var(--text-secondary);
  font-style: italic;
  padding: var(--space-3xl) 0;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  gap: var(--space-md);
}

.logo {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.logo img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

/* Logo pencil icon (squircle) */
.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-icon svg { width: 16px; height: 16px; }

/* Inline wordmark image */
.piq-mark {
  height: 1.25em;
  vertical-align: -0.2em;
  display: inline;
  object-fit: contain;
  border-radius: 3px;
}
.logo .piq-mark {
  height: 1.4em;
  vertical-align: -0.25em;
}
h2 .piq-mark { height: 1.15em; vertical-align: -0.15em; border-radius: 4px; }

/* Back to home link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }
.back-link svg { width: 16px; height: 16px; stroke: currentColor; }

/* Desktop Nav */
.main-nav {
  display: flex;
  gap: var(--space-lg);
}

.main-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color 0.2s ease;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--text-primary);
}

.main-nav a[aria-current="page"] {
  color: var(--text-primary);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Theme Toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-primary);
  padding: 0.3rem 0.8rem;
  font-weight: 600;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle-track {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 52px;
  padding: 0.15rem 0.3rem;
  border-radius: var(--radius-full);
  background: var(--surface-card);
  position: relative;
  pointer-events: none;
  --thumb-offset: 24px;
}

.theme-toggle-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient-accent);
  position: absolute;
  top: 50%;
  left: 4px;
  transform: translate(0, -50%);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.theme-toggle[data-theme="light"] .theme-toggle-thumb {
  transform: translate(var(--thumb-offset), -50%);
}

.theme-toggle-icon {
  font-size: 0.8rem;
  line-height: 1;
}

.theme-toggle-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Hamburger Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  width: 44px;
  height: 44px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger → X animation */
.nav-open .menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

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

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

/* --- Mobile Nav --- */
@media (max-width: 900px) {
  .main-nav {
    flex-direction: column;
    gap: var(--space-xs);
    width: 100%;
    order: 10;
    padding: var(--space-md) 0;
    border-top: 1px solid var(--border-subtle);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.3s ease;
  }

  .main-nav a {
    padding: var(--space-sm) 0;
    font-size: var(--text-base);
  }

  .nav-open .main-nav {
    max-height: 400px;
    opacity: 1;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .header-actions .btn {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .main-nav {
    transition: none;
  }
}

/* --- Shared Section Utilities --- */
.section-heading--centered {
  text-align: center;
  margin-inline: auto;
}

/* --- Section 1: Hero --- */
.section-hero {
  background: var(--gradient-hero);
  min-height: 90vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.section-hero::before,
.section-hero::after {
  content: "";
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

.section-hero::before {
  top: -100px;
  left: -100px;
  background: rgba(247, 119, 216, 0.2);
}

.section-hero::after {
  bottom: -100px;
  right: -100px;
  background: rgba(143, 91, 243, 0.15);
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: center;
  position: relative;
  z-index: 1;
}

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

.hero-subline {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-top: var(--space-md);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

/* Hero visual */
.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-visual img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

/* --- Section 2: Problem --- */
.section-problem {
  background: var(--bg-secondary);
}

.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

.problem-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.problem-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--accent-subtle);
  color: var(--accent);
  margin-bottom: var(--space-md);
}

.problem-card h3 {
  margin-bottom: var(--space-sm);
}

.problem-card p {
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* --- Section 3: Workflow --- */
.section-workflow {
  background: var(--bg-primary);
}

.workflow-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.workflow-step {
  flex: 1;
  text-align: center;
  padding: 0 var(--space-md);
}

.workflow-step-number {
  display: inline-block;
  font-family: "Fraunces", Georgia, serif;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

.workflow-step-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--accent-subtle);
  color: var(--accent);
  margin: 0 auto var(--space-md);
}

.workflow-step-visual {
  display: block;
  max-width: 180px;
  height: auto;
  margin: 0 auto var(--space-md);
  border-radius: var(--radius-lg);
}

.workflow-step h3 {
  margin-bottom: var(--space-xs);
}

.workflow-step p {
  font-size: var(--text-sm);
  line-height: 1.6;
}

.workflow-connector {
  width: 40px;
  min-width: 40px;
  height: 2px;
  background: var(--border-strong);
  margin-top: 52px;
  position: relative;
}

.workflow-connector::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--border-strong);
  border-right: 2px solid var(--border-strong);
  transform: rotate(45deg);
}

/* --- Section 4: Features --- */
.section-features {
  background: var(--bg-secondary);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

.feature-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.feature-card-visual {
  display: block;
  max-width: 160px;
  height: auto;
  margin: 0 auto var(--space-md);
  border-radius: var(--radius-lg);
}

.feature-card h3 {
  margin-bottom: var(--space-sm);
}

.feature-card p {
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* --- Section 5: Science --- */
.section-science {
  background: var(--bg-primary);
}

.science-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  text-align: center;
  padding: var(--space-lg);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.stat-value {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

.science-citation {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
}

/* --- Section 6: Apple Pencil --- */
.section-pencil {
  background: var(--bg-secondary);
}

.pencil-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

.pencil-content h2 {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-md);
}

.pencil-content > p {
  font-size: var(--text-lg);
  line-height: 1.7;
  margin-bottom: var(--space-xl);
}

.pencil-stat {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--accent-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
}

.pencil-stat-value {
  font-family: "Fraunces", Georgia, serif;
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  flex-shrink: 0;
}

.pencil-stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

.pencil-citation {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
}

/* Pencil visual */
.pencil-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pencil-visual img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

/* --- Section 7: Pricing --- */
.section-pricing {
  background: var(--bg-primary);
}

.pricing-toggle {
  display: flex;
  justify-content: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-2xl);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: var(--space-2xs);
  width: fit-content;
  margin-inline: auto;
}

.pricing-toggle-btn {
  padding: var(--space-xs) var(--space-lg);
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.pricing-toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

.pricing-toggle-btn .badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
  align-items: start;
}

.pricing-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
}

.pricing-card--popular {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
  position: relative;
}

.pricing-card--popular > .badge {
  position: absolute;
  top: calc(-1 * var(--space-sm));
  left: 50%;
  transform: translateX(-50%);
}

.pricing-card h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-xs);
}

.pricing-card--popular h3 {
  margin-top: var(--space-sm);
}

.pricing-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-2xs);
  margin-bottom: var(--space-sm);
}

.pricing-amount {
  font-family: "Fraunces", Georgia, serif;
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

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

.pricing-description {
  font-size: var(--text-sm);
  margin-bottom: var(--space-lg);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-xl);
  flex: 1;
}

.pricing-features li {
  padding: var(--space-xs) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding-left: var(--space-lg);
  position: relative;
}

.pricing-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-subtle);
  border: 2px solid var(--accent);
}

.pricing-features li:last-child {
  border-bottom: none;
}

.pricing-card .btn {
  width: 100%;
}

.pricing-note {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-xl);
}

/* --- Section 8: CTA --- */
.section-cta {
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
}

.cta-content {
  text-align: center;
  max-width: 600px;
  margin-inline: auto;
}

.cta-content h2 {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.cta-content > p {
  font-size: var(--text-lg);
  margin-bottom: var(--space-xl);
}

.cta-form {
  margin-bottom: var(--space-md);
}

.cta-form-group {
  display: flex;
  gap: var(--space-sm);
}

.cta-form-group input[type="email"] {
  flex: 1;
  background: var(--surface-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  padding: 0.85rem 1.2rem;
  color: var(--text-primary);
  font-size: var(--text-base);
  min-width: 0;
}

.cta-form-group input[type="email"]::placeholder {
  color: var(--text-muted);
}

.cta-form-group input[type="email"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.cta-form-group input[type="email"].error {
  border-color: #ef4444;
  outline-color: #ef4444;
}

.cta-form-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

.cta-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xl);
}

.cta-success svg {
  color: var(--accent);
}

.cta-success p {
  font-size: var(--text-lg);
  color: var(--text-primary);
}

/* --- Responsive: Sections --- */
@media (max-width: 900px) {
  .hero-layout {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-content {
    max-width: none;
  }

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

  .hero-visual {
    order: -1;
    margin-bottom: var(--space-lg);
  }

  .workflow-steps {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .workflow-step {
    padding: var(--space-md) 0;
  }

  .workflow-connector {
    width: 2px;
    height: 32px;
    min-width: auto;
    margin-top: 0;
  }

  .workflow-connector::after {
    right: -3px;
    top: auto;
    bottom: -3px;
    transform: rotate(135deg);
  }

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

  .pencil-layout {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--space-2xl);
  }

  .pencil-stat {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .section-hero {
    min-height: auto;
    padding-top: var(--space-3xl);
  }

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

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

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

  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-inline: auto;
  }

  .pricing-card--popular {
    order: -1;
  }

  .cta-form-group {
    flex-direction: column;
  }

  .cta-form-group .btn {
    width: 100%;
  }

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

/* --- Footer --- */
.site-footer {
  padding: var(--space-2xl) 0 var(--space-lg);
  background: var(--footer-bg);
  border-top: 1px solid var(--border-subtle);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--space-2xl);
}

.footer-brand p {
  margin-top: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 280px;
}

.footer-heading {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.footer-col a {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  padding: var(--space-2xs) 0;
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: var(--text-primary);
}

.footer-note {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

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

@media (max-width: 640px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }
}

/* --- Documentation Page (Phase 5 — basic support) --- */
.docs-page {
  background: var(--bg-primary);
}

.doc-hero {
  padding: var(--space-3xl) 0 var(--space-xl);
  background: var(--bg-secondary);
}

.doc-hero-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.doc-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.doc-layout {
  display: flex;
  gap: var(--space-2xl);
  align-items: flex-start;
  padding: var(--space-2xl) 0 var(--space-3xl);
}

.doc-sidebar {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-card);
  padding: var(--space-lg);
  position: sticky;
  top: 80px;
  min-width: 220px;
  max-width: 260px;
}

.doc-sidebar ol {
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0 0;
  display: grid;
  gap: var(--space-2xs);
}

.doc-sidebar a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
}

.doc-sidebar a:hover {
  color: var(--accent);
}

.doc-content {
  flex: 1;
  min-width: 0;
}

.doc-section {
  padding: var(--space-2xl) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.doc-section:first-child {
  padding-top: 0;
}

.doc-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.doc-section-header {
  max-width: 720px;
  margin-bottom: var(--space-xl);
}

.doc-subsection {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-card);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.doc-subsection:last-child {
  margin-bottom: 0;
}

.doc-subsection h3 {
  margin-top: 0;
  margin-bottom: var(--space-sm);
}

.doc-subsection ul {
  margin: var(--space-xs) 0 0;
  padding-left: 1.2rem;
  list-style: disc;
  color: var(--text-secondary);
}

.doc-subsection code {
  background: var(--accent-subtle);
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.docs-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

@media (max-width: 960px) {
  .doc-layout {
    flex-direction: column;
  }

  .doc-sidebar {
    position: static;
    width: 100%;
    max-width: none;
  }
}

/* ============================================================
   Animations & Motion (Phase 3)
   ============================================================ */

/* --- Keyframes --- */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-only {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes hero-fade-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-visual-fade-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- Scroll Reveal: Safe default (always visible) --- */
.scroll-reveal {
  /* Content visible by default — animations are progressive enhancement */
}

/* --- Scroll Reveal: CSS scroll-driven (modern browsers) --- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .scroll-reveal {
      animation: fade-in-up 0.6s ease both;
      animation-timeline: view();
      animation-range: entry 0% entry 30%;
    }
  }
}

/* --- Scroll Reveal: JS fallback classes --- */
.js-scroll-hidden {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: var(--reveal-delay, 0s);
}

.js-scroll-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .js-scroll-hidden {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* --- Hero Entrance Animation --- */
@media (prefers-reduced-motion: no-preference) {
  .hero-content {
    animation: hero-fade-in 0.8s ease-out 0.1s both;
  }

  .hero-visual {
    animation: hero-visual-fade-in 0.8s ease-out 0.3s both;
  }
}

/* --- Card Hover States --- */
@media (prefers-reduced-motion: no-preference) {
  .problem-card {
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  }

  .problem-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
  }

  .problem-icon,
  .feature-card-visual {
    transition: transform 0.3s ease;
  }

  .problem-card:hover .problem-icon,
  .feature-card:hover .feature-card-visual {
    transform: scale(1.05);
  }

  .feature-card {
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  }

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

  .stat-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
  }

  .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
  }

  .pricing-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
  }

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

  .pricing-card--popular:hover {
    box-shadow: 0 0 0 1px var(--accent), 0 8px 32px rgba(143, 91, 243, 0.3);
  }
}

/* --- Forgetting Curve SVG --- */
.science-chart {
  margin-bottom: var(--space-2xl);
  position: relative;
}

.science-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.science-chart .axis-label {
  fill: var(--text-muted);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 12px;
}

.science-chart .axis-line {
  stroke: var(--border);
  stroke-width: 1;
}

.science-chart .grid-line {
  stroke: var(--border-subtle);
  stroke-width: 0.5;
}

.science-chart .curve-decay {
  fill: none;
  stroke: #ef6461;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.science-chart .curve-recovery {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.science-chart .review-point {
  fill: var(--accent);
  r: 6;
}

.science-chart .legend-text {
  fill: var(--text-secondary);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
}

.science-chart .legend-dot-decay {
  fill: #ef6461;
}

.science-chart .legend-dot-recovery {
  fill: var(--accent);
}

.science-chart-caption {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-style: italic;
  margin-top: var(--space-md);
}

/* --- Forgetting Curve Animation --- */
.science-chart .curve-decay,
.science-chart .curve-recovery {
  stroke-dasharray: var(--path-length, 1000);
  stroke-dashoffset: var(--path-length, 1000);
}

.science-chart .review-point {
  transform: scale(0);
  transform-origin: center;
  transform-box: fill-box;
}

@keyframes draw-curve {
  to { stroke-dashoffset: 0; }
}

@keyframes pulse-point {
  0% { transform: scale(0); }
  60% { transform: scale(1.6); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: no-preference) {
  .science-chart.is-animating .curve-decay {
    animation: draw-curve 1.5s ease-out forwards;
  }

  .science-chart.is-animating .curve-recovery {
    animation: draw-curve 1.5s ease-out 0.8s forwards;
  }

  .science-chart.is-animating .review-point:nth-child(1) {
    animation: pulse-point 0.4s ease-out 1.2s forwards;
  }

  .science-chart.is-animating .review-point:nth-child(2) {
    animation: pulse-point 0.4s ease-out 1.6s forwards;
  }

  .science-chart.is-animating .review-point:nth-child(3) {
    animation: pulse-point 0.4s ease-out 2.0s forwards;
  }

  .science-chart.is-animating .review-point:nth-child(4) {
    animation: pulse-point 0.4s ease-out 2.4s forwards;
  }
}

@media (prefers-reduced-motion: reduce) {
  .science-chart .curve-decay,
  .science-chart .curve-recovery {
    stroke-dashoffset: 0;
  }

  .science-chart .review-point {
    transform: scale(1);
  }
}

/* --- Workflow Connector Animation --- */
@media (prefers-reduced-motion: no-preference) {
  .workflow-connector.js-scroll-hidden {
    transform: scaleX(0);
    transform-origin: left center;
    opacity: 1;
  }

  .workflow-connector.js-scroll-visible {
    transform: scaleX(1);
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .workflow-connector.js-scroll-hidden {
    transform: scaleY(0);
    transform-origin: center top;
  }

  .workflow-connector.js-scroll-visible {
    transform: scaleY(1);
  }
}

/* --- Animated Stat Counters --- */
.stat-value {
  font-variant-numeric: tabular-nums;
}

/* --- Skip to Content (Accessibility) --- */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600;
  z-index: 10000;
  transition: top 0.2s ease;
}

.skip-to-content:focus {
  top: var(--space-sm);
}
