:root {
  /* VinOps palette: light and dark modes */
  --wine-cream:       #FAF8F5;
  --wine-ink:         #212121;
  --wine-burgundy:    #4B1A22;
  --wine-red:         #9E0000;
  --wine-beige:       #E6E2D3;
  --wine-gold:        #FFECB3;
  --wine-cream-text:  #F1E9DA;
  --wine-dark-bg:     #1F1F1F;
  --wine-dark-surface:#282828;
  --wine-dark-red:    #C62828;

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;

  --c-ink: var(--wine-ink);
  --c-cream: var(--wine-cream);
  --c-paper: #FFFFFF;
  --c-coffee: var(--wine-burgundy);
  --c-coffee-dark: var(--wine-ink);
  --c-coffee-light: var(--wine-red);
  --c-amber: var(--wine-red);
  --c-amber-2: var(--wine-beige);
  --c-gold: var(--wine-cream-text);
  --c-muted: rgba(75, 26, 34, 0.65);
  --c-border: var(--wine-beige);
  --c-accent: var(--wine-red);
  --c-accent-2: var(--wine-burgundy);
  --c-highlight: rgba(158, 0, 0, 0.08);
  --c-player: rgba(33, 33, 33, 0.95);
  --radius: 0.75rem;
  --shadow: 0 10px 30px rgba(33, 33, 33, 0.10);
  --shadow-lg: 0 24px 60px rgba(33, 33, 33, 0.15);
  --max-content: 780px;
}

html[data-theme='dark'] {
  --c-ink: var(--wine-cream-text);
  --c-cream: var(--wine-dark-bg);
  --c-paper: var(--wine-dark-surface);
  --c-coffee: var(--wine-cream-text);
  --c-coffee-dark: var(--wine-cream-text);
  --c-coffee-light: var(--wine-gold);
  --c-amber: var(--wine-dark-red);
  --c-amber-2: var(--wine-gold);
  --c-gold: var(--wine-gold);
  --c-muted: rgba(241, 233, 218, 0.60);
  --c-border: rgba(241, 233, 218, 0.12);
  --c-accent: var(--wine-dark-red);
  --c-accent-2: var(--wine-gold);
  --c-highlight: rgba(198, 40, 40, 0.14);
  --c-player: rgba(31, 31, 31, 0.98);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
  color-scheme: light dark;
}

body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.75;
  color: var(--c-ink);
  background: var(--c-cream);
  transition: color 0.25s ease, background-color 0.25s ease;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  z-index: 1000;
  background: var(--c-accent);
  color: var(--c-coffee-dark);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
}
.skip-link:focus { top: 1rem; }

.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 3rem 1.5rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255, 236, 179, 0.16), transparent 45%),
    radial-gradient(ellipse at 80% 80%, rgba(94, 23, 54, 0.28), transparent 45%),
    linear-gradient(135deg, var(--c-coffee-dark), #4B1A22 70%);
  color: var(--c-gold);
  text-align: center;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 236, 179, 0.10), transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(198, 40, 40, 0.20), transparent 40%);
  animation: pulse 12s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes pulse {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(1.08); opacity: 0.85; }
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(241, 233, 218, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(241, 233, 218, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.6;
  mask-image: radial-gradient(circle at center, black, transparent 70%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 920px;
}

.hero-inner > * {
  opacity: 1;
  animation: fadeUp 0.7s ease both;
}

.hero-inner > *:nth-child(1) { animation-delay: 0.1s; }
.hero-inner > *:nth-child(2) { animation-delay: 0.2s; }
.hero-inner > *:nth-child(3) { animation-delay: 0.3s; }
.hero-inner > *:nth-child(4) { animation-delay: 0.4s; }
.hero-inner > *:nth-child(5) { animation-delay: 0.5s; }
.hero-inner > *:nth-child(6) { animation-delay: 0.55s; }
.hero-inner > *:nth-child(7) { animation-delay: 0.6s; }

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

.hero-kicker {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-amber-2);
  margin: 0 0 1.5rem;
  opacity: 0.9;
}

.hero-title {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: clamp(4rem, 12vw, 9rem);
  line-height: 0.9;
  margin: 0;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--c-gold), var(--c-amber));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 20px 80px rgba(0,0,0,0.3);
}

.hero-subtitle {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: clamp(1.25rem, 3vw, 2rem);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin: 0.75rem 0 1.5rem;
  color: var(--c-amber-2);
  opacity: 0.92;
}

.hero-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  color: var(--c-gold);
  opacity: 0.85;
  max-width: 640px;
  margin: 0 auto 2.5rem;
  line-height: 1.5;
}

.hero-dedication {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--c-amber-2);
  opacity: 0.75;
  max-width: 560px;
  margin: 2rem auto 0;
  line-height: 1.6;
  white-space: pre-line;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: linear-gradient(135deg, var(--c-amber), var(--c-accent));
  color: #212121;
  box-shadow: 0 8px 22px rgba(198, 40, 40, 0.35);
}

.btn-primary:hover { box-shadow: 0 12px 30px rgba(198, 40, 40, 0.45); }

.btn-secondary {
  background: transparent;
  color: var(--c-gold);
  border-color: var(--c-amber-2);
}

.btn-secondary:hover {
  background: var(--c-amber);
  color: #212121;
  border-color: var(--c-amber);
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 1.5rem 8rem;
}

.toc {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding: 0.5rem;
  z-index: 10;
  transition: top 0.25s ease;
}

.sticky-bar.visible ~ .layout .toc {
  top: 4rem;
  max-height: calc(100vh - 5rem);
}

.toc-toggle {
  display: none;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-paper);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-weight: 700;
  cursor: pointer;
}

.toc-search {
  width: 100%;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-paper);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: sticky;
  top: 0;
  z-index: 1;
}

.toc-search:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

.toc-search::placeholder {
  color: var(--c-muted);
}

html[data-theme='light'] .toc-search:focus {
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.08);
}

.toc-tree {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.45;
  background: var(--c-paper);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.toc-tree ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1rem;
}

.toc-tree > ul { padding-left: 0; }

.toc-tree li { margin: 0.15rem 0; }

.toc-tree a {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 0.4rem;
  color: var(--c-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.toc-tree a:hover {
  color: var(--c-coffee-dark);
  background: var(--c-highlight);
}

.toc-tree a.active {
  color: var(--c-coffee-dark);
  background: rgba(255, 236, 179, 0.18);
  font-weight: 700;
  border-left: 3px solid var(--c-accent);
  border-radius: 0 0.4rem 0.4rem 0;
}

html[data-theme='light'] .toc-tree a.active {
  background: rgba(198, 40, 40, 0.10);
  border-left-color: var(--c-coffee-dark);
}

.toc-tree li.toc-hidden { display: none; }

.toc-tree .toc-h1 { font-weight: 700; font-size: 0.92rem; color: var(--c-coffee-dark); }
.toc-tree .toc-h2 { padding-left: 0.75rem; }
.toc-tree .toc-h3 { padding-left: 1.5rem; font-size: 0.78rem; }
.toc-tree .toc-h4 { padding-left: 2.25rem; font-size: 0.74rem; opacity: 0.85; }

.main {
  min-width: 0;
  background: var(--c-paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.5rem, 4vw, 3.5rem);
}

.manuscript {
  max-width: var(--max-content);
  margin: 0 auto;
}

.manuscript :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-sans);
  font-weight: 800;
  color: var(--c-coffee-dark);
  line-height: 1.2;
  margin: 2.5em 0 0.6em;
  scroll-margin-top: 6rem;
}

.manuscript h1 { font-size: 2.4rem; margin-top: 1.5em; }
.manuscript h2 { font-size: 1.85rem; }
.manuscript h3 { font-size: 1.45rem; font-weight: 700; }
.manuscript h4 { font-size: 1.15rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }

.manuscript p {
  margin: 0 0 1.1em;
  text-align: justify;
  hyphenate-limit-chars: 6 3 3;
}

.manuscript a {
  color: var(--c-accent-2);
  text-underline-offset: 0.18em;
}
.manuscript a:hover { color: var(--c-coffee-dark); }

.manuscript strong { color: var(--c-coffee-dark); font-weight: 700; }
.manuscript em { color: var(--c-coffee-light); }

.manuscript ul, .manuscript ol {
  padding-left: 1.5rem;
  margin: 0 0 1.25em;
}

.manuscript li { margin: 0.45em 0; }

.manuscript blockquote {
  margin: 1.75em 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--c-amber);
  background: var(--c-highlight);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}

.manuscript blockquote p { margin: 0; }

.manuscript hr {
  border: none;
  border-top: 2px solid var(--c-border);
  margin: 2.5rem 0;
}

.manuscript table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.manuscript th, .manuscript td {
  border: 1px solid var(--c-border);
  padding: 0.55rem 0.8rem;
  text-align: left;
}

.manuscript th {
  background: var(--c-cream);
  font-family: var(--font-sans);
  font-weight: 700;
}

.manuscript code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: var(--c-cream);
  padding: 0.15em 0.35em;
  border-radius: 0.3rem;
}

.manuscript pre {
  background: var(--c-cream);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
}

.anchor {
  float: left;
  margin-left: -1.1em;
  padding-right: 0.3em;
  text-decoration: none;
  color: var(--c-amber);
  opacity: 0;
  transition: opacity 0.15s;
  font-weight: 400;
}

:is(h1, h2, h3, h4):hover .anchor { opacity: 1; }

[data-tts-active] {
  background: var(--c-highlight);
  border-radius: 0.25em;
  outline: 2px solid var(--c-amber);
  outline-offset: 2px;
  transition: background 0.2s ease;
}

.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--c-player);
  color: var(--c-gold);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(241, 233, 218, 0.12);
  box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
  transition: transform 0.3s ease;
}

.player-track {
  height: 4px;
  background: rgba(241, 233, 218, 0.12);
}

.player-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--c-amber), var(--c-gold));
  transition: width 0.3s linear;
}

.player-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  flex-wrap: wrap;
}

.player-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid rgba(241, 233, 218, 0.25);
  background: rgba(241, 233, 218, 0.08);
  color: var(--c-gold);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.player-btn:hover { background: rgba(241, 233, 218, 0.18); }
.player-btn:active { transform: scale(0.95); }

.player-play { width: 2.75rem; height: 2.75rem; background: var(--c-amber); color: #212121; font-size: 1.1rem; }

.player-info {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--c-amber-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28vw;
}

.player-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--c-amber-2);
  margin-right: -0.2rem;
}

.player-select {
  background: rgba(241, 233, 218, 0.08);
  color: var(--c-gold);
  border: 1px solid rgba(241, 233, 218, 0.25);
  border-radius: 0.5rem;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  cursor: pointer;
}

.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 5.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: none;
  background: var(--c-paper);
  color: var(--c-coffee-dark);
  box-shadow: var(--shadow);
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 90;
}

.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; padding-top: 1.5rem; }
  .toc { position: relative; top: 0; max-height: none; }
  .toc-toggle { display: flex; }
  .toc-search { display: none; margin-bottom: 0; margin-top: 0.5rem; }
  .toc-search.open { display: block; }
  .toc-tree { display: none; margin-top: 0.5rem; }
  .toc-tree.open { display: block; }
  .player-info { max-width: 45vw; }
  .player-inner { justify-content: center; }
}

.hero-lang {
  margin-top: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--c-amber-2);
}

.hero-lang-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.hero-lang-select {
  background: rgba(241, 233, 218, 0.10);
  color: var(--c-gold);
  border: 1px solid rgba(241, 233, 218, 0.25);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  cursor: pointer;
}

.hero-lang-select option {
  background: var(--c-cream);
  color: var(--c-ink);
}

.sticky-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(33, 33, 33, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(241, 233, 218, 0.10);
  transform: translateY(-100%);
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
}

html[data-theme='light'] .sticky-bar {
  background: rgba(250, 247, 242, 0.94);
  border-bottom-color: rgba(33, 33, 33, 0.08);
}

.sticky-bar.visible {
  transform: translateY(0);
  opacity: 1;
}

.sticky-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 1.25rem;
  gap: 1rem;
}

.sticky-bar-logo {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--c-gold);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.sticky-bar-logo:hover { color: var(--c-amber-2); }

.sticky-bar-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sticky-bar-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--c-amber-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sticky-bar-select {
  background: rgba(241, 233, 218, 0.08);
  color: var(--c-gold);
  border: 1px solid rgba(241, 233, 218, 0.25);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
}

html[data-theme='light'] .sticky-bar-select {
  background: rgba(33, 33, 33, 0.05);
  border-color: rgba(33, 33, 33, 0.15);
  color: var(--c-ink);
}

html[data-theme='light'] .sticky-bar .player-btn {
  background: rgba(33, 33, 33, 0.05);
  border-color: rgba(33, 33, 33, 0.15);
  color: var(--c-ink);
}

html[data-theme='light'] .sticky-bar .player-btn:hover {
  background: rgba(33, 33, 33, 0.12);
  color: var(--c-accent);
}

html[data-theme='light'] .sticky-bar-label {
  color: var(--c-muted);
}

.sticky-bar-select option {
  background: var(--c-cream);
  color: var(--c-ink);
}

.scroll-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--c-amber), var(--c-gold));
  z-index: 1;
  transition: width 0.1s linear;
}

html[data-theme='light'] .scroll-progress {
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-2));
}

.site-footer {
  background: var(--c-coffee-dark);
  color: var(--c-gold);
  padding: 2.5rem 1.5rem 7rem;
  border-top: 1px solid var(--c-border);
  font-family: var(--font-sans);
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

.footer-logo {
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.footer-tagline {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: var(--c-amber-2);
  font-style: italic;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
}

.footer-contact,
.footer-link {
  margin: 0;
  font-size: 0.92rem;
  color: var(--c-gold);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.footer-contact a,
.footer-link:hover {
  color: var(--c-amber-2);
  text-decoration: underline;
}

.footer-contact a {
  font-weight: 600;
}

.copy-email-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--c-amber-2);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.copy-email-btn:hover {
  background: rgba(241, 233, 218, 0.12);
  color: var(--c-gold);
}

.copy-email-btn.copied {
  color: #7FB069;
}

.chapter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: -0.25rem 0 1.25rem 0;
}

.chapter-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--c-border, rgba(241, 233, 218, 0.12));
  border-radius: 999px;
  background: rgba(241, 233, 218, 0.06);
  color: var(--c-muted);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chapter-action:hover {
  background: rgba(241, 233, 218, 0.14);
  color: var(--c-gold);
  border-color: var(--c-gold);
}

html[data-theme='light'] .chapter-action {
  background: rgba(33, 33, 33, 0.04);
  color: var(--c-coffee-dark);
  border-color: rgba(33, 33, 33, 0.12);
}

html[data-theme='light'] .chapter-action:hover {
  background: rgba(33, 33, 33, 0.08);
  color: var(--c-accent);
  border-color: var(--c-accent);
}

.chapter-action-play::before {
  content: '▶';
  font-size: 0.55rem;
}

.chapter-action-annotate::before {
  content: '✎';
  font-size: 0.65rem;
}

.chapter-action-suggest::before {
  content: '✉';
  font-size: 0.65rem;
}

.footer-copy {
  margin: 0;
  font-size: 0.85rem;
  color: var(--c-muted);
  text-align: right;
}

.shortcuts-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: rgba(17, 6, 9, 0.7);
  color: var(--c-ink);
  backdrop-filter: blur(4px);
}

.shortcuts-dialog::backdrop {
  background: rgba(17, 6, 9, 0.7);
}

.shortcuts-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 24rem);
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--c-paper);
  box-shadow: var(--shadow);
}

.shortcuts-inner h2 {
  margin: 0 0 1rem 0;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: var(--c-coffee-dark);
}

.shortcuts-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--c-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.shortcuts-close:hover {
  background: var(--c-highlight);
  color: var(--c-coffee-dark);
}

.shortcuts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--c-ink);
}

.about-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: rgba(17, 6, 9, 0.7);
  color: var(--c-ink);
  backdrop-filter: blur(4px);
}

.about-dialog::backdrop {
  background: rgba(17, 6, 9, 0.7);
}

.about-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 38rem);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--c-paper);
  box-shadow: var(--shadow);
}

.about-inner h2 {
  margin: 0 0 1rem 0;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  color: var(--c-coffee-dark);
}

.about-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--c-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.about-close:hover {
  background: var(--c-highlight);
  color: var(--c-coffee-dark);
}

.about-body {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--c-ink);
}

.about-body p {
  margin: 0 0 1rem 0;
}

.about-body a {
  color: var(--c-accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.about-body a:hover {
  color: var(--c-gold);
}



/* Theme-specific overrides for accessibility */
html[data-theme='dark'] .hero {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255, 236, 179, 0.08), transparent 45%),
    radial-gradient(ellipse at 80% 80%, rgba(198, 40, 40, 0.18), transparent 45%),
    linear-gradient(135deg, #1F1F1F, #4B1A22 70%);
}

html[data-theme='dark'] .hero-backdrop {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 236, 179, 0.08), transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(198, 40, 40, 0.20), transparent 40%);
}

html[data-theme='dark'] .site-footer {
  background: #1F1F1F;
  color: #F1E9DA;
}

html[data-theme='light'] .sticky-bar-logo {
  color: var(--c-ink);
}

html[data-theme='light'] .sticky-bar-logo:hover {
  color: var(--c-accent);
}

@media print {
  @page { margin: 2cm; }

  .skip-link,
  .hero,
  .sticky-bar,
  .toc,
  .toc-toggle,
  .player,
  #back-to-top,
  .copy-email-btn,
  .chapter-actions,
  .shortcuts-dialog,
  .about-dialog {
    display: none !important;
  }

  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }

  .layout {
    display: block;
    max-width: 100%;
  }

  .main {
    margin: 0;
    padding: 0;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
  }

  .manuscript {
    font-size: 10.5pt;
    line-height: 1.55;
    color: #000 !important;
  }

  .manuscript h1,
  .manuscript h2,
  .manuscript h3,
  .manuscript h4 {
    color: #000 !important;
    page-break-after: avoid;
    break-after: avoid;
  }

  .manuscript p,
  .manuscript li {
    orphans: 3;
    widows: 3;
  }

  .manuscript a {
    color: #000 !important;
    text-decoration: underline;
  }

  .manuscript table {
    font-size: 9pt;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .manuscript img {
    max-width: 100%;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .site-footer {
    background: #fff !important;
    color: #000 !important;
    padding: 1rem 0 !important;
    border-top: 1px solid #ccc !important;
  }

  .footer-logo,
  .footer-tagline,
  .footer-contact,
  .footer-link,
  .footer-copy {
    color: #000 !important;
  }
}

@media (max-width: 600px) {
  body { font-size: 16px; }

  .hero { min-height: 85vh; padding: 2rem 1rem; }
  .hero-title { font-size: clamp(2.8rem, 16vw, 4.5rem); line-height: 0.95; }
  .hero-subtitle { letter-spacing: 0.1em; font-size: 0.9rem; }
  .hero-tagline { font-size: clamp(1rem, 4vw, 1.25rem); padding: 0 0.5rem; }
  .hero-actions { flex-direction: column; align-items: stretch; width: 100%; max-width: 22rem; margin: 0 auto; }
  .hero-actions .btn { width: 100%; }

  .layout { padding: 1.5rem 1rem 6rem; gap: 1rem; }
  .main { padding: 1.25rem; }

  .manuscript h1 { font-size: 1.75rem; }
  .manuscript h2 { font-size: 1.45rem; }
  .manuscript h3 { font-size: 1.25rem; }
  .manuscript p { text-align: left; }
  .manuscript table { display: block; overflow-x: auto; font-size: 0.85rem; }

  .sticky-bar-inner { padding: 0.35rem 0.75rem; }
  .sticky-bar-label { display: none; }
  .sticky-bar-select { font-size: 0.8rem; padding: 0.3rem 0.55rem; }
  .player-btn { width: 2rem; height: 2rem; font-size: 0.9rem; }
  .player-info { display: none; }
  .player-inner { gap: 0.6rem; }
  .player-select { max-width: 5rem; }
}

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