/* === Shared Design System v2 === */
/* ============================================
   KnowYourType — Premium Flow Design System v2
   Editorial Premium / Private Dossier
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* --- CSS Variables --- */
:root {
  /* Surfaces — warm stone palette */
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --surface-alt: #F5F5F0;
  --surface-warm: #FAF8F5;
  --surface-accent: #F0EEF8;
  --surface-dark: #1C1917;
  --surface-dark-alt: #292524;
  /* upd_v1: book / cover paper surfaces */
  --surface-paper: #F8F5EF;
  --surface-deep:  #EFEBE3;

  /* Borders */
  --border: #E7E5E0;
  --border-strong: #D6D3D1;
  --border-accent: #C7D2FE;
  --border-gold: #D4A853;

  /* Text */
  --text: #1C1917;
  --text-secondary: #57534E;
  --text-tertiary: #8B8680;
  --text-muted: #A8A29E;
  --text-inverse: #FAFAF9;
  --text-gold: #A16207;

  /* Accent (muted ink-blue, not purple) */
  --accent: #2F3A56;
  --accent-hover: #1F293F;
  --accent-light: #EEF1F6;
  --accent-subtle: #F7F8FA;
  --accent-muted: #667085;
  /* upd_v1: softer accent surface (used by .chip--accent, modal eyebrow) */
  --accent-soft: #EEF1F6;

  /* Ink (upd_v1 primary button + neutral dark text on light surfaces) */
  --ink: #1C1917;
  --ink-hover: #2A2724;

  /* Gold (premium marker) */
  --gold: #A16207;
  --gold-light: #FEF3C7;
  --gold-subtle: #FFFBEB;
  /* upd_v1: deeper gold for editorial accents, softer gold surface */
  --gold-deep: #7A4A04;
  --gold-soft: #F5EFE0;

  /* Semantic */
  --success: #059669;
  --success-light: #ECFDF5;
  --warning: #B45309;
  --warning-light: #FFFBEB;
  --danger: #DC2626;

  /* Category — text + subtle tinted background */
  --cat-personality: #6366F1;
  --cat-emotions: #E11D48;
  --cat-career: #059669;
  --cat-lifestyle: #D97706;
  --cat-personality-bg: #EEF2FF;
  --cat-emotions-bg: #FFF1F2;
  --cat-career-bg: #ECFDF5;
  --cat-lifestyle-bg: #FFFBEB;

  /* Preview banner (beta overlay) */
  --banner-bg: #1C1917;
  --banner-fg: #FAFAF9;
  --banner-accent: #D4A853;
  --banner-muted: #A8A29E;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 3.5rem;
  --space-3xl: 5rem;
  --space-4xl: 6.5rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 100px;

  /* Shadows — multi-layer for premium depth */
  --shadow-sm: 0 1px 2px rgba(28,25,23,0.04), 0 1px 3px rgba(28,25,23,0.06);
  --shadow-md: 0 2px 4px rgba(28,25,23,0.04), 0 8px 24px rgba(28,25,23,0.08);
  --shadow-lg: 0 4px 8px rgba(28,25,23,0.04), 0 16px 48px rgba(28,25,23,0.1);
  --shadow-xl: 0 8px 16px rgba(28,25,23,0.06), 0 24px 64px rgba(28,25,23,0.12);
  --shadow-card: 0 1px 3px rgba(28,25,23,0.04), 0 6px 20px rgba(28,25,23,0.06);
  --shadow-elevated: 0 4px 12px rgba(28,25,23,0.06), 0 20px 48px rgba(28,25,23,0.1);
  --shadow-gold: 0 4px 16px rgba(161,98,7,0.12);

  /* Typography */
  --font-serif: Georgia, 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Max widths */
  --max-width: 1120px;
  --max-width-wide: 1400px;
  --max-width-narrow: 720px;
  --max-width-reading: 640px;
  /* Analysis reading system — three-tier responsive:
     mobile  → full-width (container padding only)
     tablet/small desktop (<1280) → 820 canvas
     wide desktop (>=1280) → 1040 canvas
     Long prose (paragraphs) stays at 720-760 inside the canvas so line length
     doesn't become uncomfortable even when canvas is wide. Cards/grids/CTAs
     take the full canvas. */
  --max-width-analysis: 820px;
  --max-width-analysis-canvas: 1040px;
  --max-width-analysis-prose: 720px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.35s ease;

  /* Z-index scale */
  --z-base: 1;
  --z-sticky: 10;
  --z-nav: 100;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 2000;
}

/* --- Typography (editorial premium) --- */
.t-display {
  font-family: var(--font-serif);
  font-size: 3.25rem;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0;
  color: var(--text);
}
.t-h1 {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--text);
}
.t-h2 {
  font-family: var(--font-serif);
  font-size: 1.625rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--text);
}
.t-h3 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
}
.t-h4 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}
.t-body {
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.7;
}
.t-body-lg {
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-secondary);
}
.t-small {
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
}
.t-label {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

/* --- upd_v1 type scale (h-display / h-1 / h-2 / h-3) ---
   Editorial Premium / Private Dossier sizes per mockup `_shared.css`.
   Used by upd_v1 templates (Phase 2-7 migration). Legacy `.t-*` classes
   stay for now to avoid breaking existing pages — phased out as templates
   migrate. Phase 0 decision: 4 sizes, not 5; .t-h4 → falls back to .h-3
   or .t-body during migration.
   Canon: letter-spacing: 0. No font compression on body / chrome / book.
   No global h1..h5 rule — typography is opt-in via .h-* classes only,
   so Phase 1 does not silently restyle existing headings before Phase 2-7
   markup migration. */
.h-display {
  font-family: var(--font-serif);
  font-size: 4.25rem;
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: 0;
  color: var(--text);
}
.h-1 {
  font-family: var(--font-serif);
  font-size: 2.75rem;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--text);
}
.h-2 {
  font-family: var(--font-serif);
  font-size: 1.875rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--text);
}
.h-3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text);
}
.lead {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 1.375rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.lead--lg { font-size: 1.5rem; }
@media (max-width: 900px) {
  .h-display { font-size: 3rem; }
  .h-1 { font-size: 2.25rem; }
  .h-2 { font-size: 1.5rem; }
}

/* --- upd_v1 wordmark `KnowYourType / УзнайСвойТип` ---
   Paired bilingual brand. Last token (`Type` / `Тип`) goes in the muted
   ink-blue `--accent`. Both halves baseline-aligned with separator slash.
   `.kw--stack` for mobile/footer stacked variant (separator hidden). */
.kw {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0;
  color: var(--text);
  white-space: nowrap;
}
.kw__en, .kw__ru { font: inherit; color: inherit; }
.kw__en em, .kw__ru em {
  font-style: normal;
  color: var(--accent);
}
.kw__sep {
  color: var(--text-tertiary);
  font-weight: 400;
  font-size: 0.9em;
  letter-spacing: 0;
}
.kw--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.05;
}
.kw--stack .kw__sep { display: none; }
.kw--lg { font-size: 1.5rem; }
.kw--xl { font-size: 2.25rem; }

/* --- upd_v1 editorial primitives ---
   `_shared.css` portable building blocks for marketing / book / result
   pages. Margins kept conservative; per-template overrides allowed. */

/* Horizontal rules */
.rule { width: 56px; height: 1px; background: var(--gold); border: 0; margin: var(--space-lg) 0; }
.rule--center { margin-left: auto; margin-right: auto; }
.rule--full { width: 100%; background: var(--border); }

/* Eyebrow / overline label */
.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.eyebrow--gold { color: var(--gold); }
.eyebrow--accent { color: var(--accent); }
.eyebrow .dot {
  display: inline-block;
  width: 4px; height: 4px;
  margin: 0 8px 2px;
  background: var(--gold);
  border-radius: 50%;
  vertical-align: middle;
}

/* Marginalia (gold rule + italic aside) */
.marginalia {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-style: normal;
  color: var(--text-tertiary);
  border-left: 1px solid var(--gold);
  padding-left: var(--space-md);
  line-height: 1.55;
}

/* Pull-quote (top/bottom border, serif quote) */
.pull-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.4;
  color: var(--text);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

/* Drop cap — first letter of a paragraph styled large + gold */
.dropcap::first-letter {
  font-family: var(--font-serif);
  font-size: 4rem;
  font-weight: 400;
  float: left;
  line-height: 0.85;
  margin: 0.08em 0.12em 0 0;
  color: var(--gold);
}

/* Chapter label (Глава I / II / III / IV — small uppercase, gold numeral) */
.chapter-label {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.chapter-label strong { color: var(--gold); font-weight: 600; }

/* Notice — quiet editorial callout (used by pricing beta-access cue
   and other narrow message blocks). `.notice--lock` adds a compact NB marker. */
.notice {
  padding: var(--space-lg) var(--space-xl);
  background: var(--surface-paper);
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.5;
}
.notice--lock::before {
  content: 'NB';
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  font-style: italic;
  letter-spacing: 0;
  color: var(--gold);
  margin-right: var(--space-sm);
}

/* Scale (editorial bar — label / thin track / numeric value).
   Used in result page, dashboard summary. Mobile collapses to single column. */
.scale { display: grid; gap: var(--space-sm); }
.scale__row {
  display: grid;
  grid-template-columns: 220px 1fr 90px;
  gap: var(--space-lg);
  align-items: center;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}
.scale__row:last-child { border-bottom: none; }
.scale__label { font-family: var(--font-sans); font-size: 0.9375rem; color: var(--text); }
.scale__track { position: relative; height: 2px; background: var(--border); }
.scale__fill  { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.scale__fill--gold { background: var(--gold); }
.scale__value {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.scale__value strong { color: var(--text); font-weight: 600; }
.scale__value em { color: var(--accent); font-style: normal; font-weight: 600; }
@media (max-width: 900px) {
  .scale__row { grid-template-columns: 1fr; gap: var(--space-xs); }
  .scale__value { text-align: left; }
}

/* --- upd_v1 book primitives (Phase 3) ---
   Spread (.book__spread), single page (.page), cover (.cover) — reusable
   editorial book metaphor used in home hero artifact, home «closer» block,
   pricing sample spread, dashboard cover, and PDF preview. Mockup canon:
   `mockups/full-round/_shared.css` lines 361-496. */
.book { max-width: 1120px; margin: 0 auto; }
.book__spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: linear-gradient(90deg, var(--surface-deep) 0%, var(--surface-paper) 10%, var(--surface-paper) 50%, var(--surface-paper) 90%, var(--surface-deep) 100%);
  box-shadow:
    0 1px 0 rgba(0,0,0,0.04),
    0 2px 6px rgba(0,0,0,0.05),
    0 24px 60px rgba(28,25,23,0.18);
  position: relative;
  border-radius: 1px;
  overflow: hidden;
}
.book__spread::before {
  content: '';
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 18px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.06) 45%, rgba(0,0,0,0.10) 50%, rgba(0,0,0,0.06) 55%, transparent 100%);
  pointer-events: none;
}
.page {
  padding: 64px 72px 88px;
  min-height: 660px;
  position: relative;
}
.page--single {
  background: var(--surface-paper);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 18px 50px rgba(28,25,23,0.14);
}
.page--left { border-right: 1px solid rgba(0,0,0,0.04); }
.page__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-lg);
}
.page__header strong { color: var(--gold); font-weight: 600; }
.page__title {
  font-family: var(--font-serif);
  font-size: 1.875rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  margin: 0 0 var(--space-md);
  color: var(--text);
}
.page p {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 var(--space-md);
  /* Web book previews follow the approved mockup: left-rag prose. Full
     justification belongs in generated/PDF reading layouts, not in narrow
     marketing spreads where it creates rivers and forced hyphenation. */
  text-align: left;
  text-align-last: left;
  hyphens: none;
  -webkit-hyphens: none;
}
.page p.dropcap::first-letter {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  font-weight: 400;
  float: left;
  line-height: 0.85;
  margin: 0.08em 0.1em 0 0;
  color: var(--gold);
}
.page__foot {
  position: absolute;
  left: 72px; right: 72px; bottom: 32px;
  height: 10px;
  display: block;
  font-family: var(--font-sans);
  font-size: 0.5625rem;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.page__foot > span {
  display: block;
  position: absolute;
  top: 50%;
  line-height: 1;
  transform: translateY(-50%);
}
.page__foot > span:first-child,
.page__running {
  left: 50%;
  max-width: calc(100% - 4.75rem);
  transform: translate(-50%, -50%);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page__foot > span:last-child,
.page__folio {
  right: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.page--left .page__foot > span:last-child,
.page--left .page__folio {
  left: 0;
  right: auto;
  text-align: left;
}
.page--single .page__foot > span:first-child,
.page--single .page__running {
  left: 0;
  max-width: calc(100% - 4rem);
  transform: translateY(-50%);
  text-align: left;
}
.page--single .page__foot > span:last-child,
.page--single .page__folio {
  left: auto;
  right: 0;
  text-align: right;
}
.page__tab {
  position: absolute;
  right: -2px;
  top: 32px;
  background: var(--gold);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px 4px 12px;
  font-weight: 600;
}

/* Book modifier: --hero — first-screen artifact matched to the approved
   mockup: tall pages, generous padding, dense but readable body. */
.book--hero .page {
  padding: 48px 56px 56px;
  min-height: 520px;
}
.book--hero .page__header {
  font-size: 0.625rem;
  margin-bottom: var(--space-md);
}
.book--hero .page__title {
  font-size: 1.5rem;
  line-height: 1.2;
  margin-bottom: var(--space-lg);
}
.book--hero .page p {
  font-size: 0.9375rem;
  line-height: 1.65;
  margin-bottom: var(--space-md);
  text-align: left;
  text-align-last: left;
  hyphens: none;
  -webkit-hyphens: none;
}
.book--hero .page p.dropcap::first-letter {
  font-size: 2.75rem;
  margin: 0.06em 0.08em 0 0;
}
.book--hero .page__foot {
  left: 32px;
  right: 32px;
  bottom: 24px;
  font-size: 0.5rem;
  letter-spacing: 0.13em;
}
.book--hero .page__running {
  max-width: calc(100% - 3.5rem);
}

/* Book modifier: --sample — for pricing sample spread.
   Same density as default but with explicit class for future overrides. */
.book--sample .page { min-height: 580px; }

.cover {
  background: linear-gradient(180deg, var(--surface-paper) 0%, var(--surface-deep) 100%);
  border: 1px solid var(--border);
  padding: var(--space-3xl) var(--space-2xl);
  text-align: center;
  position: relative;
  box-shadow: 0 24px 60px rgba(28,25,23,0.10);
}
.cover__eyebrow {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-md);
}
.cover__title {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 0;
}
.cover__rule {
  width: 80px; height: 1px;
  background: var(--gold);
  margin: var(--space-lg) auto;
}
.cover__sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 0;
}
@media (max-width: 900px) {
  .book__spread { grid-template-columns: 1fr; }
  .book__spread::before { display: none; }
  .page { padding: 36px 28px 64px; min-height: 0; }
  .page__foot { left: 28px; right: 28px; }
  .page--left .page__foot > span:first-child,
  .page--left .page__running {
    left: 0;
    max-width: calc(100% - 4rem);
    transform: translateY(-50%);
    text-align: left;
  }
  .page--left .page__foot > span:last-child,
  .page--left .page__folio {
    left: auto;
    right: 0;
    text-align: right;
  }
  .cover { padding: var(--space-2xl) var(--space-xl); }
  .cover__title { font-size: 2rem; }
  /* Mobile reverts justified body to left-aligned: narrow columns +
     justify produces rivers/gaps. Hyphenation stays on. */
  .page p { text-align: left; text-align-last: left; }
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}
.container--wide { max-width: var(--max-width-wide); }
.container--narrow { max-width: var(--max-width-narrow); }
.container--reading { max-width: var(--max-width-reading); }
.container--analysis { max-width: var(--max-width-analysis); }
@media (min-width: 1280px) {
  .container--analysis { max-width: var(--max-width-analysis-canvas); }
}

/* --- Responsive reading geometry (tokens drive both shell and grid) ---
   Explicit tokens so each breakpoint's math is verifiable:
     shell inner width = analysis-main + analysis-gap + analysis-toc
     shell max-width   = shell inner width + analysis-shell-pad + analysis-shell-pad
   If any of these drift apart, document.body.scrollWidth > window.innerWidth. */
:root {
  --analysis-shell-pad: var(--space-xl);  /* 40px — inherits .container side padding */
  --analysis-main:      var(--max-width-analysis); /* 820 default */
  --analysis-toc:       240px;
  --analysis-gap:       var(--space-xl);  /* 40px */
}
@media (min-width: 1440px) {
  :root {
    --analysis-main: 920px;
    --analysis-toc:  260px;
  }
}
@media (min-width: 1680px) {
  :root {
    --analysis-main: 1040px;
    --analysis-toc:  280px;
    --analysis-gap:  var(--space-2xl);    /* 56px */
  }
}

/* Shell for analysis pages that render a sticky TOC alongside the reading
   column. Below 1280 there's no TOC → shell collapses to main + padding.
   At 1280+ shell width = main + gap + toc + padding (math verified per tier). */
.container--analysis-shell {
  /* calc uses addition-only (avoid `2 * var(...)`) for broader browser compat;
     an invalid calc would silently fall back to auto and re-introduce TOC overflow. */
  max-width: calc(var(--analysis-main) + var(--analysis-shell-pad) + var(--analysis-shell-pad));
  margin: 0 auto;
  padding: 0 var(--analysis-shell-pad);
}
@media (min-width: 1280px) {
  .container--analysis-shell {
    max-width: calc(
      var(--analysis-main)
      + var(--analysis-gap)
      + var(--analysis-toc)
      + var(--analysis-shell-pad)
      + var(--analysis-shell-pad)
    );
  }
}

/* === Analysis reading system (Wave 4 reading-pass, 2026-04-23) ===
   Four primitives shared across /dashboard, /cross-analysis, /result/*:
   - .analysis-lead    — first paragraph / drop-cap area
   - .analysis-section — container with label + body
   - .analysis-card    — boxed info with modifiers (--focus, --quote, --ai)
   - .analysis-note    — editorial aside (border-left, muted)
   Plus .analysis-bullets for unified list treatment.
   Existing v2-* and page-specific classes may add these as companions
   for consistent reading rhythm without breaking JS selectors. */
.analysis-lead {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 var(--space-lg);
  max-width: 640px;
}
.analysis-section {
  margin: var(--space-2xl) 0;
}
.analysis-section + .analysis-section {
  margin-top: var(--space-3xl);
}
.analysis-section__marker {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}
.analysis-section__number {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  color: var(--gold);
  font-weight: 400;
  letter-spacing: 0;
}
.analysis-section__label { flex: 1; }
/* Default analysis-card — editorial margin-note, not SaaS box.
   Feels like a spread of the book with left-rail annotation, not a widget. */
.analysis-card {
  padding: var(--space-md) 0 var(--space-md) var(--space-lg);
  border-left: 2px solid var(--border);
  transition: border-left-color 0.2s ease;
  margin: 0;
}
.analysis-card:hover { border-left-color: var(--text-tertiary); }
.analysis-card + .analysis-card { margin-top: var(--space-sm); }
.analysis-card__label {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin: 0 0 var(--space-xs);
}
.analysis-card__title {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 var(--space-sm);
  line-height: 1.3;
}
.analysis-card__body {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-secondary);
}
.analysis-card__body > :last-child { margin-bottom: 0; }

/* Focus modifier — crown-jewel, the "priority" block. Keeps weight but reads
   as an accented spread, not a card. Gold, not chip-pill. */
.analysis-card--focus {
  padding: var(--space-lg) var(--space-xl);
  border-left: 3px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 4%, transparent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.analysis-card--focus .analysis-card__label { color: var(--gold); }

/* Quote modifier — surface-alt for visual lift on pulled-out quotes. */
.analysis-card--quote {
  background: var(--surface-alt);
  border: none;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-md) var(--space-lg);
  color: var(--text);
  font-style: italic;
}

/* AI modifier — discrete boxed analysis (only real "card" look in the set,
   because AI analyses ARE discrete artifacts of computation). */
.analysis-card--ai {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}
.analysis-card--ai:hover { border-left-color: var(--border); }
.analysis-note {
  border-left: 2px solid var(--border);
  padding: var(--space-xs) 0 var(--space-xs) var(--space-md);
  margin: var(--space-md) 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.65;
  font-style: normal;
}
.analysis-bullets {
  padding-left: 1.25em;
  margin: var(--space-md) 0;
  list-style-type: disc;
}
.analysis-bullets li {
  line-height: 1.65;
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
}
.analysis-bullets li::marker { color: var(--text-tertiary); }

/* Two-column grid for analysis cards — shared by /result AI blocks and
   /cross-analysis chapter sections. Single grid primitive, single breakpoint. */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xl) var(--space-2xl);
  margin-top: var(--space-lg);
}
@media (max-width: 768px) {
  .analysis-grid { grid-template-columns: 1fr; }
}

/* Prose-measure helper — constrain long paragraphs inside wider analysis canvas
   so line length stays editorially comfortable (~65-75 chars) on desktop. */
.analysis-prose {
  max-width: var(--max-width-analysis-prose);
}
.analysis-prose p { line-height: 1.7; }

/* NOTE: opacity tune-down for `.chapter-ornament` and `.section-marker` is
   page-scoped inside cross_analysis.html local <style> — global scoping here
   would regress the home artifact ornament (Unit 26 book-page mockup). */

.section { padding: var(--space-2xl) 0; }
.section--lg { padding: var(--space-3xl) 0; }
.section--sm { padding: var(--space-xl) 0; }
.section--alt { background: var(--surface-alt); }
.section--dark {
  background: var(--surface-dark);
  color: var(--text-inverse);
}

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

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.text-center { text-align: center; }

/* --- Navbar (premium, sticky, with active states) --- */
.navbar {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
  background: rgba(250,250,249,0.96);
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
}
.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar__logo {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0;
}
.navbar__logo span { color: var(--accent); }
.navbar__links {
  display: flex;
  gap: var(--space-xl);
  list-style: none;
}
.navbar__links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: color var(--transition-base);
  position: relative;
}
.navbar__links a:hover { color: var(--text); }
.navbar__links a.is-active {
  color: var(--text);
  font-weight: 600;
}
.navbar__links a.is-active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
}

/* --- Buttons (premium with transitions) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.6875rem 1.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
}
/* upd_v1: primary button shifted from accent to ink (editorial premium baseline).
   Old accent buttons → migrate to ink. Muted ink-blue stays for links / chip / em
   wordmark accent. Gold stays as point marker (rules, drop caps, gilded frames). */
.btn--primary {
  background: var(--ink);
  color: var(--text-inverse);
  border-color: var(--ink);
  box-shadow: 0 2px 8px rgba(28,25,23,0.18);
}
.btn--primary:hover {
  background: var(--ink-hover);
  border-color: var(--ink-hover);
  color: var(--text-inverse);
  box-shadow: 0 4px 16px rgba(28,25,23,0.24);
  transform: translateY(-1px);
}

/* Flagship CTA (upd_v1) — ink + 1px gold rule + inset gold shadow.
   Reserved for top-tier pricing CTA («Открыть книгу» в `Полная книга`). */
.btn--flagship {
  background: var(--ink);
  color: var(--text-inverse);
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 1px rgba(161, 98, 7, 0.25);
}
.btn--flagship:hover {
  background: var(--ink-hover);
  border-color: var(--gold);
  color: var(--text-inverse);
  transform: translateY(-1px);
}

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn--secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover {
  color: var(--text);
  border-color: var(--text);
  background: var(--surface);
}
.btn--lg {
  padding: 0.875rem 2.25rem;
  font-size: 0.9375rem;
  border-radius: var(--radius-lg);
}
.btn--sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn--full { width: 100%; }

/* --- Cards (elevated, with premium shadows) --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
}
.card--flat { box-shadow: none; }
.card--accent {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-elevated);
}
.card--gold {
  border-color: var(--border-gold);
  box-shadow: var(--shadow-gold);
}
.card--hover {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  cursor: pointer;
}
.card--hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card--elevated {
  box-shadow: var(--shadow-elevated);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  line-height: 1;
}
.badge--accent { background: var(--accent-light); color: var(--accent); }
.badge--gold { background: var(--gold-light); color: var(--gold); }
.badge--success { background: var(--success-light); color: var(--success); }
.badge--warning { background: var(--warning-light); color: var(--warning); }
.badge--personality { background: var(--cat-personality-bg); color: var(--cat-personality); }
.badge--emotions { background: var(--cat-emotions-bg); color: var(--cat-emotions); }
.badge--career { background: var(--cat-career-bg); color: var(--cat-career); }
.badge--lifestyle { background: var(--cat-lifestyle-bg); color: var(--cat-lifestyle); }

/* --- Preview banner (v2 beta overlay) --- */
.v2-preview-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-toast);
  background: var(--banner-bg);
  color: var(--banner-fg);
  padding: 10px 16px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}
.v2-preview-banner__label { color: var(--banner-accent); font-weight: 700; }
.v2-preview-banner__off { color: var(--banner-muted); margin-left: 12px; text-decoration: underline; }
.v2-preview-banner__off:hover { color: var(--banner-fg); }

/* --- Dividers --- */
.divider { height: 1px; background: var(--border); border: none; margin: var(--space-xl) 0; }
.divider--sm { margin: var(--space-md) 0; }
.divider--lg { margin: var(--space-3xl) 0; }
.divider--gold { background: linear-gradient(to right, transparent, var(--border-gold), transparent); }

/* --- Trust Row --- */
.trust-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
  padding: var(--space-lg) 0;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.trust-item svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--accent); opacity: 0.85; }

/* --- Data Pair --- */
.data-pair { display: flex; flex-direction: column; gap: 0.25rem; }
.data-pair__label {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em;
  color: var(--text-tertiary);
}
.data-pair__value { font-size: 1rem; font-weight: 600; color: var(--text); }

/* --- Metric Card --- */
.metric { display: flex; flex-direction: column; gap: 0.125rem; }
.metric__number {
  font-family: var(--font-serif);
  font-size: 2rem; font-weight: 600; color: var(--text);
  letter-spacing: 0; line-height: 1.1;
}
.metric__label { font-size: 0.75rem; font-weight: 500; color: var(--text-tertiary); }

/* --- Progress Bar --- */
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-bar__fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; transition: width 0.4s ease;
}
.progress-bar--thick { height: 6px; border-radius: 3px; }
.progress-bar--thick .progress-bar__fill { border-radius: 3px; }

/* --- Tag / Pill --- */
.tag {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.375rem 0.75rem; font-size: 0.8125rem; font-weight: 500;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius-full); color: var(--text-secondary);
}
.tag--active { background: var(--accent-light); border-color: var(--border-accent); color: var(--accent); }

/* --- Feature List (premium checkmarks) --- */
.feature-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.feature-list li {
  display: flex; align-items: flex-start; gap: 0.625rem;
  font-size: 0.9rem; line-height: 1.55; color: var(--text-secondary);
}
.feature-list li::before {
  content: '';
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px;
  background: var(--accent-light); border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='%232F3A56' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.5 10.793L4.354 8.646l-.708.708L6.5 12.207l6.354-6.354-.708-.707L6.5 10.793z'/%3E%3C/svg%3E");
  background-size: 14px; background-position: center; background-repeat: no-repeat;
}

/* --- Inline Note / Alert --- */
.inline-note {
  display: flex; align-items: flex-start; gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  background: var(--surface-accent); border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  font-size: 0.9rem; line-height: 1.6; color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

/* --- Dossier Block --- */
.dossier-block {
  padding: var(--space-xl);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.dossier-block__marker {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em;
  color: var(--accent); margin-bottom: var(--space-sm);
}
.dossier-block__title {
  font-family: var(--font-serif);
  font-size: 1.375rem; font-weight: 500; margin-bottom: var(--space-md);
  color: var(--text); letter-spacing: 0;
}
.dossier-block__body { font-size: 0.9375rem; line-height: 1.75; color: var(--text-secondary); }

/* --- Action Step --- */
.action-step { display: flex; gap: var(--space-md); padding: var(--space-md) 0; }
.action-step__number {
  flex-shrink: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--accent);
  background: var(--accent-light); border-radius: 50%;
}
.action-step__content { flex: 1; }
.action-step__title { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.125rem; }
.action-step__desc { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.55; }

/* --- Hero (premium, large, editorial) --- */
.hero {
  padding: var(--space-3xl) 0 var(--space-2xl);
  text-align: center;
  position: relative;
}
.hero--sm {
  padding: var(--space-2xl) 0 var(--space-lg);
}
.hero--sm .hero__title { font-size: 2.5rem; margin-bottom: var(--space-md); }
.hero--sm .hero__subtitle { margin-bottom: 0; font-size: 1rem; }
.hero--dark {
  background: var(--surface-dark);
  color: var(--text-inverse);
}
.hero--dark .hero__subtitle { color: rgba(250,250,249,0.65); }
.hero--dark .hero__overline { color: var(--gold); }
.hero--dark .trust-item { color: rgba(250,250,249,0.5); }
.hero--dark .trust-item svg { color: rgba(250,250,249,0.4); }
.hero__overline {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.14em;
  color: var(--gold); margin-bottom: var(--space-lg);
}
.hero__title {
  font-family: var(--font-serif);
  font-size: 3.25rem; font-weight: 500; line-height: 1.08;
  letter-spacing: 0; max-width: 740px; margin: 0 auto var(--space-xl);
}
.hero__subtitle {
  font-size: 1.125rem; line-height: 1.65; color: var(--text-secondary);
  max-width: 560px; margin: 0 auto var(--space-xl);
}
.hero__actions {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-md); flex-wrap: wrap;
}

/* --- Footer --- */
.footer {
  padding: var(--space-2xl) 0 var(--space-xl);
  border-top: 1px solid var(--border);
  color: var(--text-tertiary); font-size: 0.8125rem;
}
.footer a { color: var(--text-secondary); }
.footer a:hover { color: var(--text); }
.footer__inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-md);
}
.footer__links { display: flex; gap: var(--space-lg); list-style: none; }

/* --- upd_v1 footer (.foot family) — Phase 2.2 quiet close ---
   No brand wordmark inside footer (it lives only in the header). Layout
   is just an italic editorial tag-line on the left and a quiet inline
   legal row + small muted copyright on the right. Goal: footer that
   calmly closes the page, not a sitemap. */
.foot {
  border-top: 1px solid var(--border);
  margin-top: var(--space-3xl);
  padding: var(--space-xl) 0 var(--space-lg);
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.foot a { color: var(--text-muted); text-decoration: none; }
.foot a:hover { color: var(--text); }
.foot__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md) var(--space-xl);
  align-items: baseline;
}
.foot__brand-tag {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  line-height: 1.5;
  max-width: 42ch;
  margin: 0;
  align-self: baseline;
}
.foot__copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  text-align: right;
  align-self: baseline;
}
/* Legal row: one calm inline string with subtle · separators.
   Anchors use white-space: nowrap so «Отзыв согласия» stays intact,
   and the whole row wraps as a unit on narrow viewports. */
.foot__legal {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.foot__legal a {
  color: var(--text-muted);
  white-space: nowrap;
}
.foot__legal a:hover { color: var(--text); }
.foot__legal a:not(:last-child)::after {
  content: ' · ';
  color: var(--text-muted);
  margin: 0 4px;
}
.foot__copyline {
  color: var(--text-muted);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
}
@media (max-width: 900px) {
  .foot__inner {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  .foot__copy {
    align-items: flex-start;
    text-align: left;
  }
}

/* --- Utility --- */
.text-accent { color: var(--accent); }
.text-gold { color: var(--gold); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.opacity-60 { opacity: 0.6; }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* --- Editorial ornament (chapter separator) --- */
.chapter-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin: var(--space-2xl) 0;
  color: var(--border-gold);
}
.chapter-ornament::before,
.chapter-ornament::after {
  content: "";
  flex: 1;
  max-width: 80px;
  height: 1px;
  background: linear-gradient(to var(--ornament-dir, right), transparent, var(--border));
}
.chapter-ornament::after { --ornament-dir: left; }
.chapter-ornament__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--border-gold);
  flex-shrink: 0;
}

/* --- Drop-cap (first letter of first paragraph in a section) --- */
.drop-cap::first-letter {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  font-weight: 500;
  line-height: 0.9;
  float: left;
  padding: 0.2rem var(--space-sm) 0 0;
  color: var(--accent);
  letter-spacing: 0;
}

/* --- Connection chip (for "Связи между модулями") --- */
.conn-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.375rem var(--space-md) 0.375rem var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}
.conn-chip__glyph {
  width: 22px;
  height: 12px;
  flex-shrink: 0;
  color: var(--accent);
}

/* --- Editorial text helpers (for JS-generated report content) --- */
.v2-priority { font-weight: 600; font-size: 1.125rem; margin-bottom: var(--space-sm); color: var(--text); }
.v2-sub-heading { font-weight: 600; margin-top: var(--space-md); margin-bottom: var(--space-sm); color: var(--text); }
.v2-step-list { padding-left: 1.5rem; display: flex; flex-direction: column; gap: var(--space-sm); }
.v2-caption { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; color: var(--text-tertiary); margin-bottom: var(--space-xs); }
.v2-reflection { color: var(--text-secondary); font-style: normal; }
.v2-secondary { color: var(--text-secondary); }
.v2-disclaimer { color: var(--text-tertiary); font-size: 0.8125rem; margin-top: var(--space-xl); font-style: normal; }
.v2-spaced { margin-bottom: var(--space-sm); }
.v2-intro-body { font-size: 1rem; color: var(--text-secondary); line-height: 1.6; max-width: 640px; }
.v2-actions-row { display: flex; gap: var(--space-md); flex-wrap: wrap; margin-top: var(--space-lg); }
.v2-actions-row--spaced { margin-top: var(--space-xl); }
.v2-insights-list { display: flex; flex-direction: column; gap: var(--space-sm); list-style: none; padding-left: 0; }
.v2-dash-grid--flush { margin-top: 0; }
.v2-plan-actions { margin-top: var(--space-md); display: flex; gap: var(--space-sm); flex-wrap: wrap; }

/* --- Modal (overlay + dialog) --- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(28,25,23,0.6);
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}
.modal.is-open { display: flex; }
.modal__dialog {
  max-width: 520px;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-xl);
}
.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0 var(--space-xs);
}
.modal__close:hover { color: var(--text); }
.modal__body { margin-bottom: var(--space-lg); }
.modal__form { display: flex; flex-direction: column; gap: var(--space-md); }
.modal__msg { font-size: 0.875rem; min-height: 1.2em; color: var(--text-secondary); }
.modal__msg--error { color: var(--danger); }
.modal__msg--success { color: var(--success); }

/* --- Form field (shared) --- */
.field { display: flex; flex-direction: column; gap: var(--space-xs); font-size: 0.875rem; color: var(--text-secondary); }
.field input,
.field textarea,
.field select {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.field input:focus,
.field textarea:focus,
.field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,58,86,0.14); }
.field textarea { resize: vertical; min-height: 4rem; }

/* --- Mobile nav (hamburger + drawer) --- */
.kyt-nav__burger {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 44px;
  height: 44px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: border-color var(--transition-base);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1002;
}
.kyt-nav__burger:hover { border-color: var(--accent); color: var(--accent); }
.kyt-nav__burger svg { width: 20px; height: 20px; }
.kyt-nav__burger svg line { transition: transform 0.2s ease, opacity 0.2s ease; transform-origin: center; transform-box: fill-box; }
.kyt-nav__burger[aria-expanded="true"] svg line:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.kyt-nav__burger[aria-expanded="true"] svg line:nth-child(2) { opacity: 0; }
.kyt-nav__burger[aria-expanded="true"] svg line:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.kyt-nav__backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,25,23,0.5);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.kyt-nav__backdrop.is-open { opacity: 1; }

body.body--menu-open { overflow: hidden; }

/* --- Focus treatment for interactive cards --- */
.module-row:focus-visible,
.scenario-card:focus-visible,
.card--hover:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47,58,86,0.12);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .container { padding: 0 var(--space-lg); }
}
@media (max-width: 768px) {
  :root {
    --space-3xl: 3.5rem;
    --space-2xl: 2.5rem;
    --space-4xl: 5rem;
  }
  .hero__title { font-size: 2.25rem; }
  .t-display { font-size: 2.25rem; }
  .t-h1 { font-size: 1.75rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .navbar__links { display: none; }
  .trust-row { gap: var(--space-md); }
  .container { padding: 0 var(--space-md); }

  /* Mobile nav: burger visible, drawer slides in from right */
  .kyt-nav__burger { display: inline-flex !important; }
  .kyt-nav__inner { grid-template-columns: auto 1fr auto !important; }
  .kyt-nav__backdrop { display: block; pointer-events: none; }
  .kyt-nav__backdrop.is-open { pointer-events: auto; }

  .kyt-nav__links {
    position: fixed !important;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(320px, 82vw);
    max-width: 100vw;
    margin: 0;
    padding: 5rem var(--space-lg) var(--space-xl);
    list-style: none;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #FFFFFF;
    box-shadow: -8px 0 32px rgba(28,25,23,0.18);
    z-index: 1001;
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.34, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .kyt-nav__links.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  .kyt-nav__cta {
    max-width: min(34vw, 142px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .kyt-nav__links li { display: block; border-bottom: 1px solid var(--border); }
  .kyt-nav__links li:last-child { border-bottom: none; }
  .kyt-nav__links a {
    display: block;
    padding: 1rem 0;
    font-size: 1.0625rem;
    color: var(--text);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .kyt-nav__links a.is-active { color: var(--accent); font-weight: 600; }
  .kyt-nav__links a.is-active::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .kyt-nav__links,
  .kyt-nav__backdrop,
  .kyt-nav__burger svg line { transition: none !important; }
}
@media (max-width: 480px) {
  .hero__title { font-size: 1.875rem; }
  .hero__actions { flex-direction: column; }
  .btn--lg { width: 100%; }
}

/* --- Accessibility: keyboard focus --- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.btn:focus-visible,
.tag:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-offset: 0;
  box-shadow: 0 0 0 3px rgba(55, 48, 163, 0.15);
}

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