@font-face {
  font-family: 'Markazi Text';
  src: url('/assets/MarkaziText.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
}

@font-face {
  font-family: Zain;
  src: url('/assets/Zain-Regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

:root {
  color-scheme: light;
  font-family: Zain, system-ui, sans-serif;
  color: #292925;
  background: #f8f5ee;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 280px;
  background:
    radial-gradient(ellipse at 0% 0%, #e9ddc755, transparent 42%),
    radial-gradient(ellipse at 100% 85%, #e7d9be40, transparent 38%),
    linear-gradient(125deg, #f8f4ec, #fcfaf5 48%, #f6f1e7);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 4%, #c9bba414 9%, transparent 14%, #c9bba40d 18%, transparent 23%);
  filter: blur(18px);
}

a { color: inherit; }
a:focus-visible { outline: 2px solid #a44f2e; outline-offset: 7px; }
button:focus-visible, select:focus-visible { outline: 2px solid #a44f2e; outline-offset: 4px; }
::selection { background: #e8cbb4; color: #292925; }

.reader {
  position: relative;
  min-height: 100svh;
  max-width: 1080px;
  margin-inline: auto;
  padding: 58px 64px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  direction: ltr;
  text-decoration: none;
  border-radius: 4px;
}

.brand img { display: block; width: 58px; height: 59px; }

.passage {
  width: 100%;
  margin-block: clamp(64px, 12vh, 120px) 0;
  text-align: center;
}

.reference {
  margin: 0 0 32px;
  font-family: Zain, system-ui, sans-serif;
  font-size: 25px;
  font-weight: 400;
  line-height: 1.5;
  color: #a7502d;
}

.reference a { text-decoration: none; }
.reference bdi { direction: ltr; unicode-bidi: isolate; }
.reference a:hover { text-decoration: underline; text-underline-offset: 6px; }
.scripture { font-family: 'Markazi Text', serif; font-size: 44px; line-height: 1.65; }
.verse { display: inline; margin: 0; overflow-wrap: break-word; unicode-bidi: isolate; }
.verse-opening { display: inline-block; white-space: nowrap; unicode-bidi: isolate; }
.verse + .verse::before { content: ' '; white-space: pre-wrap; }
.verse-number {
  display: inline-block;
  position: relative;
  top: -.45em;
  margin-inline: .3em .2em;
  color: #a7502d;
  font-family: 'Markazi Text', serif;
  font-size: .48em;
  line-height: 1;
  text-decoration: none;
  border-radius: 2px;
}
.verse-number:hover { text-decoration: underline; text-underline-offset: 4px; }
.verse:target { background: #ead4bb55; border-radius: 4px; }

.reader-footer { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 54px; padding-block: 4px 14px; }
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60px;
  padding: 11px 32px 13px;
  border-radius: 100px;
  background: #2c2d29;
  color: #fcfaf5;
  font-size: 25px;
  line-height: 1.4;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease;
}
.download svg { flex: none; width: 23px; height: 23px; }
.download:hover { background: #45463e; transform: translateY(-2px); }
.download:active { transform: translateY(0); }

.reader--chapter .passage { max-width: 850px; margin-top: 64px; }
.reader--chapter .scripture { font-size: 36px; text-align: start; line-height: 1.85; }
.reader--chapter .reference { margin-bottom: 36px; }

@media (min-width: 1500px) {
  .reader { padding-top: 72px; padding-bottom: 72px; }
  .scripture { font-size: 46px; }
}

@media (max-width: 600px) {
  .reader { padding: 36px 26px 34px; }
  .brand img { width: 50px; height: 51px; }
  .passage { margin-top: 64px; }
  .reference { font-size: 22px; margin-bottom: 24px; }
  .scripture { font-size: 34px; line-height: 1.7; }
  .download { min-height: 56px; font-size: 23px; padding: 10px 27px 12px; gap: 10px; }
  .download svg { width: 21px; height: 21px; }
  .reader-footer { margin-top: 38px; padding-bottom: 0; }
  .reader--chapter .passage { margin-top: 48px; }
  .reader--chapter .scripture { font-size: 31px; }
}

.reader-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; min-height: 49px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 10px; border: 0; border-radius: 50%; color: #58584d; background: transparent; cursor: pointer; }
.icon-button svg { width: 24px; height: 24px; }
.icon-button:hover { background: #e8e1d480; }
.selection-pill { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 42px; max-width: min(75%, 400px); padding: 6px 15px; border: 1px solid #d6cebf; border-radius: 100px; background: #fcfaf580; color: #535548; font: 400 20px/1.4 Zain, system-ui, sans-serif; text-decoration: none; }
.selection-pill:hover { background: #eee8dc; border-color: #c4b8a4; }
.selection-pill svg { width: 17px; height: 17px; flex: none; }
.selection-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.selection-label bdi { flex: none; }
.selection-book { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (min-width: 601px) {
  .selection-pill svg { transform: rotate(90deg); }
  .reader[dir="ltr"] .selection-pill svg { transform: rotate(-90deg); }
}
.chapter-navigation { display: flex; justify-content: space-between; gap: 16px; width: 100%; max-width: 480px; margin-top: 38px; }
.chapter-nav-link { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 52px; height: 52px; padding: 12px; border: 1px solid #d6cebf; border-radius: 50%; background: #fcfaf5e6; color: #535548; text-decoration: none; }
.chapter-nav-link svg { width: 24px; height: 24px; flex: none; }
.chapter-nav-link:hover { background: #eee8dc; border-color: #bcb09b; }
.chapter-nav-next { margin-inline-start: auto; }
.reader[dir="ltr"] .chapter-nav-link svg { transform: rotate(180deg); }
@media (min-width: 1000px) {
  .reader--chapter .passage { max-width: min(850px, calc(100vw - 280px)); }
  .chapter-navigation { margin: 0; }
  .chapter-nav-link { position: fixed; top: 50%; z-index: 1; transform: translateY(-50%); }
  .chapter-nav-prev { inset-inline-start: max(22px, calc((100vw - 1240px) / 2)); }
  .chapter-nav-next { inset-inline-end: max(22px, calc((100vw - 1240px) / 2)); }
}
.read-chapter { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; border-radius: 100px; padding: 11px 28px 13px; font-size: 25px; line-height: 1.4; text-decoration: none; }
.read-chapter { border: 1px solid #ccc4b6; color: #535548; }
.read-chapter svg { width: 22px; height: 22px; flex: none; }
.read-chapter:hover { background: #eee8dc; border-color: #b7ac97; }
.bible-picker { --picker-slide: 12px; position: fixed; inset-block: 0; inset-inline: 0 auto; margin: 0; width: 390px; max-width: 100%; height: 100%; max-height: 100%; overflow: hidden; padding: 24px 22px 0; border: 0; border-inline-end: 1px solid #e8e1d4; background: #fcfaf5; color: #292925; box-shadow: 0 0 80px #38312616; }
.bible-picker[dir="ltr"] { --picker-slide: -12px; }
.bible-picker::backdrop { background: #25241f36; backdrop-filter: blur(4px); animation: backdrop-appear .18s ease-out; }
.bible-picker[open] { display: flex; flex-direction: column; animation: picker-appear .18s ease-out; }
.bible-picker[open].is-closing { animation: picker-disappear .18s ease-in forwards; pointer-events: none; }
.bible-picker[open].is-closing::backdrop { animation: backdrop-disappear .18s ease-in forwards; }
.bible-picker [hidden] { display: none !important; }
html:has(.bible-picker[open]) { overflow: hidden; }
.picker-header { flex: none; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding-bottom: 20px; border-bottom: 1px solid #e9e2d5; }
.picker-header h2 { grid-column: 2; grid-row: 1; text-align: center; margin: 0; font: 400 25px/1.5 Zain, system-ui, sans-serif; outline: none; }
.picker-back { grid-column: 1; grid-row: 1; }
.picker-close { grid-column: 3; grid-row: 1; }
.picker-close { flex: none; }
.picker-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 4px max(24px, env(safe-area-inset-bottom)); scrollbar-width: thin; scrollbar-color: #d6cbbb transparent; }
.picker-view { animation: view-appear .2s ease-out; }
.picker-book { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 54px; padding: 10px 14px; border: 0; border-radius: 10px; font: 400 24px/1.4 Zain, system-ui, sans-serif; text-align: start; color: #43443b; background: transparent; cursor: pointer; }
.picker-book svg { width: 18px; height: 18px; flex: none; color: #9a9486; }
.picker-book:hover { background: #f1ebe0; }
.picker-book[aria-current] { background: #f0e6d8; color: #9f4f30; }
.picker-book-name { text-align: center; margin: 10px 0 22px; font-size: 25px; color: #a7502d; }
.chapter-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.chapter-grid a { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border: 1px solid #e2d9ca; border-radius: 10px; font: 400 24px/1 Zain, system-ui, sans-serif; text-decoration: none; background: #f8f4eb; }
.chapter-grid a:hover { background: #eee4d5; border-color: #c6b79f; }
.chapter-grid a[aria-current] { background: #a7502d; border-color: #a7502d; color: #fffaf2; }
.bible-picker[dir="ltr"] .picker-back svg, .bible-picker[dir="ltr"] .picker-book svg { transform: rotate(180deg); }
@keyframes picker-appear { from { opacity: 0; transform: translateX(var(--picker-slide)); } to { opacity: 1; transform: translateX(0); } }
@keyframes picker-disappear { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(var(--picker-slide)); } }
@keyframes backdrop-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-disappear { from { opacity: 1; } to { opacity: 0; } }
@keyframes view-appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) {
  .reader-header { gap: 18px; }
  .selection-pill { min-height: 44px; max-width: calc(100% - 68px); padding: 6px 13px; gap: 8px; font-size: 19px; }
  .reader-footer { flex-direction: column; gap: 12px; }
  .read-chapter { min-height: 56px; font-size: 23px; padding: 10px 27px 12px; }
  .bible-picker { inset-block: auto 0; inset-inline: 0; width: 100%; height: min(76svh, 680px); padding: 26px 18px 0; border: 0; border-radius: 26px 26px 0 0; }
  .bible-picker::before { content: ''; position: absolute; top: 9px; left: calc(50% - 18px); width: 36px; height: 4px; border-radius: 4px; background: #d7cfc0; }
  .bible-picker[open] { animation-name: sheet-appear; }
  .bible-picker[open].is-closing { animation-name: sheet-disappear; }
  .picker-header { padding-bottom: 14px; }
}
@keyframes sheet-appear { from { opacity: 0; transform: translateY(36px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sheet-disappear { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(36px); } }

@media (prefers-reduced-motion: reduce) {
  .download { transition: none; }
  .bible-picker[open], .bible-picker[open].is-closing, .bible-picker::backdrop, .bible-picker[open].is-closing::backdrop, .picker-view { animation: none; }
}
