:root {
  color-scheme: light;
  --paper: #fffdf7;
  --paper-deep: #f5f0e3;
  --ink: #29261f;
  --muted: #6b6253;
  --accent: #6d3e25;
  --accent-dark: #462617;
  --line: #d8ccb8;
  --shadow: 0 18px 55px rgba(70, 38, 23, 0.12);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(176, 134, 77, 0.12), transparent 32rem),
    var(--paper-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 0.96rem + 0.18vw, 1.12rem);
  line-height: 1.72;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-dark); }
a:focus-visible { outline: 3px solid #b97b3f; outline-offset: 3px; }

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  padding: 0.65rem 0.9rem;
  background: var(--accent-dark);
  color: white;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.page-shell {
  width: min(100% - 2rem, 940px);
  margin: clamp(1rem, 3vw, 3rem) auto;
  padding: clamp(1.25rem, 4vw, 4rem);
  background: var(--paper);
  border: 1px solid rgba(109, 62, 37, 0.16);
  box-shadow: var(--shadow);
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(250px, 0.8fr);
  align-items: end;
  gap: clamp(1rem, 4vw, 3rem);
  margin-bottom: 1.5rem;
}
.site-header h1 {
  margin: 0 0 0.35rem;
  color: var(--accent-dark);
  font-size: clamp(2rem, 5vw, 3.8rem);
  font-weight: 500;
  line-height: 1.05;
}
.site-header h1 span { display: block; margin-top: 0.35rem; font-size: 0.42em; font-style: italic; }
.site-header p { margin: 0; color: var(--muted); font-size: 1rem; }
.book-promo {
  display: block;
  padding: 1.15rem 1.25rem 1.1rem;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(109, 62, 37, 0.07), rgba(176, 134, 77, 0.04));
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0.2rem;
  box-shadow: 0 8px 24px rgba(70, 38, 23, 0.07);
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.book-promo:hover {
  color: var(--ink);
  border-color: rgba(109, 62, 37, 0.55);
  box-shadow: 0 11px 28px rgba(70, 38, 23, 0.12);
  transform: translateY(-2px);
}
.book-promo span,
.book-promo strong,
.book-promo small { display: block; }
.promo-kicker {
  margin-bottom: 0.55rem;
  color: var(--accent);
  font: 700 0.68rem/1 system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.book-promo strong {
  color: var(--accent-dark);
  font-size: clamp(1.2rem, 2.1vw, 1.55rem);
  font-weight: 600;
}
.promo-edition { margin-top: 0.12rem; color: var(--muted); font-size: 0.86rem; }
.book-promo small { margin-top: 0.55rem; color: var(--muted); font-size: 0.72rem; font-style: italic; }
.promo-action {
  margin-top: 0.85rem;
  color: var(--accent);
  font: 700 0.76rem/1.2 system-ui, sans-serif;
}

.hero-image { margin: 1.5rem 0 2rem; }
.hero-image img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
}

.chapter-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -0.5rem 2.5rem;
  padding: 0.7rem 0.5rem;
  background: rgba(255, 253, 247, 0.96);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.chapter-nav table,
.chapter-nav tbody,
.chapter-nav tr { display: block; width: 100%; }
.chapter-nav tr:first-child { margin-bottom: 0.4rem; color: var(--muted); text-align: center; }
.chapter-nav tr:last-child { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; }
.chapter-nav th { display: block; width: auto !important; padding: 0; border: 0; }
.chapter-nav a {
  display: grid;
  place-items: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font: 700 0.86rem/1 system-ui, sans-serif;
  text-decoration: none;
}

main { max-width: 46rem; margin-inline: auto; }
main p { margin: 0 0 1.35rem; text-align: left !important; }
main blockquote {
  margin: 0.75rem 0 1.5rem;
  padding: 0.2rem 0 0.2rem clamp(1rem, 4vw, 2rem);
  border-left: 3px solid var(--line);
}
.capitulo {
  display: inline-block;
  margin: 1.65rem 0 0.4rem;
  color: var(--accent-dark);
  font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.5rem);
  font-weight: 700;
  line-height: 1.25;
}
.super {
  position: relative;
  top: -0.35em;
  margin-right: 0.22em;
  color: var(--accent);
  font: 700 0.68em/1 system-ui, sans-serif;
  vertical-align: baseline;
}
.scripture-ref {
  color: var(--accent);
  text-decoration-color: rgba(109, 62, 37, 0.72);
  text-decoration-style: solid;
  text-decoration-thickness: 1px;
}
.scripture-ref:hover,
.scripture-ref:focus-visible {
  color: var(--accent-dark);
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}
[name] { scroll-margin-top: 5.5rem; }

.site-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem 1.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

#copyright {
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

@media (max-width: 680px) {
  .page-shell { width: 100%; margin: 0; padding: 1rem; border: 0; box-shadow: none; }
  .site-header { display: block; }
  .book-promo { margin-top: 1.25rem; text-align: left; }
  .site-header img { margin-left: 0; }
  .chapter-nav { margin-inline: -1rem; padding-inline: 1rem; }
  main blockquote { margin-left: 0; margin-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  body { background: white; font-size: 11pt; }
  .page-shell { width: 100%; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .chapter-nav, .book-promo { display: none; }
  a { color: inherit; }
}
