/* ============================================================
   Classics Engine — Stylesheet
   /var/www/html/library/classics/css/style.css
   Extends shakespeare/css/style.css (loaded first)
   ============================================================ */

/* ====== EDITION TAB BAR ====== */
.edition-tabs {
    display: flex;
    gap: 0;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 1.25rem;
    position: sticky;
    top: 52px;
    z-index: 90;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.edition-tabs::-webkit-scrollbar { display: none; }

.edition-tab {
    padding: 0.7rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-lighter);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}
.edition-tab:hover {
    color: var(--ink);
    background: var(--parchment);
}
.edition-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ====== LAYOUT ADJUSTMENT (account for sticky tab bar) ====== */
.layout {
    min-height: calc(100vh - 52px - 42px); /* topbar + edition tabs */
}

/* Override shakespeare sidebar-toggle to account for edition tab bar */
.sidebar-toggle {
    top: 100px; /* 52px topbar + 43px edition tabs + 5px padding */
    z-index: 85; /* below edition tabs (90) */
}

/* ====== GUIDE CONTENT STYLES ====== */
.guide-content h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.guide-content h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent);
    margin: 1.5rem 0 0.5rem;
}
.guide-content blockquote {
    background: var(--parchment);
    border-left: 3px solid var(--gold);
    padding: 1rem 1.5rem;
    margin: 1.25rem 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--ink-light);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.guide-content dl {
    margin: 1rem 0;
}
.guide-content dt {
    font-weight: 700;
    color: var(--accent);
    font-size: 1rem;
    margin-top: 0.75rem;
}
.guide-content dd {
    margin-left: 1.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--ink-light);
}

/* ====== ILLUSTRATION FIGURES ====== */
.guide-content figure {
    margin: 2rem 0;
    text-align: center;
}
.guide-content figure img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.guide-content figure img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}
.guide-content figcaption {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--ink-lighter);
    margin-top: 0.75rem;
    line-height: 1.4;
}

/* ====== DUAL TIMELINES ====== */
.timeline-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}
.timeline-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    overflow: hidden;
}
.timeline-heading {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.timeline-tag {
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: var(--accent-faint);
    color: var(--accent);
}
.timeline {
    position: relative;
    padding-left: 1.25rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-strong, #ccc);
}
.tl-item {
    position: relative;
    padding: 0 0 1.1rem 0;
}
.tl-item::before {
    content: '';
    position: absolute;
    left: -1.25rem;
    top: 0.35rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: white;
    z-index: 1;
}
/* Color-coded dots */
.tl-item.tl-war::before { border-color: #8b1a1a; background: #fee2e2; }
.tl-item.tl-adventure::before { border-color: #B8860B; background: #fef3c7; }
.tl-item.tl-calypso::before { border-color: #6b21a8; background: #f3e8ff; }
.tl-item.tl-flashback::before { border-color: #B8860B; background: #B8860B; }
.tl-item.tl-home::before { border-color: var(--accent); background: var(--accent-faint); }

.tl-year, .tl-books {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    margin-bottom: 0.15rem;
}
.tl-body {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--ink-light);
}
.tl-body strong {
    color: var(--ink);
    font-size: 0.92rem;
}
.tl-note {
    display: block;
    font-size: 0.78rem;
    font-style: italic;
    color: var(--ink-lighter);
    margin-top: 0.2rem;
}
/* Flashback highlight */
.tl-item.tl-flashback {
    background: linear-gradient(90deg, rgba(184,134,11,0.06), transparent);
    margin-left: -0.75rem;
    padding-left: 0.75rem;
    border-radius: var(--radius);
}
.tl-item.tl-flashback .tl-body strong {
    color: #92400e;
}

.timeline-caption {
    font-size: 0.88rem;
    font-style: italic;
    color: var(--ink-lighter);
    text-align: center;
    margin: 0.5rem 0 1.5rem;
    line-height: 1.6;
}

/* Floated figure — text wraps alongside */
.guide-content figure.figure-float {
    float: right;
    max-width: 38%;
    margin: 0.25rem 0 1.25rem 1.75rem;
    text-align: center;
}
.guide-content figure.figure-float img {
    max-width: 100%;
}

/* ====== PROSE CONTENT (Butler / Lawrence) ====== */
.prose-content {
    font-size: 1.08rem;
    line-height: 1.85;
    color: var(--ink);
    max-width: 720px;
}
.prose-content p {
    margin-bottom: 1rem;
    text-indent: 1.5em;
}
.prose-content p:first-child {
    text-indent: 0;
}

/* ====== GREEK SIDE-BY-SIDE ====== */
.greek-toggle-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
}
.greek-toggle-label {
    font-size: 0.85rem;
    color: var(--ink-lighter);
    font-weight: 500;
}
.greek-toggle-btn {
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-family: var(--font-body);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: white;
    color: var(--ink-light);
    cursor: pointer;
    transition: var(--transition);
}
.greek-toggle-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.greek-toggle-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.greek-columns {
    grid-template-columns: 1fr 1fr;
}
.greek-col {
    border-right: 1px solid var(--border);
}
.greek-text {
    font-family: 'Noto Serif', Georgia, serif;
    font-size: 1.05rem;
    line-height: 2;
    color: var(--ink);
}
.english-text {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--ink-light);
}

/* ====== DOWNLOADS ====== */
.downloads-section {
    margin-bottom: 2rem;
}
.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}
.download-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink);
    transition: var(--transition);
}
.download-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}
.download-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.download-icon.pdf { background: #fee2e2; color: #c0392b; }
.download-icon.html { background: #e0f2fe; color: #0369a1; }
.download-text { flex: 1; }
.download-text h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.15rem;
}
.download-text p {
    font-size: 0.78rem;
    color: var(--ink-lighter);
    line-height: 1.4;
}
.download-arrow {
    flex-shrink: 0;
    color: var(--ink-lighter);
    transition: var(--transition);
}
.download-card:hover .download-arrow {
    color: var(--accent);
}

/* ====== TOC ENHANCEMENTS ====== */
.toc-subtitle {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-lighter);
    font-size: 0.88rem;
}
.toc-books {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--ink-lighter);
    white-space: nowrap;
}
.toc-row.disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* ====== SIDEBAR DISABLED ITEMS ====== */
.sb-ch.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ====== READER ENHANCEMENTS ====== */
.reader-books-covered {
    font-size: 0.85rem;
    color: var(--ink-lighter);
    margin-top: 0.25rem;
}

.no-content {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--ink-lighter);
    font-style: italic;
    font-size: 1.1rem;
}

/* ====== SEARCH OVERLAY ====== */
.search-results-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}
.search-results-panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 560px;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
}
.search-close-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--ink-lighter);
    padding: 0.25rem;
}
.search-results-body {
    overflow-y: auto;
    padding: 0.5rem;
}
.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--ink);
    border-radius: var(--radius);
    transition: var(--transition);
}
.search-result-item:hover {
    background: var(--parchment);
}
.search-result-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
}
.search-result-edition {
    font-size: 0.72rem;
    color: var(--ink-lighter);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ====== IMAGE LIGHTBOX ====== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 2rem;
}
.lightbox-overlay img {
    max-width: 95%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .edition-tabs {
        padding: 0 0.75rem;
    }
    .edition-tab {
        padding: 0.6rem 1rem;
        font-size: 0.82rem;
    }
    .greek-columns {
        grid-template-columns: 1fr;
    }
    .greek-col {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .downloads-grid {
        grid-template-columns: 1fr;
    }
    .guide-content figure.figure-float {
        float: none;
        max-width: 70%;
        margin: 1.5rem auto;
    }
    .timeline-pair {
        grid-template-columns: 1fr;
    }
    .prose-content {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .edition-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.78rem;
    }
    .greek-toggle-bar {
        flex-wrap: wrap;
    }
}
