/* =============================================================================
   Era Books (exodusnds.com/era-books/<era>)

   Shared structure for every Era Book section: page frame, header, landing
   page, chapter page with its chapter list and "On this page" list, pager,
   footer. It carries no look of its own beyond neutral defaults. Each era's
   theme.css, loaded after this file from assets/era-books/<era>/, sets the
   --eb-* tokens and styles the book's own boxes (bounty, instrument, ...).
   Classes are eb-*; tokens are --eb-*.
   ============================================================================= */

:root {
  --eb-paper:        #f6f3ec;
  --eb-paper-2:      #ebe5d6;
  --eb-ink:          #22201c;
  --eb-muted:        #5c5546;
  --eb-primary:      #2a4a6e;
  --eb-on-primary:   #f6f3ec;
  --eb-accent:       #b8332a;
  --eb-on-accent:    #f6f3ec;
  --eb-accent-2:     #6b4a2c;
  --eb-highlight:    #d9a93a;
  --eb-border:       #22201c;
  --eb-rule:         #2a4a6e;
  --eb-font-display: Georgia, 'Times New Roman', serif;
  --eb-font-heading: Georgia, 'Times New Roman', serif;
  --eb-font-body:    Georgia, 'Times New Roman', serif;
  --eb-max-width:    1180px;
  --eb-prose-width:  46rem;

  /* rulebook.css styles the chapter content from the core site's tokens.
     Map them onto the era tokens so one theme file restyles the prose too. */
  --ends-navy:          var(--eb-primary);
  --ends-purple:        var(--eb-primary);
  --ends-purple-lt:     var(--eb-highlight);
  --ends-blue:          var(--eb-primary);
  --ends-text:          var(--eb-ink);
  --ends-text-muted:    var(--eb-muted);
  --ends-note-bg:       var(--eb-paper-2);
  --ends-desc-bg:       var(--eb-accent-2);
  --ends-desc-text:     var(--eb-paper);
  --theme-header-font:  var(--eb-font-heading);
  --theme-body-font:    var(--eb-font-body);
  --theme-text-color:   var(--eb-ink);
  --theme-table-bg:     var(--eb-paper);
  --theme-table-alt:    var(--eb-paper-2);
  --tblr-font-sans-serif: var(--eb-font-heading);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body.era-book {
  margin: 0;
  background: var(--eb-paper);
  color: var(--eb-ink);
  font-family: var(--eb-font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  overflow-x: hidden;
}

:where(.era-book) img { max-width: 100%; height: auto; }
:where(.era-book) a { color: var(--eb-primary); }
:where(.era-book) [id] { scroll-margin-top: 1rem; }

.era-book :focus-visible { outline: 3px solid var(--eb-accent); outline-offset: 3px; }

.eb-skip {
  position: absolute;
  top: 0.5rem;
  left: -200vw;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--eb-ink);
  color: var(--eb-paper);
  font-family: var(--eb-font-heading);
  text-decoration: none;
}
.eb-skip:focus { left: 0.5rem; }

.eb-inner {
  width: 100%;
  max-width: var(--eb-max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.eb-header {
  background: var(--eb-paper);
  border-bottom: 4px solid var(--eb-ink);
  box-shadow: inset 0 -8px 0 var(--eb-paper), inset 0 -9px 0 var(--eb-primary);
}
.eb-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: var(--eb-max-width);
  margin: 0 auto;
  padding: 0.9rem 16px 1.1rem;
}
.eb-brand {
  display: flex;
  flex-direction: column;
  color: var(--eb-ink);
  text-decoration: none;
}
.eb-brand-kicker {
  font-family: var(--eb-font-heading);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--eb-muted);
}
.eb-brand-title {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.15rem 0.8rem;
  font-family: var(--eb-font-display);
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--eb-accent);
  color: var(--eb-on-accent);
}
.eb-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }
.eb-nav-link {
  font-family: var(--eb-font-heading);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--eb-primary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.eb-nav-link:hover,
.eb-nav-link:focus-visible { border-bottom-color: var(--eb-accent); }

/* ── Type ─────────────────────────────────────────────────────────────────── */
.eb-kicker {
  margin: 0 0 0.35rem;
  font-family: var(--eb-font-heading);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--eb-accent);
}
.eb-kicker a { color: inherit; text-decoration: none; }
.eb-kicker a:hover,
.eb-kicker a:focus-visible { text-decoration: underline; }
.eb-title {
  margin: 0;
  font-family: var(--eb-font-display);
  font-weight: 400;
  line-height: 1.05;
  color: var(--eb-primary);
}
.eb-section-title {
  margin: 0 0 1rem;
  padding-bottom: 0.35rem;
  font-family: var(--eb-font-heading);
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 700;
  color: var(--eb-primary);
  border-bottom: 2px solid var(--eb-primary);
}
.eb-lead { max-width: var(--eb-prose-width); font-size: 1.15rem; }

.eb-button {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  font-family: var(--eb-font-heading);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--eb-primary);
  background: var(--eb-paper);
  border: 2px solid var(--eb-primary);
}
.eb-button:hover,
.eb-button:focus-visible { background: var(--eb-primary); color: var(--eb-on-primary); }
.eb-button-primary { background: var(--eb-accent); border-color: var(--eb-accent); color: var(--eb-on-accent); }
.eb-button-primary:hover,
.eb-button-primary:focus-visible { background: var(--eb-ink); border-color: var(--eb-ink); color: var(--eb-paper); }

/* ── The list page ────────────────────────────────────────────────────────── */
.eb-list { padding: 2.5rem 0 3rem; }
.eb-list .eb-title { font-size: clamp(2.4rem, 7vw, 4rem); margin-bottom: 0.8rem; }
.eb-book-cards { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1.5rem; }
.eb-book-card-link {
  display: grid;
  grid-template-columns: minmax(120px, 200px) minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.25rem;
  color: var(--eb-ink);
  text-decoration: none;
  background: var(--eb-paper);
  border: 3px solid var(--eb-ink);
  outline: 1px solid var(--eb-primary);
  outline-offset: 3px;
}
.eb-book-card-cover { width: 100%; height: auto; border: 2px solid var(--eb-ink); }
.eb-book-card-body { display: flex; flex-direction: column; gap: 0.5rem; }
.eb-book-card-title { font-family: var(--eb-font-display); font-size: 1.8rem; line-height: 1.1; color: var(--eb-primary); }
.eb-book-card-subtitle { font-family: var(--eb-font-heading); color: var(--eb-muted); }
.eb-book-card-body .eb-button { align-self: flex-start; margin-top: 0.5rem; }
.eb-empty { color: var(--eb-muted); }

/* ── Landing page: hero ───────────────────────────────────────────────────── */
.eb-hero {
  position: relative;
  background-color: var(--eb-primary);
  background-size: cover;
  background-position: center 30%;
  color: var(--eb-on-primary);
}
.eb-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 32, 0.72);
}
.eb-hero-plain::before { display: none; }
.eb-hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
  max-width: var(--eb-max-width);
  margin: 0 auto;
  padding: 2.5rem 16px 3rem;
}
@media (min-width: 760px) {
  .eb-hero-inner { grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: 3rem; }
}
.eb-hero-cover {
  width: 100%;
  max-width: 320px;
  height: auto;
  justify-self: center;
  border: 4px solid var(--eb-paper);
  outline: 1px solid var(--eb-highlight);
  outline-offset: 4px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.eb-hero-text .eb-kicker { color: var(--eb-highlight); }
.eb-hero-title {
  font-size: clamp(2.6rem, 8vw, 5rem);
  color: var(--eb-paper);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.eb-hero-subtitle {
  margin: 0.6rem 0 0;
  font-family: var(--eb-font-heading);
  font-size: 1.15rem;
  color: var(--eb-highlight);
}
.eb-hero-blurb { margin: 1.2rem 0 0; max-width: var(--eb-prose-width); font-size: 1.12rem; }
.eb-hero-facts { margin: 0.8rem 0 0; font-family: var(--eb-font-heading); font-size: 0.95rem; opacity: 0.85; }
.eb-hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.eb-hero .eb-button { background: transparent; color: var(--eb-paper); border-color: var(--eb-paper); }
.eb-hero .eb-button:hover,
.eb-hero .eb-button:focus-visible { background: var(--eb-paper); color: var(--eb-primary); }
.eb-hero .eb-button-primary { background: var(--eb-accent); border-color: var(--eb-accent); color: var(--eb-on-accent); }
.eb-hero .eb-button-primary:hover,
.eb-hero .eb-button-primary:focus-visible { background: var(--eb-paper); border-color: var(--eb-paper); color: var(--eb-accent); }

/* ── Landing page: contents ───────────────────────────────────────────────── */
.eb-contents { padding: 2.5rem 0; }
.eb-parts { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.eb-part {
  padding: 1rem 1.1rem 1.2rem;
  background: var(--eb-paper);
  border: 3px double var(--eb-primary);
}
.eb-part-title {
  margin: 0 0 0.6rem;
  font-family: var(--eb-font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--eb-primary);
}
.eb-part-number {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--eb-accent);
}
.eb-part-list { list-style: none; margin: 0; padding: 0; }
.eb-part-list li + li { border-top: 1px solid var(--eb-paper-2); }
.eb-part-link {
  display: block;
  padding: 0.55rem 0;
  color: var(--eb-ink);
  text-decoration: none;
}
.eb-part-link:hover .eb-part-link-title,
.eb-part-link:focus-visible .eb-part-link-title { text-decoration: underline; color: var(--eb-accent); }
.eb-part-link-title { display: block; font-family: var(--eb-font-heading); font-weight: 700; color: var(--eb-primary); }
.eb-part-link-summary { display: block; margin-top: 0.15rem; font-size: 0.92rem; line-height: 1.4; color: var(--eb-muted); }

/* ── Landing page: cast ───────────────────────────────────────────────────── */
.eb-cast { padding: 1.5rem 0 2.5rem; background: var(--eb-paper-2); }
.eb-cast-lead { margin: -0.4rem 0 1.2rem; color: var(--eb-muted); }
.eb-cast-strip {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
}
.eb-cast-card { display: flex; flex-direction: column; gap: 0.35rem; text-align: center; }
.eb-cast-image {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center;
  background: var(--eb-paper);
  border: 3px solid var(--eb-ink);
  outline: 1px solid var(--eb-primary);
  outline-offset: 2px;
}
.eb-cast-name { margin-top: 0.4rem; font-family: var(--eb-font-heading); font-weight: 700; line-height: 1.25; color: var(--eb-primary); }
.eb-cast-caption { font-size: 0.9rem; line-height: 1.3; color: var(--eb-muted); }

/* ── Landing page: licence note ───────────────────────────────────────────── */
.eb-license { padding: 2rem 0 2.5rem; }
.eb-license-note {
  max-width: var(--eb-prose-width);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  text-align: center;
  font-size: 0.98rem;
  background: var(--eb-paper-2);
  border: 3px double var(--eb-primary);
}

/* ── Chapter page ─────────────────────────────────────────────────────────── */
.eb-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem 2.5rem;
  max-width: var(--eb-max-width);
  margin: 0 auto;
  padding: 1.5rem 16px 3rem;
}
@media (min-width: 901px) {
  .eb-page { grid-template-columns: 16rem minmax(0, 1fr); padding-top: 2rem; }
  .eb-side { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; }
}
.eb-main { min-width: 0; }

details.eb-fold {
  padding: 0.9rem 1rem;
  font-family: var(--eb-font-heading);
  font-size: 0.9rem;
  background: var(--eb-paper-2);
  border: 3px double var(--eb-primary);
}
details.eb-fold > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--eb-muted);
}
details.eb-fold > summary::-webkit-details-marker { display: none; }
details.eb-fold > summary::after { content: ' +'; float: right; }
details.eb-fold[open] > summary::after { content: ' \2212'; }

.eb-toc-book { display: block; margin: 0.7rem 0 0.2rem; font-weight: 700; color: var(--eb-primary); text-decoration: none; }
.eb-toc-part {
  margin: 0.8rem 0 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--eb-accent);
}
.eb-toc-list { list-style: none; margin: 0; padding: 0; }
.eb-toc-link {
  display: block;
  padding: 0.25rem 0.5rem;
  margin-left: -0.5rem;
  color: var(--eb-ink);
  text-decoration: none;
  line-height: 1.35;
}
.eb-toc-link:hover,
.eb-toc-link:focus-visible { text-decoration: underline; color: var(--eb-accent); }
.eb-toc-link.is-active { background: var(--eb-primary); color: var(--eb-on-primary); font-weight: 700; }

.eb-chapter-head { margin-bottom: 1.25rem; }
.eb-chapter-title { font-size: clamp(2.2rem, 6vw, 3.6rem); text-transform: uppercase; letter-spacing: 0.02em; }
.eb-chapter-banner { margin: 1.25rem 0 0; }
.eb-chapter-banner img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: cover;
  border: 3px solid var(--eb-ink);
  outline: 1px solid var(--eb-primary);
  outline-offset: 3px;
}
.eb-chapter-banner figcaption { margin-top: 0.5rem; font-size: 0.92rem; font-style: italic; color: var(--eb-muted); }

.eb-onpage { margin: 0 0 1.5rem; }
.eb-onpage ol { list-style: none; margin: 0.6rem 0 0; padding: 0; columns: 2; column-gap: 1.5rem; }
@media (max-width: 600px) { .eb-onpage ol { columns: 1; } }
.eb-onpage li { break-inside: avoid; margin: 0 0 0.3rem; }
.eb-onpage li.eb-onpage-sub { padding-left: 0.9rem; font-size: 0.93em; color: var(--eb-muted); }
.eb-onpage a { color: var(--eb-ink); text-decoration: none; }
.eb-onpage a:hover,
.eb-onpage a:focus-visible { color: var(--eb-accent); text-decoration: underline; }

/* The prose column. rulebook.css gives it its padding and type; the era theme restyles the boxes. */
.eb-prose.rulebook-content { padding: 0; font-size: 1.05rem; }
.eb-prose > :first-child { margin-top: 0; }
.eb-prose p, .eb-prose ul, .eb-prose ol { max-width: var(--eb-prose-width); }
.eb-prose img.framed {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.25rem 0;
  border: 3px solid var(--eb-ink);
  outline: 1px solid var(--eb-primary);
  outline-offset: 3px;
}
.eb-prose figure { margin: 1.5rem 0; }
.eb-prose figure img.framed { margin: 0; }
.eb-prose figcaption { margin-top: 0.5rem; font-size: 0.92rem; font-style: italic; color: var(--eb-muted); }
.eb-prose .eb-figure { max-width: var(--eb-prose-width); }
/* Paired portraits in a grid (the origins page). */
.eb-prose .eb-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); margin: 1.5rem 0; }
.eb-prose .eb-fig { margin: 0; text-align: center; }
.eb-prose .eb-pair { display: flex; gap: 4px; }
.eb-prose .eb-pair a { flex: 1 1 0; min-width: 0; }
.eb-prose .eb-pair img.framed { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; margin: 0; outline: none; }
.eb-prose .eb-fig figcaption { font-style: normal; font-weight: 700; color: var(--eb-ink); }
/* Tables scroll sideways on a phone instead of breaking the page. */
.eb-prose table { display: block; overflow-x: auto; max-width: 100%; }
.eb-prose .legalPage { font-size: 0.95rem; }

/* ── Pager ────────────────────────────────────────────────────────────────── */
.eb-pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; }
.eb-pager-link {
  display: flex;
  flex-direction: column;
  flex: 1 1 240px;
  padding: 0.8rem 1rem;
  color: var(--eb-ink);
  text-decoration: none;
  background: var(--eb-paper);
  border: 3px solid var(--eb-ink);
  outline: 1px solid var(--eb-primary);
  outline-offset: 3px;
}
.eb-pager-link:hover,
.eb-pager-link:focus-visible { background: var(--eb-paper-2); }
.eb-pager-next { text-align: right; align-items: flex-end; }
.eb-pager-dir { font-family: var(--eb-font-heading); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--eb-accent); }
.eb-pager-label { font-family: var(--eb-font-heading); font-weight: 700; color: var(--eb-primary); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.eb-footer { margin-top: 1rem; padding: 2rem 0 2.5rem; background: var(--eb-primary); color: var(--eb-on-primary); border-top: 6px solid var(--eb-ink); }
.eb-footer-inner { max-width: var(--eb-max-width); margin: 0 auto; padding: 0 16px; }
.eb-footer a { color: var(--eb-on-primary); }
.eb-footer-line { margin: 0; max-width: var(--eb-prose-width); }
.eb-footer-links { list-style: none; margin: 1.2rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; font-family: var(--eb-font-heading); font-size: 0.9rem; letter-spacing: 0.06em; text-transform: uppercase; }
.eb-footer-links a { text-decoration: none; }
.eb-footer-links a:hover,
.eb-footer-links a:focus-visible { text-decoration: underline; }
.eb-footer-legal { margin: 1.2rem 0 0; font-size: 0.85rem; opacity: 0.85; }

.eb-book-card-download { margin: .5rem 0 0; font-size: .95rem; }
.eb-book-card-download a { font-weight: 700; text-decoration: underline; }
