:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #687481;
  --line: #e5ddcf;
  --paper: #fbf7ef;
  --panel: #fffdfa;
  --gold: #c99542;
  --gold-dark: #9c6a27;
  --green: #315b55;
  --blue: #476979;
  --red: #8f493d;
  --shadow: 0 18px 45px rgba(68, 47, 20, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr minmax(220px, 340px);
  gap: 28px;
  align-items: center;
  padding: 18px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid rgba(84, 68, 44, 0.14);
  background: rgba(251, 247, 239, 0.94);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: clamp(18px, 3vw, 48px);
  color: #26313a;
  font-size: 14px;
  font-weight: 700;
}

.search input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.88);
  padding: 0 18px;
  color: var(--ink);
  outline: none;
}

.hero {
  display: grid;
  min-height: 420px;
  grid-template-columns: minmax(320px, 0.8fr) minmax(380px, 1.4fr);
  align-items: stretch;
  border-bottom: 1px solid rgba(84, 68, 44, 0.14);
  background:
    linear-gradient(90deg, rgba(251, 247, 239, 1) 0%, rgba(251, 247, 239, 0.92) 42%, rgba(251, 247, 239, 0.2) 100%),
    #f8efe1;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 5vw, 68px) clamp(24px, 4vw, 58px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

h1 {
  max-width: 660px;
  margin-bottom: 18px;
  font-size: clamp(44px, 5vw, 76px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow) {
  max-width: 460px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.primary-action {
  width: fit-content;
  margin-top: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, #d9b875, #b98233);
  color: #fffdf8;
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(156, 106, 39, 0.22);
}

.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  overflow: hidden;
  isolation: isolate;
}

.hero-art::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 50% 25%, rgba(255, 255, 255, 0.58), transparent 32%),
    linear-gradient(120deg, rgba(49, 91, 85, 0.16), rgba(143, 73, 61, 0.12));
}

.hero-cover {
  position: absolute;
  z-index: 2;
  width: min(28vw, 330px);
  min-width: 190px;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: var(--shadow);
  transform: rotate(-2deg);
}

.hero-cover:nth-child(2) {
  z-index: 1;
  transform: translateX(-48%) scale(0.86) rotate(5deg);
}

.hero-cover:nth-child(3) {
  z-index: 1;
  transform: translateX(48%) scale(0.86) rotate(-6deg);
}

.rail-section,
.feature-row,
.books-section,
.journal {
  padding: 32px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid rgba(84, 68, 44, 0.12);
}

.section-heading {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.section-heading h2 {
  margin-bottom: 8px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}

.section-heading > p:not(.eyebrow) {
  max-width: 460px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.section-heading a {
  width: fit-content;
  color: var(--gold-dark);
  font-size: 14px;
  font-weight: 800;
  border-bottom: 1px solid currentColor;
}

.grouped-series-directory {
  display: grid;
  gap: 36px;
  padding: 2px;
}

.mythology-section {
  display: grid;
  gap: 18px;
}

.mythology-heading,
.roadmap-group-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.mythology-heading {
  border-bottom: 1px solid rgba(84, 68, 44, 0.16);
  padding-bottom: 13px;
}

.mythology-heading .eyebrow {
  margin-bottom: 7px;
}

.mythology-heading h3 {
  margin: 0;
  font-size: clamp(27px, 3vw, 40px);
  line-height: 1;
}

.mythology-heading p:not(.eyebrow),
.roadmap-group-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.roadmap-groups {
  display: grid;
  gap: 24px;
}

.roadmap-group {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.roadmap-group-heading h4 {
  margin: 0;
  color: #26313a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(21px, 2vw, 28px);
  font-weight: 500;
  line-height: 1;
}

.series-directory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding: 2px;
}

.series-card,
.book-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(84, 68, 44, 0.08);
  overflow: hidden;
}

.series-card {
  position: relative;
  display: block;
  min-height: 150px;
  padding: 0;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.series-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
}

.lazy-image {
  background:
    linear-gradient(135deg, rgba(201, 149, 66, 0.12), rgba(49, 91, 85, 0.1)),
    #e9dfcf;
}

.series-card::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 253, 250, 0.96) 0%, rgba(255, 253, 250, 0.82) 54%, rgba(255, 253, 250, 0.18) 100%),
    linear-gradient(0deg, rgba(23, 32, 42, 0.16), rgba(23, 32, 42, 0.02));
}

.series-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.series-card-body {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(78%, 270px);
  min-height: inherit;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
}

.series-card-body span {
  width: fit-content;
  margin-bottom: 10px;
  border-radius: 999px;
  background: rgba(201, 149, 66, 0.16);
  color: var(--gold-dark);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.series-card h3 {
  margin: 0 0 7px;
  font-size: 27px;
  line-height: 0.98;
  letter-spacing: 0;
}

.series-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #50606c;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.28;
}

.book-card p,
.journal p {
  color: var(--muted);
}

.feature-row {
  display: grid;
  grid-template-columns: minmax(220px, 310px) 1fr;
  gap: 34px;
  align-items: center;
  background:
    linear-gradient(90deg, rgba(255, 253, 250, 0.62), rgba(255, 253, 250, 0)),
    var(--paper);
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.featured-card {
  min-height: 210px;
}

.featured-card::after {
  background:
    linear-gradient(0deg, rgba(12, 18, 25, 0.82) 0%, rgba(12, 18, 25, 0.54) 42%, rgba(12, 18, 25, 0.08) 100%),
    linear-gradient(90deg, rgba(12, 18, 25, 0.16), rgba(12, 18, 25, 0));
}

.featured-card .series-card-body {
  width: 100%;
  color: #fffdf8;
}

.featured-card .series-card-body span {
  background: rgba(255, 253, 250, 0.86);
  color: var(--gold-dark);
}

.featured-card h3 {
  max-width: 220px;
  color: #fffdf8;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.34);
}

.featured-card p {
  max-width: 260px;
  color: rgba(255, 253, 248, 0.82);
}

.books-section,
.series-page {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 28px;
}

.series-page {
  padding: 34px clamp(20px, 4vw, 56px) 56px;
}

.back-link {
  width: fit-content;
  color: var(--gold-dark);
  font-size: 14px;
  font-weight: 850;
  border-bottom: 1px solid currentColor;
}

.series-hero {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(280px, 1fr) minmax(220px, 340px);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  padding: 18px 0 28px;
  border-bottom: 1px solid rgba(84, 68, 44, 0.14);
}

.series-hero h1 {
  max-width: 760px;
}

.series-hero p:not(.eyebrow) {
  max-width: 820px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.52;
}

.series-page-cover {
  display: grid;
  place-items: center;
}

.series-page-cover .hero-cover {
  width: min(100%, 300px);
  min-width: 0;
}

.series-books-header {
  align-self: start;
}

.series-books-header h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}

.book-groups {
  display: grid;
  gap: 28px;
}

.book-series-group {
  min-width: 0;
}

.book-series-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(84, 68, 44, 0.14);
  padding-bottom: 10px;
}

.book-series-heading .eyebrow {
  margin-bottom: 7px;
}

.book-series-heading h3 {
  margin: 0;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1;
}

.book-series-heading a {
  flex: 0 0 auto;
  color: var(--gold-dark);
  font-size: 13px;
  font-weight: 850;
  border-bottom: 1px solid currentColor;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 280px));
  gap: 18px;
}

.series-book-grid {
  align-content: start;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.book-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  color: inherit;
}

.book-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #e9dfcf;
}

.book-card-large img {
  min-height: 330px;
}

.book-card-body {
  padding: 12px;
}

.book-card h3 {
  margin-bottom: 5px;
  font-size: 19px;
  line-height: 1.03;
}

.book-card p {
  margin-bottom: 0;
  font-size: 12px;
  font-weight: 700;
}

.journal {
  max-width: none;
  padding-bottom: 52px;
}

.journal p {
  max-width: 720px;
  line-height: 1.55;
}

.reader {
  width: min(1200px, calc(100vw - 24px));
  max-width: none;
  height: min(900px, calc(100vh - 24px));
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #10151b;
  color: #fffdf8;
}

.reader::backdrop {
  background: rgba(20, 18, 16, 0.72);
  backdrop-filter: blur(4px);
}

.reader-shell {
  display: grid;
  height: 100%;
  grid-template-rows: auto 1fr auto;
}

.reader-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  background: #10151b;
}

.reader-bar,
.reader-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.05);
}

.reader-bar p {
  margin: 0 0 4px;
  color: #d8c8aa;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.reader-bar h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
}

.reader-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reader button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fffdf8;
  padding: 10px 13px;
  cursor: pointer;
}

.reader button.is-active {
  background: var(--gold);
  border-color: var(--gold);
  color: #1d1408;
  font-weight: 800;
}

.reader-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  justify-content: stretch;
  gap: 12px;
  min-height: 0;
  padding: 18px;
  overflow: hidden;
  outline: none;
}

.reader-stage.single {
  grid-template-columns: minmax(0, 1fr);
}

.reader-page {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: none;
  min-height: 0;
  border-radius: 4px;
  object-fit: contain;
  object-position: center;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
}

.reader-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.reader-controls-left,
.reader-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reader-controls-left {
  justify-content: flex-start;
}

.reader-controls-right {
  justify-content: flex-end;
}

#pageStatus {
  min-width: 130px;
  text-align: center;
  color: #d8c8aa;
  font-weight: 800;
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero,
  .feature-row,
  .books-section,
  .series-page,
  .series-hero {
    grid-template-columns: 1fr;
  }

  .hero-art {
    min-height: 310px;
  }

  .hero-cover {
    width: min(56vw, 300px);
    min-width: 170px;
  }

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

  .mythology-heading,
  .roadmap-group-heading {
    align-items: start;
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 620px) {
  .brand-text {
    font-size: 18px;
  }

  .nav-links {
    gap: 18px;
    overflow-x: auto;
  }

  .series-grid,
  .book-grid {
    grid-template-columns: 1fr 1fr;
  }

  .book-card-large img {
    min-height: 0;
  }

  .hero-cover {
    width: min(48vw, 200px);
    min-width: 135px;
  }

  .hero-cover:nth-child(2) {
    transform: translateX(-42%) scale(0.86) rotate(5deg);
  }

  .hero-cover:nth-child(3) {
    transform: translateX(42%) scale(0.86) rotate(-6deg);
  }

  .reader-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .reader-controls {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .reader-controls-left,
  .reader-controls-right {
    justify-content: center;
    width: 100%;
  }

  .reader-stage {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
  }

  .reader-page {
    height: 100%;
  }
}
