/* 
 * GENERIC TEMPLATE STYLESHEET
 * ---------------------------
 * This CSS file defines the design system for the template.
 */

/* --------------------------- CSS Design System ------------------------------ */
:root {
    --font-base: 18px;
    --font-scale: 1;
    --border-radius: 12px;
    --transition-speed: 0.3s;
    --font-title: 'Gabriela', serif;
    --font-body: 'Lato', sans-serif;
    --max-width: 900px;
}

/* --------------------------- Theme Definitions ------------------------------ */

/* --- DARK THEMES --- */
body.theme-dark-auburn {
    --bg-color: #2a0a0a;
    --text-color: #fce4ec;
    --primary: #ff5252;
    --secondary: #4a0d0d;
    --accent: #ff8a80;
    --link-color: #ffb3b3;
    --shadow: rgba(0, 0, 0, 0.6);
}

body.theme-dark-art-deco {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --primary: #d4af37;
    --secondary: #1e1e1e;
    --accent: #f7e7ce;
    --link-color: #fdd835;
    --shadow: rgba(0, 0, 0, 0.8);
}

body.theme-dark-midnight {
    --bg-color: #0d1b2a;
    --text-color: #e0f1f8;
    --primary: #38bdf8;
    --secondary: #1b263b;
    --accent: #7dd3fc;
    --link-color: #7dd3fc;
    --shadow: rgba(0, 0, 0, 0.5);
}

body.theme-dark-acid {
    --bg-color: #050505;
    --text-color: #eaffea;
    --primary: #39ff14;
    --secondary: #1a1a1a;
    --accent: #baffba;
    --link-color: #76ff03;
    --shadow: rgba(0, 255, 0, 0.2);
}

body.theme-dark-vaporwave {
    --bg-color: #1a0b2e;
    --text-color: #ffdef9;
    --primary: #ff00ff;
    --secondary: #3b1e56;
    --accent: #00ffff;
    --link-color: #ea80fc;
    --shadow: rgba(128, 0, 255, 0.4);
}

body.theme-dark-boreal {
    --bg-color: #002b36;
    --text-color: #e0f2f1;
    --primary: #26a69a;
    --secondary: #004d40;
    --accent: #80cbc4;
    --link-color: #4db6ac;
    --shadow: rgba(0, 0, 0, 0.5);
}

body.theme-dark-neon {
    --bg-color: #000000;
    --text-color: #ccfffa;
    --primary: #00e5ff;
    --secondary: #111111;
    --accent: #e040fb;
    --link-color: #18ffff;
    --shadow: rgba(0, 255, 255, 0.3);
}

/* --- LIGHT THEMES --- */
body.theme-light-creme {
    --bg-color: #fdfbf7;
    --text-color: #3e3b32;
    --primary: #c5a059;
    --secondary: #f2efe6;
    --accent: #e0d5b7;
    --link-color: #8a6a2e;
    --shadow: rgba(0, 0, 0, 0.08);
}

body.theme-light-ink {
    --bg-color: #ffffff;
    --text-color: #212121;
    --primary: #000000;
    --secondary: #f0f0f0;
    --accent: #616161;
    --link-color: #d32f2f;
    --shadow: rgba(0, 0, 0, 0.1);
}

body.theme-light-forest {
    --bg-color: #f1f8e9;
    --text-color: #1b5e20;
    --primary: #388e3c;
    --secondary: #dcedc8;
    --accent: #8bc34a;
    --link-color: #2e7d32;
    --shadow: rgba(0, 0, 0, 0.08);
}

body.theme-light-denim {
    --bg-color: #ecf3f9;
    --text-color: #102a43;
    --primary: #336699;
    --secondary: #dbeafe;
    --accent: #9fb3c8;
    --link-color: #205c90;
    --shadow: rgba(0, 0, 0, 0.1);
}

body.theme-light-peach {
    --bg-color: #fff5f0;
    --text-color: #4e342e;
    --primary: #ff8a65;
    --secondary: #ffccbc;
    --accent: #ffab91;
    --link-color: #d84315;
    --shadow: rgba(0, 0, 0, 0.08);
}

body.theme-light-sahara {
    --bg-color: #fff8e1;
    --text-color: #5d4037;
    --primary: #d4a017;
    --secondary: #ffecb3;
    --accent: #ffd54f;
    --link-color: #bf8d0a;
    --shadow: rgba(0, 0, 0, 0.1);
}

body.theme-light-lavender {
    --bg-color: #faf5ff;
    --text-color: #4a148c;
    --primary: #9c27b0;
    --secondary: #f3e5f5;
    --accent: #e1bee7;
    --link-color: #7b1fa2;
    --shadow: rgba(0, 0, 0, 0.08);
}

/* --------------------------- General Styling ------------------------------ */
html {
    font-size: calc(var(--font-base) * var(--font-scale));
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --------------------------- Typography ------------------------------ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-title);
    color: var(--primary);
    text-shadow: 1px 1px 2px var(--shadow);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

h5 {
    font-size: 1.25rem;
    font-weight: bold;
}

h6 {
    font-size: 1.1rem;
    font-weight: bold;
    font-style: italic;
}

p,
li {
    font-size: 1rem;
    text-align: justify;
    hyphens: auto;
    margin-bottom: 1em;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: opacity 0.2s;
    font-weight: 500;
}

a:hover {
    text-decoration: underline;
    opacity: 0.9;
}

.bible-link {
    font-weight: bold;
    border-bottom: 1px dotted var(--link-color);
}

/* --------------------------- Layout ------------------------------ */
.page-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-height: 100vh;
}

.page-header {
    width: 100%;
    max-width: 1600px;
    margin: 1rem auto;
    padding: 0 1rem;
    box-sizing: border-box;
    text-align: center;
}

.banner-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1600 / 400;
    border-radius: var(--border-radius);
    object-fit: cover;
    display: block;
    box-shadow: 0 4px 15px var(--shadow);
    transition: transform 0.2s;
}

.banner-image:hover {
    transform: scale(1.005);
}

.text-title {
    text-align: center;
    font-size: 3rem;
    margin: 2rem 0;
    cursor: pointer;
    color: var(--primary);
}

#page-description {
    max-width: var(--max-width);
    text-align: center;
    padding: 0 2rem;
    margin-bottom: 2rem;
    color: var(--text-color);
    opacity: 0.9;
    font-style: italic;
    font-size: 1.1rem;
}

/* --------------------------- Control Bar ------------------------------ */
.control-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 2rem;
    padding: 0 1rem;
    max-width: var(--max-width);
    width: 100%;
}

.control-btn {
    background-color: var(--secondary);
    color: var(--text-color);
    border: 1px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    font-family: var(--font-body);
}

.control-btn:hover {
    background-color: var(--primary);
    color: var(--bg-color);
    text-shadow: none;
    transform: translateY(-2px);
}

.control-btn:active {
    transform: translateY(2px);
}

/* --------------------------- Dropdown ------------------------------ */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--secondary);
    min-width: 200px;
    box-shadow: 0 8px 16px var(--shadow);
    z-index: 100;
    border-radius: var(--border-radius);
    overflow: hidden;
    right: 0;
    border: 1px solid var(--primary);
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 1rem;
    text-align: left;
}

.dropdown-content a:hover {
    background-color: var(--primary);
    color: var(--bg-color);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content hr {
    border: 0;
    border-top: 1px solid var(--primary);
    margin: 0;
    opacity: 0.3;
}

/* --------------------------- Main Content ------------------------------ */
main,
.content-body {
    max-width: var(--max-width);
    width: 100%;
    background-color: var(--secondary);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow);
    margin: 0 1rem 3rem 1rem;
    box-sizing: border-box;
}

main h2,
.content-body h2 {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* --------------------------- Components ------------------------------ */
blockquote {
    border-left: 5px solid var(--primary);
    padding: 1rem 2rem;
    margin: 1.5rem 0;
    background-color: rgba(127, 127, 127, 0.1);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-style: italic;
    color: var(--text-color);
}

blockquote footer {
    text-align: right;
    font-weight: bold;
    color: var(--primary);
    margin-top: 0.5rem;
    font-style: normal;
}

ul,
ol {
    margin: 1em 0;
    padding-left: 2em;
}

li {
    margin-bottom: 0.5em;
}

button:not(.control-btn) {
    background-color: var(--primary);
    color: var(--bg-color);
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
}

button:not(.control-btn):hover {
    opacity: 0.9;
}

input,
textarea,
select {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--primary);
    padding: 8px;
    border-radius: 6px;
    margin: 5px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--primary);
}

th {
    color: var(--primary);
    font-family: var(--font-title);
    font-size: 1.1rem;
}

tr:hover {
    background-color: rgba(127, 127, 127, 0.05);
}

hr {
    border: 0;
    border-top: 2px solid var(--primary);
    margin: 2em 0;
    opacity: 0.5;
}

code,
pre {
    font-family: 'Courier New', Courier, monospace;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 2px 4px;
    border-radius: 4px;
}

pre {
    padding: 1rem;
    overflow-x: auto;
}

details {
    margin: 1em 0;
    padding: 0.5em 1em;
    background-color: rgba(127, 127, 127, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid var(--primary);
}

summary {
    cursor: pointer;
    font-weight: bold;
    color: var(--primary);
}

.pull-quote {
    font-size: 1.5rem;
    font-family: var(--font-title);
    text-align: center;
    color: var(--primary);
    margin: 2rem 0;
    padding: 1rem;
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    line-height: 1.4;
    background-color: rgba(127, 127, 127, 0.05);
}

main a[target="_blank"]:after,
.content-body a[target="_blank"]:after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.7;
    display: inline-block;
    vertical-align: text-top;
}

/* --------------------------- Theme Toast Notification ------------------------------ */
#theme-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background-color: var(--secondary);
    color: var(--text-color);
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 5px 20px var(--shadow);
    border: 1px solid var(--primary);
    font-weight: bold;
    font-family: var(--font-body);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    pointer-events: none;
    text-align: center;
    min-width: 200px;
}

#theme-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* --------------------------- Flash Title Splash ------------------------------ */
#flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    cursor: pointer;
    animation: flashFade var(--flash-duration, 2.5s) ease-in-out forwards;
}

#flash-overlay img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--border-radius);
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.2);
}

@keyframes flashFade {
    0% {
        opacity: 0;
        visibility: visible;
    }

    10% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}

/* --------------------------- Responsive ------------------------------ */
@media (max-width: 768px) {
    :root {
        --font-base: 16px;
    }

    .page-header {
        padding: 0 0.25rem;
        margin: 0.5rem auto;
    }

    main,
    .content-body {
        padding: 1.5rem 1rem;
        margin: 0 auto 2rem auto;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
    }

    .page-container {
        padding: 0;
    }

    #control-bar {
        gap: 8px;
        padding: 0 0.5rem;
    }

    .control-btn {
        padding: 8px 12px;
        flex-grow: 1;
        font-size: 1rem;
        min-width: unset;
    }

    blockquote {
        padding: 0.5rem 1rem;
        margin: 1rem 0;
    }
}

/* --------------------------- Lightbox (Added) ------------------------------ */
#lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

#lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content-wrapper {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--border-radius);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    object-fit: contain;
}

#lightbox-caption {
    margin-top: 15px;
    color: #fff;
    font-size: 1.2rem;
    text-align: center;
    max-width: 80%;
    font-family: var(--font-body);
}

.lightbox-nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 3rem;
    border: none;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 5px;
    user-select: none;
    transition: background 0.2s;
}

.lightbox-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#prev-btn {
    left: 20px;
}

#next-btn {
    right: 20px;
}

#close-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    color: #fff;
    cursor: pointer;
    z-index: 10002;
    background: transparent;
    border: none;
    line-height: 1;
}

/* Ensure images in content have cursor pointer if clickable */
.chapter-image {
    cursor: pointer;
    transition: transform 0.2s;
}

.chapter-image:hover {
    transform: scale(1.01);
}