@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@500;700&family=Fraunces:opsz,wght@9..144,500..800&family=JetBrains+Mono:wght@400;500;700&family=Source+Serif+4:opsz,wght@8..60,400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=Spectral:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap");

:root {
  color-scheme: light;
  /* Aged paper palette - warmer, more authentic */
  --paper: #f8f5ef;
  --paper-strong: #fffdf8;
  --paper-soft: #f0ebe2;
  --paper-deep: #e4ddd0;
  --paper-aged: #d9d2c4;
  --panel: rgba(255, 253, 248, 0.82);
  --panel-strong: rgba(255, 253, 248, 0.96);
  
  /* Scholarly ink tones */
  --ink: #1a1814;
  --ink-soft: #3d3830;
  --ink-faint: #6b6459;
  --ink-ghost: #9a9285;
  
  /* Refined lines */
  --line: rgba(26, 24, 20, 0.1);
  --line-strong: rgba(26, 24, 20, 0.18);
  --line-rule: rgba(26, 24, 20, 0.06);
  
  /* Academic accent colors */
  --accent: #c23028;
  --accent-soft: rgba(194, 48, 40, 0.1);
  --accent-glow: rgba(194, 48, 40, 0.06);
  --highlight-yellow: rgba(255, 235, 140, 0.5);
  --highlight-red: rgba(194, 48, 40, 0.12);
  --highlight-blue: rgba(45, 85, 145, 0.08);
  
  /* Status colors - muted scholarly palette */
  --success: #2d5a3d;
  --success-soft: rgba(45, 90, 61, 0.12);
  --warn: #9a6d1f;
  --warn-soft: rgba(154, 109, 31, 0.14);
  --danger: #8b2d23;
  --danger-soft: rgba(139, 45, 35, 0.1);
  --blue-soft: rgba(45, 85, 145, 0.08);
  
  /* Shadows with sepia warmth */
  --shadow: 0 8px 24px rgba(26, 24, 20, 0.06);
  --shadow-lifted: 0 16px 40px rgba(26, 24, 20, 0.1);
  --shadow-inset: inset 0 1px 2px rgba(26, 24, 20, 0.04);
  
  --radius: 3px;
  --radius-tight: 2px;
  --max-page: 1180px;
  --max-copy: 720px;
  
  /* Typography - scholarly print aesthetic */
  --serif: "Fraunces", Georgia, serif;
  --body: "Spectral", "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --hand: "Caveat", cursive;
  
  /* VEX-style animation tokens */
  --vex-glow: 0 0 20px rgba(194, 48, 40, 0.15);
  --vex-pulse: 0 0 0 0 rgba(194, 48, 40, 0.4);
}

/* ============================================
   DARK MODE THEME
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161412;
    --paper-strong: #1c1a17;
    --paper-soft: #201e1a;
    --paper-deep: #0e0d0b;
    --paper-aged: #2a2722;
    --panel: rgba(28, 26, 23, 0.92);
    --panel-strong: rgba(32, 30, 26, 0.98);
    --ink: #f0ede6;
    --ink-soft: #c4bfb5;
    --ink-faint: #8a857a;
    --ink-ghost: #6b665c;
    --line: rgba(240, 237, 230, 0.1);
    --line-strong: rgba(240, 237, 230, 0.18);
    --accent: #e85450;
    --accent-soft: rgba(232, 84, 80, 0.12);
    --accent-glow: rgba(232, 84, 80, 0.08);
    --success: #5cb85c;
    --success-soft: rgba(92, 184, 92, 0.12);
    --warn: #d4a04a;
    --warn-soft: rgba(212, 160, 74, 0.14);
    --danger: #d45450;
    --danger-soft: rgba(212, 84, 80, 0.12);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lifted: 0 16px 40px rgba(0, 0, 0, 0.4);
  }
}

[data-theme="dark"] {
  --paper: #161412;
  --paper-strong: #1c1a17;
  --paper-soft: #201e1a;
  --paper-deep: #0e0d0b;
  --paper-aged: #2a2722;
  --panel: rgba(28, 26, 23, 0.92);
  --panel-strong: rgba(32, 30, 26, 0.98);
  --ink: #f0ede6;
  --ink-soft: #c4bfb5;
  --ink-faint: #8a857a;
  --ink-ghost: #6b665c;
  --line: rgba(240, 237, 230, 0.1);
  --line-strong: rgba(240, 237, 230, 0.18);
  --accent: #e85450;
  --accent-soft: rgba(232, 84, 80, 0.12);
  --accent-glow: rgba(232, 84, 80, 0.08);
  --success: #5cb85c;
  --success-soft: rgba(92, 184, 92, 0.12);
  --warn: #d4a04a;
  --warn-soft: rgba(212, 160, 74, 0.14);
  --danger: #d45450;
  --danger-soft: rgba(212, 84, 80, 0.12);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lifted: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* Dark mode specific overrides */
[data-theme="dark"] .site-header,
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header {
    background: rgba(22, 20, 18, 0.92);
  }
}

[data-theme="dark"] .site-header.is-scrolled {
  background: rgba(22, 20, 18, 0.96);
}

[data-theme="dark"] .paper-demo {
  background: linear-gradient(180deg, #1c1a17 0%, #161412 100%);
  border-color: rgba(240, 237, 230, 0.1);
}

[data-theme="dark"] body::before {
  opacity: 0.3;
}

[data-theme="dark"] body::after {
  background: radial-gradient(
    ellipse 80% 60% at 50% 50%,
    transparent 50%,
    rgba(0, 0, 0, 0.15) 80%,
    rgba(0, 0, 0, 0.25) 100%
  );
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
}

/* Documentary film grain + aged paper texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: 
    /* Fine film grain */
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)' opacity='0.04'/%3E%3C/svg%3E"),
    /* Subtle paper fiber texture */
    url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='fiber'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.02 0.08' numOctaves='2' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='2' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='%23d4cfc3' filter='url(%23fiber)' opacity='0.015'/%3E%3C/svg%3E");
  opacity: 0.55;
  pointer-events: none;
}

/* Aged paper edge vignette */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
    ellipse 80% 60% at 50% 50%,
    transparent 50%,
    rgba(180, 168, 148, 0.04) 80%,
    rgba(140, 128, 108, 0.08) 100%
  );
  pointer-events: none;
}

body[data-page="dashboard"] {
  background: linear-gradient(180deg, var(--paper) 0%, #f6f3ed 100%);
}

a {
  color: inherit;
}

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

button {
  touch-action: manipulation;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
}

[hidden] {
  display: none !important;
}

main [id],
section[id],
h1[id],
h2[id] {
  scroll-margin-top: 96px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid rgba(212, 43, 43, 0.3);
  outline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 4px rgba(212, 43, 43, 0.14);
}

.skip-link {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 80;
  padding: 10px 14px;
  border-radius: var(--radius-tight);
  background: var(--ink);
  color: var(--paper-strong);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transform: translateY(-140%);
  transition: transform 160ms ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* ============================================
   PAGE LOAD TRANSITIONS
   ============================================ */

main {
  opacity: 0;
  transition: opacity 400ms ease;
}

body.is-loaded main {
  opacity: 1;
}

/* ============================================
   ENHANCED HEADER
   ============================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(248, 245, 239, 0.88);
  border-bottom: 1px solid var(--line);
  transition: 
    box-shadow 300ms ease,
    background-color 300ms ease,
    border-color 300ms ease;
}

.site-header.is-scrolled {
  background: rgba(248, 245, 239, 0.95);
  box-shadow: 
    0 1px 0 var(--line),
    0 4px 20px rgba(26, 24, 20, 0.06);
}

.site-header__inner,
.page-wrap {
  width: min(var(--max-page), calc(100vw - 48px));
  margin: 0 auto;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 60px;
}

.brand {
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.brand__dot {
  color: var(--accent);
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-tight);
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  transition: 
    color 200ms ease,
    background-color 200ms ease,
    border-color 200ms ease,
    transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-toggle:hover {
  color: var(--ink);
  background: var(--paper-soft);
  border-color: var(--line-strong);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-toggle:hover svg {
  transform: rotate(15deg);
}

/* Sun/moon icon visibility */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

:root:not([data-theme]) .theme-toggle .icon-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun {
    display: none;
  }
  :root:not([data-theme]) .theme-toggle .icon-moon {
    display: block;
  }
}

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

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

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

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

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.site-nav a {
  position: relative;
  padding: 8px 6px;
  border-radius: 0;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 200ms ease;
}

/* Animated underline on hover */
.site-nav a::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 4px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.page-wrap {
  padding-bottom: 96px;
}

.home-hero {
  padding-top: 0;
}

.hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr);
  min-height: calc(100vh - 60px);
  border-bottom: 1px solid var(--line);
}

.hero-split__lead {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 84px 60px 80px 8px;
  border-right: 1px solid var(--line);
}

.hero-split__demo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 0 72px 52px;
  background: var(--paper-soft);
}

/* Scholarly eyebrow - like journal category labels */
.hero-eyebrow,
.hero-subtext {
  font-family: var(--mono);
  text-transform: uppercase;
}

.hero-eyebrow {
  position: relative;
  display: inline-block;
  margin: 0 0 28px;
  padding: 6px 14px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent-soft);
  border-radius: 2px;
}

/* Editorial title - refined scholarly weight */
.hero-title {
  max-width: 640px;
  margin: 0 0 32px;
  font-family: var(--serif);
  font-size: clamp(2.8rem, 4.8vw, 4.4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
  color: var(--ink);
}

/* Strikethrough with editorial red pencil effect */
.hero-strike {
  position: relative;
  color: var(--ink-faint);
  font-style: italic;
}

.hero-strike::after {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: 52%;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(194, 48, 40, 0.7) 8%,
    rgba(194, 48, 40, 0.85) 50%,
    rgba(194, 48, 40, 0.7) 92%,
    transparent 100%
  );
  transform: rotate(-0.8deg) scaleY(0.8);
  border-radius: 2px;
  /* Rough hand-drawn effect */
  filter: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='rough'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.05' numOctaves='2'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='1'/%3E%3C/filter%3E%3C/svg%3E#rough");
}

/* Body text - readable scholarly prose */
.hero-body {
  max-width: 480px;
  margin: 0 0 40px;
  color: var(--ink-soft);
  font-size: 1.12rem;
  line-height: 1.82;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Subtext - footnote style */
.hero-subtext {
  position: relative;
  margin-top: 20px;
  padding-top: 16px;
  color: var(--ink-ghost);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
}

.hero-subtext::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 1px;
  background: var(--line-strong);
}

.page-hero {
  padding: 42px 0 28px;
}

.page-hero--compact {
  padding-top: 40px;
}

.hero-grid {
  display: grid;
  gap: 28px;
  align-items: start;
}

.hero-grid--home {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.hero-grid--dashboard {
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
}

.page-title,
.section__title,
.panel__title,
.card__title,
.banner__title,
.stat__value {
  font-family: var(--serif);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.page-title {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 4.6rem);
}

.page-title--compact {
  font-size: clamp(2.15rem, 4vw, 3.4rem);
}

.page-lead,
.section__text,
.panel__text {
  max-width: var(--max-copy);
  color: var(--ink-soft);
  font-size: 1.1rem;
}

/* Scholarly labels - journal/academic styling */
.section__eyebrow,
.panel__eyebrow,
.stat__label,
.badge,
.surface-card__meta,
.finding-card__meta,
.helper-text,
.subtle-label,
.faq-trigger__label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Section eyebrow - like journal section headers */
.section__eyebrow,
.panel__eyebrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--accent);
}

.section__eyebrow::before {
  content: "";
  display: block;
  width: 24px;
  height: 2px;
  background: var(--accent);
  opacity: 0.6;
}

.button-row,
.report-actions,
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Scholarly buttons - refined, authoritative */
.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper-strong);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  overflow: hidden;
  transition:
    background-color 200ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 200ms ease,
    color 200ms ease,
    transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 200ms ease;
}

/* Subtle inner highlight */
.button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08) 0%,
    transparent 50%
  );
  pointer-events: none;
}

.button:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(194, 48, 40, 0.2);
}

/* Primary accent button */
.button--accent {
  background: linear-gradient(
    180deg,
    #c93830 0%,
    #b02a24 100%
  );
  border-color: #9a2420;
  box-shadow: 
    0 1px 2px rgba(154, 36, 32, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.button--accent:hover {
  background: linear-gradient(
    180deg,
    #d44038 0%,
    #b82e28 100%
  );
  border-color: #8a1e1a;
  box-shadow: 
    0 4px 16px rgba(194, 48, 40, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.button:disabled {
  cursor: not-allowed;
  background: rgba(21, 19, 17, 0.36);
  border-color: rgba(21, 19, 17, 0.36);
  color: rgba(252, 250, 246, 0.88);
  transform: none;
}

.button--secondary {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

.button--secondary:hover,
.button--ghost:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper-strong);
}

.button--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.inline-note,
.helper-text {
  color: var(--ink-faint);
}

.inline-note {
  font-size: 0.96rem;
}

/* Cards and panels with refined depth */
.panel,
.hero-card,
.surface-card,
.stat-card,
.faq-item,
.metric-card,
.scenario-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 
    0 1px 2px rgba(26, 24, 20, 0.04),
    0 4px 16px rgba(26, 24, 20, 0.04);
  transition: 
    transform 280ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 280ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 200ms ease;
}

/* Subtle hover lift for interactive cards */
.surface-card:hover,
.stat-card:hover,
.metric-card:hover,
.scenario-card:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 2px 4px rgba(26, 24, 20, 0.04),
    0 8px 24px rgba(26, 24, 20, 0.08),
    0 16px 48px rgba(26, 24, 20, 0.04);
  border-color: var(--line-strong);
}

.hero-card,
.panel {
  padding: 28px;
}

.panel + .panel,
.content-stack > * + * {
  margin-top: 20px;
}

.panel__header,
.section__header {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.panel__title,
.section__title {
  margin: 0;
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
}

.section {
  padding-top: 20px;
}

.section + .section {
  margin-top: 34px;
}

.stats-grid,
.workflow-grid,
.surface-grid,
.kpi-grid,
.chart-grid,
.info-grid,
.scenario-grid,
.chip-list {
  display: grid;
  gap: 16px;
}

.stats-bar-section {
  padding-top: 0;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.stats-bar__item {
  padding: 34px 28px;
  border-right: 1px solid var(--line);
}

.stats-bar__item:last-child {
  border-right: 0;
}

.stats-bar__value {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.stats-bar__label {
  margin: 0 0 8px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stats-bar__text {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workflow-grid,
.surface-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.info-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

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

.chip-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card,
.surface-card,
.metric-card,
.scenario-card {
  padding: 20px;
}

.surface-card--editorial {
  background: var(--paper-soft);
}

.stat__value {
  margin: 10px 0 6px;
  font-size: 2.35rem;
}

.stat__label {
  color: var(--ink-faint);
}

.stat__text,
.surface-card__body,
.metric-card__body,
.scenario-card__note,
.faq-answer,
.field-note {
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.demo-card {
  position: relative;
  overflow: hidden;
}

/* Scholarly document preview - aged paper effect */
.paper-demo {
  position: relative;
  width: min(100%, 490px);
  padding: 38px 42px 42px;
  border: 1px solid rgba(26, 24, 20, 0.12);
  background: 
    linear-gradient(180deg, 
      #fffef9 0%, 
      #faf8f3 50%,
      #f5f2eb 100%
    );
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 16px rgba(26, 24, 20, 0.08),
    0 16px 48px rgba(26, 24, 20, 0.06),
    /* Red accent corner fold */
    inset -3px -3px 0 rgba(194, 48, 40, 0.08);
  font-size: 0.9rem;
  line-height: 1.85;
  transform: rotate(-0.3deg);
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Paper texture overlay */
.paper-demo::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: inherit;
}

/* Subtle page edge shadow */
.paper-demo::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  right: -4px;
  bottom: -4px;
  background: rgba(26, 24, 20, 0.04);
  border-radius: 2px;
  z-index: -1;
  transform: rotate(0.5deg);
}

.paper-demo:hover {
  transform: rotate(0deg) translateY(-2px);
}

.paper-demo__header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(26, 24, 20, 0.1);
  color: var(--ink-ghost);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Typewriter-style line number effect */
.paper-line {
  position: relative;
  margin-top: 12px;
  padding-left: 28px;
  padding-right: 20px;
}

.paper-line::before {
  content: counter(line);
  counter-increment: line;
  position: absolute;
  left: 0;
  top: 0;
  color: var(--ink-ghost);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.5;
}

/* Initialize line counter */
.paper-demo {
  counter-reset: line;
}

.paper-line--quiet {
  color: var(--ink-faint);
  font-style: italic;
}

/* ============================================
   VEX-STYLE HIGHLIGHT EFFECTS
   Scholarly annotations with subtle glow animations
   ============================================ */

/* VEX glow keyframe */
@keyframes vexPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(194, 48, 40, 0);
  }
  50% {
    box-shadow: 0 0 12px 2px rgba(194, 48, 40, 0.15);
  }
}

@keyframes highlightSweep {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes marginGlow {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.8;
  }
}

/* Red highlight - critical findings */
.underline-red {
  position: relative;
  text-decoration: none;
  background: 
    linear-gradient(90deg, 
      transparent 0%, 
      rgba(194, 48, 40, 0.06) 10%,
      rgba(194, 48, 40, 0.12) 50%,
      rgba(194, 48, 40, 0.06) 90%,
      transparent 100%
    ),
    linear-gradient(
      to top,
      rgba(194, 48, 40, 0.08) 0%,
      rgba(194, 48, 40, 0.08) 35%,
      transparent 35%
    );
  padding: 1px 4px;
  margin: 0 -4px;
  border-radius: 2px;
  transition: all 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.underline-red::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(194, 48, 40, 0.1), 
    transparent
  );
  background-size: 200% 100%;
  border-radius: 3px;
  opacity: 0;
  animation: highlightSweep 3s ease-in-out infinite;
  animation-play-state: paused;
}

.underline-red:hover::before {
  opacity: 1;
  animation-play-state: running;
}

.underline-red::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    var(--accent) 15%,
    var(--accent) 85%,
    transparent
  );
  opacity: 0.6;
  border-radius: 1px;
  transition: opacity 200ms ease;
}

.underline-red:hover::after {
  opacity: 0.9;
}

/* Amber highlight - warnings */
.underline-amber {
  position: relative;
  text-decoration: none;
  background: 
    linear-gradient(
      to top,
      rgba(154, 109, 31, 0.08) 0%,
      rgba(154, 109, 31, 0.08) 35%,
      transparent 35%
    );
  padding: 1px 4px;
  margin: 0 -4px;
  border-radius: 2px;
  transition: all 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.underline-amber::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    var(--warn) 15%,
    var(--warn) 85%,
    transparent
  );
  opacity: 0.5;
  border-radius: 1px;
  transition: opacity 200ms ease;
}

.underline-amber:hover {
  background: 
    linear-gradient(
      to top,
      rgba(154, 109, 31, 0.14) 0%,
      rgba(154, 109, 31, 0.14) 40%,
      transparent 40%
    );
}

.underline-amber:hover::after {
  opacity: 0.8;
}

/* Yellow highlighter - like physical marker */
.highlight-marker {
  position: relative;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 25%,
    var(--highlight-yellow) 25%,
    var(--highlight-yellow) 85%,
    transparent 85%
  );
  padding: 0 2px;
  margin: 0 -2px;
  border-radius: 1px;
}

/* Margin note indicator */
.margin-mark {
  position: relative;
}

.margin-mark::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 100%;
  min-height: 20px;
  background: var(--accent);
  opacity: 0.5;
  border-radius: 2px;
  animation: marginGlow 2s ease-in-out infinite;
}

/* Hover states with VEX glow */
.underline-red:hover,
.underline-amber:hover {
  transform: translateY(-1px);
}

.underline-red:hover {
  box-shadow: 0 2px 8px rgba(194, 48, 40, 0.12);
}

/* ============================================
   SCHOLARLY FINDING BADGES
   Typewriter-style stamps with VEX glow
   ============================================ */

@keyframes stampIn {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.8) rotate(-2deg);
  }
  60% {
    transform: translateY(2px) scale(1.02) rotate(0.5deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes fatalPulse {
  0%, 100% {
    box-shadow: 
      0 1px 3px rgba(139, 45, 35, 0.3),
      0 0 0 0 rgba(139, 45, 35, 0);
  }
  50% {
    box-shadow: 
      0 1px 3px rgba(139, 45, 35, 0.3),
      0 0 12px 3px rgba(139, 45, 35, 0.2);
  }
}

.finding {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  padding: 4px 12px;
  opacity: 0;
  transform: translateY(-8px) scale(0.8);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 2px;
  border: 1px solid transparent;
  transition: all 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.finding.is-visible {
  animation: stampIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.paper-annotation.is-visible,
.paper-verdict__badge.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Fatal - red stamp with glow */
.finding--fatal {
  background: linear-gradient(135deg, #8b2d23 0%, #6b1f17 100%);
  color: #fff;
  border-color: rgba(139, 45, 35, 0.3);
  box-shadow: 
    0 1px 3px rgba(139, 45, 35, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.finding--fatal.is-visible {
  animation: stampIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             fatalPulse 2.5s ease-in-out 0.5s infinite;
}

/* Major - amber/sepia stamp */
.finding--major {
  background: linear-gradient(135deg, #faf6ef 0%, #f5ebe0 100%);
  color: #7a5518;
  border-color: rgba(154, 109, 31, 0.25);
  box-shadow: 
    0 1px 2px rgba(154, 109, 31, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Pass - muted green scholarly */
.finding--pass {
  background: linear-gradient(135deg, #f0f7f2 0%, #e4f0e8 100%);
  color: #2d5a3d;
  border-color: rgba(45, 90, 61, 0.15);
  box-shadow: 
    0 1px 2px rgba(45, 90, 61, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.paper-annotation {
  position: absolute;
  top: -4px;
  right: -104px;
  opacity: 0;
  transform: translateY(-4px) rotate(2deg);
  color: var(--accent);
  font-family: var(--hand);
  font-size: 1.05rem;
  white-space: nowrap;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.paper-verdict {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.paper-verdict__label {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.paper-verdict__badge {
  padding: 6px 10px;
  background: var(--danger);
  color: white;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.demo-card::after {
  content: "";
  position: absolute;
  inset: auto -14% -18% 46%;
  height: 160px;
  background: radial-gradient(circle, rgba(212, 43, 43, 0.18), transparent 68%);
  pointer-events: none;
}

.demo-card__stack {
  display: grid;
  gap: 16px;
}

.demo-card__rule {
  height: 1px;
  background: var(--line);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(21, 19, 17, 0.08);
  color: var(--ink);
}

.badge--success {
  background: var(--success-soft);
  color: var(--success);
}

.badge--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge--neutral {
  background: rgba(21, 19, 17, 0.06);
  color: var(--ink-faint);
}

.list-clean {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-clean li + li {
  margin-top: 10px;
}

.terminal-card {
  background: #1a1816;
  color: #f8f5ef;
  border-radius: var(--radius-tight);
  padding: 20px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.75;
}

.terminal-card__label {
  color: rgba(248, 245, 239, 0.56);
}

.status-box {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-tight);
  background: rgba(21, 19, 17, 0.04);
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.status-box--info {
  background: var(--blue-soft);
  border-color: rgba(18, 51, 122, 0.16);
}

.status-box--success {
  background: var(--success-soft);
  border-color: rgba(30, 106, 67, 0.2);
}

.status-box--error {
  background: var(--danger-soft);
  border-color: rgba(212, 43, 43, 0.2);
  color: var(--danger);
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.tab {
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 18px;
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    border-color 160ms ease,
    color 160ms ease;
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.field-label {
  display: inline-block;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dropzone {
  width: 100%;
  padding: 26px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-tight);
  background: var(--paper-strong);
  color: var(--ink-soft);
  text-align: center;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.dropzone:hover,
.dropzone[data-drag="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone[data-has-file="true"] {
  border-color: var(--success);
  background: rgba(30, 106, 67, 0.06);
}

.dropzone__icon {
  display: block;
  margin-bottom: 8px;
  font-size: 1.9rem;
  line-height: 1;
}

.dropzone__title {
  display: block;
  font-weight: 600;
}

.dropzone__meta,
.field-note {
  margin-top: 8px;
}

.textarea {
  width: 100%;
  min-height: 230px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-tight);
  background: var(--paper-strong);
  color: var(--ink);
  resize: vertical;
}

.textarea::placeholder {
  color: var(--ink-faint);
}

.submit-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 20px;
}

.progress-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.progress-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-tight);
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.progress-item__dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--ink-faint);
  flex: 0 0 auto;
}

.progress-item[data-state="active"] .progress-item__dot {
  background: var(--warn);
  animation: pulse 1.3s ease-in-out infinite;
}

.progress-item[data-state="done"] .progress-item__dot {
  background: var(--success);
}

.progress-item[data-state="error"] .progress-item__dot {
  background: var(--danger);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.92);
  }
}

.banner {
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.banner--success {
  background: rgba(30, 106, 67, 0.08);
  border-color: rgba(30, 106, 67, 0.18);
}

.banner--warn {
  background: rgba(169, 109, 17, 0.08);
  border-color: rgba(169, 109, 17, 0.18);
}

.banner--danger {
  background: rgba(159, 45, 32, 0.08);
  border-color: rgba(159, 45, 32, 0.18);
}

.banner__title {
  margin: 6px 0 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.banner__summary {
  margin-top: 12px;
  color: var(--ink-soft);
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.claims-list {
  margin: 0;
  padding-left: 20px;
}

.claims-list li + li {
  margin-top: 8px;
}

.finding-group {
  display: grid;
  gap: 14px;
}

.finding-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-tight);
  background: var(--paper-strong);
  overflow: hidden;
}

.finding-card__toggle {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.finding-card__toggle:hover {
  background: rgba(21, 19, 17, 0.04);
}

.finding-card__claim {
  overflow-wrap: anywhere;
}

.finding-card__body {
  padding: 0 16px 16px;
}

.finding-card__body > * + * {
  margin-top: 14px;
}

.finding-card__body blockquote {
  margin: 0;
  padding: 0 0 0 14px;
  border-left: 3px solid var(--line);
  color: var(--ink-faint);
}

.field-group__label {
  margin-bottom: 6px;
  color: var(--ink-faint);
}

.helper-grid {
  display: grid;
  gap: 12px;
}

.chart-panel canvas {
  width: 100% !important;
  height: 320px !important;
}

.kpi-value {
  margin: 10px 0 6px;
  font-family: var(--serif);
  font-size: 2.05rem;
  line-height: 1;
}

.chip {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-tight);
  background: var(--paper-strong);
}

.chip__title {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip__meta {
  color: var(--ink-soft);
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  padding: 0;
}

.faq-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border: 0;
  background: transparent;
  text-align: left;
}

.faq-trigger:hover {
  background: rgba(21, 19, 17, 0.04);
}

.faq-trigger__label {
  color: var(--ink);
  font-size: 0.8rem;
}

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

.section--ink {
  padding: 52px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
}

.section--ink .section__text,
.section--ink .surface-card__body {
  color: rgba(250, 250, 247, 0.72);
}

.section--ink .section__eyebrow {
  color: var(--accent);
}

.section--ink .section__title,
.section--ink .card__title {
  color: var(--paper);
}

.section--ink .surface-card {
  background: rgba(250, 250, 247, 0.06);
  border-color: rgba(250, 250, 247, 0.12);
  box-shadow: none;
}

.section--ink .surface-card__meta {
  color: var(--accent);
}

.footer-note {
  margin-top: 28px;
  color: var(--ink-faint);
  font-size: 0.95rem;
}

.empty-card {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-tight);
  color: var(--ink-faint);
  background: rgba(21, 19, 17, 0.03);
}

.empty-card--error {
  border-style: solid;
  border-color: rgba(159, 45, 32, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 28px 0;
}

@media (max-width: 1100px) {
  .hero-split,
  .hero-grid--home,
  .hero-grid--dashboard,
  .stats-grid,
  .stats-bar,
  .kpi-grid,
  .chart-grid,
  .info-grid,
  .surface-grid,
  .workflow-grid,
  .scenario-grid,
  .chip-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .site-header__inner,
  .page-wrap {
    width: min(var(--max-page), calc(100vw - 32px));
  }

  .site-header__inner {
    min-height: 80px;
    align-items: flex-start;
    padding: 12px 0;
  }

  /* Better mobile nav */
  .site-nav {
    gap: 8px;
  }

  .site-nav a {
    padding: 6px 4px;
    font-size: 0.65rem;
  }

  .hero-split__lead,
  .hero-split__demo {
    padding: 48px 0;
    border-right: 0;
  }

  .hero-split {
    min-height: auto;
  }

  .paper-annotation {
    position: static;
    display: block;
    margin-top: 6px;
  }

  /* Reduce animation complexity on mobile */
  .paper-demo {
    transform: none;
  }

  .paper-demo:hover {
    transform: none;
  }

  .hero-grid--home,
  .hero-grid--dashboard,
  .stats-grid,
  .stats-bar,
  .kpi-grid,
  .chart-grid,
  .info-grid,
  .surface-grid,
  .workflow-grid,
  .scenario-grid,
  .chip-list {
    grid-template-columns: 1fr;
  }

  .submit-row {
    grid-template-columns: 1fr;
  }

  .section--ink {
    padding: 32px 24px;
  }

  .chart-panel canvas {
    height: 260px !important;
  }

  /* Touch-friendly tap targets */
  .button {
    min-height: 52px;
    padding: 0 20px;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 560px) {
  .page-hero {
    padding-top: 28px;
  }

  .hero-title {
    font-size: clamp(2.3rem, 13vw, 3.3rem);
  }

  .hero-card,
  .panel,
  .surface-card,
  .stat-card,
  .metric-card,
  .scenario-card {
    padding: 20px;
  }

  .tablist {
    display: flex;
  }

  .button {
    width: 100%;
  }

  .finding-card__toggle {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .metric-row {
    gap: 8px;
  }

  .dropzone {
    padding: 22px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
