:root {
  --black: #05070b;
  --midnight: #071426;
  --ink: #0d1f2d;
  --forest: #163f36;
  --pine: #0f2d28;
  --gold: #d8b761;
  --light-gold: #f5dfa2;
  --blue: #62c7ff;
  --ember: #b95b45;
  --text: #f5f0df;
  --muted: #b9c5bf;
  --panel: rgba(7, 20, 38, 0.72);
  --line: rgba(245, 223, 162, 0.22);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --header-h: 72px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(98, 199, 255, 0.16), transparent 30rem),
    linear-gradient(135deg, var(--black), var(--midnight) 46%, #07100f);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(245, 223, 162, 0.28) 1px, transparent 1.8px),
    linear-gradient(120deg, transparent, rgba(98, 199, 255, 0.07), transparent);
  background-size: 160px 160px, 100% 100%;
  opacity: 0.32;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

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

img {
  display: block;
  max-width: 100%;
}

.nowrap {
  white-space: nowrap;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 3.5rem);
  background: rgba(5, 7, 11, 0.7);
  border-bottom: 1px solid rgba(245, 223, 162, 0.12);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(98, 199, 255, 0.55), inset 0 0 18px rgba(216, 183, 97, 0.2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.audio-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 38px;
  padding: 0.42rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.audio-switch:hover,
.audio-switch[aria-pressed="true"] {
  color: var(--light-gold);
  border-color: rgba(245, 223, 162, 0.48);
}

.audio-switch[aria-pressed="true"] {
  background: rgba(98, 199, 255, 0.08);
}

.audio-switch-track {
  position: relative;
  width: 34px;
  height: 18px;
  flex: 0 0 auto;
  border: 1px solid rgba(185, 197, 191, 0.38);
  border-radius: 999px;
  background: rgba(5, 7, 11, 0.55);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.28);
}

.audio-switch-thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.audio-switch[aria-pressed="true"] .audio-switch-thumb {
  background: var(--blue);
  box-shadow: 0 0 12px rgba(98, 199, 255, 0.75);
  transform: translate(15px, -50%);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 2rem);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
}

.site-nav a {
  transition: color 180ms ease;
}

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

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 5px auto;
  background: currentColor;
}

.panel {
  min-height: 100svh;
  padding: calc(var(--header-h) + 2rem) clamp(1rem, 5vw, 5rem) 2rem;
  position: relative;
  display: grid;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  isolation: isolate;
}

.hero,
.author,
.contact {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.76fr);
}

.hero {
  overflow: hidden;
}

.aurora {
  position: absolute;
  width: min(56vw, 620px);
  aspect-ratio: 1;
  right: 8%;
  top: 16%;
  z-index: -1;
  border: 1px solid rgba(216, 183, 97, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(98, 199, 255, 0.24), transparent 54%),
    conic-gradient(from 30deg, transparent, rgba(216, 183, 97, 0.24), transparent, rgba(22, 63, 54, 0.55), transparent);
  filter: blur(0.2px);
  animation: pulse 7s ease-in-out infinite alternate;
}

.hero-content,
.section-copy,
.section-heading {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  letter-spacing: 0;
  line-height: 1.05;
}

h1 {
  max-width: 850px;
  font-size: clamp(2.55rem, 6.25vw, 5.25rem);
  line-height: 1.04;
}

h2 {
  font-size: clamp(2.2rem, 5vw, 4.8rem);
}

h3 {
  font-size: clamp(1.1rem, 2vw, 1.55rem);
}

p {
  color: var(--muted);
  font-size: clamp(0.98rem, 1.4vw, 1.15rem);
}

.hero-copy {
  max-width: 720px;
  margin: 1.05rem 0 0;
  color: #dfecdf;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.25rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.8rem 1.15rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

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

.button-primary {
  color: #08111b;
  background: linear-gradient(135deg, var(--light-gold), var(--gold));
  box-shadow: 0 14px 35px rgba(216, 183, 97, 0.22);
}

.button-ghost {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.hero-book {
  position: relative;
  justify-self: center;
  width: min(100%, 360px);
}

.hero-book img,
.feature-cover img,
.book-card img {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-book img {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 62svh;
  object-fit: contain;
}

.portal-ring {
  position: absolute;
  inset: -7%;
  border: 1px solid rgba(98, 199, 255, 0.42);
  border-radius: 50%;
  box-shadow: 0 0 54px rgba(98, 199, 255, 0.28), inset 0 0 70px rgba(216, 183, 97, 0.16);
}

.hero-book-meta {
  position: relative;
  z-index: 2;
  margin: 0.8rem auto 0;
  width: 100%;
  padding: 0.15rem 0.25rem 0;
  border-top: 1px solid rgba(245, 223, 162, 0.32);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(245, 223, 162, 0.08), transparent 72%);
  box-shadow: none;
  backdrop-filter: none;
}

.hero-book-meta span,
.book-number,
.contact-list span,
.lore-card span {
  display: block;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-book-meta strong,
.hero-book-meta em {
  display: block;
}

.hero-book-meta strong {
  margin-top: 0.08rem;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.98rem;
}

.hero-book-meta em,
.tagline {
  color: #d9ece8;
  font-style: normal;
}

.hero-book-meta em {
  font-size: 0.88rem;
}

.feature-cover {
  justify-self: center;
}

.feature-cover img {
  width: min(300px, 58vw);
  max-height: 68svh;
  object-fit: contain;
}

.books {
  align-content: center;
  padding-top: var(--header-h);
  padding-bottom: var(--header-h);
}

.books,
.world {
  grid-template-rows: auto auto;
}

.section-heading {
  justify-self: center;
  text-align: center;
}

.section-heading p {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.9rem, 2vw, 1.35rem);
}

.book-card {
  display: grid;
  grid-template-columns: minmax(92px, 0.38fr) minmax(0, 1fr);
  gap: 1rem;
  min-height: 280px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.book-card img {
  width: 100%;
  height: 100%;
  max-height: 250px;
  object-fit: contain;
  background: rgba(5, 7, 11, 0.45);
}

.book-card h3 {
  margin-top: 0.25rem;
}

.book-card p {
  margin: 0.55rem 0;
  font-size: 0.94rem;
}

.book-card a {
  display: inline-flex;
  margin-top: 0.3rem;
  color: var(--light-gold);
  font-weight: 800;
}

.world {
  background:
    linear-gradient(180deg, rgba(5, 7, 11, 0.1), rgba(5, 7, 11, 0.36)),
    radial-gradient(circle at 18% 24%, rgba(185, 91, 69, 0.18), transparent 22rem);
  align-content: start;
  padding-top: calc(var(--header-h) + 1rem);
}

.lore-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.lore-card {
  min-height: 138px;
  padding: 1.1rem;
  border: 1px solid rgba(98, 199, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(13, 31, 45, 0.8), rgba(15, 45, 40, 0.58));
}

.lore-card h3 {
  margin-top: 0.4rem;
}

.lore-card p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.author {
  grid-template-columns: minmax(240px, 0.58fr) minmax(0, 1fr);
}

.author-photo {
  justify-self: center;
}

.author-photo img {
  width: min(310px, 62vw);
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 0 0 12px rgba(245, 223, 162, 0.05), var(--shadow);
}

.contact {
  grid-template-columns: minmax(0, 1fr);
  min-height: calc(100svh - 72px);
}

.contact .section-copy {
  max-width: 980px;
}

.contact h2 {
  max-width: 920px;
  font-size: clamp(2.25rem, 5.8vw, 5.4rem);
}

.contact-note {
  margin-top: 1rem;
  color: #d9ece8;
  font-size: clamp(0.98rem, 1.4vw, 1.12rem);
}

.contact-note a {
  color: var(--light-gold);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(245, 223, 162, 0.35);
  text-underline-offset: 0.18em;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem clamp(1rem, 5vw, 5rem);
  border-top: 1px solid rgba(245, 223, 162, 0.12);
  background: var(--black);
}

.site-footer p,
.site-footer a {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes pulse {
  from {
    transform: scale(0.96);
    opacity: 0.72;
  }
  to {
    transform: scale(1.04);
    opacity: 1;
  }
}

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

  .book-card {
    min-height: 0;
    grid-template-columns: 108px 1fr;
  }

  .book-card img {
    max-height: 168px;
  }

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

@media (min-width: 821px) and (max-height: 780px) {
  .panel {
    padding-top: calc(var(--header-h) + 1.15rem);
    padding-bottom: 1.15rem;
  }

  h1 {
    font-size: clamp(3rem, 8vw, 5.8rem);
  }

  h2 {
    font-size: clamp(2rem, 4.2vw, 3.7rem);
  }

  p {
    font-size: 0.98rem;
  }

  .hero-copy {
    font-size: 1rem;
  }

  .hero-book {
    width: min(100%, 300px);
  }

  .book-card {
    min-height: 232px;
  }

  .books {
    padding-top: var(--header-h);
    padding-bottom: var(--header-h);
  }

  .book-card img {
    max-height: 210px;
  }

  .lore-card {
    min-height: 116px;
    padding: 0.9rem;
  }

  .lore-card p,
  .book-card p {
    font-size: 0.86rem;
  }
}

@media (max-width: 820px) {
  :root {
    --header-h: 64px;
  }

  .nav-toggle {
    display: block;
  }

  .header-actions {
    gap: 0.55rem;
  }

  .audio-switch {
    font-size: 0.7rem;
    padding-inline: 0.56rem;
  }

  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    display: grid;
    gap: 0;
    padding: 0.8rem 1rem 1rem;
    background: rgba(5, 7, 11, 0.96);
    border-bottom: 1px solid var(--line);
    transform: translateY(-130%);
    transition: transform 220ms ease;
  }

  .site-nav.open {
    transform: translateY(0);
  }

  .site-nav a {
    padding: 0.85rem 0;
  }

  .panel {
    min-height: auto;
    padding-top: calc(var(--header-h) + 1.6rem);
    padding-bottom: 2.5rem;
  }

  .hero,
  .author,
  .contact {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 100svh;
  }

  .hero-book {
    width: min(62vw, 260px);
  }

  .hero-book img {
    max-height: 42svh;
  }

  .feature-cover {
    order: -1;
  }

  .feature-cover img {
    width: min(210px, 48vw);
  }

  .author-photo {
    order: -1;
  }

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

@media (max-width: 560px) {
  .site-header {
    padding-inline: 1rem;
  }

  .brand span:last-child {
    max-width: 210px;
  }

  .audio-switch [data-audio-label] {
    display: none;
  }

  h1 {
    font-size: clamp(2.7rem, 15vw, 4rem);
  }

  .hero-actions,
  .button-row,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .book-card {
    grid-template-columns: 84px 1fr;
    padding: 0.8rem;
  }

  .book-card img {
    max-height: 142px;
  }
}

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