/* ==========================================================================
   CODEX DESIGN SYSTEM: TYPOGRAPHY, THEMES, AND FULL-WIDTH RESPONSIVE PAGES
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
  /* Fonts */
  --font-title: 'Cinzel', serif;
  --font-body: 'EB Garamond', serif;
  --font-ui: 'Outfit', sans-serif;
  --font-sans: 'Outfit', sans-serif;

  /* Parchment (Light) Theme Variables - Antique Sage & Calming Tea Wash */
  --bg-desk: #dfe4db;
  --bg-desk-gradient: linear-gradient(180deg, #e4e9e0 0%, #d8ded4 100%);
  --bg-header: rgba(235, 240, 233, 0.94);
  --bg-header-image: url('assets/parchment-texture.png');
  --bg-page: #e8ebe4;
  --bg-page-image: url('assets/parchment-texture.png');
  --bg-card: rgba(224, 230, 221, 0.75);

  --color-text: #242e28;
  --color-text-muted: #59665d;
  --color-accent: #2d4a3e;
  --color-accent-hover: #3d6354;
  --color-gold: #8c7b4c;
  --color-gold-bright: #ab9861;
  --border-antique: #c2ccbf;
  --shadow-color: rgba(30, 40, 32, 0.08);

  /* Font scale base */
  --font-base-size: 20px;
  --line-height-base: 1.65;

  /* Layout dimensions */
  --header-height: 76px;
  --max-width: 1500px;
  --max-width-readable: 860px;
}

/* Inkwell (Dark) Theme Variables - Warm Obsidian & Warm Bronze */
body.inkwell-theme {
  --bg-desk: #0c0f17;
  --bg-desk-gradient: radial-gradient(circle at 50% 30%, #161c28 0%, #080a10 100%);
  --bg-header: rgba(18, 22, 34, 0.92);
  --bg-header-image: url('assets/inkwell-texture.png');
  --bg-page: #141824;
  --bg-page-image: url('assets/inkwell-texture.png');
  --bg-card: rgba(24, 30, 46, 0.55);

  --color-text: #e2ded4;
  --color-text-muted: #9ba3b0;
  --color-accent: #6397c7;
  --color-accent-hover: #82b0dd;
  --color-gold: #c8a96e;
  --color-gold-bright: #e5c889;
  --border-antique: #283042;
  --shadow-color: rgba(0, 0, 0, 0.38);
}

/* Espresso (Dark Roasted) Theme Variables - Deep Mocha & Roasted Amber */
body.espresso-theme {
  --bg-desk: #120e0d;
  --bg-desk-gradient: radial-gradient(circle at 50% 30%, #201917 0%, #0d0a09 100%);
  --bg-header: rgba(24, 19, 17, 0.94);
  --bg-header-image: url('assets/inkwell-texture.png');
  --bg-page: #1b1513;
  --bg-page-image: url('assets/inkwell-texture.png');
  --bg-card: rgba(38, 30, 27, 0.65);

  --color-text: #eae0d5;
  --color-text-muted: #a6988c;
  --color-accent: #d4a373;
  --color-accent-hover: #e8b88a;
  --color-gold: #c9935a;
  --color-gold-bright: #eec170;
  --border-antique: #3d2f2a;
  --shadow-color: rgba(0, 0, 0, 0.45);
}

/* Reset and Base Elements */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-base-size, 20px);
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--bg-desk);
  background-image: var(--bg-desk-gradient);
  min-height: 100vh;
  padding-top: var(--header-height);
  transition: color 0.3s, background-color 0.3s;
}

/* Scrollbar customizations */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-desk);
}

::-webkit-scrollbar-thumb {
  background: var(--color-gold);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gold-bright);
}

/* Desk Background overlay */
#desk {
  width: 100%;
  min-height: calc(100vh - var(--header-height));
  position: relative;
  display: flex;
  flex-direction: column;
}

#desk::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 20%, rgba(255, 230, 180, 0.02) 0%, rgba(0, 0, 0, 0) 80%);
  pointer-events: none;
}

/* ==========================================================================
   STICKY TOP HEADER
   ========================================================================== */
#codex-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px var(--shadow-color);
  border-bottom: 1px solid var(--border-antique);
  z-index: 1000;
  transition: background-color 0.3s, border-color 0.3s;
}

.header-inner {
  width: 100%;
  height: 100%;
  padding: 0 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

/* Branding */
.header-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  gap: 2px;
  height: 100%;
}

.brand-title {
  font-family: var(--font-title);
  font-size: 19px;
  font-weight: 800;
  color: var(--color-accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  line-height: 1.1;
}

.brand-tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
  margin-top: 1px;
  line-height: 1.1;
}

/* Navigation Links */
.header-nav {
  display: flex;
  align-items: center;
  height: 100%;
  margin-top: 0;
}

.header-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 2.5rem;
  height: 100%;
  margin: 0;
  padding: 0;
}

.header-nav li {
  display: flex;
  align-items: center;
  height: 100%;
}

.header-nav a {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 4px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.header-nav a:hover,
.header-nav li.active a {
  color: var(--color-accent);
  background: none;
  border-bottom: 3px solid var(--color-accent);
}

/* Utilities Block */
.header-utilities {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}

/* Search Box */
.search-box {
  position: relative;
  width: 210px;
}

.search-box input {
  width: 100%;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-antique);
  border-radius: 6px;
  padding: 8px 12px 8px 36px;
  color: var(--color-text);
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 13px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.inkwell-theme .search-box input,
body.espresso-theme .search-box input {
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-accent);
  width: 260px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(28, 59, 87, 0.15);
}

body.inkwell-theme .search-box input:focus {
  box-shadow: 0 0 0 3px rgba(80, 139, 192, 0.25);
}

body.espresso-theme .search-box input:focus {
  box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.25);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  width: 14px;
  height: 14px;
  pointer-events: none;
}

/* Mobile search toggle & dropdown */
.mobile-search-btn {
  display: none !important;
}

.search-dropdown-panel {
  width: 280px;
  padding: 0.85rem 1rem;
}

.mobile-search-box {
  position: relative;
  width: 100%;
}

.mobile-search-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 4px;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
}

.mobile-search-box input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.2);
}

.mobile-search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  pointer-events: none;
}

/* Utility buttons with badges */
.utility-dropdown-wrapper {
  position: relative;
}

.utility-btn {
  background: none;
  border: 1px solid var(--border-antique);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.utility-btn:hover,
.utility-btn.active {
  color: var(--color-accent);
  border-color: var(--color-gold);
  background: rgba(197, 160, 89, 0.1);
}

.mobile-menu-btn {
  display: none !important;
}

/* Mobile Navigation Drawer */
.mobile-nav-drawer {
  display: none !important;
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  background-color: var(--bg-header);
  background-image: var(--bg-header-image);
  background-size: cover;
  background-blend-mode: multiply;
  border-bottom: 2px solid var(--color-gold);
  box-shadow: 0 12px 30px var(--shadow-color);
  z-index: 999;
  padding: 1rem 1.25rem 1.25rem 1.25rem;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  transform-origin: top center;
}

.mobile-nav-drawer.hidden {
  display: none !important;
}

.mobile-nav-header {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-gold);
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--border-antique);
}

#mobile-categories-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s ease;
}

.mobile-nav-link:hover,
#mobile-categories-nav-list li.active .mobile-nav-link {
  border-color: var(--color-gold);
  color: var(--color-accent);
  background: rgba(197, 160, 89, 0.12);
}

.mobile-nav-icon {
  width: 18px;
  height: 18px;
  color: var(--color-gold);
  flex-shrink: 0;
}

.utility-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: bold;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Dropdown panels */
.dropdown-panel {
  position: absolute;
  top: 48px;
  right: 0;
  width: 320px;
  max-width: calc(100vw - 1.5rem);
  background: var(--bg-header);
  background-image: var(--bg-header-image);
  background-size: cover;
  background-blend-mode: multiply;
  border: 1px solid var(--border-antique);
  outline: 3px double var(--border-antique);
  outline-offset: -5px;
  border-radius: 4px;
  box-shadow: 0 10px 30px var(--shadow-color);
  padding: 1.3rem 1.15rem;
  z-index: 1010;
  transition: opacity 0.2s;
  box-sizing: border-box;
}

.dropdown-panel.hidden {
  display: none;
}

.dropdown-panel h3 {
  font-family: var(--font-title);
  font-size: 13px;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--border-antique);
  padding-bottom: 5px;
}

.bookmarks-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--border-antique);
  padding-bottom: 6px;
  gap: 8px;
}

.bookmarks-panel-header h3 {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.bookmark-current-btn {
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid var(--color-gold);
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.bookmark-current-btn i {
  width: 12px;
  height: 12px;
  color: var(--color-gold);
}

.bookmark-current-btn:hover {
  background: var(--color-gold);
  color: #120e0d;
}

.bookmark-current-btn:hover i {
  color: #120e0d;
}

.bookmark-current-btn.saved {
  background: #2e7d32;
  color: #ffffff;
  border-color: #4caf50;
}

/* Bookmarks Dropdown List */
#bookmarks-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 250px;
  overflow-y: auto;
  width: 100%;
}

#bookmarks-list li {
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 4px;
  background: var(--bg-card);
  border-left: 3px solid var(--color-accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bookmark-link {
  color: var(--color-text);
  text-decoration: none;
  font-size: 13px;
  font-family: var(--font-sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
  cursor: pointer;
}

.bookmark-link:hover {
  color: var(--color-accent);
}

#bookmarks-list li.empty-state {
  border-left: none;
  background: none;
  color: var(--color-text-muted);
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.4rem 0.5rem;
  margin-bottom: 0;
  gap: 6px;
  width: 100%;
}

#bookmarks-list li.empty-state .empty-icon {
  width: 20px;
  height: 20px;
  color: var(--color-gold);
  opacity: 0.7;
}

.remove-bookmark-btn {
  background: none;
  border: none;
  color: var(--color-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.remove-bookmark-btn:hover {
  opacity: 1;
}

/* Settings Options */
.control-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 14px;
  font-family: var(--font-sans);
  font-size: 13px;
}

.control-row.control-row-inline {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

.control-label {
  color: var(--color-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.theme-switchers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.theme-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-antique);
  color: var(--color-text);
  padding: 6px 4px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
}

body.inkwell-theme .theme-btn,
body.espresso-theme .theme-btn {
  background: rgba(0, 0, 0, 0.3);
}

.theme-btn:hover,
.theme-btn.active {
  border-color: var(--color-gold);
  background: rgba(197, 160, 89, 0.15);
}

.theme-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.theme-dot.parchment {
  background: #e8ebe4;
  border: 1px solid #7a8c7e;
}

.theme-dot.inkwell {
  background: #141824;
  border: 1px solid #6397c7;
}

.theme-dot.espresso {
  background: #1b1513;
  border: 1px solid #d4a373;
}

.font-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.font-btn {
  width: 36px;
  height: 32px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-antique);
  color: var(--color-text);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  user-select: none;
  touch-action: manipulation;
}

body.inkwell-theme .font-btn,
body.espresso-theme .font-btn {
  background: rgba(0, 0, 0, 0.3);
}

.font-btn:hover,
.font-btn:active {
  border-color: var(--color-gold);
  background: rgba(197, 160, 89, 0.15);
  color: var(--color-gold-bright);
}

.font-size-indicator {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 38px;
  text-align: center;
}

/* Reading Progress Indicator */
#reading-progress-container {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.05);
  z-index: 999;
}

#reading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  transition: width 0.15s ease-out;
}

/* ==========================================================================
   MAIN CONTENT PAGE LAYOUT
   ========================================================================== */
#codex-container {
  width: 100%;
  padding: 0 2.5rem;
  margin: 2rem auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

#codex-page {
  background-color: var(--bg-page);
  border: 1px solid var(--border-antique);
  box-shadow: 0 4px 18px var(--shadow-color);
  border-radius: 6px;
  padding: 2.5rem 3rem;
  position: relative;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s;
}

#page-content {
  position: relative;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TYPOGRAPHY SPECIFICS
   ========================================================================== */
h1,
h2,
h3,
h4 {
  font-family: var(--font-title);
  color: var(--color-accent);
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 1.2rem;
}

h1 {
  font-size: 2.2rem;
  line-height: 1.25;
  border-bottom: 2px double var(--color-gold);
  padding-bottom: 0.8rem;
  text-align: center;
  text-transform: uppercase;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  border-bottom: 1px solid var(--border-antique);
  padding-bottom: 0.4rem;
}

p {
  margin-bottom: 1.4rem;
  text-align: left;
  text-indent: 0;
}

blockquote {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.12rem;
  color: var(--color-text-muted);
  border-left: 3px solid var(--color-gold);
  background: rgba(197, 160, 89, 0.06);
  margin: 1.8rem 0;
  padding: 0.9rem 1.4rem;
  border-radius: 0 6px 6px 0;
  text-align: left;
}

blockquote p {
  text-indent: 0;
  text-align: left;
  margin-bottom: 0;
}

blockquote strong {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--color-gold);
  display: inline-block;
  margin-right: 6px;
}

ul,
ol {
  margin-bottom: 1.3rem;
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Ornamental Codex Divider (---) */
hr.codex-divider {
  border: none;
  height: auto;
  margin: 3rem auto;
  text-align: center;
  position: relative;
  overflow: visible;
  max-width: 320px;
}

hr.codex-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-antique) 20%, var(--color-gold) 50%, var(--border-antique) 80%, transparent);
}

hr.codex-divider::after {
  content: '✦ ✦ ✦';
  position: relative;
  display: inline-block;
  background: var(--bg-page);
  padding: 0 14px;
  color: var(--color-gold);
  font-size: 0.75rem;
  letter-spacing: 6px;
  vertical-align: middle;
}

/* Footnotes back references */
.footnote-ref {
  vertical-align: super;
  font-size: 0.7rem;
  font-weight: bold;
  color: var(--color-accent);
  text-decoration: none;
  cursor: pointer;
  padding: 0 2px;
}

.footnote-ref:hover {
  color: var(--color-gold-bright);
}

.footnotes-section {
  margin-top: 3rem;
  border-top: 2px double var(--border-antique);
  padding-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footnotes-section h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.footnote-backref {
  text-decoration: none;
  color: var(--color-gold);
  margin-left: 5px;
  font-weight: bold;
  transition: color 0.15s;
}

.footnote-backref:hover {
  color: var(--color-gold-bright);
}

.footnote-target-highlight {
  background-color: rgba(197, 160, 89, 0.22) !important;
  border-radius: 4px;
  padding: 2px 6px;
  transition: background-color 0.4s ease;
}

.empty-chapter-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.empty-chapter-state p {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--color-text-muted);
  text-indent: 0;
  margin: 0;
}

/* ==========================================================================
   HISTORIC SPLICE: HORIZONTAL TIMELINE
   ========================================================================== */
.timeline-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
  padding: 1.5rem 0 2rem 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-gold) transparent;
}

.timeline-scroll-wrapper::-webkit-scrollbar {
  height: 6px;
}

.timeline-scroll-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.timeline-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--color-gold);
  border-radius: 3px;
}

.timeline-track {
  display: flex;
  align-items: flex-end;
  position: relative;
  min-width: max-content;
  padding: 170px 4rem 45px 4rem;
  min-height: 330px;
}

.tl-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 53px;
  height: 2px;
  background: var(--border-antique);
  z-index: 0;
}

.tl-point {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 1;
  min-width: 200px;
  padding: 0 2rem;
}

.tl-dot {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-gold);
  border: 3px solid var(--bg-page);
  box-shadow: 0 0 0 2px var(--color-gold);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  flex-shrink: 0;
  z-index: 2;
}

.tl-point:hover .tl-dot {
  transform: scale(1.4);
  background: var(--color-gold-bright);
  box-shadow: 0 0 0 3px var(--color-gold-bright), 0 0 14px rgba(181, 150, 89, 0.4);
}

.tl-year {
  margin-top: 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  white-space: nowrap;
  text-transform: uppercase;
}

.tl-point:hover .tl-year {
  color: var(--color-accent);
}

.tl-preview-card {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: 240px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-antique);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px var(--shadow-color);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  z-index: 10;
}

.tl-point:hover .tl-preview-card {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.tl-preview-card-header {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-antique);
}

.tl-preview-rows {
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-gold) transparent;
}

.tl-preview-row {
  display: block;
  padding: 7px 8px;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
}

.tl-preview-row:hover {
  background: rgba(181, 150, 89, 0.12);
}

.tl-preview-row+.tl-preview-row {
  border-top: 1px solid rgba(128, 128, 128, 0.1);
}

.tl-preview-row-title {
  display: block;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.3;
  margin-bottom: 2px;
}

.tl-preview-row-meta {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--color-text-muted);
  letter-spacing: 0.3px;
}

.tl-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--color-accent);
  color: var(--bg-page);
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tl-preview-card::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-antique);
  border-bottom: 1px solid var(--border-antique);
}

/* ==========================================================================
   LANDING PAGE: LATEST ACTIVITY & CHAPTERS EXPLORE
   ========================================================================== */
.landing-section {
  margin-bottom: 3rem;
}

.section-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-antique);
  padding-bottom: 10px;
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-muted);
  margin-top: 0;
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-badge {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-gold);
  background: rgba(197, 160, 89, 0.12);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(197, 160, 89, 0.2);
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.8rem;
}

.activity-card {
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 2px 10px var(--shadow-color);
}

.activity-card:hover {
  border-color: var(--color-gold);
  transform: translateY(-4px);
  box-shadow: 0 10px 25px var(--shadow-color);
}

.activity-card-media {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background-color: #121620;
}

.activity-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.activity-card:hover .activity-card-thumb {
  transform: scale(1.05);
}

.card-read-time {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(14, 18, 26, 0.85);
  color: #e2ded4;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 4px;
}

.read-time-icon {
  width: 11px;
  height: 11px;
  color: var(--color-gold);
}

.activity-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

.activity-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.card-category-tag {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
}

.card-cat-icon {
  width: 13px;
  height: 13px;
  margin-right: 5px;
  color: var(--color-gold);
  flex-shrink: 0;
}

.card-date {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.3px;
}

.activity-card-body h3 {
  font-size: 1.25rem;
  color: var(--color-accent);
  line-height: 1.35;
  margin-bottom: 10px;
  text-align: left;
}

.activity-card-body p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--color-text-muted);
  text-indent: 0;
  text-align: left;
  margin-bottom: 1.5rem;
}

.activity-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px dashed var(--border-antique);
}

.card-author {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--color-text-muted);
  font-style: italic;
}

.card-footer-link {
  font-family: var(--font-title);
  font-size: 10px;
  color: var(--color-accent);
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  background: rgba(197, 160, 89, 0.1);
  border: 1px solid var(--border-antique);
  padding: 4px 10px;
  border-radius: 14px;
  transition: all 0.25s ease;
}

.card-arrow-icon {
  width: 13px;
  height: 13px;
  transition: transform 0.2s ease;
}

.activity-card:hover .card-footer-link {
  background: var(--color-gold);
  color: #0c0f17;
  border-color: var(--color-gold-bright);
  box-shadow: 0 3px 10px rgba(200, 169, 110, 0.35);
}

.activity-card:hover .card-arrow-icon {
  transform: translateX(4px);
  color: #0c0f17;
}

/* Category cards list */
.chapters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.chapter-card-compact {
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 8px;
  padding: 1.15rem 1.3rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 1.1rem;
  box-shadow: 2px 2px 10px var(--shadow-color);
  position: relative;
  overflow: hidden;
}

.chapter-card-compact::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--color-gold);
  opacity: 0.6;
  transition: width 0.25s ease, opacity 0.25s ease;
}

.chapter-card-compact:hover {
  border-color: var(--color-gold);
  background: rgba(197, 160, 89, 0.1);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow-color);
}

.chapter-card-compact:hover::before {
  width: 6px;
  opacity: 1;
  background: var(--color-gold-bright);
}

.chapter-compact-icon {
  width: 42px;
  height: 42px;
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid var(--border-antique);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold);
  flex-shrink: 0;
  transition: transform 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.chapter-compact-icon i {
  width: 20px;
  height: 20px;
}

.chapter-card-compact:hover .chapter-compact-icon {
  transform: scale(1.08);
  color: var(--color-gold-bright);
  border-color: var(--color-gold);
}

.chapter-compact-content {
  flex-grow: 1;
  min-width: 0;
}

.chapter-compact-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.chapter-volume-tag {
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--color-gold);
}

.chapter-compact-count {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
  background: rgba(128, 128, 128, 0.12);
  padding: 1px 6px;
  border-radius: 8px;
}

.chapter-compact-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 3px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-card-compact:hover .chapter-compact-title {
  color: var(--color-accent-hover, var(--color-accent));
}

.chapter-compact-desc {
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--color-text-muted);
  margin-bottom: 0;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-compact-arrow {
  color: var(--color-gold);
  opacity: 0.45;
  transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.chapter-compact-arrow i {
  width: 16px;
  height: 16px;
}

.chapter-card-compact:hover .chapter-compact-arrow {
  opacity: 1;
  transform: translateX(4px);
  color: var(--color-gold-bright);
}

/* ==========================================================================
   READING MODE: SINGLE OPTIMIZED COLUMN
   ========================================================================== */
.readable-column {
  max-width: var(--max-width-readable);
  margin: 0 auto;
  width: 100%;
  position: relative;
}

.article-header {
  text-align: center;
  margin-bottom: 3rem;
}

.article-meta {
  font-family: var(--font-sans);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.article-figure {
  margin: 2.5rem auto;
  text-align: center;
  max-width: 100%;
}

.article-image {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border-antique);
  box-shadow: 0 4px 18px var(--shadow-color);
  display: block;
  margin: 0 auto;
  background-color: #ffffff;
}

.article-figure.small,
.article-image.small {
  max-width: 340px;
}

.article-figure.medium,
.article-image.medium {
  max-width: 540px;
}

.article-figure.large,
.article-image.large {
  max-width: 960px;
}

figcaption {
  margin-top: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
}

.add-bookmark-container {
  display: flex;
  justify-content: center;
  margin-top: 3rem;
}

.add-bookmark-btn {
  background: none;
  border: 1px solid var(--color-gold);
  color: var(--color-accent);
  font-family: var(--font-title);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.add-bookmark-btn:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ==========================================================================
   HISTORIC SPLICE: BALANCED TWO-COLUMN INTERACTIVE LAYOUT
   ========================================================================== */
.splice-view-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.splice-container {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 2.5rem;
  align-items: start;
  width: 100%;
}

.splice-media-column {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: sticky;
  top: 96px;
}

.splice-media-inner {
  position: relative;
  width: 100%;
  border: 1px solid var(--border-antique);
  border-radius: 6px;
  box-shadow: 0 8px 24px var(--shadow-color);
  overflow: hidden;
  background: #0d1117;
}

.splice-media-inner img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.splice-bookmark-centered {
  margin-top: 3rem;
  padding-top: 1.8rem;
  border-top: 1px dashed var(--border-antique);
  width: 100%;
  display: flex;
  justify-content: center;
}

.splice-map-box {
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 1.5rem;
  box-shadow: 0 4px 14px var(--shadow-color);
  transition: border-color 0.2s ease;
}

.splice-map-box:hover {
  border-color: var(--color-gold);
}

.splice-map-frame {
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-antique);
  position: relative;
  z-index: 1;
}

.splice-map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.map-title-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.map-icon {
  width: 13px;
  height: 13px;
  color: var(--color-gold);
}

.map-heading {
  font-family: var(--font-title);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.map-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-ctrl-btn {
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid var(--border-antique);
  color: var(--color-gold);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.map-ctrl-btn i {
  width: 12px;
  height: 12px;
}

.map-ctrl-btn:hover {
  background: var(--color-gold);
  color: #120e0d;
  border-color: var(--color-gold);
}

.splice-map-frame {
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-antique);
}

.hotspots-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.image-hotspot {
  position: absolute;
  width: 11px;
  height: 11px;
  background: rgba(200, 169, 110, 0.9);
  border: 1.5px solid #ffffff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
  z-index: 10;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.image-hotspot::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border-radius: 50%;
}

.image-hotspot:hover,
.image-hotspot.active {
  transform: translate(-50%, -50%) scale(1.45);
  background-color: var(--color-gold-bright);
  box-shadow: 0 0 10px rgba(255, 212, 122, 0.9);
  z-index: 20;
}

.splice-info-column {
  display: flex;
  flex-direction: column;
}

.splice-header {
  margin-bottom: 0.85rem;
}

.splice-title {
  font-family: var(--font-title);
  font-size: 1.65rem;
  line-height: 1.25;
  color: var(--color-accent);
  text-align: left;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0.35rem;
}

.splice-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.splice-text-intro {
  margin-bottom: 1.2rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--color-text);
}

.splice-text-intro p {
  margin-bottom: 0;
  text-indent: 0;
}

.poi-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-antique);
  margin-top: 0.3rem;
  margin-bottom: 0.85rem;
}

.poi-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.poi-icon {
  width: 14px;
  height: 14px;
  color: var(--color-gold);
}

.poi-heading {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  border: none;
  padding: 0;
}

.splice-annotation-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.splice-annotation {
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-left: 3px solid var(--color-gold);
  padding: 1rem 1.15rem;
  border-radius: 4px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.splice-annotation:hover,
.splice-annotation.active {
  background: rgba(197, 160, 89, 0.12);
  border-color: var(--color-gold);
  border-left-color: var(--color-gold-bright);
  box-shadow: 0 4px 16px var(--shadow-color);
  transform: translateX(4px);
}

.splice-annotation h3 {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--color-accent);
  line-height: 1.3;
}

.splice-annotation p {
  font-size: 0.86rem;
  line-height: 1.5;
  margin-bottom: 0;
  text-indent: 0;
  text-align: left;
  color: var(--color-text-muted);
}

/* ==========================================================================
   MICRO-ANIMATIONS & GENERAL UTILITIES
   ========================================================================== */
.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading-state,
.error-state {
  padding: 4rem 2rem;
  text-align: center;
  width: 100%;
}

.loading-state {
  font-family: var(--font-title);
  font-style: italic;
  color: var(--color-text-muted);
}

/* ==========================================================================
   MATHEMATICAL EQUATIONS (KATEX & MATH BLOCKS)
   ========================================================================== */
.math-block {
  margin: 1.8rem 0;
  padding: 1.2rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 6px;
  overflow-x: auto;
  text-align: center;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.math-block .katex-display {
  margin: 0;
  padding: 0;
}

.katex {
  font-size: 0.98em;
  color: var(--color-accent);
}

.math-block .katex {
  font-size: 1.15em;
}

body.inkwell-theme .katex {
  color: var(--color-gold-bright);
}

.math-inline {
  font-family: monospace;
  background: rgba(197, 160, 89, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}

/* ==========================================================================
   ARTICLE SIDENOTES / MARGINALIA & EDITORIAL CALLOUTS
   ========================================================================== */
.article-sidenote {
  margin: 1.4rem 0 1.6rem 0;
  padding: 0.9rem 1.3rem;
  background: rgba(197, 160, 89, 0.07);
  border: 1px solid rgba(200, 169, 110, 0.25);
  border-left: 3px solid var(--color-gold);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  box-shadow: 0 2px 10px var(--shadow-color);
  transition: all 0.2s ease;
}

body.inkwell-theme .article-sidenote {
  background: rgba(20, 26, 40, 0.75);
  border-color: rgba(200, 169, 110, 0.25);
  border-left-color: var(--color-gold);
}

.article-sidenote:hover {
  border-color: var(--color-gold);
  box-shadow: 0 4px 16px var(--shadow-color);
}

.sidenote-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border-antique);
}

.sidenote-header i {
  width: 13px;
  height: 13px;
}

.sidenote-body {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

.sidenote-body p {
  margin-bottom: 0;
  font-size: inherit;
  line-height: inherit;
}

/* ==========================================================================
   CLEAN FOOTER
   ========================================================================== */
#codex-footer {
  width: 100%;
  max-width: 1500px;
  margin: 2.5rem auto 1.5rem auto;
  padding: 0 2.5rem;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

.codex-copyright {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  letter-spacing: 0.5px;
}

.codex-copyright em {
  font-family: var(--font-body);
  font-style: italic;
  margin-left: 4px;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 1280px) {
  .chapters-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  :root {
    --font-base-size: 19px;
  }

  #codex-page {
    padding: 2.5rem 2.5rem;
  }

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

  .splice-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .splice-media-column {
    position: relative;
    top: 0;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
    --font-base-size: 18px;
  }

  .header-inner {
    padding: 0 1rem;
    gap: 0.5rem;
  }

  .header-nav {
    display: none !important;
  }

  .desktop-search {
    display: none !important;
  }

  .mobile-search-btn {
    display: flex !important;
  }

  .mobile-menu-btn {
    display: flex !important;
  }

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

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

  #codex-container {
    padding: 0 1rem;
    margin: 1.2rem auto;
    max-width: 100%;
    overflow-x: hidden;
  }

  #codex-page {
    padding: 1.8rem 1.4rem;
    max-width: 100%;
    overflow-x: hidden;
  }

  .readable-column {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  .article-body {
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .article-figure,
  .article-image,
  .article-figure.small,
  .article-figure.medium,
  .article-figure.large,
  .article-image.small,
  .article-image.medium,
  .article-image.large {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
  }

  .article-figure figcaption {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .tl-point {
    min-width: 160px;
    padding: 0 1.2rem;
  }

  .tl-preview-card {
    width: 200px;
  }

  .timeline-track {
    padding: 0 2rem;
  }
}

/* ==========================================================================
   MOMENTS & SNIPPETS (LIFE REEL, STREAM & GALLERY)
   ========================================================================== */

/* Section header link */
.section-header-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-gold);
  text-decoration: none;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.section-header-link:hover {
  color: var(--color-gold-bright);
  transform: translateX(3px);
}

.section-header-link i {
  width: 15px;
  height: 15px;
}

/* Landing Page Stream */
.snippets-stream-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 4px 20px 4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-gold) transparent;
}

.snippets-stream-wrapper::-webkit-scrollbar {
  height: 6px;
}

.snippets-stream-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.snippets-stream-wrapper::-webkit-scrollbar-thumb {
  background: var(--color-gold);
  border-radius: 3px;
}

.snippets-stream-track {
  display: flex;
  gap: 1.5rem;
  min-width: min-content;
}

.snippet-stream-card {
  width: 320px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--shadow-color);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.snippet-stream-card:hover {
  transform: translateY(-5px);
  border-color: var(--color-gold);
  box-shadow: 0 12px 28px var(--shadow-color);
}

.snippet-stream-media {
  position: relative;
  width: 100%;
  height: 190px;
  overflow: hidden;
  background-color: #0d111a;
}

.snippet-stream-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.snippet-stream-card:hover .snippet-stream-thumb {
  transform: scale(1.06);
}

.snippet-stream-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(12, 16, 24, 0.85);
  color: #f1ebd8;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 14px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  z-index: 2;
}

.snippet-stream-badge.video i {
  color: #e5c889;
}

.snippet-stream-badge.photo i {
  color: var(--color-accent);
}

.snippet-stream-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  transition: background 0.3s ease;
  z-index: 1;
}

.snippet-stream-play-icon i {
  width: 44px;
  height: 44px;
  padding: 11px;
  border-radius: 50%;
  background: rgba(14, 18, 26, 0.75);
  border: 1px solid var(--color-gold);
  color: var(--color-gold-bright);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease, background 0.25s ease;
}

.snippet-stream-card:hover .snippet-stream-play-icon {
  background: rgba(0, 0, 0, 0.05);
}

.snippet-stream-card:hover .snippet-stream-play-icon i {
  transform: scale(1.15);
  background: var(--color-gold);
  color: #0c0f17;
}

.snippet-stream-meta-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 12px 8px 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 13, 20, 0.88) 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 11px;
  color: #ddd6cb;
  z-index: 2;
}

.snippet-stream-loc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-gold-bright);
  font-weight: 500;
}

.snippet-stream-loc i {
  width: 12px;
  height: 12px;
}

.snippet-stream-info {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.snippet-stream-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
  line-height: 1.35;
}

.snippet-stream-desc {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Snippets Category View */
.snippets-category-wrapper {
  padding-bottom: 3rem;
}

.snippets-filter-bar {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin: 1.5rem 0 2.5rem 0;
  flex-wrap: wrap;
}

.snippet-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 24px;
  border: 1px solid var(--border-antique);
  background: var(--bg-card);
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px var(--shadow-color);
}

.snippet-filter-btn i {
  width: 15px;
  height: 15px;
}

.snippet-filter-btn:hover {
  border-color: var(--color-gold);
  color: var(--color-text);
  transform: translateY(-2px);
}

.snippet-filter-btn.active {
  background: var(--color-gold);
  border-color: var(--color-gold-bright);
  color: #0c0f17;
  box-shadow: 0 4px 14px rgba(200, 169, 110, 0.35);
}

.snippets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 2rem;
}

.snippet-card {
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 18px var(--shadow-color);
  display: flex;
  flex-direction: column;
}

.snippet-card:hover {
  transform: translateY(-6px);
  border-color: var(--color-gold);
  box-shadow: 0 16px 32px var(--shadow-color);
}

.snippet-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #0d111a;
}

.snippet-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.snippet-card:hover .snippet-card-thumb {
  transform: scale(1.06);
}

.snippet-media-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(12, 16, 24, 0.85);
  color: #f1ebd8;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 14px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  z-index: 2;
}

.snippet-media-badge.video i {
  color: var(--color-gold-bright);
}

.snippet-media-badge.photo i {
  color: var(--color-accent);
}

.snippet-play-hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.22);
  transition: all 0.3s ease;
  z-index: 1;
}

.snippet-play-hover i {
  width: 48px;
  height: 48px;
  padding: 12px;
  border-radius: 50%;
  background: rgba(14, 18, 26, 0.8);
  border: 1px solid var(--color-gold);
  color: var(--color-gold-bright);
  backdrop-filter: blur(5px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s ease, background 0.25s ease;
}

.snippet-card:hover .snippet-play-hover i {
  transform: scale(1.15);
  background: var(--color-gold);
  color: #0c0f17;
}

.snippet-overlay-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(10, 13, 20, 0.85) 100%);
  pointer-events: none;
  z-index: 1;
}

.snippet-card-bottom-info {
  position: absolute;
  bottom: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 11px;
  color: #ddd6cb;
  z-index: 2;
}

.snippet-loc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-gold-bright);
  font-weight: 500;
}

.snippet-loc i {
  width: 12px;
  height: 12px;
}

.snippet-card-content {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.snippet-card-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  line-height: 1.35;
}

.snippet-card-summary {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

.snippet-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-antique);
  padding-top: 10px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

.snippet-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-gold);
  font-weight: 600;
}

.snippet-action-btn i {
  width: 14px;
  height: 14px;
}

.snippet-story-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

.snippet-story-link:hover {
  color: var(--color-accent);
}

.snippet-story-link i {
  width: 13px;
  height: 13px;
}

/* ==========================================================================
   SNIPPETS LIGHTBOX MODAL
   ========================================================================== */

body.lightbox-open {
  overflow: hidden;
}

.snippets-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.snippets-lightbox.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 12, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.lightbox-dialog {
  position: relative;
  z-index: 10;
  width: min(94vw, 1100px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-antique);
  background: rgba(0, 0, 0, 0.25);
}

.lightbox-counter {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-gold);
  letter-spacing: 0.5px;
}

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

.lightbox-entry-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(200, 169, 110, 0.15);
  border: 1px solid var(--color-gold);
  color: var(--color-gold-bright);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.lightbox-entry-btn:hover {
  background: var(--color-gold);
  color: #0c0f17;
}

.lightbox-entry-btn i {
  width: 14px;
  height: 14px;
}

.lightbox-close-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lightbox-close-btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

.lightbox-close-btn i {
  width: 22px;
  height: 22px;
}

.lightbox-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #06080d;
  min-height: 280px;
  max-height: 56vh;
  overflow: hidden;
}

.lightbox-media-stage {
  width: 100%;
  height: 100%;
  max-height: 56vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image-frame,
.lightbox-video-frame {
  width: 100%;
  height: 100%;
  max-height: 56vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-main-img {
  max-width: 100%;
  max-height: 56vh;
  object-fit: contain;
  display: block;
}

#lightbox-active-video {
  max-width: 100%;
  max-height: 56vh;
  width: auto;
  height: auto;
  display: block;
  outline: none;
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10, 14, 22, 0.7);
  border: 1px solid var(--border-antique);
  color: var(--color-text);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  z-index: 5;
  transition: all 0.2s ease;
}

.lightbox-nav-btn:hover {
  background: var(--color-gold);
  border-color: var(--color-gold-bright);
  color: #0c0f17;
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav-btn.prev {
  left: 16px;
}

.lightbox-nav-btn.next {
  right: 16px;
}

.lightbox-nav-btn i {
  width: 22px;
  height: 22px;
}

.lightbox-footer {
  padding: 16px 22px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-antique);
}

.lightbox-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.lightbox-meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.lightbox-meta-tag i {
  width: 13px;
  height: 13px;
  color: var(--color-gold);
}

.lightbox-meta-tag.type-badge {
  color: var(--color-gold);
}

.lightbox-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.lightbox-summary {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   SNIPPET DETAIL PAGE (SINGLE ENTRY)
   ========================================================================== */

.snippet-detail-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: 4rem;
}

.snippet-back-bar {
  margin-bottom: 1.8rem;
}

.snippet-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-gold);
  text-decoration: none;
  transition: all 0.2s ease;
}

.snippet-back-link:hover {
  color: var(--color-gold-bright);
  transform: translateX(-3px);
}

.snippet-back-link i {
  width: 16px;
  height: 16px;
}

.snippet-detail-header {
  text-align: center;
  margin-bottom: 2rem;
}

.snippet-volume-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: 8px;
}

.snippet-detail-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.25;
  margin-bottom: 12px;
}

.snippet-detail-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.snippet-detail-theater {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-antique);
  box-shadow: 0 16px 40px var(--shadow-color);
  background: #080b12;
  margin-bottom: 2.5rem;
}

.snippet-detail-theater.photo-theater {
  cursor: zoom-in;
}

.snippet-detail-video {
  width: 100%;
  display: block;
  border-radius: 9px;
  max-height: 65vh;
  outline: none;
}

.snippet-detail-photo {
  width: 100%;
  display: block;
  border-radius: 9px;
  max-height: 70vh;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.snippet-detail-theater:hover .snippet-detail-photo {
  transform: scale(1.015);
}

.snippet-theater-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(12, 16, 24, 0.85);
  color: var(--color-gold);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.snippet-theater-tag i {
  width: 13px;
  height: 13px;
}

.snippet-zoom-hint {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(12, 16, 24, 0.85);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.snippet-detail-theater:hover .snippet-zoom-hint {
  opacity: 1;
}

.snippet-metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.snippet-meta-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.snippet-meta-card i {
  width: 20px;
  height: 20px;
  color: var(--color-gold);
  flex-shrink: 0;
  margin-top: 2px;
}

.meta-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.meta-val {
  display: block;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.35;
}

.snippet-journal-section {
  background: var(--bg-card);
  border: 1px solid var(--border-antique);
  border-radius: 10px;
  padding: 2.2rem 2.4rem;
  box-shadow: 0 6px 20px var(--shadow-color);
  position: relative;
}

.snippet-journal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  border-bottom: none;
  padding-bottom: 0;
}

.journal-quill-icon {
  width: 20px;
  height: 20px;
  color: var(--color-gold);
}

.snippet-journal-header h2 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
  padding: 0;
  border: none;
  border-bottom: none;
}

.snippet-journal-body p {
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--color-text);
  font-style: normal;
}

@media (max-width: 480px) {
  :root {
    --header-height: 56px;
    --font-base-size: 17px;
  }

  .header-inner {
    padding: 0 0.75rem;
  }

  .brand-title {
    font-size: 14px;
    letter-spacing: 0.6px;
    line-height: 1.1;
  }

  .brand-tagline {
    display: block !important;
    font-size: 8.5px;
    letter-spacing: 0.2px;
    line-height: 1.1;
    color: var(--color-text-muted);
  }

  .header-utilities {
    gap: 0.3rem;
  }

  .utility-btn {
    width: 34px;
    height: 34px;
  }

  #codex-container {
    padding: 0 0.5rem;
    margin: 0.8rem auto;
  }

  #codex-page {
    padding: 1.25rem 0.85rem;
    border-radius: 4px;
  }

  h1 {
    font-size: 1.45rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .activity-card {
    padding: 0;
  }

  .chapter-card {
    padding: 1.2rem;
  }

  .splice-annotation {
    padding: 1rem;
  }

  .snippets-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .snippet-stream-card {
    width: 270px;
  }

  .snippet-stream-media {
    height: 160px;
  }

  .snippet-detail-title {
    font-size: 1.6rem;
  }

  .snippet-journal-section {
    padding: 1.4rem 1.2rem;
  }

  .lightbox-dialog {
    width: 98vw;
    max-height: 96vh;
    border-radius: 8px;
  }

  .lightbox-body,
  .lightbox-media-stage,
  .lightbox-image-frame,
  .lightbox-video-frame,
  .lightbox-main-img,
  #lightbox-active-video {
    max-height: 46vh;
  }

  .lightbox-title {
    font-size: 1.1rem;
  }

  .lightbox-summary {
    font-size: 0.95rem;
  }
}