/* The Great Awakening - Bryed Billerbeck
   Archival presentation of the original 282-slide deck. */

:root {
    --ink:        #1b1a17;
    --ink-soft:   #4a4741;
    --ink-faint:  #78736a;
    --paper:      #f7f4ed;
    --paper-2:    #fffdf8;
    --rule:       #ddd6c7;
    --rule-soft:  #eae4d6;
    --navy:       #14202e;
    --navy-2:     #1d2d40;
    --gold:       #b3872f;
    --gold-soft:  #d9b769;
    --red:        #8c2f22;

    --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
    --sans:  system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --wrap: 62rem;
    --shadow: 0 1px 2px rgba(20,32,46,.06), 0 6px 18px rgba(20,32,46,.06);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a { color: #1c4f7c; }
a:hover { color: var(--red); }

img { max-width: 100%; height: auto; display: block; }

.skip {
    position: absolute; left: -9999px;
    background: var(--navy); color: #fff; padding: .6rem 1rem; z-index: 200;
}
.skip:focus { left: 1rem; top: .5rem; }

/* ---------- top bar ---------- */

.topbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--navy);
    box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 2px 14px rgba(0,0,0,.28);
}
.topbar-inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: .7rem 1.25rem;
    display: flex; align-items: center; gap: 1.5rem;
}
.brand {
    display: flex; align-items: center; gap: .6rem;
    color: #fff; text-decoration: none; font-family: var(--sans);
    font-weight: 600; letter-spacing: .01em;
}
.brand:hover { color: #fff; }
.brand-mark {
    display: inline-grid; place-items: center;
    width: 2rem; height: 2rem; flex: 0 0 auto;
    border: 1px solid var(--gold); color: var(--gold-soft);
    font-size: .7rem; font-weight: 700; letter-spacing: .04em;
}
.brand-text { font-size: 1rem; }

.topnav { margin-left: auto; display: flex; gap: 1.4rem; font-family: var(--sans); font-size: .88rem; }
.topnav a {
    color: #cfd7e0; text-decoration: none; padding: .25rem 0;
    border-bottom: 1px solid transparent;
}
.topnav a:hover { color: #fff; border-bottom-color: var(--gold); }

.nav-toggle {
    display: none; margin-left: auto;
    background: none; border: 0; cursor: pointer; padding: .4rem;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: #cfd7e0; margin: 4px 0; }

.progress { height: 2px; background: var(--gold); width: 0; transition: width .1s linear; }

/* ---------- hero ---------- */

.hero {
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
    color: #f2ede2;
    padding: 4.5rem 1.25rem 3.5rem;
    text-align: center;
}
.hero-inner { max-width: 46rem; margin: 0 auto; }
.hero h1 {
    font-size: clamp(2.4rem, 6vw, 3.9rem);
    line-height: 1.05; margin: 0 0 .6rem;
    letter-spacing: -.01em;
}
.hero .kicker {
    font-family: var(--sans); font-size: .78rem; letter-spacing: .22em;
    text-transform: uppercase; color: var(--gold-soft); margin: 0 0 1.4rem;
}
.hero .byline { font-size: 1.15rem; color: #d9d2c4; margin: 0 0 .2rem; }
.hero .dateline { font-family: var(--sans); font-size: .82rem; color: #9aa5b1; margin: 0; }

.hero-verses {
    margin: 2.5rem auto 0; max-width: 40rem;
    border-top: 1px solid rgba(217,183,105,.3);
    padding-top: 1.5rem;
    font-size: .98rem; font-style: italic; color: #cdc6b8;
}
.hero-verses p { margin: .5rem 0; }

.hero-cta {
    margin-top: 2.5rem; display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap;
}
.btn {
    font-family: var(--sans); font-size: .85rem; letter-spacing: .02em;
    padding: .7rem 1.4rem; text-decoration: none; border: 1px solid var(--gold);
    color: var(--gold-soft); background: transparent; cursor: pointer;
}
.btn:hover { background: var(--gold); color: var(--navy); }
.btn-solid { background: var(--gold); color: var(--navy); }
.btn-solid:hover { background: var(--gold-soft); color: var(--navy); }

/* ---------- generic sections ---------- */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

.band { padding: 3.5rem 0; }
.band-alt { background: var(--paper-2); border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); }

.band h2 {
    font-size: 1.9rem; margin: 0 0 1.2rem; line-height: 1.2;
}
.eyebrow {
    font-family: var(--sans); font-size: .72rem; letter-spacing: .2em;
    text-transform: uppercase; color: var(--gold); margin: 0 0 .5rem;
}

.prose p { margin: 0 0 1.1rem; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- table of contents ---------- */

.toc-list {
    list-style: none; margin: 0; padding: 0;
    counter-reset: toc;
    columns: 2; column-gap: 2.5rem;
}
.toc-list li {
    break-inside: avoid;
    margin: 0 0 .1rem;
    font-size: .95rem;
}
.toc-list li:not(.toc-part) { counter-increment: toc; }
.toc-list a {
    display: flex; gap: .7rem; align-items: baseline;
    text-decoration: none; color: var(--ink-soft);
    padding: .35rem .5rem .35rem 0;
    border-bottom: 1px solid transparent;
}
.toc-list a:hover { color: var(--red); border-bottom-color: var(--rule); }
.toc-list a::before {
    content: counter(toc, decimal-leading-zero);
    font-family: var(--sans); font-size: .7rem; color: var(--gold);
    flex: 0 0 1.6rem;
}
.toc-list .toc-part {
    margin: .7rem 0 .15rem;
    break-after: avoid-column;
}
.toc-list .toc-part a {
    color: var(--navy);
    font-size: 1.08rem;
    font-weight: 700;
    padding-top: .45rem;
}
.toc-list .toc-part a::before { content: none; }
.toc-list .toc-section-heading span {
    display: block;
    color: var(--navy);
    font-size: 1.15rem;
    font-weight: 700;
    padding: .45rem .5rem .2rem 0;
}
.toc-list .toc-subheading {
    margin: .15rem 0 .1rem;
}
.toc-list .toc-subheading span {
    display: block;
    color: var(--ink-soft);
    font-size: 1rem;
    font-weight: 700;
    padding: .2rem .5rem .2rem 1rem;
}
.toc-list .toc-subitem {
    margin-left: 1rem;
}
.toc-list .toc-subsubheading {
    margin: .15rem 0 .1rem 2rem;
}
.toc-list .toc-subsubheading span {
    display: block;
    color: var(--ink-soft);
    font-size: .95rem;
    font-weight: 700;
    padding: .2rem .5rem;
}
.toc-list .toc-subsubitem {
    margin-left: 3rem;
}
.toc-list .toc-placeholder {
    margin: 0 0 .1rem 1rem;
}
.toc-list .toc-placeholder span {
    display: block;
    color: var(--ink-faint);
    padding: .35rem .5rem .35rem 2.3rem;
}
.toc-note {
    font-family: var(--sans); font-size: .82rem; color: var(--ink-faint);
    margin: 1.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--rule-soft);
}

/* ---------- the chapters ---------- */

.chapters { padding-bottom: 4rem; }

.chapter {
    border-top: 1px solid var(--rule);
    background: var(--paper);
}
.chapter[open] { background: var(--paper-2); }

.chapter > summary {
    list-style: none; cursor: pointer;
    padding: 1.5rem 1.25rem;
    display: flex; align-items: baseline; gap: 1rem;
    transition: background .12s ease;
}
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary:hover { background: #f0ebe0; }
.chapter[open] > summary { border-bottom: 1px solid var(--rule-soft); }

.ch-num {
    font-family: var(--sans); font-size: .72rem; font-weight: 600;
    color: var(--gold); flex: 0 0 2.2rem; letter-spacing: .04em;
}
.ch-title { font-size: 1.32rem; line-height: 1.25; flex: 1 1 auto; margin: 0; }
.ch-meta {
    font-family: var(--sans); font-size: .72rem; color: var(--ink-faint);
    flex: 0 0 auto; white-space: nowrap;
}
.ch-caret {
    flex: 0 0 auto; color: var(--ink-faint); font-size: .8rem;
    transition: transform .15s ease;
}
.chapter[open] .ch-caret { transform: rotate(90deg); }

.ch-body { padding: 1.75rem 1.25rem 2.5rem; }

/* ---------- slides ---------- */

.slide {
    margin: 0 0 2.5rem;
    padding: 0 0 2rem;
    border-bottom: 1px dashed var(--rule-soft);
}
.slide:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }

.slide-num {
    font-family: var(--sans); font-size: .68rem; letter-spacing: .12em;
    text-transform: uppercase; color: var(--ink-faint);
    margin: 0 0 .6rem;
}
.slide h3 {
    font-size: 1.12rem; line-height: 1.35; margin: 0 0 .9rem;
    color: var(--navy);
}
.slide-text p { margin: 0 0 .85rem; }
.slide-text p:last-child { margin-bottom: 0; }

.verse {
    border-left: 3px solid var(--gold-soft);
    padding-left: 1rem; font-style: italic; color: var(--ink-soft);
}

/* images */
.shots {
    display: grid; gap: 1rem; margin: 1.25rem 0;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}
.shot {
    background: #fff; border: 1px solid var(--rule);
    padding: .5rem; box-shadow: var(--shadow);
}
.shot img { width: 100%; }
.shot figcaption {
    font-family: var(--sans); font-size: .68rem; color: var(--ink-faint);
    margin-top: .45rem; word-break: break-word;
}
.shots-1 { grid-template-columns: minmax(0, 34rem); }

.ocr {
    margin-top: .5rem; font-family: var(--sans); font-size: .74rem;
    color: var(--ink-soft);
}
.ocr summary { cursor: pointer; color: var(--ink-faint); }
.ocr summary:hover { color: var(--red); }
.ocr pre {
    white-space: pre-wrap; word-break: break-word;
    background: #faf7f0; border: 1px solid var(--rule-soft);
    padding: .6rem; margin: .5rem 0 0; font-size: .72rem; line-height: 1.5;
}

/* links */
.slide-links {
    margin: 1.25rem 0 0; padding: .9rem 1rem;
    background: #f2eee4; border: 1px solid var(--rule-soft);
    font-family: var(--sans); font-size: .78rem;
}
.slide-links p {
    margin: 0 0 .4rem; font-weight: 600; color: var(--ink-faint);
    text-transform: uppercase; letter-spacing: .1em; font-size: .68rem;
}
.slide-links ul { margin: 0; padding-left: 1.1rem; }
.slide-links li { margin: .2rem 0; word-break: break-all; }

.video-note {
    font-family: var(--sans); font-size: .78rem; color: var(--red);
    border: 1px dashed var(--red); padding: .5rem .75rem; margin: 1rem 0;
    display: inline-block;
}

/* ---------- chapter footer nav ---------- */

.ch-next {
    margin-top: 2.5rem; padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap;
    font-family: var(--sans); font-size: .85rem;
}
.ch-next .next-label {
    display: block; font-size: .68rem; letter-spacing: .14em;
    text-transform: uppercase; color: var(--ink-faint); margin-bottom: .2rem;
}
.ch-next a { text-decoration: none; font-weight: 600; }
.ch-next .to-top { color: var(--ink-faint); font-weight: 400; }

/* ---------- sources ---------- */

.src-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
    margin-top: 1.5rem;
}
.src-card {
    background: var(--paper-2); border: 1px solid var(--rule);
    padding: 1rem; font-family: var(--sans);
}
.src-card .n { font-size: 1.6rem; color: var(--navy); display: block; line-height: 1; }
.src-card .d { font-size: .8rem; color: var(--ink-faint); margin-top: .3rem; display: block; word-break: break-all; }

/* ---------- footer ---------- */

.sitefoot {
    background: var(--navy); color: #9aa5b1;
    padding: 3rem 1.25rem; text-align: center;
    font-family: var(--sans); font-size: .84rem;
}
.sitefoot p { margin: .35rem 0; }
.foot-title { color: #f2ede2; font-family: var(--serif); font-size: 1.2rem; margin-bottom: .6rem; }
.foot-note { max-width: 34rem; margin: 1.2rem auto 0; font-size: .76rem; color: #78838f; line-height: 1.6; }
.foot-top { margin-top: 1.5rem; }
.sitefoot a { color: var(--gold-soft); text-decoration: none; }
.sitefoot a:hover { color: #fff; }

/* ---------- responsive ---------- */

@media (max-width: 46rem) {
    body { font-size: 17px; }
    .toc-list { columns: 1; }
    .topnav {
        display: none; position: absolute; top: 100%; left: 0; right: 0;
        background: var(--navy-2); flex-direction: column; gap: 0; padding: .5rem 1.25rem 1rem;
    }
    .topnav.open { display: flex; }
    .topnav a { padding: .6rem 0; border-bottom: 1px solid rgba(255,255,255,.07); }
    .nav-toggle { display: block; }
    .brand-text { font-size: .9rem; }
    .chapter > summary { padding: 1.2rem .75rem; gap: .6rem; flex-wrap: wrap; }
    .ch-meta { flex-basis: 100%; padding-left: 2.8rem; }
    .ch-body { padding: 1.25rem .75rem 2rem; }
    .hero { padding: 3rem 1.25rem 2.5rem; }
}

@media print {
    .topbar, .sitefoot, .hero-cta, .ch-next { display: none; }
    .chapter { border: 0; }
    .ch-body { display: block !important; }
    details { open: true; }
}

/* ---------------------------------------------------------------------------
   Standalone pages (input/*.md)

   The deck's sections carry their own markup (.chapter/.slide/.verse) and are
   styled above. Pages dropped in input/ are plain Markdown, so bare h2-h6 / p
   / a land straight in <main> and match nothing. These rules give them the
   same voice. _Layout wraps them in .band > .wrap.page.
   --------------------------------------------------------------------------- */
.page-title {
    font-size: 2.25rem; line-height: 1.15; color: var(--navy);
    margin: 0 0 1.5rem;
}
.page h2 {
    font-size: 1.55rem; line-height: 1.25; color: var(--navy);
    margin: 2.5rem 0 1rem; padding-bottom: .4rem;
    border-bottom: 1px solid var(--rule);
}
.page h3 {
    font-size: 1.16rem; line-height: 1.3; color: var(--navy);
    margin: 1.9rem 0 .6rem;
}
.page h4 {
    font-size: 1.02rem; line-height: 1.3; color: var(--navy);
    margin: 1.5rem 0 .5rem;
}
.page h5, .page h6 {
    font-family: var(--sans); font-size: .84rem; letter-spacing: .03em;
    color: var(--ink-soft); margin: 1.2rem 0 .4rem;
}
.page p { margin: 0 0 1.05rem; }
.page em { color: var(--ink-soft); }

/* Document links: 93 of them across two pages, so make them scannable. */
.page a[href^="/assets/docs/"] {
    display: inline-block; text-decoration: none;
    font-family: var(--sans); font-size: .92rem; font-weight: 600;
    color: var(--navy); background: var(--paper-2);
    border: 1px solid var(--rule); border-left: 3px solid var(--gold);
    border-radius: 3px; padding: .55rem .85rem;
    box-shadow: var(--shadow);
}
.page a[href^="/assets/docs/"]::before {
    content: "PDF"; font-family: var(--sans); font-size: .62rem;
    letter-spacing: .1em; color: var(--gold); margin-right: .6rem;
}
.page a[href^="/assets/docs/"]:hover {
    border-left-color: var(--red); color: var(--red);
}
.page a[href^="/assets/docs/"]:hover::before { color: var(--red); }

@media (max-width: 640px) {
    .page-title { font-size: 1.75rem; }
    .page h2 { font-size: 1.3rem; }
    .page a[href^="/assets/docs/"] { display: block; }
}

/* Document modal (site.js). Native <dialog>, so Esc and focus trapping are free. */
.pdfmodal {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: rgba(20, 32, 46, .62);
}
.pdfmodal[hidden] { display: none; }
.pdfmodal-panel {
    /* wide on purpose: Chrome's thumbnail rail is a fixed pixel width, so the
       more width the panel has, the smaller a share of it the rail occupies */
    width: min(1500px, 96vw); height: 94vh;
    background: var(--paper-2); border-radius: 4px;
    box-shadow: 0 10px 50px rgba(20, 32, 46, .35);
    display: flex; flex-direction: column; overflow: hidden;
}
.pdfmodal-head {
    flex: 0 0 auto; display: flex; align-items: center; gap: 1rem;
    padding: .7rem .9rem; background: var(--paper);
    border-bottom: 1px solid var(--rule);
}
.pdfmodal-title {
    flex: 1 1 auto; min-width: 0;
    font-family: var(--sans); font-size: .95rem; font-weight: 600; color: var(--navy);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pdfmodal-actions { flex: 0 0 auto; display: flex; align-items: center; gap: .9rem; }
.pdfmodal-act {
    font-family: var(--sans); font-size: .8rem; color: var(--ink-soft);
    text-decoration: none; border-bottom: 1px solid var(--rule);
}
.pdfmodal-act:hover { color: var(--red); border-bottom-color: var(--red); }
.pdfmodal-x {
    border: 0; background: none; cursor: pointer; padding: 0 .2rem;
    font-size: 1.5rem; line-height: 1; color: var(--ink-faint);
}
.pdfmodal-x:hover { color: var(--red); }
.pdfmodal-load {
    margin: 0; padding: 1rem .9rem 0;
    font-family: var(--sans); font-size: .85rem; color: var(--ink-faint);
}
.pdfmodal-frame { flex: 1 1 auto; width: 100%; border: 0; }

/* Close control: form[method=dialog] closes natively, so give it a real target. */
.pdfmodal-closeform { margin: 0; display: flex; }  /* unused since the <dialog> swap */
.pdfmodal-x {
    display: flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; padding: 0;
    border: 1px solid var(--rule); border-radius: 3px;
    background: var(--paper-2); cursor: pointer;
    font-size: 1.35rem; line-height: 1; color: var(--ink-soft);
}
.pdfmodal-x:hover { color: var(--red); border-color: var(--red); }
.pdfmodal-x:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* External links that stand alone on the standalone pages. Same family as the
   document chips but grey rather than gold, so PDF vs. offsite reads at a glance.
   The class is applied by site.js -- the markdown stays a plain bare link. */
.page a.linkcard {
    display: inline-block; text-decoration: none;
    font-family: var(--sans); font-size: .92rem; font-weight: 600;
    color: var(--navy); background: var(--paper);
    border: 1px solid var(--rule); border-left: 3px solid var(--ink-faint);
    border-radius: 3px; padding: .55rem .85rem;
}
.page a.linkcard::before {
    content: "LINK"; font-family: var(--sans); font-size: .62rem;
    letter-spacing: .1em; color: var(--ink-faint); margin-right: .6rem;
}
.page a.linkcard:hover { border-left-color: var(--red); color: var(--red); }
.page a.linkcard:hover::before { color: var(--red); }
