/* Bible Study — mikepietsch.com/biblestudy
   Apple-style system: system fonts (SF Pro / New York on Apple devices; Inter / Newsreader elsewhere),
   white and #f5f5f7 surfaces, #1d1d1f text, Apple blue, true black in dark mode. */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --bg-raised: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --hairline: #d2d2d7;
  --accent: #0071e3;
  --link: #0066cc;
  --wj: #b3261e;
  --glass: rgba(255, 255, 255, 0.72);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --hl: rgba(0, 113, 227, 0.08);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: ui-serif, "New York", "Newsreader", "Iowan Old Style", Georgia, serif;
  --nav-h: 48px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg-alt: #161617; --bg-raised: #1d1d1f; --text: #f5f5f7; --text-2: #a1a1a6;
    --text-3: #86868b; --hairline: #424245; --accent: #2997ff; --link: #2997ff; --wj: #ff6b5e;
    --glass: rgba(22, 22, 23, 0.72); --shadow: 0 8px 32px rgba(0, 0, 0, 0.6); --hl: rgba(41, 151, 255, 0.14);
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg-alt: #161617; --bg-raised: #1d1d1f; --text: #f5f5f7; --text-2: #a1a1a6;
  --text-3: #86868b; --hairline: #424245; --accent: #2997ff; --link: #2997ff; --wj: #ff6b5e;
  --glass: rgba(22, 22, 23, 0.72); --shadow: 0 8px 32px rgba(0, 0, 0, 0.6); --hl: rgba(41, 151, 255, 0.14);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 24px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.47 var(--sans); letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -0.015em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 22px; }
.muted { color: var(--text-2); }

/* ---------- global nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent);
}
.nav .wrap { height: 100%; display: flex; align-items: center; gap: 28px; }
.nav .brand { font: 600 19px/1 var(--display); color: var(--text); letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.nav .brand svg { width: 20px; height: 20px; }
.nav .brand:hover { text-decoration: none; }
.nav .links { display: flex; gap: 24px; margin-right: auto; }
.nav .links a { color: var(--text); opacity: 0.8; font-size: 13px; letter-spacing: -0.01em; }
.nav .links a:hover, .nav .links a[aria-current] { opacity: 1; text-decoration: none; }
.nav button { background: none; border: 0; color: var(--text); opacity: 0.8; cursor: pointer; padding: 6px; display: flex; align-items: center; gap: 6px; font: 13px var(--sans); border-radius: 8px; }
.nav button:hover { opacity: 1; background: var(--hl); }
.nav kbd { font: 11px var(--sans); color: var(--text-3); border: 1px solid var(--hairline); border-radius: 5px; padding: 1px 5px; }
@media (max-width: 700px) {
  .nav .links { display: none; }
  .nav .brand { margin-right: auto; }
  .nav kbd { display: none; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 11px 22px; border-radius: 980px; background: var(--accent); color: #fff; font-size: 17px; border: 0; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-plain { color: var(--link); font-size: 17px; display: inline-flex; align-items: center; gap: 4px; }
.btn-plain::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); margin-left: 2px; }

/* ---------- home ---------- */
.hero { text-align: center; padding: 96px 22px 72px; }
.hero h1 { font-size: clamp(44px, 7vw, 80px); line-height: 1.05; letter-spacing: -0.03em; }
.hero p { font-size: clamp(19px, 2.2vw, 24px); color: var(--text-2); max-width: 640px; margin: 18px auto 30px; line-height: 1.35; letter-spacing: -0.01em; }
.hero .actions { display: flex; gap: 24px; justify-content: center; align-items: center; flex-wrap: wrap; }
.hero .reveal { animation: rise 0.9s cubic-bezier(.2, .7, .2, 1) both; }
.hero .reveal:nth-child(2) { animation-delay: .08s; }
.hero .reveal:nth-child(3) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 0 12px 12px; }
.tile {
  position: relative; overflow: hidden; border-radius: 28px; background: var(--bg-alt); color: var(--text);
  padding: 44px 40px; min-height: 380px; display: flex; flex-direction: column;
}
.tile:hover { text-decoration: none; }
.tile.span-6 { grid-column: span 6; } .tile.span-4 { grid-column: span 4; } .tile.span-3 { grid-column: span 3; } .tile.span-2 { grid-column: span 2; }
.tile h2 { font-size: clamp(32px, 4vw, 48px); line-height: 1.08; }
.tile .sub { font-size: 21px; color: var(--text-2); margin-top: 8px; line-height: 1.3; letter-spacing: -0.01em; }
.tile .more { margin-top: 18px; }
.tile.dark { background: #000; color: #f5f5f7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile.dark { background: #1d1d1f; } }
:root[data-theme="dark"] .tile.dark { background: #1d1d1f; }
.tile.dark .sub { color: #a1a1a6; }
.tile .art { margin-top: auto; padding-top: 28px; }
.tile.center { text-align: center; align-items: center; }
.tile.center .verse-art { margin: 0 auto; }
.tile .constellation { width: min(760px, 100%); height: auto; margin: 0 auto; }
.tile .verse-art { font: 400 clamp(22px, 2.6vw, 30px)/1.4 var(--serif); letter-spacing: -0.01em; max-width: 34ch; }
.tile .verse-art cite { display: block; font: 14px var(--sans); color: var(--text-2); margin-top: 12px; font-style: normal; }
.faces { display: flex; gap: 14px; flex-wrap: wrap; }
.faces img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; object-position: top; filter: grayscale(0.15); }
@media (max-width: 900px) {
  .tile.span-4, .tile.span-3, .tile.span-2 { grid-column: span 6; }
  .tile { min-height: 300px; padding: 36px 28px; }
}

.section { padding: 80px 0; }
.section.alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(32px, 4vw, 48px); line-height: 1.08; }

.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 20px; }
.books a { color: var(--text); padding: 9px 0; border-bottom: 1px solid var(--hairline); display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; }
.books a:hover { color: var(--link); text-decoration: none; }
.books a small { color: var(--text-3); font-size: 13px; }
.books a .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; margin-left: 8px; vertical-align: middle; }
.testament + .testament { margin-top: 48px; }
.testament h3 { font-size: 21px; margin-bottom: 10px; color: var(--text-2); font-weight: 600; }

/* ---------- page headers ---------- */
.page-head { padding: 64px 0 40px; }
.page-head.narrow { max-width: 680px; margin: 0 auto; }
.page-head .crumbs { font-size: 14px; color: var(--text-2); margin-bottom: 10px; }
.page-head .crumbs a { color: var(--text-2); }
.page-head h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1.05; letter-spacing: -0.025em; }
.page-head .lede { font-size: clamp(19px, 2vw, 24px); color: var(--text-2); margin-top: 14px; max-width: 46ch; line-height: 1.35; letter-spacing: -0.01em; }

/* ---------- book page ---------- */
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; padding-bottom: 80px; }
.chapters a { aspect-ratio: 1; border-radius: 16px; background: var(--bg-alt); color: var(--text); display: grid; place-items: center; font: 600 21px var(--display); position: relative; }
.chapters a:hover { background: var(--hl); text-decoration: none; color: var(--link); }
.chapters a.has-c::after { content: ""; position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- chapter page ---------- */
.chapter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 0; }
.pager { display: flex; gap: 8px; }
.pager a, .pager span { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-alt); display: grid; place-items: center; color: var(--text); }
.pager a:hover { background: var(--hl); color: var(--link); text-decoration: none; }
.pager span { opacity: 0.35; }
.pager svg { width: 16px; height: 16px; }
.psalm-title { font: italic 19px/1.5 var(--serif); color: var(--text-2); margin: 6px 0 0; }

.reading { padding-bottom: 96px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 56px; }
.reading.with-c .row { grid-template-columns: minmax(0, 640px) minmax(0, 1fr); }
.row + .row { margin-top: 8px; }
.sec-head { font: 600 15px/1.3 var(--sans); color: var(--text-2); margin: 32px 0 10px; letter-spacing: -0.01em; }
.scripture { font: 400 21px/1.75 var(--serif); letter-spacing: -0.003em; margin: 0; }
.reading:not(.with-c) .scripture, .reading:not(.with-c) .sec-head { max-width: 680px; margin-left: auto; margin-right: auto; }
.v { border-radius: 4px; transition: background .25s; }
.v.lit { background: var(--hl); }
.vn { font: 600 11px var(--sans); color: var(--text-3); vertical-align: super; margin: 0 3px 0 2px; letter-spacing: 0; text-decoration: none; }
.wj { color: var(--wj); }
.sc { font-variant: small-caps; letter-spacing: 0.02em; }
.end-note { font: italic 17px/1.6 var(--serif); color: var(--text-2); margin-top: 28px; }
.commentary { padding-top: 32px; }
.c-unit {
  border-left: 2px solid var(--hairline); padding: 2px 0 2px 18px; margin: 0 0 22px; font-size: 15px; line-height: 1.55;
  transition: border-color .25s;
}
.c-unit:hover, .c-unit.lit { border-color: var(--accent); }
.c-unit .c-ref { font: 600 13px var(--sans); color: var(--text-2); display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.c-unit .c-ref a { color: inherit; }
.c-unit p { margin: 0 0 10px; }
.c-unit q, .article q { quotes: none; font-family: var(--serif); font-size: 1.06em; color: var(--text); }
.article p q { display: block; margin: 14px 0 4px; padding-left: 18px; border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.article p q::before { content: "\201C"; } .article p q::after { content: "\201D"; }
.article p q + cite { display: block; padding-left: 20px; margin-bottom: 14px; white-space: normal; }
.c-unit q { display: block; margin: 10px 0 2px; padding-left: 12px; border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); line-height: 1.5; }
.c-unit q::before { content: "\201C"; } .c-unit q::after { content: "\201D"; }
.c-unit q + cite { display: block; padding-left: 14px; margin-bottom: 10px; white-space: normal; }
cite { font-style: normal; color: var(--text-2); font-size: 0.86em; white-space: nowrap; }
cite::before { content: "\2014\00a0"; }
.avatars { display: inline-flex; }
.avatars img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; object-position: top; border: 2px solid var(--bg); margin-left: -6px; }
.avatars img:first-child { margin-left: 0; }
details.c-toggle > summary { display: none; }
@media (max-width: 900px) {
  .reading.with-c .row { grid-template-columns: minmax(0, 1fr); }
  .commentary { padding-top: 6px; }
  details.c-toggle > summary {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 14px; color: var(--link);
    padding: 6px 12px; border-radius: 980px; background: var(--bg-alt); margin: 6px 0 14px;
  }
  details.c-toggle > summary::-webkit-details-marker { display: none; }
  .scripture { font-size: 19px; }
}
@media (min-width: 901px) { details.c-toggle:not([open]) > .c-body { display: block; } }

/* ---------- subject / author articles ---------- */
.article-wrap { display: grid; grid-template-columns: minmax(0, 680px) minmax(0, 1fr); gap: 64px; padding-bottom: 96px; }
.article { font: 400 19px/1.7 var(--serif); letter-spacing: -0.005em; }
.article p { margin: 0 0 1.1em; }
.article h2 { font: 600 28px/1.2 var(--display); margin: 1.8em 0 0.6em; letter-spacing: -0.02em; }
.article .pull { margin: 1.6em 0; padding: 0 0 0 22px; border-left: 3px solid var(--accent); font-size: 22px; line-height: 1.5; }
.article .pull q { font-size: inherit; }
.article .pull cite { display: block; margin-top: 8px; font: 14px var(--sans); }
.aside h3 { font: 600 13px var(--sans); color: var(--text-2); margin: 0 0 12px; letter-spacing: -0.01em; }
.aside .block + .block { margin-top: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 13px; border-radius: 980px; background: var(--bg-alt); color: var(--text); font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.chip:hover { background: var(--hl); color: var(--link); text-decoration: none; }
.chip img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; object-position: top; margin-left: -5px; }
.aside { position: sticky; top: calc(var(--nav-h) + 32px); align-self: start; }
@media (max-width: 900px) { .article-wrap { grid-template-columns: minmax(0, 1fr); } .aside { position: static; } }

.subject-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding-bottom: 96px; }
.subject-card { background: var(--bg-alt); border-radius: 22px; padding: 26px 26px 22px; color: var(--text); display: flex; flex-direction: column; gap: 8px; min-height: 170px; }
.subject-card:hover { text-decoration: none; background: var(--hl); }
.subject-card h2 { font-size: 22px; letter-spacing: -0.015em; }
.subject-card p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.45; }
.subject-card .meta { margin-top: auto; font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 10px; }
.subject-card.thin { min-height: 0; background: none; border: 1px solid var(--hairline); }

.author-hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; align-items: end; padding: 64px 0 48px; }
.author-hero img { width: 220px; height: 260px; border-radius: 28px; object-fit: cover; object-position: top; }
.author-hero .dates { color: var(--text-2); font-size: 21px; margin-top: 8px; }
@media (max-width: 700px) { .author-hero { grid-template-columns: 1fr; gap: 24px; } .author-hero img { width: 160px; height: 190px; } }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; padding-bottom: 96px; }
.person { color: var(--text); }
.person:hover { text-decoration: none; }
.person img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; border-radius: 24px; background: var(--bg-alt); }
.person h2 { font-size: 22px; margin-top: 14px; }
.person p { margin: 4px 0 0; color: var(--text-2); font-size: 15px; }
.credit { font-size: 12px; color: var(--text-3); margin-top: 28px; line-height: 1.5; }
.credit a { color: inherit; text-decoration: underline; }

/* ---------- hover preview ---------- */
.preview {
  position: fixed; z-index: 80; width: min(380px, calc(100vw - 24px)); background: var(--bg-raised); color: var(--text);
  border-radius: 18px; box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--hairline) 70%, transparent);
  padding: 16px 18px; font-size: 15px; line-height: 1.5; pointer-events: auto;
  opacity: 0; transform: translateY(4px) scale(.98); transition: opacity .15s, transform .15s;
}
.preview.on { opacity: 1; transform: none; }
.preview .p-title { font: 600 13px var(--sans); color: var(--text-2); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.preview .p-title img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; object-position: top; }
.preview .p-body { font-family: var(--serif); font-size: 16px; max-height: 220px; overflow: hidden; }
.preview .p-body.sans { font-family: var(--sans); font-size: 15px; }

/* ---------- search (Cmd-K) ---------- */
.search-veil { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.search-box { width: min(680px, 100%); background: var(--bg-raised); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; border: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: 400 21px var(--sans); padding: 20px 22px; letter-spacing: -0.02em; border-bottom: 1px solid var(--hairline); }
.search-results { max-height: 58vh; overflow: auto; padding: 8px; }
.search-results .grp { font: 600 12px var(--sans); color: var(--text-3); padding: 12px 14px 6px; }
.search-results a { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; color: var(--text); }
.search-results a:hover, .search-results a.sel { background: var(--hl); text-decoration: none; }
.search-results a .t { font-weight: 500; }
.search-results a .s { color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results a .tx { display: flex; flex-direction: column; min-width: 0; }
.search-results a img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: top; flex: none; }
.search-results .ico { width: 32px; height: 32px; border-radius: 9px; background: var(--bg-alt); display: grid; place-items: center; flex: none; color: var(--text-2); font: 600 12px var(--sans); }
.search-empty { padding: 28px; text-align: center; color: var(--text-2); }

/* ---------- map ---------- */
body.map-page { background: #000; overflow: hidden; }
#graph { position: fixed; inset: var(--nav-h) 0 0 0; }
.map-legend { position: fixed; left: 22px; bottom: 22px; z-index: 5; color: #f5f5f7; font-size: 13px; background: rgba(29, 29, 31, 0.72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 14px 16px; border-radius: 16px; display: grid; gap: 8px; }
.map-legend span { display: flex; align-items: center; gap: 8px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.map-tip { position: fixed; right: 22px; bottom: 22px; z-index: 5; color: #a1a1a6; font-size: 13px; }

footer.foot { border-top: 1px solid var(--hairline); padding: 28px 0 40px; font-size: 12px; color: var(--text-3); background: var(--bg-alt); }
footer.foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer.foot a { color: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
