/* Shared reader styles for Memorial chapters and the epilogue will live here. */
/* Shared reader styles for In Memoriam chapters and the epilogue. */

:root {
  --reader-background-image: none;
  --reader-surface: #e3dccf;
  --reader-ink: #27231d;
  --reader-muted: #716a5f;
  --reader-rule: #c7baa6;
}

html[data-reader-theme="night"] {
  --reader-surface: #24231f;
  --reader-ink: #eee8dc;
  --reader-muted: #beb3a3;
  --reader-rule: #5d5449;
}

body.reader-page {
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  background: transparent;
}

body.reader-page::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  background-image: linear-gradient(rgba(12, 13, 12, 0.5), rgba(12, 13, 12, 0.5)), var(--reader-background-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  content: "";
  pointer-events: none;
}

.reader-toolbar,
.reader-shell {
  position: relative;
  z-index: 1;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 3rem, 50rem);
  min-height: 4.25rem;
  margin-inline: auto;
  color: var(--muted);
  font-size: 0.75rem;
}

.reader-toolbar a {
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
  text-decoration-color: transparent;
  text-underline-offset: 0.25em;
}

.reader-toolbar a:hover,
.reader-toolbar a:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.reader-mode-toggle {
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
  font: inherit;
  line-height: 1.2;
}

.reader-mode-toggle:hover,
.reader-mode-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.reader-shell {
  width: min(100% - 3rem, 72rem);
  margin: 0 auto clamp(3rem, 8vw, 7rem);
}

.reader-surface {
  width: min(100%, 50rem);
  margin-inline: auto;
  padding: clamp(2.75rem, 8vw, 6rem) clamp(1.5rem, 8vw, 6.5rem) clamp(3.25rem, 8vw, 6rem);
  color: var(--reader-ink);
  background: var(--reader-surface);
}

.chapter-label {
  margin-bottom: 1.2rem;
  color: var(--reader-muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.reader-surface h1 {
  max-width: 10ch;
  margin-bottom: clamp(2.75rem, 6vw, 4.5rem);
  color: var(--reader-ink);
  font-size: clamp(2.5rem, 6.3vw, 4.5rem);
  letter-spacing: -0.055em;
  line-height: 0.92;
}

.reader-prose {
  max-width: 70ch;
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.4vw, 1.18rem);
  line-height: 1.8;
}

.reader-prose p {
  margin-bottom: 1.5em;
}

.reader-prose p:last-child {
  margin-bottom: 0;
}

.reader-prose p:has(> em) {
  margin-left: clamp(1rem, 4vw, 2.5rem);
}

.address-list {
  width: 100%;
  margin: 1.75rem 0;
  border-collapse: collapse;
  color: var(--reader-ink);
  font-family: var(--sans);
  font-size: 0.74rem;
  line-height: 1.45;
}

.address-list td {
  width: 25%;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--reader-rule);
  vertical-align: top;
}

.scene-break {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  width: 9rem;
  margin: 3rem auto;
  color: var(--reader-muted);
}

.scene-break::before,
.scene-break::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.28;
}

.scene-break span {
  width: 0.38rem;
  height: 0.38rem;
  border: 1px solid currentColor;
  box-sizing: border-box;
  opacity: 0.55;
  transform: rotate(45deg);
}

.chapter-question {
  max-width: 62ch;
  margin-top: clamp(2rem, 4vw, 3.25rem);
  padding-left: clamp(1rem, 3vw, 1.75rem);
  border-left: 2px solid var(--accent);
}

.chapter-question h2 {
  margin-bottom: 0.75rem;
  color: var(--reader-ink);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  line-height: 1.4;
  text-transform: uppercase;
}

.chapter-question p {
  margin-bottom: 0;
  color: var(--reader-muted);
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.65;
}

.reader-hints-link {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--reader-muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  text-decoration-color: transparent;
  text-underline-offset: 0.25em;
}

.reader-hints-link:hover,
.reader-hints-link:focus-visible {
  color: var(--reader-ink);
  text-decoration-color: currentColor;
}

.chapter-navigation {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: clamp(2rem, 4vw, 3.25rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--reader-rule);
}

.next-chapter,
.previous-chapter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--reader-ink);
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.15;
  text-decoration: none;
}

.previous-chapter {
  align-items: flex-start;
  text-align: left;
}

.next-chapter {
  align-items: flex-start;
  margin-left: auto;
  text-align: left;
}

.next-chapter span,
.previous-chapter span {
  color: var(--reader-muted);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.previous-chapter span {
  align-self: stretch;
  text-align: right;
}

.next-chapter span {
  align-self: stretch;
  text-align: left;
}

.next-chapter:hover,
.next-chapter:focus-visible,
.previous-chapter:hover,
.previous-chapter:focus-visible {
  color: var(--accent);
}

@media (max-width: 32rem) {
  body.reader-page::before {
    background-image: linear-gradient(rgba(12, 13, 12, 0.78), rgba(12, 13, 12, 0.78)), var(--reader-background-image);
  }

  .chapter-navigation {
    align-items: stretch;
    flex-direction: column;
  }

  .next-chapter {
    align-items: flex-start;
    margin-left: 0;
    text-align: left;
  }

  .reader-toolbar {
    width: min(100% - 2rem, 50rem);
    min-height: 3.75rem;
  }

  .reader-shell {
    width: 100%;
    margin-bottom: 0;
  }

  .reader-surface {
    padding: 2.5rem 1.25rem 3.5rem;
  }

  .address-list,
  .address-list tbody,
  .address-list tr {
    display: block;
  }

  .address-list tr {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid var(--reader-rule);
  }

  .address-list td {
    width: auto;
    border: 0;
  }
}
