:root {
    --bg-dark: #121013;
    --text-primary: #e8e2d2;
    --text-secondary: #a39b88;
    --gold: #d4af37;
    --crimson: #7a1f1f;
    --glass-bg: rgba(18, 16, 19, 0.7);
    --glass-border: rgba(212, 175, 55, 0.25);
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Home Body Background */
.home-body {
    background-image: url('Augustine.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--glass-border);
}

/* Navigation Bar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 4rem;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
}

.navbar .logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 2px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--gold);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 80px;
}

.hero-content {
    text-align: center;
    padding: 4rem;
    border-radius: 8px;
    max-width: 800px;
    animation: fadeIn 1s ease-out forwards;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 3rem; /* reduced from 4.5rem */
    color: var(--gold);
    margin-bottom: 1rem; /* tighter spacing */
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
    line-height: 1.2; /* improve line break handling */
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--gold), #a67c00);
    color: #111;
    font-family: var(--font-heading);
    font-weight: 700;
    text-decoration: none;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

/* Authors Section on Home Page */
#authors-section {
    background: linear-gradient(to bottom, transparent, var(--bg-dark) 20%);
    padding: 6rem 2rem;
}

/* Page Layout */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 2rem 4rem 2rem;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--gold);
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

/* Authors Grid */
.authors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.author-card {
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    text-align: center;
    padding-bottom: 2rem;
}

.author-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.author-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-bottom: 2px solid var(--gold);
    filter: sepia(0.3) contrast(1.1);
}

.author-name {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--gold);
    margin: 1.5rem 0 0.5rem 0;
}

.author-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
}

.btn {
    text-decoration: none;
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    transition: background 0.3s ease, color 0.3s ease;
    font-family: var(--font-heading);
    font-weight: 600;
    text-align: center;
}

.btn:hover:not(.disabled) {
    background: var(--gold);
    color: #111;
}

.btn.disabled {
    border-color: #555;
    color: #888;
    cursor: not-allowed;
    pointer-events: none;
}

/* Works List */
.works-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.work-item {
    padding: 2rem;
    border-radius: 8px;
    transition: transform 0.3s ease;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.work-image-container {
    flex-shrink: 0;
    width: 180px;
}

.work-image-container img {
    width: 100%;
    border-radius: 4px;
    border: 1px solid var(--gold);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.work-details {
    flex-grow: 1;
}

.work-details h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.work-details p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.work-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .work-item {
        flex-direction: column;
        text-align: center;
    }
    .work-buttons {
        justify-content: center;
    }
}

/* Library Page Styles */
.library-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 120px 2rem 4rem 2rem;
    display: grid;
    grid-template-columns: minmax(300px, 400px) 1fr;
    gap: 2rem;
    min-height: calc(100vh - 120px);
}

.library-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
    border-radius: 8px;
    height: fit-content;
}

.library-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.library-controls input,
.library-controls select {
    width: 100%;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    background: rgba(18, 16, 19, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.library-controls input:focus,
.library-controls select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

.library-controls input::placeholder {
    color: var(--text-secondary);
}

.library-controls select option {
    background-color: var(--bg-dark);
    color: var(--text-primary);
}

#library-status {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Scrollbar styling */
.library-list::-webkit-scrollbar {
    width: 6px;
}

.library-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.library-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.library-list::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

.library-card {
    width: 100%;
    padding: 1.2rem;
    background: rgba(18, 16, 19, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.3s, box-shadow 0.3s;
    font-family: var(--font-body);
}

.library-card:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.library-card.active {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.library-card strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 0.3rem;
}

.library-card small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.library-preview-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2.5rem;
    border-radius: 8px;
    min-height: 600px;
}

.preview-details h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.preview-details p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

.preview-details p strong {
    color: var(--text-primary);
}

.preview-tags {
    margin-top: 0.8rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.preview-tags span {
    display: inline-block;
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    margin-top: 0.3rem;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.library-iframe-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    min-height: 600px;
    overflow: hidden;
}

.library-iframe-container iframe {
    width: 100%;
    height: 100%;
    min-height: 600px;
    border: none;
    background: #fff;
}

/* Responsive adjustment */
@media (max-width: 992px) {
    .library-container {
        grid-template-columns: 1fr;
    }
    
    .library-sidebar {
        max-width: 100%;
    }
}

/* ─── "Read Here" button variant ──────────────────────────────────────────── */
.btn-read-here {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: inherit;
    font-weight: 600;
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.btn-read-here:hover {
    background: rgba(212, 175, 55, 0.18);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
}

/* ─── Body scroll-lock when reader is open ─────────────────────────────────── */
body.reader-open {
    overflow: hidden;
}

/* ─── Reader Overlay ────────────────────────────────────────────────────────── */
.reader-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    background: var(--bg-dark);

    /* Slide up from bottom */
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
                opacity   0.35s ease;
}

.reader-overlay.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ─── Reader Sidebar ─────────────────────────────────────────────────────────── */
.reader-sidebar {
    width: 310px;
    min-width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.reader-sidebar-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.reader-sidebar-label {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--gold);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

.reader-close-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-primary);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--glass-border);
    padding: 0.45rem 0.85rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.25s, color 0.25s, border-color 0.25s;
    white-space: nowrap;
    flex-shrink: 0;
}

.reader-close-btn:hover {
    background: var(--gold);
    color: #111;
    border-color: var(--gold);
}

.reader-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* Scrollbar for reader sidebar */
.reader-sidebar-list::-webkit-scrollbar { width: 5px; }
.reader-sidebar-list::-webkit-scrollbar-track { background: transparent; }
.reader-sidebar-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}
.reader-sidebar-list::-webkit-scrollbar-thumb:hover { background: var(--gold); }

.reader-sidebar-card {
    width: 100%;
    padding: 0.9rem 1rem;
    background: rgba(18, 16, 19, 0.45);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    font-family: var(--font-body);
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.reader-sidebar-card:hover {
    border-color: var(--gold);
    transform: translateX(3px);
}

.reader-sidebar-card.active {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.12);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.15);
}

.reader-sidebar-card strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--gold);
    margin-bottom: 0.2rem;
    line-height: 1.35;
}

.reader-sidebar-card small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* ─── Reader Content Panel ───────────────────────────────────────────────────── */
.reader-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.reader-doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

#reader-doc-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--gold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
}

#reader-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
    display: block;
}

/* ─── Responsive: stack sidebar above iframe on small screens ────────────────── */
@media (max-width: 768px) {
    .reader-overlay {
        flex-direction: column;
    }

    .reader-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }

    .reader-sidebar-list {
        max-height: calc(45vh - 60px);
    }

    .reader-sidebar-card:hover {
        transform: none;
    }
}

/* ─── Mobile Friendly Layout Overrides (Automatically detected via nav.js/body.is-mobile) ─── */

/* Navbar styling adjustments */
body.is-mobile .navbar {
    padding: 1rem 1.5rem;
}

body.is-mobile .navbar .logo {
    font-size: 1.4rem;
    letter-spacing: 1px;
}

/* Menu Toggle Button (Hamburger) – hidden by default, shown on mobile */
.menu-toggle {
    display: none;
}

body.is-mobile .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 150;
    padding: 0;
}

body.is-mobile .menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--gold);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Animate Hamburger into X */
body.is-mobile .menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
body.is-mobile .menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
body.is-mobile .menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Sliding navigation menu drawer */
body.is-mobile .nav-links {
    display: flex;
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: rgba(18, 16, 19, 0.98);
    border-left: 1px solid var(--glass-border);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    padding: 2rem;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 140;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body.is-mobile .nav-links.active {
    right: 0;
}

/* Body lock scroll when menu open */
body.is-mobile.nav-open {
    overflow: hidden;
}

/* Hero section scaling */
body.is-mobile .hero {
    padding-top: 60px;
}

body.is-mobile .hero-content {
    padding: 2.5rem 1.5rem;
    margin: 0 1rem;
}

body.is-mobile .hero h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

body.is-mobile .hero p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

body.is-mobile .cta-button {
    padding: 0.8rem 1.8rem;
    font-size: 0.9rem;
}

/* Page title and container scaling */
body.is-mobile .page-container {
    padding: 90px 1rem 3rem 1rem;
}

body.is-mobile .page-title {
    font-size: 2rem;
    margin-bottom: 2rem;
}

/* Authors Grid */
body.is-mobile .authors-grid {
    gap: 1.5rem;
}

body.is-mobile .author-card {
    margin: 0 0.5rem;
}

body.is-mobile .author-image {
    height: 280px;
}

/* Works items adjustments */
body.is-mobile .work-item {
    padding: 1.2rem !important;
    gap: 1.2rem !important;
}

body.is-mobile .work-image-container {
    width: 120px !important;
    margin: 0 auto;
}

/* Library Page Layout Overrides */
body.is-mobile .library-container {
    grid-template-columns: 1fr;
    padding: 90px 1rem 2rem 1rem;
}

body.is-mobile .library-preview-panel {
    display: none !important; /* Hide inline desktop viewer */
}

body.is-mobile .library-sidebar {
    padding: 1.5rem;
    max-width: 100%;
}

body.is-mobile .library-list {
    max-height: none; /* Let the catalog flow naturally or scroll */
}

/* Document Reader & PDF Viewer container overrides */
body.is-mobile .reader-container {
    padding: 1.5rem !important;
    margin: 1rem auto !important;
    border-radius: 6px !important;
}

body.is-mobile .pdf-viewer-container {
    padding: 1rem !important;
    margin: 1rem 0 !important;
}

body.is-mobile .pdf-controls {
    gap: 0.8rem !important;
    margin-bottom: 1rem !important;
}

body.is-mobile .pdf-btn {
    padding: 0.45rem 1rem !important;
    font-size: 0.85rem !important;
}

body.is-mobile .page-info {
    font-size: 0.9rem !important;
}

