/* ============================================
   LexiFlow Landing — Legal Authority Palette
   Deep navy primary, warm ivory surfaces, gold CTA
   ============================================ */

:root,
[data-theme='light'] {
  /* Surfaces — Warm Ivory */
  --color-bg: #f6f4ef;
  --color-surface: #faf8f4;
  --color-surface-2: #fdfcf9;
  --color-surface-offset: #f0ede6;
  --color-surface-offset-2: #eae5db;
  --color-surface-dynamic: #e3dfd6;
  --color-divider: #d9d5cc;
  --color-border: #d0ccbf;

  /* Text — Ink Navy */
  --color-text: #1c2438;
  --color-text-muted: #6b6f7a;
  --color-text-faint: #a8aab0;
  --color-text-inverse: #f9f8f4;

  /* Primary — Midnight Navy */
  --color-primary: #1a2a4a;
  --color-primary-hover: #121d35;
  --color-primary-active: #0d1524;
  --color-primary-highlight: #d6dce8;

  /* Accent — Justice Gold */
  --color-accent: #b8860b;
  --color-accent-hover: #9a7009;
  --color-accent-active: #7d5a07;
  --color-accent-highlight: #f0e6cc;

  /* Success */
  --color-success: #2d6a2e;
  --color-success-hover: #1e4d1f;
  --color-success-active: #143514;
  --color-success-highlight: #d0e0d0;

  /* Blue */
  --color-blue: #2b5078;
  --color-blue-hover: #1e3d5e;
  --color-blue-active: #162d47;
  --color-blue-highlight: #d0dce8;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 250 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 250 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 250 / 0.12);
  --shadow-xl: 0 24px 56px oklch(0.2 0.01 250 / 0.16);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;

  /* Fonts */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
}

[data-theme='dark'] {
  --color-bg: #0f131f;
  --color-surface: #141928;
  --color-surface-2: #181e30;
  --color-surface-offset: #1a2032;
  --color-surface-offset-2: #1e2538;
  --color-surface-dynamic: #252c42;
  --color-divider: #232a3d;
  --color-border: #2e364c;

  --color-text: #d4d7e0;
  --color-text-muted: #82889a;
  --color-text-faint: #565b6e;
  --color-text-inverse: #1c2438;

  --color-primary: #5b7cb5;
  --color-primary-hover: #456a9e;
  --color-primary-active: #345685;
  --color-primary-highlight: #2a3450;

  --color-accent: #d4a437;
  --color-accent-hover: #e0b44a;
  --color-accent-active: #ecc45d;
  --color-accent-highlight: #3d3520;

  --color-success: #5da85e;
  --color-success-hover: #4a9a4b;
  --color-success-active: #3a8a3b;
  --color-success-highlight: #1e3320;

  --color-blue: #5b86b5;
  --color-blue-hover: #4575a0;
  --color-blue-active: #35658a;
  --color-blue-highlight: #1e2d3d;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  --shadow-xl: 0 24px 56px oklch(0 0 0 / 0.5);
}

/* System dark fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0f131f;
    --color-surface: #141928;
    --color-surface-2: #181e30;
    --color-surface-offset: #1a2032;
    --color-surface-offset-2: #1e2538;
    --color-surface-dynamic: #252c42;
    --color-divider: #232a3d;
    --color-border: #2e364c;
    --color-text: #d4d7e0;
    --color-text-muted: #82889a;
    --color-text-faint: #565b6e;
    --color-text-inverse: #1c2438;
    --color-primary: #5b7cb5;
    --color-primary-hover: #456a9e;
    --color-primary-active: #345685;
    --color-primary-highlight: #2a3450;
    --color-accent: #d4a437;
    --color-accent-hover: #e0b44a;
    --color-accent-active: #ecc45d;
    --color-accent-highlight: #3d3520;
    --color-success: #5da85e;
    --color-success-hover: #4a9a4b;
    --color-success-active: #3a8a3b;
    --color-success-highlight: #1e3320;
    --color-blue: #5b86b5;
    --color-blue-hover: #4575a0;
    --color-blue-active: #35658a;
    --color-blue-highlight: #1e2d3d;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
    --shadow-xl: 0 24px 56px oklch(0 0 0 / 0.5);
  }
}

/* ============================================
   Layout
   ============================================ */
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section {
  padding-block: clamp(var(--space-12), 6vw, var(--space-24));
}

/* ============================================
   Header
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.06);
  transition: box-shadow var(--transition-interactive);
  overflow: hidden;
}
.header--scrolled {
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 64px;
  box-sizing: border-box;
}
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
  flex-shrink: 0;
}
.logo-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.nav {
  display: flex;
  align-items: center;
  flex-shrink: 1;
  min-width: 0;
  gap: var(--space-6);
}
.nav-links {
  display: none;
}
.nav-link {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  display: inline-block;
  padding: 0 8px;
}
.nav-link:last-child {
  padding-right: 0;
}
.header .btn {
  padding: 6px 14px;
  font-size: 13px;
}
.nav-link:hover {
  color: var(--color-text);
}
.header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.header-actions .theme-toggle {
  margin-right: 12px;
}
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  border: 1px solid oklch(from var(--color-text) l c h / 0.1);
}
.theme-toggle:hover {
  color: var(--color-text);
  border-color: oklch(from var(--color-text) l c h / 0.2);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  min-height: 44px;
}
.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
}
.btn-primary:active {
  background: var(--color-accent-active);
}
.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: oklch(from var(--color-text) l c h / 0.25);
}
.btn-secondary:hover {
  border-color: oklch(from var(--color-text) l c h / 0.3);
  background: oklch(from var(--color-text) l c h / 0.03);
}
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  padding: var(--space-2) var(--space-4);
}
.btn-ghost:hover {
  background: oklch(from var(--color-primary) l c h / 0.08);
}
.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* ============================================
   Hero
   ============================================ */
.hero {
  position: relative;
  padding-block: clamp(var(--space-16), 10vw, var(--space-32));
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, oklch(from var(--color-primary) l c h / 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 80% 20%, oklch(from var(--color-accent) l c h / 0.04), transparent);
  pointer-events: none;
}
.hero-content {
  position: relative;
  max-width: 760px;
  margin-inline: auto;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: oklch(from var(--color-accent) l c h / 0.1);
  border: 1px solid oklch(from var(--color-accent) l c h / 0.2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-8);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-6);
  color: var(--color-text);
}
.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.5;
  max-width: 60ch;
  margin-inline: auto;
  margin-bottom: var(--space-10);
}
.hero-cta {
  text-align: center;
  padding: 0 16px;
}
.hero-cta .btn {
  display: inline-flex;
  margin: 8px 16px;
}
.hero-stats {
  text-align: center;
  margin-top: var(--space-16);
  padding-top: var(--space-8);
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
}
.hero-stat {
  text-align: center;
  display: inline-block;
  min-width: 140px;
  padding: 16px 32px;
}
.hero-stat-number {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  display: block;
}
.hero-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-1);
}

/* ============================================
   Section Headers
   ============================================ */
.section-header {
  text-align: center;
  max-width: 640px;
  margin-inline: auto;
  margin-bottom: var(--space-12);
}
.section-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-3);
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
  color: var(--color-text);
}
.section-header p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
}

/* ============================================
   Trust Bar
   ============================================ */
.trust-bar {
  padding-block: var(--space-8);
  border-block: 1px solid oklch(from var(--color-text) l c h / 0.06);
  background: var(--color-surface);
}
.trust-items {
  text-align: center;
  padding-inline: var(--space-4);
}
.trust-item {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 8px 20px;
}
.trust-item svg {
  width: 20px;
  height: 20px;
  color: var(--color-success);
  flex-shrink: 0;
}

/* ============================================
   Outcomes Table
   ============================================ */
.outcomes-table {
  max-width: var(--content-default);
  margin-inline: auto;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}
.outcomes-table table {
  width: 100%;
}
.outcomes-table th,
.outcomes-table td {
  padding: var(--space-4) var(--space-6);
  text-align: left;
}
.outcomes-table th {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.outcomes-table td {
  font-size: var(--text-base);
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
}
.outcomes-table td:first-child {
  font-weight: 600;
  color: var(--color-text);
}
.outcomes-table td:nth-child(2) {
  color: var(--color-text-muted);
  text-decoration: line-through;
  text-decoration-color: oklch(from var(--color-text-faint) l c h / 0.5);
}
.outcomes-table td:last-child {
  color: var(--color-accent);
  font-weight: 700;
}
@media (max-width: 600px) {
  .outcomes-table th,
  .outcomes-table td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
  }
  .outcomes-table th:nth-child(1),
  .outcomes-table td:nth-child(1) {
    display: none;
  }
  .outcomes-table th:first-of-type,
  .outcomes-table td:first-of-type {
    display: table-cell;
  }
}

/* ============================================
   Feature Grid
   ============================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
}
.feature-card {
  padding: 32px;
  margin: 12px;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive), transform var(--transition-interactive);
}
.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: oklch(from var(--color-primary) l c h / 0.08);
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}
.feature-icon svg {
  width: 24px;
  height: 24px;
}
.feature-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-3);
  color: var(--color-text);
}
.feature-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}
.feature-card .source-link {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}
.feature-card .source-link:hover {
  text-decoration: underline;
}

/* ============================================
   Stats Banner
   ============================================ */
.stats-banner {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding-block: clamp(var(--space-12), 6vw, var(--space-20));
}
.stats-banner .section-header h2 {
  color: var(--color-text-inverse);
}
.stats-banner .section-header p {
  color: oklch(from var(--color-text-inverse) l c h / 0.7);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  max-width: var(--content-wide);
  margin-inline: auto;
}
.stat-card {
  text-align: center;
  padding: 24px 20px;
}
.stat-card .stat-number {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-accent);
  display: block;
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: var(--text-sm);
  color: oklch(from var(--color-text-inverse) l c h / 0.7);
  margin-top: var(--space-2);
}

/* ============================================
   Pricing
   ============================================ */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  max-width: var(--content-default);
  margin-inline: auto;
}
.pricing-card {
  padding: 32px;
  margin: 12px;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
}
.pricing-card--featured {
  border-color: var(--color-accent);
  border-width: 2px;
  box-shadow: var(--shadow-lg);
}
.pricing-card--featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-accent);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}
.pricing-plan {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.pricing-price {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.pricing-price span {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 400;
}
.pricing-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}
.pricing-features {
  display: block;
  margin-bottom: var(--space-8);
  flex-grow: 1;
}
.pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--color-text);
  list-style: none;
  margin-bottom: 12px;
}
.pricing-features li::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8860b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* ============================================
   FAQ Accordion
   ============================================ */
.faq-list {
  max-width: var(--content-default);
  margin-inline: auto;
}
.faq-item {
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
  margin-bottom: 12px;
}
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-4) var(--space-6);
  text-align: left;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  min-height: 44px;
}
.faq-question:hover {
  background: oklch(from var(--color-text) l c h / 0.02);
}
.faq-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: transform var(--transition-interactive);
}
.faq-item[open] .faq-icon {
  transform: rotate(180deg);
}
.faq-answer {
  padding: 0 var(--space-6) var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
}
.faq-answer a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}
.faq-answer a:hover {
  text-decoration: underline;
}

/* ============================================
   Final CTA
   ============================================ */
.final-cta {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  text-align: center;
  padding-block: clamp(var(--space-16), 8vw, var(--space-32));
}
.final-cta h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
  color: var(--color-text-inverse);
}
.final-cta p {
  font-size: var(--text-lg);
  color: oklch(from var(--color-text-inverse) l c h / 0.7);
  max-width: 50ch;
  margin-inline: auto;
  margin-bottom: var(--space-8);
}
.final-cta .btn-primary {
  background: var(--color-accent);
}
.final-cta .btn-primary:hover {
  background: var(--color-accent-hover);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  padding-block: var(--space-12) var(--space-8);
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
  background: var(--color-surface);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  justify-content: space-between;
  align-items: flex-start;
}
.footer-brand {
  max-width: 280px;
}
.footer-brand p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
}
.footer-links {
  display: block;
}
.footer-col {
  display: inline-block;
  vertical-align: top;
  margin-right: 48px;
}
.footer-col h4 {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
}
.footer-col a {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  margin-bottom: var(--space-2);
}
.footer-col a:hover {
  color: var(--color-text);
}
.footer-bottom {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-align: center;
}

/* ============================================
   Scroll Reveal Animation
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}
