/* ==========================================================================
   BETAPSYCHE ARCHETYPE DOSSIER SYSTEM — STYLESHEET
   Design Language: Betapsyche Monochrome Luxury Minimal
   Typefaces: Glacial Indifference / Clean Modern Sans
   Full Light & Pure Black Dark Mode Support
   ========================================================================== */

/* ── Dark Theme (Default: Pure Black Luxury) ──────────────────────────────── */
:root,
[data-theme="dark"] {
  --bg-primary: #000000;
  --bg-secondary: #050505;
  --bg-surface: #000000;
  --bg-surface-elevated: #111111;
  --border-subtle: #1c1c1c;
  --border-medium: #2a2a2a;
  --border-light: #3a3a3a;

  --text-primary: #ffffff;
  --text-secondary: #e2e8f0;
  --text-muted: #888888;
  --text-dim: #555555;

  --badge-bg: #0d0d0d;
  --badge-border: #222222;
  --badge-text: #f8fafc;

  --code-bg: #000000;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.85);
  --shadow-elevated: 0 10px 30px rgba(0, 0, 0, 0.95);
  --nav-backdrop: rgba(0, 0, 0, 0.94);

  --cta-bg: #ffffff;
  --cta-color: #000000;
  --cta-hover-bg: #e2e8f0;

  color-scheme: dark;
}

/* ── Light Theme ──────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f5f5f7;
  --border-subtle: #eeeeee;
  --border-medium: #dddddd;
  --border-light: #cccccc;

  --text-primary: #000000;
  --text-secondary: #1f2937;
  --text-muted: #555555;
  --text-dim: #777777;

  --badge-bg: #f5f5f7;
  --badge-border: #dddddd;
  --badge-text: #000000;

  --code-bg: #f8fafc;
  --shadow-card: 0 4px 18px rgba(0, 0, 0, 0.04);
  --shadow-elevated: 0 10px 25px rgba(0, 0, 0, 0.07);
  --nav-backdrop: rgba(255, 255, 255, 0.94);

  --cta-bg: #000000;
  --cta-color: #ffffff;
  --cta-hover-bg: #222222;

  color-scheme: light;
}

:root {
  --font-sans: 'Glacial Indifference', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  --container-max: 1360px;
  --header-height: clamp(68px, 8vw, 84px);
}

@font-face {
  font-family: 'Glacial Indifference';
  src: url('../fonts/glacial-indifference/GlacialIndifference-Regular.otf') format('opentype'),
    url('./fonts/glacial-indifference/GlacialIndifference-Regular.otf') format('opentype'),
    url('/fonts/glacial-indifference/GlacialIndifference-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Glacial Indifference';
  src: url('../fonts/glacial-indifference/GlacialIndifference-Bold.otf') format('opentype'),
    url('./fonts/glacial-indifference/GlacialIndifference-Bold.otf') format('opentype'),
    url('/fonts/glacial-indifference/GlacialIndifference-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Glacial Indifference';
  src: url('../fonts/glacial-indifference/GlacialIndifference-Italic.otf') format('opentype'),
    url('./fonts/glacial-indifference/GlacialIndifference-Italic.otf') format('opentype'),
    url('/fonts/glacial-indifference/GlacialIndifference-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 85px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body {
  min-height: 100vh;
  line-height: 1.65;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Logo Switching based on data-theme */
.logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
  display: block;
  transition: opacity 0.2s ease;
}

[data-theme="dark"] .logo-light-mode {
  display: none !important;
}

[data-theme="dark"] .logo-dark-mode {
  display: block !important;
}

[data-theme="light"] .logo-dark-mode {
  display: none !important;
}

[data-theme="light"] .logo-light-mode {
  display: block !important;
}

/* Top Global Navigation Bar */
.dossier-nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-backdrop);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--header-height);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.dossier-nav-container {
  max-width: var(--container-max);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dossier-nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.dossier-nav-brand img {
  height: 30px;
}

.dossier-nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dossier-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dossier-nav-link:hover {
  color: var(--text-primary);
}

/* Theme Toggle Button */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

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

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

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

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

.btn-nav-action {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-nav-action:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-light);
}

/* Page Layout */
.dossier-layout {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 40px clamp(24px, 3.5vw, 48px) 80px clamp(24px, 3.5vw, 48px);
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: clamp(36px, 4vw, 56px);
  position: relative;
  box-sizing: border-box;
}

/* Sidebar / Table of Contents */
.dossier-sidebar {
  position: relative;
}

.dossier-sidebar-sticky {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 12px;
}

.dossier-sidebar-sticky::-webkit-scrollbar {
  width: 4px;
}

.dossier-sidebar-sticky::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.sidebar-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  padding: 5px 8px;
  border-radius: 6px;
}

.toc-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.toc-link span.num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Sidebar Spec Card */
.spec-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.82rem;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.spec-label {
  color: var(--text-muted);
  font-weight: 500;
}

.spec-val {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

/* Main Dossier Content Stream */
.dossier-main {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

/* Hero Header */
.hero-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 36px;
}

.hero-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid var(--badge-border);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-family {
  border-color: var(--border-light);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.hero-title {
  font-size: 3.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.hero-plain-line {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 24px;
}

.hero-core-question {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--text-primary);
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
}

.hero-core-question strong {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

/* Chapter Sections */
.dossier-chapter {
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-margin-top: 85px;
}

.chapter-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.chapter-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.chapter-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.chapter-desc {
  font-size: 0.94rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Callout Quote Boxes */
.quote-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--text-primary);
  border-radius: 8px;
  padding: 24px 28px;
  position: relative;
  box-shadow: var(--shadow-card);
}

.quote-box-text {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.6;
}

.quote-box-caption {
  margin-top: 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 700;
}

/* Portrait Grid */
.portrait-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.portrait-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.portrait-card:hover {
  border-color: var(--border-medium);
}

.portrait-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.portrait-card-label span.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-primary);
}

.portrait-card-body {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 4-Role Cast Cards */
.cast-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.cast-role-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.cast-role-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.cast-role-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.cast-role-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
}

.cast-role-framing {
  font-size: 0.86rem;
  font-style: italic;
  color: var(--text-muted);
  border-left: 2px solid var(--border-medium);
  padding-left: 10px;
}

.cast-role-body {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* Engine Scenarios Grid */
.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scenario-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
}

.scenario-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scenario-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 700;
}

.scenario-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.scenario-action {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Inner Argument Dialogue Box */
.dialogue-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: var(--shadow-card);
}

.dialogue-tension-banner {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  padding: 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
}

.dialogue-exchange {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialogue-bubble {
  display: flex;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.dialogue-bubble.voice-b {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
}

.dialogue-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.dialogue-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dialogue-speaker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dialogue-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.dialogue-synthesis-box {
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.synthesis-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.synthesis-text {
  font-size: 1rem;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.65;
}

/* Compatibility & Relational Grid */
.relationship-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.rel-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
}

.rel-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.rel-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Math Disclosures Table */
.math-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-card);
}

.math-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.math-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.math-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  line-height: 1.5;
}

.math-table tr:last-child td {
  border-bottom: none;
}

.math-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   OFFICIAL BETAPSYCHE FOOTER
   ========================================================================== */
.dossier-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 56px;
  margin-top: 56px;
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 48px 36px 32px 36px;
  box-shadow: var(--shadow-card);
}

.footer-top-section {
  display: grid;
  grid-template-columns: 1.4fr 2fr;
  gap: 48px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border-subtle);
}

.footer-brand-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-brand-column img {
  height: 32px;
  width: auto;
}

.footer-brand-tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 380px;
}

.footer-nav-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.footer-nav-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-nav-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.footer-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.15s ease;
}

.footer-nav-link:hover {
  color: var(--text-primary);
}

.footer-location {
  color: var(--text-dim);
  font-style: normal;
}

/* Footer Archetype Directory Grid */
.footer-directory-container {
  padding: 36px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.footer-directory-heading {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 24px;
  text-align: center;
}

.footer-family-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.footer-family-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-family-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.footer-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-link-item a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
}

.footer-link-item a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.footer-link-item.active a {
  color: var(--text-primary);
  font-weight: 700;
}

.footer-link-item a span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Footer Bottom Bar */
.footer-bottom-bar {
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-bottom-bar a {
  color: inherit;
  text-decoration: underline;
  transition: color 0.15s ease;
}

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

.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-bottom-link {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-bottom-link:hover {
  color: var(--text-primary);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .dossier-layout {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 28px clamp(16px, 4vw, 24px) 60px clamp(16px, 4vw, 24px);
  }

  .dossier-sidebar {
    position: static;
  }

  .dossier-sidebar-sticky {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .sidebar-box.toc-box {
    display: none;
  }

  .footer-top-section {
    grid-template-columns: 1fr;
    gap: 32px;
  }

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

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


@media (max-width: 768px) {
  .hero-title {
    font-size: 2.4rem;
  }

  .hero-plain-line {
    font-size: 1.2rem;
  }

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

  .footer-nav-columns {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-family-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom-bar {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* Print Stylesheet */
@media print {
  body {
    background: #ffffff !important;
    color: #111111 !important;
  }

  .dossier-nav-bar,
  .dossier-sidebar,
  .btn-nav-action,
  .btn-theme-toggle,
  .dossier-footer {
    display: none !important;
  }

  .dossier-layout {
    grid-template-columns: 1fr !important;
    padding: 0 !important;
  }

  .hero-title,
  .chapter-title,
  .scenario-title,
  .cast-role-title {
    color: #000000 !important;
  }

  .hero-plain-line,
  .chapter-desc,
  .scenario-action,
  .cast-role-body,
  p {
    color: #222222 !important;
  }

  .portrait-card,
  .cast-role-card,
  .scenario-card,
  .quote-box,
  .dialogue-container,
  .rel-card,
  .math-table-container {
    background: #fdfdfd !important;
    border: 1px solid #d0d0d0 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .dossier-chapter {
    page-break-before: auto;
    page-break-after: auto;
  }
}

/* ==========================================================================
   ARCHETYPE MOTION PORTRAIT & ATLAS MEDIA EXTENSIONS
   ========================================================================== */
.hero-header-split {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 36px;
  align-items: center;
}

@media (max-width: 900px) {
  .hero-header-split {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

.hero-header-content {
  display: flex;
  flex-direction: column;
}

.hero-motion-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-elevated);
}

.hero-motion-video {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}

.hero-motion-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .hero-motion-badge {
  background: rgba(255, 255, 255, 0.85);
  color: #09090b;
  border-color: rgba(0, 0, 0, 0.15);
}

/* Sidebar Portrait */
.sidebar-portrait-wrap {
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.sidebar-portrait-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

/* Atlas Grid Cards with Portrait */
.atlas-archetype-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  transition: all 0.25s ease;
}

.atlas-archetype-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-card);
}

.atlas-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-secondary);
}

.atlas-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.atlas-archetype-card:hover .atlas-card-img {
  transform: scale(1.04);
}

.atlas-card-body {
  padding: 16px 20px;
}

/* ── Atlas Family Totem Banners ───────────────────────────────────────────── */
.atlas-family-banner {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 24px;
}

@media (max-width: 768px) {
  .atlas-family-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

.atlas-family-totem-wrap {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-elevated);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.atlas-family-totem-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.atlas-family-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.atlas-family-title {
  font-size: 1.85rem;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 2px 0;
}

.atlas-family-question {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Dossier Cast Role Talisman Artifacts ─────────────────────────────────── */
.cast-role-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cast-role-talisman-media {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-medium);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  margin-bottom: 14px;
  background: var(--bg-surface-elevated);
}

.cast-role-talisman-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Sidebar Family Totem */
.sidebar-family-totem {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-family-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-family-info {
  display: flex;
  flex-direction: column;
}

.sidebar-family-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-family-tempo {
  font-size: 0.75rem;
  color: var(--text-muted);
}


/* ── Additional Cross-Linking & Interactive Styles ───────────────────────── */
a.cast-role-talisman-media {
  display: block;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

a.cast-role-talisman-media:hover {
  transform: scale(1.1);
  border-color: var(--border-light);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.cast-role-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cast-role-link-pill {
  font-size: 0.68rem;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  color: var(--text-dim, #888899);
  text-decoration: none;
  border: 1px dashed var(--border-medium, #333340);
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-surface, #141418);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cast-role-link-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-light, #555566);
  border-style: solid;
  background: var(--bg-surface-elevated, #1f1f26);
}

a.sidebar-family-totem {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  border-radius: 8px;
  padding: 8px;
  margin-top: 12px;
  cursor: pointer;
}

a.sidebar-family-totem:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-hover);
}

.atlas-family-dossier-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 0.78rem;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border-medium);
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--bg-surface);
  transition: all 0.2s ease;
}

.atlas-family-dossier-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
  background: var(--bg-surface-elevated);
  transform: translateY(-1px);
}


/* ── Unified References-Style Header & Navigation ──────────────────────── */
.site-header,
.dossier-nav-bar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: var(--nav-backdrop);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--header-height);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.is-scrolled,
.dossier-nav-bar.is-scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.header-inner,
.dossier-nav-container {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 3.5vw, 48px);
  height: 100%;
  box-sizing: border-box;
}

.header-logo,
.dossier-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 16px);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.header-logo img,
.dossier-nav-brand img {
  height: clamp(30px, 4vw, 42px);
  width: auto;
  flex-shrink: 0;
  display: block;
}

.logo-divider {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: linear-gradient(180deg, var(--border-subtle), var(--border-medium) 50%, var(--border-subtle));
  flex-shrink: 0;
  border-radius: 1px;
}

.logo-title {
  font-family: var(--font-sans);
  font-size: clamp(1.15rem, 1.4vw, 1.4rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  position: relative;
  top: 1px;
}

.header-nav,
.dossier-nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1.2rem, 2vw, 2.8rem);
}

.nav-link,
.dossier-nav-link {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  transition: color 0.2s ease;
  position: relative;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.nav-link::after,
.dossier-nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--text-primary);
  transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active,
.nav-link.is-active,
.dossier-nav-link:hover,
.dossier-nav-link.active,
.dossier-nav-link.is-active {
  color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after,
.nav-link.is-active::after,
.dossier-nav-link:hover::after,
.dossier-nav-link.active::after,
.dossier-nav-link.is-active::after {
  width: 100%;
}

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

/* Theme Toggle Button */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

[data-theme="dark"] .theme-icon-moon {
  display: none !important;
}

[data-theme="dark"] .theme-icon-sun {
  display: block !important;
}

[data-theme="light"] .theme-icon-sun {
  display: none !important;
}

[data-theme="light"] .theme-icon-moon {
  display: block !important;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 22px;
  color: var(--cta-color);
  background: var(--cta-bg);
  border: 1px solid var(--border-medium);
  border-radius: 9999px;
  transition: all 0.2s ease;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.nav-cta:hover {
  background: var(--cta-hover-bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.mobile-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: background 0.2s ease;
  z-index: 1001;
  background: none;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.mobile-menu-toggle:hover {
  background: var(--bg-surface-elevated);
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 20px;
}

.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center;
}

.mobile-menu-toggle.is-active .hamburger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.is-active .hamburger span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.mobile-menu-toggle.is-active .hamburger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile Nav Drawer ──────────────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
  background: var(--bg-primary);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.8rem, 4vw, 3rem);
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.mobile-nav.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-link {
  font-family: inherit;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.mobile-nav.is-open .mobile-nav-link {
  transform: translateY(0);
  opacity: 1;
}

.mobile-nav-cta {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 14px 34px;
  color: var(--cta-color);
  background: var(--cta-bg);
  border-radius: 100px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.mobile-nav.is-open .mobile-nav-cta {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 960px) {

  .header-nav,
  .dossier-nav-links,
  .nav-cta {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .mobile-nav {
    display: flex;
  }
}

/* ── Unified Global Footer Matching References ─────────────────────────── */
.site-footer,
.dossier-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: clamp(4rem, 6vw, 6rem) 0 clamp(2.5rem, 4vw, 4rem);
  margin-top: 60px;
}

.footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(24px, 3.5vw, 48px);
  box-sizing: border-box;
}

.footer-top {
  display: grid;
  grid-template-columns: 1.4fr 1.6fr;
  gap: clamp(3rem, 5vw, 6rem);
  margin-bottom: clamp(3rem, 5vw, 5rem);
}

@media (max-width: 860px) {
  .footer-top {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.footer-logo img {
  height: 34px;
  width: auto;
}

.footer-tagline {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 440px;
}

.footer-links-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

@media (max-width: 580px) {
  .footer-links-group {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }
}

.footer-col-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 1.2rem;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
  transition: color 0.2s ease;
  text-decoration: none;
}

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

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  flex-wrap: wrap;
  padding-top: 2.2rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-bottom a {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
}

/* ── Responsive Improvements Across All Dossier Layouts ─────────────────── */
@media (max-width: 960px) {
  .dossier-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 24px 16px 60px 16px;
  }

  .dossier-sidebar {
    position: static;
  }

  .dossier-sidebar-sticky {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .sidebar-portrait-wrap {
    max-width: 240px;
    margin: 0 auto;
  }

  .portrait-grid,
  .cast-grid,
  .scenarios-grid,
  .rel-grid {
    grid-template-columns: 1fr;
  }

  .math-table-container {
    overflow-x: auto;
  }
}