/*
=========================================================================
ASSEMBLIES OF CHRIST — UNIFIED STUDY-PAGE DESIGN
=========================================================================
These rules give long-form Bible studies the same parchment, navy, muted-gold,
and editorial typography used by the homepage while preserving every article,
quotation, table, link, and table of contents.
*/

:root {
    --study-body-font-size: 1.045rem;
    --study-body-line-height: 1.86;
    --study-reading-width: 48rem;
    --study-quote-indent: clamp(.15rem, 1.5vw, 1rem);
}

html { scroll-padding-top: 7rem; }

/* Page foundation */
.study-detail-page {
    background: var(--home-paper);
    color: var(--home-ink);
}

.study-detail-page .home-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

/* Quiet editorial hero */
.study-hero {
    position: relative;
    overflow: hidden;
    padding: 72px 0 70px;
    background:
        radial-gradient(circle at 86% 18%, rgba(183,121,18,.085), transparent 23rem),
        linear-gradient(110deg, var(--home-paper) 0%, var(--home-paper) 62%, var(--home-paper-warm) 100%);
    border-bottom: 1px solid var(--home-line);
}

.study-hero::after {
    content: "";
    position: absolute;
    right: -6rem;
    bottom: -11rem;
    width: 26rem;
    height: 26rem;
    border: 1px solid rgba(183,121,18,.11);
    border-radius: 50%;
    pointer-events: none;
}

.study-hero-inner { position: relative; z-index: 1; max-width: 920px; }
.study-back-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 28px;
    color: var(--home-gold-dark) !important;
    font-family: Georgia, serif;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .055em;
    text-decoration: none;
    text-transform: uppercase;
}
.study-back-link:hover, .study-back-link:focus-visible { color: var(--home-navy) !important; }
.study-kicker {
    display: block;
    margin-bottom: 12px;
    color: var(--home-gold-dark);
    font-family: Georgia, serif;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.study-hero h1 {
    max-width: 900px;
    margin: 0;
    color: var(--home-navy);
    font-family: var(--home-serif);
    font-size: clamp(3rem, 6vw, 5.2rem);
    font-weight: 600;
    letter-spacing: -.028em;
    line-height: .98;
    text-wrap: balance;
}
.study-title-rule { display: block; width: 42px; height: 2px; margin: 28px 0 23px; background: var(--home-gold); }
.study-hero p {
    max-width: 710px;
    margin: 0;
    color: #4e5b66;
    font-family: Georgia, serif;
    font-size: 1.08rem;
    line-height: 1.78;
}

/* Reading area */
.study-detail-main { padding: 64px 0 76px; background: var(--home-paper); }
.study-detail-shell { max-width: 1180px; }
.article-browser-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    min-width: 0;
    align-items: start;
}
.article-card {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    padding: clamp(28px, 4vw, 58px);
    background: rgba(255,253,248,.82);
    border: 1px solid var(--home-line);
    border-radius: 2px;
    box-shadow: 0 18px 44px rgba(35,45,55,.055);
}

.article-content {
    max-width: var(--study-reading-width);
    min-width: 0;
    margin-inline: auto;
    color: #37434d;
    font-family: Merriweather, Georgia, serif;
    font-size: var(--study-body-font-size);
    line-height: var(--study-body-line-height);
    overflow-wrap: anywhere;
}
.article-content > * { min-width: 0; max-width: 100%; }
.article-content > * + * { margin-top: 1.2rem; }
.article-content p { margin-top: 1.05rem; }
.article-content p, .article-content li, .article-content blockquote, .article-content a { overflow-wrap: anywhere; word-break: break-word; }
.article-content img, .article-content svg, .article-content video, .article-content iframe { max-width: 100%; height: auto; }

/* Editorial headings */
.article-content h2 {
    position: relative;
    margin-top: 4.35rem;
    padding: 0 0 1rem;
    color: var(--home-navy);
    border-bottom: 1px solid var(--home-line);
    font-family: var(--home-serif);
    font-size: clamp(2.05rem, 4vw, 3rem);
    font-weight: 600;
    letter-spacing: -.018em;
    line-height: 1.05;
    text-wrap: balance;
}
.article-content h2:first-child { margin-top: 0; }
.article-content h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 44px;
    height: 2px;
    background: var(--home-gold);
}
.article-content h3 {
    margin-top: 2.8rem;
    color: var(--home-navy-soft);
    font-family: var(--home-serif);
    font-size: clamp(1.52rem, 2.8vw, 2rem);
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1.2;
}
.article-content strong { color: var(--home-navy); font-weight: 700; }
.article-content u { text-decoration-color: rgba(183,121,18,.48); text-underline-offset: .17em; }
.article-content a {
    color: var(--home-gold-dark);
    text-decoration-color: rgba(142,93,11,.45);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.article-content a:hover, .article-content a:focus-visible { color: var(--home-navy); }

/* Scripture and source quotations */
.article-content .scripture-quote {
    margin: 1.65rem var(--study-quote-indent);
    padding: 1.15rem clamp(1.05rem, 2.4vw, 1.45rem);
    border: 1px solid #eadfc9;
    border-left: 3px solid var(--home-gold);
    border-radius: 1px;
    background: var(--home-paper-warm);
    box-shadow: 0 8px 22px rgba(35,45,55,.025);
    font-family: Georgia, serif;
    font-size: .98rem;
    line-height: 1.78;
    text-wrap: pretty;
}
.article-content .scripture-quote p { margin: 0; color: #46525c; font-style: normal; line-height: inherit; }
.article-content .source-quote {
    margin: 1.55rem var(--study-quote-indent);
    padding: 1rem 1.15rem;
    border-left: 2px solid #c9b68f;
    background: rgba(247,243,234,.58);
    color: #53606a;
    font-size: .95rem;
    line-height: 1.72;
}

/* Lists and utility links */
.article-content ol, .article-content ul { margin-top: 1rem; padding-left: 1.55rem; }
.article-content ol { list-style: decimal; }
.article-content ul { list-style: disc; }
.article-content li { margin-top: .62rem; padding-left: .22rem; }
.article-content li::marker { color: var(--home-gold-dark); font-weight: 700; }
.back-to-top { margin-top: 1.8rem !important; text-align: right; font-family: Inter, system-ui, sans-serif; font-size: .74rem; letter-spacing: .035em; text-transform: uppercase; }
.back-to-top a { color: var(--home-gold-dark); font-weight: 700; text-decoration: none; }

/* Tables */
.table-scroll {
    width: 100%;
    max-width: 100%;
    margin: 1.75rem 0;
    overflow-x: auto;
    border: 1px solid var(--home-line);
    border-radius: 2px;
    background: var(--home-surface);
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}
.study-table { width: 100%; min-width: 760px; border-collapse: collapse; background: var(--home-surface); font-family: Inter, system-ui, sans-serif; font-size: .9rem; }
.study-table th, .study-table td { padding: .78rem .8rem; border: 1px solid var(--home-line); text-align: center; vertical-align: middle; }
.study-table th { background: var(--home-navy); color: #fffdf8; font-weight: 600; }
.study-table tbody tr:nth-child(even) { background: var(--home-paper-warm); }
.study-table td:first-child, .study-table th:first-child { text-align: left; font-weight: 600; }

/* Contents panels */
.toc-list { list-style: decimal; padding-left: 1.35rem; }
.toc-list > li { margin: .72rem 0; padding-left: .18rem; }
.toc-list ol { margin-top: .4rem; padding-left: 1.35rem; list-style: lower-alpha; }
.toc-list ol li { margin: .34rem 0; }
.toc-list li::marker { color: var(--home-gold-dark); font-weight: 700; }
.toc-list a { color: #53616c; text-decoration: none; }
.toc-list a:hover, .toc-list a:focus-visible { color: var(--home-gold-dark); text-decoration: underline; text-underline-offset: 3px; }
.study-toc-nav { max-height: 68vh; overflow-y: auto; padding-right: .35rem; font-family: Georgia, serif; font-size: .84rem; line-height: 1.58; scrollbar-width: thin; scrollbar-color: #c9b68f transparent; }
.study-mobile-toc {
    display: block;
    min-width: 0;
    margin-bottom: 26px;
    overflow: hidden;
    background: var(--home-paper-warm);
    border: 1px solid var(--home-line);
    border-radius: 2px;
}
.study-mobile-toc summary {
    cursor: pointer;
    list-style: none;
    padding: 17px 20px;
    color: var(--home-navy);
    font-family: var(--home-serif);
    font-size: 1.22rem;
    font-weight: 600;
}
.study-mobile-toc summary::-webkit-details-marker { display: none; }
.study-mobile-toc summary::after { content: "+"; float: right; color: var(--home-gold-dark); font-family: Inter, sans-serif; font-size: 1.15rem; }
.study-mobile-toc[open] summary::after { content: "−"; }
.study-mobile-toc-body { padding: 16px 20px 20px; border-top: 1px solid var(--home-line); }
.desktop-toc { display: none; min-width: 0; }
.study-toc-card { padding: 25px 23px; background: var(--home-paper-warm); border: 1px solid var(--home-line); border-top: 3px solid var(--home-gold); box-shadow: 0 12px 30px rgba(35,45,55,.045); }
.study-toc-card h2 { margin: 0 0 16px; color: var(--home-navy); font-family: var(--home-serif); font-size: 1.42rem; font-weight: 600; line-height: 1.1; }

/* Under-article navigation */
.study-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 36px;
    padding-top: 26px;
    border-top: 1px solid var(--home-line);
}
.study-bottom-link {
    color: var(--home-gold-dark) !important;
    font-family: Georgia, serif;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-decoration: none;
    text-transform: uppercase;
}
.study-bottom-link:hover, .study-bottom-link:focus-visible { color: var(--home-navy) !important; }
.study-footer { margin-top: 0; }

/* Responsive layout */
@media (min-width: 1024px) {
    .article-browser-grid { grid-template-columns: minmax(0, 1fr) 18rem; gap: 38px; }
    .mobile-toc { display: none; }
    .desktop-toc { display: block; position: sticky; top: 8.25rem; }
}

@media (max-width: 760px) {
    .study-hero { padding: 54px 0 52px; }
    .study-hero h1 { font-size: clamp(2.75rem, 13vw, 4rem); }
    .study-detail-main { padding: 34px 0 54px; }
    .article-card { padding: 26px 20px 34px; }
    .article-content { font-size: 1rem; line-height: 1.78; }
    .article-content h2 { margin-top: 3.45rem; font-size: clamp(1.9rem, 9vw, 2.5rem); }
    .article-content h3 { margin-top: 2.35rem; font-size: clamp(1.45rem, 7vw, 1.85rem); }
    .article-content .scripture-quote, .article-content .source-quote { margin-inline: 0; }
    .study-bottom-nav { align-items: flex-start; flex-direction: column; }
}

/* Print */
@media print {
    .home-header, .study-hero, .home-footer, .back-to-studies, .back-to-top,
    .mobile-toc, .desktop-toc, .study-bottom-nav { display: none !important; }
    body, .study-detail-main, .article-card { background: white !important; }
    .study-detail-main { padding: 0; }
    .article-card { padding: 0; border: 0; box-shadow: none; }
    .article-content { max-width: none; color: black; }
    .article-content h2 { break-after: avoid; }
    .table-scroll { overflow: visible; }
    .study-table { min-width: 0; font-size: .75rem; }
}
