/* =========================================================
 *  DARK GRAINY THEME + CURSOR GLOW + INDEX PAGE STYLES
 *  ========================================================= */
@import url('https://cdn.jsdelivr.net/npm/@fontsource/playfair-display@5.0.18/index.css');
@import url('https://cdn.jsdelivr.net/npm/@fontsource/cormorant-garamond@5.0.18/index.css');
@import url('https://cdn.jsdelivr.net/npm/@fontsource/space-grotesk@5.0.18/index.css');

:root {
    --bg-base: #050505;
    --bg-panel: #0f0f0f;
    --border-subtle: #1f1f1f;
    --border-strong: #333333;
    --text-main: #f5f5f5;
    --text-muted: #9e9e9e;
    --text-dark: #666666;
    --accent: #e8b832;
}

/* Base Layout */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: auto; min-height: 100%; font-size: 100%; background-color: var(--bg-base); }
body {
    height: auto;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.35rem;
    line-height: 1.8;
    max-width: 75ch;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--bg-base);
    color: var(--text-main);
    padding: 0 1.5rem 3rem 1.5rem; /* FIXED: Removed top padding so header touches top */
    overflow-wrap: anywhere;
    background-image: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
}

/* =========================================================
 *  THE GRAIN / FILM NOISE OVERLAY
 *  ========================================================= */
body::after {
    content: "";
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none; z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.18; mix-blend-mode: overlay;
}

/* =========================================================
 *  MOUSE CURSOR GLOW
 *  ========================================================= */
#cursor-glow {
    position: fixed; top: 0; left: 0; width: 300px; height: 300px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
    border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%);
    z-index: 10; mix-blend-mode: screen; opacity: 0; transition: opacity 0.5s ease;
}
@media (pointer: fine) { body:hover #cursor-glow { opacity: 0.06; } }

/* =========================================================
 *  MAIN READING PANEL (Chapters)
 *  ========================================================= */
.main {
    min-height: 0; 
    margin-top: 3rem; /* FIXED: Pushes text box down from the header */
    padding: 3rem 4rem;
    background: var(--bg-panel); border: 1px solid var(--border-subtle);
    border-radius: 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

/* Typography */
h1, h2, h3, .mt, .mt1, .mte, .mte1, .mt2, .mte2, .mt3, .mte3 {
    font-family: 'Playfair Display', serif; font-weight: 400; text-align: center; color: var(--accent); margin-bottom: 2rem;
}
h1 { font-size: 2.5rem; }
.chapterlabel { font-family: 'Playfair Display', serif; text-align: center; font-size: 4rem; color: var(--accent); margin-bottom: 2rem; line-height: 1; }
.m { margin-top: 1.5rem; text-align: justify; }
.p, .p1, .pb, .pde, .pdi { text-indent: 2em; margin-top: .5em; }
.p, .nb { display: block; font-size: 1em; }

/* Verse Numbers & Highlights */
.verse { font-family: 'Space Grotesk', sans-serif; font-size: 0.65em; color: var(--accent); font-weight: 600; vertical-align: super; margin-right: 0.5em; line-height: 0; letter-spacing: 0.05em; }
.wj { color: var(--accent); }
.add { font-style: italic; color: var(--text-muted); opacity: 0.8; }

/* Poetry & Indents */
.q, .q1, .q2, .q3 { margin-top: 0pt; }
html[dir=ltr] .q, html[dir=ltr] .q1 { text-indent: -2em; margin-left: 2em; }
html[dir=ltr] .q2 { text-indent: -1em; margin-left: 2em; }
html[dir=ltr] .q3 { text-indent: -1em; margin-left: 3em; }
html[dir=rtl] .q, html[dir=rtl] .q1 { text-indent: -2em; margin-right: 2em; }
html[dir=rtl] .q2 { text-indent: -1em; margin-right: 2em; }
html[dir=rtl] .q3 { text-indent: -1em; margin-right: 3em; }

/* Footnotes & Text */
.f, .x { margin: 1.5rem 0; line-height: 1.6; font-size: 0.9em; color: var(--text-muted); }
.fm, .notemark { vertical-align: super; margin-left: .16em; line-height: 0; position: relative; text-decoration: none; color: var(--accent); }
.copyright { text-align: center; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border-subtle); font-family: 'Space Grotesk', sans-serif; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-dark); }
.copyright a { color: var(--text-dark); text-decoration: none; transition: color 0.3s ease; }
.copyright a:hover { color: var(--accent); }

/* Chapter Navigation (Top/Bottom) */
ul.tnav {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    list-style-type: none; padding: 0; margin: 0 0 2rem 0; width: 100%; max-width: 75ch; margin-left: auto; margin-right: auto;
}
ul.tnav:last-of-type { margin: 3rem auto 0 auto; padding-top: 2rem; border-top: 1px solid var(--border-subtle); }
.tnav li { display: inline; }
.tnav a {
    display: inline-block; border: 1px solid var(--border-subtle); padding: 0.6rem 1.2rem; background-color: transparent;
    text-decoration: none; color: var(--text-muted); border-radius: 50px; font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.15em; transition: all 0.3s ease;
}
.tnav a:hover { color: var(--accent); border-color: var(--accent); background-color: rgba(232, 184, 50, 0.05); }

/* =========================================================
 *  INDEX PAGE (Book List) STYLES
 *  ========================================================= */
body.bklist {
    max-width: 1200px; /* Widen the layout for the grid */
}

body.bklist h1 {
    margin-bottom: 3rem;
    font-size: 3rem;
    letter-spacing: -0.02em;
}

body.bklist h1 a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

body.bklist h1 a:hover {
    color: var(--text-main);
}

.bookList {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

ul.vnav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem;
}

.vnav li { margin: 0; }

.vnav a {
    display: block;
    padding: 0.8rem 1.2rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    border-left: 2px solid var(--border-strong);
}

/* Highlight New Testament books with the gold accent */
.vnav a.nn {
    border-left: 2px solid var(--accent);
}

.vnav a:hover {
    background: var(--bg-base);
    color: var(--accent);
    border-color: var(--border-subtle);
    border-left-color: var(--accent);
    transform: translateX(4px);
}

/* Fix for the copyright link at the bottom of the book list */
ul.vnav li:last-child {
    grid-column: 1 / -1; /* Makes it span all columns in the grid */
    margin-top: 2rem;    /* Adds space above it */
    padding-top: 2rem;   /* Adds space above the text */
    border-top: 1px solid var(--border-subtle); /* Adds a nice separator line */
}

ul.vnav li:last-child a {
    border-left: none !important; /* Removes the gold border */
    padding: 0 !important;        /* Removes the button padding */
    text-align: center;           /* Centers the text */
    color: var(--text-dark) !important;
    font-size: 0.75rem;
}

ul.vnav li:last-child a:hover {
    background: transparent !important;
    transform: none !important;   /* Stops it from sliding to the right on hover */
    color: var(--accent) !important;
}

.mainindex {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 3rem;
}

.toc, .toc1 {
    margin-bottom: 1rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.toc a, .toc1 a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
    margin: 0 0.3rem;
}

.toc a:hover, .toc1 a:hover {
    color: var(--text-main);
    text-decoration: underline;
}

/* FIXED: Cleaned up the corrupted .fine block */
.fine {
    margin-top: 4rem;
    font-size: 0.7rem;
    color: var(--text-dark);
    text-align: center;
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: 0.05em;
}
.fine a { color: var(--text-dark); text-decoration: underline; transition: color 0.3s; }
.fine a:hover { color: var(--text-muted); }

/* Image handling */
img, svg, video { max-width: 100%; height: auto; }

@media (max-width: 600px) {
    body { padding: 0 1rem 2rem 1rem; font-size: 1.15rem; }
    .main { padding: 2rem 1.5rem; margin-top: 2rem; }
    .chapterlabel { font-size: 3rem; }
    ul.tnav { flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
    .tnav a { padding: 0.4rem 0.8rem; font-size: 0.65rem; }

    body.bklist h1 { font-size: 2.2rem; }
    .bookList { padding: 1.5rem; }
    ul.vnav { grid-template-columns: 1fr; }
    .vnav a { padding: 0.6rem 1rem; }
}

/* =========================================================
   MAIN SITE HEADER (Injected)
   ========================================================= */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100vw;
    /* Breaks out of the max-width of the body to span the whole screen */
    margin-left: calc(-50vw + 50%);
    background: rgba(5, 5, 5, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 3rem;
    margin-bottom: 3rem;
    box-sizing: border-box;
}

.site-header .logo {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-header .logo:hover {
    color: var(--accent);
}

.site-nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav-links a {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: color 0.3s ease;
}

.site-nav-links a:hover {
    color: var(--text-main);
}

@media (max-width: 600px) {
    .site-header {
        padding: 1rem 1.5rem;
        flex-direction: column;
        gap: 1rem;
    }
}