:root {
  color-scheme: light;
  --paper: #fff9ed;
  --card: #fffdf8;
  --ink: #183149;
  --muted: #486172;
  --red: #b7352f;
  --red-dark: #8f2724;
  --green: #2f6a53;
  --line: #dfd1b9;
  --wash: #f7edda;
  font-family: "Atkinson Hyperlegible", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.6; }
[hidden] { display: none !important; }
a { color: var(--red-dark); }
a:hover { color: var(--green); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid #146b89; outline-offset: 3px; }
.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 30; background: var(--ink); color: white; padding: .7rem 1rem; border-radius: .5rem; }
.skip-link:focus { top: .5rem; }

.site-header { border-bottom: 1px solid var(--line); background: rgba(255, 249, 237, .97); }
.brand-trail { max-width: 78rem; margin: auto; padding: .7rem clamp(1rem, 3vw, 2rem); display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.series-link, .book-link { font-family: "Great Vibes", Georgia, serif; font-size: clamp(1.55rem, 3vw, 2rem); color: var(--ink); text-decoration: none; line-height: 1.3; }
.book-link { border: 1px solid var(--line); border-radius: .7rem; padding: .16rem .75rem; background: var(--card); }
.series-link:hover, .book-link:hover { color: var(--red-dark); }
.trail-separator { color: var(--muted); font-size: 1.3rem; }

main { max-width: 78rem; margin: auto; padding: 0 clamp(1rem, 3vw, 2rem) 4rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.7rem, 6vw, 5rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.2; }
.eyebrow { color: var(--red-dark); text-transform: uppercase; font-size: .82rem; font-weight: 700; letter-spacing: .13em; }
.lede { font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 700; line-height: 1.4; }

.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(15rem, .75fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; padding: clamp(2rem, 5vw, 5rem) 0; }
.hero-copy { max-width: 43rem; }
.hero-copy > p:not(.eyebrow) { max-width: 38rem; }
.cover-image, .cover-placeholder { width: min(100%, 21rem); justify-self: center; border-radius: 1.15rem; box-shadow: 0 1rem 2.6rem rgba(57, 49, 34, .16); border: 1px solid var(--line); }
.cover-image { height: auto; display: block; }
.cover-placeholder { aspect-ratio: 2 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at 25% 25%, #fce0bc, transparent 37%), linear-gradient(150deg, #f8efd6, #d8e5d1); color: var(--ink); font-family: Georgia, serif; font-size: 2.4rem; }
.cover-placeholder strong { font-size: 6rem; line-height: 1.15; color: var(--red-dark); }
.primary-link { display: inline-flex; align-items: center; min-height: 3rem; padding: .65rem 1.2rem; border-radius: .8rem; background: var(--red-dark); color: white; font-weight: 700; text-decoration: none; margin-top: .5rem; }
.primary-link:hover { background: var(--green); color: white; }

.intro { max-width: 52rem; background: var(--wash); border-left: .3rem solid var(--green); padding: 1.5rem clamp(1.2rem, 3vw, 2rem); border-radius: 0 .9rem .9rem 0; }
.intro p:last-child { margin-bottom: 0; }
.edition-note { color: var(--muted); font-size: .94rem; }
.book-sections { padding-top: 4rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.section-heading h2 { margin-bottom: .4rem; }
.section-heading > p { color: var(--muted); font-weight: 700; }
.search-panel { border: 1px solid var(--line); background: var(--card); padding: 1.2rem; border-radius: 1rem; margin: 1rem 0 2rem; }
.search-panel label { display: block; font-weight: 700; margin-bottom: .4rem; }
.search-controls { display: flex; gap: .6rem; }
.search-controls input { flex: 1; min-width: 0; min-height: 3.2rem; border: 1px solid #8f9e9d; border-radius: .65rem; font: inherit; padding: .55rem .8rem; background: white; color: var(--ink); }
.search-controls button { min-height: 3.2rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--wash); color: var(--ink); padding: .5rem 1rem; font: inherit; font-weight: 700; cursor: pointer; }
.search-controls button:disabled { opacity: .52; cursor: default; }
#search-status { margin: .5rem 0 0; color: var(--muted); }
.search-results { border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; background: var(--card); margin: -1rem 0 2rem; max-height: 24rem; overflow: auto; }
.search-results ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .5rem; list-style: none; padding: 0; margin: 0; }
.search-results a { display: flex; flex-direction: column; min-height: 3.2rem; border-radius: .5rem; padding: .3rem .65rem; text-decoration: none; background: var(--wash); }
.search-results a span { color: var(--muted); font-size: .85rem; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14.5rem), 1fr)); gap: 1rem; padding: 0; margin: 0; list-style: none; }
.chapter-card { min-height: 11rem; display: flex; flex-direction: column; justify-content: space-between; border-radius: 1rem; padding: 1.2rem; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: 0 .3rem 1rem rgba(67, 54, 35, .05); }
.chapter-card:hover { border-color: var(--green); transform: translateY(-2px); color: var(--ink); }
.chapter-card strong { font-size: 1.35rem; line-height: 1.2; }
.chapter-card > span:last-child { color: var(--muted); font-size: .9rem; }
.chapter-number { color: var(--red-dark); font-weight: 700; letter-spacing: .08em; }

.chapter-shell { max-width: 70rem; margin: auto; }
.back-link { margin: 2rem 0 1rem; }
.back-link a { display: inline-flex; min-height: 3rem; align-items: center; font-weight: 700; }
.chapter-hero { padding: 1.5rem 0 2rem; border-bottom: 1px solid var(--line); }
.chapter-hero h1 { margin-bottom: .8rem; }
.chapter-hero > p:last-child { font-size: 1.15rem; max-width: 46rem; }
.spreads { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); gap: clamp(1rem, 3vw, 2rem); padding: 2rem 0; }
.word-spread { padding: 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: 1rem; }
.word-spread h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.word-grid { padding: 0; margin: 0; list-style: none; display: grid; gap: .65rem; }
.word-card { scroll-margin-top: 1rem; display: flex; align-items: center; gap: 1rem; min-height: 4.7rem; padding: .6rem 1rem; background: var(--wash); border-radius: .7rem; border: 2px solid transparent; }
.word-card:target { border-color: var(--green); background: #e8f3e5; }
.word-card strong { font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.2; overflow-wrap: anywhere; }
.word-number { color: var(--red-dark); font-size: .9rem; font-weight: 700; min-width: 1.8rem; }
.reading-prompt { background: #e9f2e9; border-radius: 1rem; padding: 1.5rem; margin: 1rem 0 2rem; }
.reading-prompt h2 { font-size: 1.3rem; }
.reading-prompt p { margin: 0; }
.chapter-pager { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1rem 0; }
.chapter-pager > * { flex: 1; }
.chapter-pager > :last-child { text-align: right; }
.chapter-pager a { display: inline-flex; align-items: center; min-height: 3rem; font-weight: 700; }
.theme-nav { padding-top: 2.5rem; }
.theme-nav h2 { font-size: 1.4rem; }
.theme-nav ul { list-style: none; display: flex; gap: .5rem; flex-wrap: wrap; padding: 0; margin: 0; }
.theme-nav a { display: inline-flex; align-items: center; min-height: 3rem; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--card); text-decoration: none; }
.theme-nav a[aria-current="page"] { background: var(--ink); color: white; border-color: var(--ink); }
.site-footer { border-top: 1px solid var(--line); padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: .9rem; }
.site-footer p { margin: 0; }

@media (max-width: 650px) {
  .hero { grid-template-columns: 1fr; }
  .cover-image, .cover-placeholder { width: min(75vw, 16rem); }
  .hero-copy { order: 1; }
  .hero > :last-child { order: 0; }
  .search-controls { flex-wrap: wrap; }
  .search-controls button { width: 100%; }
  .chapter-pager { flex-direction: column; }
  .chapter-pager > :last-child { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chapter-card:hover { transform: none; }
}
