@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Inter:wght@300;400;500&display=swap');

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

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--navy);
  color: #e8d48b;
  padding: 0.5rem 1rem;
  border-radius: 0 0 4px 4px;
  z-index: 200;
  font-size: 0.85rem;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

:root {
  --bg: #f8f6f1;
  --bg-card: #ffffff;
  --bg-card-hover: #fdfcfa;
  --navy: #14142a;
  --navy-light: #2a2a4a;
  --gold: #9a7b2d;
  --gold-light: #b8942f;
  --gold-dim: #7a6223;
  --text: #2c2c3a;
  --text-muted: #6e6d78;
  --border: #ddd9d0;
  --border-light: #eae7e0;
  --shadow: rgba(20, 20, 42, 0.08);
  --shadow-heavy: rgba(20, 20, 42, 0.15);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ── */

h1, h2, h3, h4 {
  font-family: 'Cinzel', serif;
  color: var(--navy);
  font-weight: 600;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--gold-light);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.site-nav .nav-links a:focus-visible {
  outline-color: #e8d48b;
}

/* ── Layout ── */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
}

/* ── Site Nav ── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  padding: 0 1.5rem;
}

.site-nav .nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.site-nav .nav-brand {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #e8d48b;
  letter-spacing: 0.06em;
}

.site-nav .nav-brand:hover {
  color: #f0e0a0;
}

.site-nav .nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.site-nav .nav-links a {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a0a0b8;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: color 0.3s ease, background 0.3s ease;
}

.site-nav .nav-links a:hover,
.site-nav .nav-links a.active {
  color: #e8d48b;
  background: rgba(232, 212, 139, 0.1);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid #3a3a5a;
  border-radius: 4px;
  color: #e8d48b;
  padding: 0.4rem 0.6rem;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

/* ── Hero Section ── */

.hero {
  text-align: center;
  padding: 4.5rem 1.5rem 3rem;
  position: relative;
}

.hero-headshot {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
  margin-bottom: 1.25rem;
  border: 3px solid var(--bg-card);
  box-shadow: 0 4px 24px var(--shadow-heavy), 0 0 0 1px var(--border-light);
  animation: fadeInUp 0.5s ease both;
}

.hero::after {
  content: '';
  display: block;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 2rem auto 0;
}

.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.05s;
}

.hero .subtitle {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.1s;
}

.hero .intro {
  max-width: 540px;
  margin: 1.5rem auto 0;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-muted);
  font-weight: 300;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.15s;
}

.hero-resume-link {
  display: inline-block;
  margin-top: 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.7;
  transition: opacity 0.3s ease, color 0.3s ease;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.2s;
}

.hero-resume-link:hover {
  opacity: 1;
  color: var(--gold);
}

/* ── Featured Books ── */

.featured {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Section Label ── */

.section-label {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-top: 2.5rem;
  margin-bottom: 0.25rem;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

/* ── Book Feature Card (horizontal) ── */

.book-feature {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow);
  text-decoration: none;
  color: inherit;
  margin-bottom: 3rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  animation: fadeInUp 0.6s ease both;
  animation-delay: 0.1s;
}

.book-feature:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px var(--shadow-heavy);
  border-color: var(--border);
  color: inherit;
}

.book-feature-cover {
  flex-shrink: 0;
  width: 140px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 16px var(--shadow-heavy);
}

.book-feature-cover img {
  width: 100%;
  height: auto;
  display: block;
}

.book-feature-info {
  flex: 1;
}

.book-feature-info .book-number {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.book-feature-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.book-feature-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

/* ── Section Cards Grid ── */

.section-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  padding: 1rem 0 4rem;
}

.section-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  animation: fadeInUp 0.6s ease both;
  box-shadow: 0 1px 3px var(--shadow);
}

.section-card:nth-child(1) { animation-delay: 0.05s; }
.section-card:nth-child(2) { animation-delay: 0.10s; }
.section-card:nth-child(3) { animation-delay: 0.15s; }
.section-card:nth-child(4) { animation-delay: 0.20s; }

.section-card:hover {
  transform: translateY(-4px);
  border-color: var(--border);
  box-shadow: 0 8px 24px var(--shadow-heavy);
}

.section-card a.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.section-card .card-image,
.section-card .card-body {
  pointer-events: none;
}

.section-card .card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #eae7e0 0%, #f0ede6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.section-card .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.section-card .card-image .card-icon {
  font-size: 3rem;
  opacity: 0.25;
  color: var(--gold-dim);
}

/* Mysteries card radar sweep */
.mysteries-card .card-image::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(74, 205, 107, 0.15) 30deg,
    rgba(74, 205, 107, 0.3) 60deg,
    transparent 90deg,
    transparent 180deg,
    rgba(201, 168, 76, 0.15) 210deg,
    rgba(201, 168, 76, 0.3) 240deg,
    transparent 270deg,
    transparent 360deg
  );
  animation: mysteries-sweep 6s linear infinite;
  z-index: 2;
}

@keyframes mysteries-sweep {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.section-card .card-body {
  padding: 1.25rem 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.section-card .card-body h3 {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.section-card .card-body .tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.section-card .card-body .badge {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  margin-top: auto;
  align-self: flex-start;
}

/* ── Origin Story (Stepfather's Handbook) ── */

.origin-story {
  margin: 1.5rem 0 2.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.origin-image {
  flex-shrink: 0;
  width: 180px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 16px var(--shadow-heavy);
  transform: rotate(-2deg);
}

.origin-image img {
  width: 100%;
  height: auto;
  display: block;
}

.origin-caption {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  font-style: italic;
  padding-top: 0.5rem;
}

/* Rules Grid */

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.rule-card {
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rule-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.rule-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

/* ── Resume Terminal Card ── */

.resume-terminal {
  background: #1a1b2e;
  align-items: stretch;
  padding: 12px 14px;
}

.terminal-window {
  background: #12132a;
  border-radius: 6px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #2a2b4a;
}

.terminal-chrome {
  background: #1e1f38;
  padding: 4px 8px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.terminal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.55rem;
  color: #555;
  font-family: monospace;
}

.terminal-body {
  padding: 8px 10px;
  font-family: 'Courier New', monospace;
  font-size: 0.6rem;
  line-height: 1.6;
  color: #8892b0;
  flex: 1;
}

.t-prompt { color: #64ffda; }
.t-cmd { color: #c792ea; }
.t-var { color: #c3e88d; }
.t-output { color: #a9b1d6; }
.t-cursor { color: #82aaff; opacity: 0.7; }

/* ── Books Grid ── */

.books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  padding: 2rem 0 3rem;
  align-items: start;
}

.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.6s ease both;
}

.book-card .card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.book-card .book-info a.book-badge {
  position: relative;
  z-index: 2;
}

.book-card:nth-child(1) { animation-delay: 0.05s; }
.book-card:nth-child(2) { animation-delay: 0.15s; }
.book-card:nth-child(3) { animation-delay: 0.25s; }

.book-card .book-cover {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 16px var(--shadow-heavy), 0 1px 3px var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover .book-cover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px var(--shadow-heavy), 0 2px 6px var(--shadow);
}

.book-card .book-cover img {
  width: 100%;
  height: auto;
  display: block;
}

.book-card .book-cover .cover-placeholder {
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8e5de 0%, #dddad2 100%);
  border: 1px dashed var(--border);
}

.book-card .book-cover .cover-placeholder span {
  font-family: 'Cinzel', serif;
  font-size: 4rem;
  color: var(--text-muted);
}

.book-card .book-info {
  padding: 1.25rem 0.25rem 0;
}

.book-card .book-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
  line-height: 1.3;
}

.book-card .book-info .book-number {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.book-card .book-info .book-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

/* Badge: linked (available) */
a.book-badge {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 0.35rem 0.85rem;
  color: var(--bg-card);
  background: var(--gold);
  text-decoration: none;
  transition: background 0.3s ease;
}

a.book-badge:hover {
  background: var(--gold-light);
  color: var(--bg-card);
}

/* Status labels (not clickable) */
.book-status {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Book Detail (expanded blurb under grid) ── */

.book-blurb {
  max-width: 680px;
  margin: 0 auto 3rem;
  padding: 2rem;
  border-left: 3px solid var(--gold);
  background: var(--bg-card);
  border-radius: 0 8px 8px 0;
  box-shadow: 0 1px 4px var(--shadow);
}

.book-blurb h3 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.book-blurb p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 0.75rem;
}

.book-blurb p:last-child {
  margin-bottom: 0;
}

.book-blurb .blurb-hook {
  color: var(--text);
  font-style: italic;
}

/* ── Author Bio ── */

.author-section {
  max-width: 780px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--border-light);
}

.author-section h3 {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2rem;
  text-align: center;
}

.author-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

.author-card h4 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.author-card .author-handle {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.author-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.75;
}

/* ── Content Page ── */

.page-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  animation: fadeInUp 0.5s ease both;
}

.page-content h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 0.5rem;
}

.page-content .page-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.page-content p {
  margin-bottom: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.page-content .contact {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 1px 3px var(--shadow);
}

.page-content .contact a {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

/* ── Footer ── */

.site-footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer .footer-nav {
  margin-bottom: 1rem;
}

.site-footer .footer-nav a {
  color: var(--gold-dim);
  padding: 0.25rem 0.5rem;
  transition: color 0.3s ease;
}

.site-footer .footer-nav a:hover {
  color: var(--gold-light);
}

.site-footer .footer-nav .sep {
  color: var(--border);
  margin: 0 0.25rem;
}

/* ── BCD Clock ── */

.bcd-clock-section {
  padding: 2rem 0 3rem;
  text-align: center;
}

.bcd-clock-section h2 {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

#bcd-clock {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.5rem 2rem;
}

#bcd-clock .digit-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#bcd-clock .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d0ccc0, #a8a498 40%, #8a867c 70%, #6e6b63);
  box-shadow:
    inset 0 -2px 4px rgba(0,0,0,0.2),
    0 1px 3px rgba(0,0,0,0.12);
  transition: all 0.3s ease;
  opacity: 0.3;
}

#bcd-clock .dot.on {
  background: radial-gradient(circle at 30% 30%, #fff8e0, #f0d860 30%, #d4a017 65%, #a07a10);
  box-shadow:
    inset 0 -2px 4px rgba(0,0,0,0.15),
    0 0 10px rgba(232, 196, 50, 0.5),
    0 0 25px rgba(232, 196, 50, 0.25),
    0 2px 6px rgba(0,0,0,0.15);
  opacity: 1;
}

#bcd-clock .colon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.8rem;
  padding: 0 0.2rem;
}

#bcd-clock .colon-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c8c0b0, #9a9488 50%, #7a756d);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  opacity: 0.4;
}

.bcd-time-readout {
  margin-top: 0.75rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
}

/* ── Error Page ── */

.error-page {
  text-align: center;
  padding: 6rem 1.5rem;
}

.error-page .error-code {
  font-family: 'Cinzel', serif;
  font-size: clamp(4rem, 10vw, 8rem);
  color: var(--border);
  line-height: 1;
  margin-bottom: 1rem;
}

.error-page h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.error-page p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.error-page .home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.error-page .home-link:hover {
  background: #faf6ea;
  border-color: var(--gold);
}

/* ── Error Page Illustrations ── */

.error-illustration {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
}

/* 400 — Garbled envelope */
.err-envelope {
  position: relative;
  width: 120px;
  height: 80px;
}
.err-envelope-body {
  position: absolute;
  bottom: 0;
  width: 120px;
  height: 60px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.err-envelope-flap {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-top: 35px solid var(--border);
}
.err-letter {
  width: 80px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  transform: translateY(-14px) rotate(-3deg);
}
.err-scribble {
  display: block;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
}
.err-scribble.short { width: 60%; }
.err-x {
  position: absolute;
  top: 2px;
  right: 4px;
  color: #c0392b;
  font-size: 1rem;
  font-weight: bold;
}

/* 401 — Padlock */
.err-lock {
  position: relative;
  width: 70px;
  height: 100px;
}
.err-lock-body {
  position: absolute;
  bottom: 0;
  width: 70px;
  height: 50px;
  background: var(--gold);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.err-keyhole {
  width: 14px;
  height: 14px;
  background: var(--navy);
  border-radius: 50%;
  position: relative;
}
.err-keyhole::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 12px;
  background: var(--navy);
  border-radius: 0 0 3px 3px;
}
.err-lock-shackle {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  border: 6px solid var(--border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
}

/* 403 — Shield */
.err-shield {
  width: 80px;
  height: 96px;
  background: var(--navy);
  clip-path: polygon(50% 100%, 0% 20%, 0% 0%, 100% 0%, 100% 20%);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.err-shield-band {
  width: 100%;
  height: 30px;
  background: var(--gold);
  margin-top: 20px;
}
.err-shield-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-size: 2rem;
  color: #fff;
  line-height: 1;
}

/* 404 — Spinning compass */
.err-compass {
  position: relative;
  width: 90px;
  height: 90px;
}
.err-compass-ring {
  width: 90px;
  height: 90px;
  border: 3px solid var(--border);
  border-radius: 50%;
  position: absolute;
}
.err-compass-ring::before,
.err-compass-ring::after {
  position: absolute;
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 600;
}
.err-compass-ring::before {
  content: 'N';
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}
.err-compass-ring::after {
  content: 'S';
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}
.err-compass-needle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 50px;
  margin-left: -2px;
  margin-top: -25px;
  background: linear-gradient(to bottom, #c0392b 50%, var(--border) 50%);
  border-radius: 2px;
  transform-origin: center center;
  animation: compass-spin 3s ease-in-out infinite;
}
.err-compass-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  background: var(--navy);
  border-radius: 50%;
}
@keyframes compass-spin {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(120deg); }
  50%  { transform: rotate(80deg); }
  75%  { transform: rotate(200deg); }
  100% { transform: rotate(360deg); }
}

/* 500 — Smoking server rack */
.err-server {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  background: var(--navy);
  border-radius: 6px;
  width: 100px;
}
.err-server-unit {
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  background: #2a2b4a;
  border-radius: 3px;
}
.err-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.err-led-on {
  background: #c0392b;
  box-shadow: 0 0 6px #c0392b;
  animation: led-blink 1s ease-in-out infinite;
}
.err-led-off {
  background: #444;
}
@keyframes led-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.err-smoke { position: relative; }
.err-smoke-puffs {
  position: absolute;
  top: -20px;
  right: 10px;
  display: flex;
  gap: 6px;
}
.err-smoke-puffs span {
  display: block;
  width: 10px;
  height: 10px;
  background: var(--border);
  border-radius: 50%;
  opacity: 0;
  animation: smoke-rise 2s ease-out infinite;
}
.err-smoke-puffs span:nth-child(2) {
  animation-delay: 0.5s;
  width: 14px;
  height: 14px;
}
.err-smoke-puffs span:nth-child(3) {
  animation-delay: 1s;
  width: 8px;
  height: 8px;
}
@keyframes smoke-rise {
  0%   { opacity: 0.6; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-30px) scale(1.5); }
}

/* ── Book Detail Pages ── */

.book-detail-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0.75rem 1.5rem;
  backdrop-filter: blur(12px);
  background: rgba(248, 246, 241, 0.85);
  border-bottom: 1px solid var(--border-light);
}

.book-detail-nav .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.06em;
  color: var(--gold-dim);
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  transition: background 0.3s ease, color 0.3s ease;
}

.book-detail-nav .back-link:hover {
  background: rgba(154, 123, 45, 0.1);
  color: var(--gold-light);
}

.book-detail-hero {
  width: 100%;
  max-width: 400px;
  margin: 2rem auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow-heavy);
}

.book-detail-hero img {
  width: 100%;
  height: auto;
  display: block;
}

.book-detail-content {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  animation: fadeInUp 0.5s ease both;
}

.book-detail-content .book-number {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.book-detail-content h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.book-detail-content .book-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.book-detail-content h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: var(--navy);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.book-detail-content h3.faction-label {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
  margin: 2rem 0 0.75rem;
}

.book-blurb-detail {
  margin: 0 0 2rem;
  padding: 1.5rem;
  border-left: 3px solid var(--gold);
  background: rgba(154, 123, 45, 0.04);
  border-radius: 0 6px 6px 0;
  line-height: 1.8;
  color: var(--text);
}

.book-blurb-detail p + p {
  margin-top: 1rem;
}

.book-blurb-detail .blurb-hook {
  font-style: italic;
  color: var(--gold-dim);
  font-weight: 500;
}

/* Book Availability CTA */

.book-availability {
  text-align: center;
  margin: 0 0 2.5rem;
}

.book-availability .amazon-link {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--gold);
  padding: 0.65rem 2rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.3s ease;
}

.book-availability .amazon-link:hover {
  background: var(--gold-light);
  color: #fff;
}

.book-availability .book-formats {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Chapter Grid */

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.chapter-card {
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chapter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.chapter-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.chapter-label {
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.chapter-num {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.chapter-title {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 10, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.2s ease;
}

.lightbox[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  line-height: 1;
  z-index: 1001;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-body {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-body img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-caption {
  margin-top: 1rem;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: #e0ddd5;
  letter-spacing: 0.06em;
}

/* Species Grid */

.species-intro {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1rem;
}

.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.species-card {
  display: flex;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  padding: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.species-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.species-portrait {
  width: 90px;
  min-width: 90px;
  height: 90px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--border-light);
}

.species-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.species-info h4 {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.species-info dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.5;
}

.species-info dt {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.65rem;
}

.species-info dd {
  color: var(--text);
}

/* Book Prev/Next Navigation */

.book-nav {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.book-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: background 0.3s ease, border-color 0.3s ease;
  text-decoration: none;
}

.book-nav a:hover {
  border-color: var(--gold-dim);
  background: rgba(154, 123, 45, 0.04);
}

.book-nav a.next {
  text-align: right;
  align-items: flex-end;
}

.book-nav .nav-direction {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.book-nav .nav-name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: var(--navy);
}

/* Typewriter Scene (Book 3) */

.typewriter-scene {
  margin: 3rem auto;
  max-width: 360px;
}

.typewriter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow);
}

.tw-paper {
  padding: 2rem 1.5rem 1.5rem;
  background: #faf8f2;
  border-bottom: 1px solid var(--border-light);
  min-height: 160px;
}

.tw-text {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text);
  text-align: left;
}

.tw-line.tw-faded {
  color: var(--text-muted);
  opacity: 0.6;
}

.tw-line.tw-struck {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.4;
}

.tw-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--navy);
  animation: blink 1s step-end infinite;
  margin-top: 0.25rem;
}

@keyframes blink {
  50% { opacity: 0; }
}

.tw-body {
  padding: 1rem 1.5rem;
  background: var(--navy);
}

.tw-keys {
  height: 28px;
  background: repeating-linear-gradient(
    90deg,
    #2a2a4a 0px, #2a2a4a 18px,
    #1a1a2e 18px, #1a1a2e 22px
  );
  border-radius: 3px;
  opacity: 0.6;
}

.tw-crumpled {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.tw-crumpled span {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
  padding: 0.2rem 0.5rem;
  border: 1px dashed var(--border);
  border-radius: 3px;
  transform: rotate(-2deg);
}

.tw-crumpled span:nth-child(2) { transform: rotate(1deg); }
.tw-crumpled span:nth-child(3) { transform: rotate(-3deg); }
.tw-crumpled span:nth-child(4) { transform: rotate(2deg); }

.coming-soon-label {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-top: 2rem;
}

/* Make book-card work as link */
a.book-card {
  text-decoration: none;
  color: inherit;
}

/* ── Animations ── */

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

/* ── Responsive ── */

@media (max-width: 900px) {
  .section-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .books-grid {
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .site-nav .nav-links {
    display: none;
    position: absolute;
    top: 3.5rem;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--navy);
    border-bottom: 1px solid #2a2a4a;
    padding: 0.5rem 1rem;
  }

  .site-nav .nav-links.open {
    display: flex;
  }

  .site-nav .nav-links a {
    padding: 0.6rem 0.75rem;
  }

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

@media (max-width: 640px) {
  .section-grid {
    grid-template-columns: 1fr;
  }

  .books-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero {
    padding: 3rem 1.5rem 2rem;
  }

  .hero-headshot {
    width: 110px;
    height: 110px;
  }

  .hero .intro {
    font-size: 0.9rem;
  }

  #bcd-clock .dot {
    width: 14px;
    height: 14px;
  }

  #bcd-clock {
    padding: 1rem 1.25rem;
    gap: 0.4rem;
  }

  #bcd-clock .digit-col {
    gap: 0.35rem;
  }

  .book-blurb {
    padding: 1.5rem;
  }

  .chapter-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  .book-feature {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .book-feature-cover {
    width: 160px;
  }

  .origin-story {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .origin-image {
    width: 150px;
  }

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

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

  .book-nav {
    flex-direction: column;
  }

  .book-nav a.next {
    text-align: left;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .books-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .book-card .book-info h3 {
    font-size: 0.9rem;
  }

  .book-card .book-info .book-desc {
    display: none;
  }
}

@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;
  }
}

@media print {
  .site-nav, .book-detail-nav, .nav-toggle, .bcd-clock-section, .site-footer { display: none; }
  body { background: #fff; color: #000; }
  .hero { padding-top: 1rem; }
  .section-card, .book-feature, .book-card { break-inside: avoid; }
  * { box-shadow: none !important; text-shadow: none !important; }
  a { color: inherit; }
  img { max-width: 100% !important; }
}
