:root {
  --ink: #16222d;
  --muted: #5e6873;
  --paper: #fffdf8;
  --canvas: #f3efe5;
  --blue: #08243f;
  --blue-soft: #eaf1f7;
  --gold: #bd7b28;
  --line: #d9d0bd;
  --mt-text-size: 1.18rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Georgia, "Times New Roman", serif; }
a { color: var(--blue); }
.chapter-progress { position: fixed; inset: 0 0 auto; z-index: 100; height: 3px; background: transparent; }
.chapter-progress span { display: block; width: 0; height: 100%; background: var(--gold); }
.chapter-masthead, .chapter-dock, .chapter-navigation, .mt-chapter-text, .chapter-footer { width: min(100% - 2rem, 1080px); margin-inline: auto; }
.chapter-masthead { padding: clamp(2.75rem, 6vw, 4rem) 1rem 1.5rem; text-align: center; }
.eyebrow { margin: 0 0 .8rem; color: var(--blue); font: 700 .72rem/1.3 system-ui, sans-serif; letter-spacing: .16em; text-transform: uppercase; }
.chapter-masthead h1 { margin: 0; font-weight: 500; font-size: clamp(2.2rem, 6vw, 4.8rem); line-height: .98; }
.chapter-masthead h1 span { display: block; margin-bottom: .7rem; color: var(--gold); font: 700 .82rem/1.2 system-ui, sans-serif; letter-spacing: .13em; text-transform: uppercase; }
.chapter-dock { position: sticky; top: calc(var(--global-nav-height, 64px) + .45rem); z-index: 20; padding: .55rem .7rem .5rem; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--paper) 95%, transparent); box-shadow: 0 8px 24px rgba(35, 39, 30, .1); backdrop-filter: blur(12px); }
.chapter-tools { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; font: 700 .8rem/1.2 system-ui, sans-serif; }
.chapter-tools label, .font-controls { display: flex; align-items: center; gap: .55rem; }
.chapter-tools select, .chapter-tools button { min-height: 36px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--blue); font: inherit; }
.chapter-tools select { padding: .3rem 2rem .3rem .55rem; }
.chapter-tools button { padding: .35rem .65rem; cursor: pointer; }
.chapter-tools button:hover, .chapter-tools button:focus-visible { border-color: var(--blue); background: var(--blue-soft); outline: none; }
.chapter-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding-block: 1.15rem; font: 700 .78rem/1.3 system-ui, sans-serif; }
.chapter-navigation a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.chapter-navigation a:last-child { text-align: right; }
.chapter-dock .chapter-navigation { width: 100%; margin: .5rem 0 0; padding: .5rem .05rem 0; border-top: 1px solid var(--line); }
.chapter-dock .chapter-navigation a { min-width: 0; padding: .42rem .55rem; overflow: hidden; border: 1px solid transparent; border-radius: 7px; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.chapter-dock .chapter-navigation a:hover, .chapter-dock .chapter-navigation a:focus-visible { border-color: var(--line); background: var(--blue-soft); outline: none; }
.mt-chapter-text { padding: clamp(1.5rem, 5vw, 4.5rem) clamp(1rem, 7vw, 6.8rem); border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 22px 70px rgba(49, 40, 21, .09); }
.mt-verse { position: relative; margin: 0 0 .78em; font-size: var(--mt-text-size); line-height: 1.72; text-wrap: pretty; }
.mt-verse-number { display: inline; margin: 0 .22em 0 0; color: var(--blue); background: transparent; border: 0; font: 400 .64em/1 Arial, Helvetica, sans-serif; line-height: 0; vertical-align: super; }
.mt-verse-omission { color: var(--muted); font: italic .82em/1.5 Georgia, "Times New Roman", serif; }
.mt-verse:target { margin-inline: -.8rem; padding: .75rem .8rem; border-radius: 9px; background: #fff1ce; scroll-margin-top: calc(var(--global-nav-height, 64px) + 8.5rem); }
.chapter-footer { padding: 2rem 1rem 4rem; color: var(--muted); text-align: center; font: 400 .78rem/1.5 system-ui, sans-serif; }

.book-masthead { padding: clamp(4rem, 10vw, 8rem) max(1rem, calc((100% - 1080px) / 2)); color: white; background: linear-gradient(135deg, #08243f, #153f65); }
.book-masthead .eyebrow { color: #efca82; }
.book-masthead h1 { max-width: 780px; margin: 0; font-size: clamp(3rem, 8vw, 6.5rem); font-weight: 500; line-height: .96; }
.book-lede { max-width: 760px; margin: 1.4rem 0 0; color: #e8eef4; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.65; }
.book-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; font: 700 .84rem/1 system-ui, sans-serif; }
.book-actions a { padding: .9rem 1.1rem; border: 1px solid #efca82; border-radius: 7px; text-decoration: none; }
.primary-button { color: #08243f; background: #efca82; }
.secondary-button { color: white; background: transparent; }
.book-index { width: min(100% - 2rem, 1080px); margin: 0 auto; padding: clamp(3rem, 7vw, 6rem) 0; }
.index-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 440px); gap: 2rem; align-items: end; margin-bottom: 2rem; }
.index-heading h2 { margin: 0; font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 500; }
.index-heading > p { margin: 0; color: var(--muted); font: 400 .95rem/1.6 system-ui, sans-serif; }
.chapter-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.chapter-card { min-height: 124px; display: flex; flex-direction: column; justify-content: space-between; padding: 1rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink); background: var(--paper); text-decoration: none; }
.chapter-card span, .chapter-card small { color: var(--muted); font: 700 .65rem/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.chapter-card strong { color: var(--blue); font-size: 2.2rem; font-weight: 500; }
.chapter-card:hover, .chapter-card:focus-visible { position: relative; z-index: 1; background: var(--blue-soft); outline: 2px solid var(--blue); outline-offset: -2px; }
.source-note { margin-top: 2rem; padding: 1.4rem 1.5rem; border-left: 4px solid var(--gold); background: var(--paper); }
.source-note h2 { margin: 0 0 .5rem; font-size: 1.25rem; }
.source-note p { max-width: 820px; margin: 0 0 .65rem; line-height: 1.6; }
.source-note a { font: 700 .78rem/1.4 system-ui, sans-serif; }

@media (max-width: 800px) {
  .chapter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .chapter-masthead { padding: 1.8rem .75rem 1.1rem; }
  .chapter-masthead h1 { font-size: clamp(2rem, 10vw, 3.4rem); }
  .chapter-dock { top: calc(var(--global-nav-height, 104px) + .3rem); width: calc(100% - 1rem); padding: .45rem .5rem; border-radius: 10px; }
  .chapter-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
  .chapter-tools label { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .chapter-tools select { width: 100%; min-width: 0; padding-right: 1.5rem; }
  .font-controls { gap: .3rem; }
  .font-controls > span { display: none; }
  .chapter-tools button { min-width: 36px; padding-inline: .48rem; }
  .chapter-dock .chapter-navigation { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .2rem; margin-top: .4rem; padding-top: .4rem; }
  .chapter-dock .chapter-navigation a { padding: .38rem .35rem; font-size: .72rem; }
  .mt-chapter-text { width: calc(100% - 1rem); padding: 1.6rem 1.15rem; }
  .index-heading { grid-template-columns: 1fr; gap: .75rem; }
}

@media (max-width: 520px) {
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-card { min-height: 104px; }
}

@media (max-width: 420px) {
  .chapter-tools label { grid-template-columns: minmax(0, 1fr); font-size: 0; }
  .chapter-tools select { font-size: .72rem; }
  .chapter-tools button { min-width: 32px; min-height: 34px; padding-inline: .38rem; font-size: .72rem; }
  .chapter-dock .chapter-navigation a { font-size: .67rem; }
}
