/* ==========================================================================
    Swami Bhishm Digital Heritage Museum (SBDHM) - Biography Stylesheet
   ========================================================================== */

/* Reading Progress Bar Container */
.sbdhm-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: transparent;
    z-index: 9999;
}

.sbdhm-progress-bar {
    height: 4px;
    background-color: var(--sbdhm-saffron);
    width: 0%;
}

/* Page Layout */
.sbdhm-biography-page {
    background-color: var(--sbdhm-bg);
    color: var(--sbdhm-text);
}

.sbdhm-bio-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 50px;
    max-width: 1200px;
    margin: 50px auto;
    padding: 0 20px;
    align-items: flex-start;
}

/* Sidebar Styling (Sticky on Desktop) */
.sbdhm-bio-sidebar {
    position: sticky;
    top: 100px;
    background-color: var(--sbdhm-card-bg);
    border: 1px solid var(--sbdhm-gold);
    border-radius: var(--sbdhm-border-radius);
    padding: 30px 20px;
    box-shadow: 4px 4px 0px rgba(197, 160, 89, 0.1);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.sbdhm-bio-sidebar-title {
    font-family: var(--sbdhm-font-headings);
    font-size: 20px;
    color: var(--sbdhm-saffron);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--sbdhm-gold);
    padding-bottom: 10px;
    font-weight: bold;
}

.sbdhm-bio-chapter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sbdhm-bio-chapter-item {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(197, 160, 89, 0.35);
}

.sbdhm-bio-chapter-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sbdhm-bio-chapter-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: color var(--sbdhm-transition);
}

.sbdhm-nav-chapter-number {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--sbdhm-gold);
    font-weight: bold;
    margin-bottom: 2px;
}

.sbdhm-nav-chapter-title {
    font-family: var(--sbdhm-font-headings);
    font-size: 16px;
    color: var(--sbdhm-text);
    font-weight: bold;
    line-height: 1.3;
}

.sbdhm-bio-chapter-link:hover .sbdhm-nav-chapter-title {
    color: var(--sbdhm-saffron);
}

.sbdhm-active-chapter .sbdhm-nav-chapter-title {
    color: var(--sbdhm-saffron);
}

.sbdhm-active-chapter .sbdhm-nav-chapter-number {
    color: var(--sbdhm-saffron);
}

/* Mobile Toggler Button (Hidden by default on desktop) */
.sbdhm-mobile-nav-toggle {
    display: none;
    width: 100%;
    padding: 15px;
    background-color: var(--sbdhm-card-bg);
    border: 1px solid var(--sbdhm-gold);
    border-radius: var(--sbdhm-border-radius);
    color: var(--sbdhm-saffron);
    font-family: var(--sbdhm-font-headings);
    font-weight: bold;
    font-size: 16px;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    box-shadow: 4px 4px 0px rgba(197, 160, 89, 0.1);
    margin-bottom: 20px;
}

/* Main Reading Content */
.sbdhm-bio-content-container {
    max-width: 800px;
    background-color: var(--sbdhm-card-bg);
    border: 1px solid var(--sbdhm-gold);
    padding: 50px;
    border-radius: var(--sbdhm-border-radius);
    box-shadow: 6px 6px 0px rgba(197, 160, 89, 0.15);
    background-image: linear-gradient(rgba(197, 160, 89, 0.02) 1px, transparent 1px);
    background-size: 100% 32px;
}

/* Chapter Headers */
.sbdhm-bio-chapter-number {
    font-family: var(--sbdhm-font-headings);
    font-size: 18px;
    text-transform: uppercase;
    color: var(--sbdhm-gold);
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
}

.sbdhm-bio-chapter-title {
    font-family: var(--sbdhm-font-headings);
    font-size: 36px;
    color: var(--sbdhm-text);
    margin-bottom: 20px;
    font-weight: bold;
    line-height: 1.2;
}

.sbdhm-bio-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--sbdhm-gold);
    padding-bottom: 20px;
}

/* Timeline Markers */
.sbdhm-chapter-timeline-marker {
    display: inline-flex;
    align-items: center;
    background-color: #FAF7F0;
    border: 1px solid var(--sbdhm-gold);
    padding: 6px 15px;
    border-radius: 4px;
    font-family: var(--sbdhm-font-headings);
    font-size: 15px;
    font-weight: bold;
    color: var(--sbdhm-saffron);
}

.sbdhm-timeline-marker-icon {
    margin-right: 8px;
}

.sbdhm-chapter-read-time {
    display: inline-flex;
    align-items: center;
    background-color: #FAF7F0;
    border: 1px solid var(--sbdhm-border);
    padding: 6px 15px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--sbdhm-text);
}

.sbdhm-read-time-icon {
    margin-right: 8px;
}

/* Reading Prose */
.sbdhm-bio-prose {
    font-size: 18px;
    line-height: 1.8;
    color: var(--sbdhm-text);
}

.sbdhm-bio-prose p {
    margin-bottom: 25px;
}

/* Dropcap for Chapter Start */
.sbdhm-bio-prose p:first-of-type::first-letter {
    font-family: var(--sbdhm-font-headings);
    font-size: 60px;
    float: left;
    line-height: 50px;
    padding-top: 4px;
    padding-right: 8px;
    padding-left: 3px;
    color: var(--sbdhm-saffron);
    font-weight: bold;
}

/* Headings Anchors */
.sbdhm-bio-prose h2,
.sbdhm-bio-prose h3 {
    font-family: var(--sbdhm-font-headings);
    color: var(--sbdhm-text);
    margin-top: 40px;
    margin-bottom: 20px;
    font-weight: bold;
    position: relative;
}

.sbdhm-bio-prose h2 {
    font-size: 26px;
    border-bottom: 1px solid var(--sbdhm-border);
    padding-bottom: 8px;
}

.sbdhm-bio-prose h3 {
    font-size: 22px;
}

.sbdhm-heading-anchor {
    font-size: 18px;
    color: var(--sbdhm-gold);
    opacity: 0.3;
    text-decoration: none;
    margin-left: 10px;
    transition: opacity var(--sbdhm-transition);
}

.sbdhm-heading-anchor:hover {
    opacity: 1;
    color: var(--sbdhm-saffron);
}

/* Featured Quotes Box */
.sbdhm-bio-quote-box {
    background-color: #FAF7F0;
    border-left: 4px solid var(--sbdhm-saffron);
    border-top: 1px solid var(--sbdhm-gold);
    border-right: 1px solid var(--sbdhm-gold);
    border-bottom: 1px solid var(--sbdhm-gold);
    padding: 25px 30px;
    margin: 40px 0;
    border-radius: 0 var(--sbdhm-border-radius) var(--sbdhm-border-radius) 0;
}

.sbdhm-quote-text {
    font-family: var(--sbdhm-font-headings);
    font-size: 20px;
    font-style: italic;
    line-height: 1.6;
    color: var(--sbdhm-text);
    margin-bottom: 10px;
}

.sbdhm-quote-symbol {
    font-size: 36px;
    color: var(--sbdhm-gold);
    line-height: 0;
    vertical-align: middle;
    display: inline-block;
    margin-right: 5px;
}

/* Chapter Actions */
.sbdhm-chapter-actions {
    display: flex;
    justify-content: flex-end;
    margin: 30px 0;
}

.sbdhm-action-btn {
    display: inline-flex;
    align-items: center;
    background-color: var(--sbdhm-card-bg);
    border: 1px solid var(--sbdhm-gold);
    padding: 10px 20px;
    border-radius: var(--sbdhm-border-radius);
    color: var(--sbdhm-saffron);
    font-family: var(--sbdhm-font-headings);
    font-weight: bold;
    cursor: pointer;
    box-shadow: 3px 3px 0px rgba(197, 160, 89, 0.1);
    transition: transform var(--sbdhm-transition), box-shadow var(--sbdhm-transition);
}

.sbdhm-action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 5px 5px 0px rgba(197, 160, 89, 0.15);
}

.sbdhm-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    color: var(--sbdhm-border);
    border-color: var(--sbdhm-border);
    box-shadow: none;
}

.sbdhm-btn-icon {
    margin-right: 8px;
}

/* Previous/Next Chapter navigation */
.sbdhm-chapter-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    border-top: 1px solid var(--sbdhm-gold);
    padding-top: 30px;
    gap: 20px;
}

.sbdhm-nav-card {
    flex: 1;
    background-color: #FAF7F0;
    border: 1px solid var(--sbdhm-border);
    border-radius: var(--sbdhm-border-radius);
    padding: 20px;
    text-decoration: none;
    transition: transform var(--sbdhm-transition), border-color var(--sbdhm-transition);
}

.sbdhm-nav-card:hover {
    transform: translateY(-3px);
    border-color: var(--sbdhm-saffron);
}

.sbdhm-nav-direction {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--sbdhm-gold);
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

.sbdhm-nav-title {
    font-family: var(--sbdhm-font-headings);
    font-size: 16px;
    color: var(--sbdhm-text);
    font-weight: bold;
    line-height: 1.3;
}

/* Related Archives Panel */
.sbdhm-bio-related-panel {
    margin-top: 50px;
    background-color: #FAF7F0;
    border: 1px solid var(--sbdhm-gold);
    border-radius: var(--sbdhm-border-radius);
    padding: 35px 30px;
}

.sbdhm-related-panel-title {
    font-family: var(--sbdhm-font-headings);
    font-size: 20px;
    color: var(--sbdhm-text);
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(197, 160, 89, 0.3);
    padding-bottom: 10px;
    font-weight: bold;
}

.sbdhm-related-archives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
}

.sbdhm-related-group {
    background-color: var(--sbdhm-card-bg);
    border: 1px solid var(--sbdhm-border);
    border-radius: var(--sbdhm-border-radius);
    padding: 20px;
}

.sbdhm-related-group-title {
    font-family: var(--sbdhm-font-headings);
    font-size: 15px;
    color: var(--sbdhm-gold);
    margin-bottom: 12px;
    font-weight: bold;
    border-bottom: 1px dashed rgba(197, 160, 89, 0.2);
    padding-bottom: 6px;
}

.sbdhm-related-links-list {
    font-size: 14px;
    line-height: 1.5;
}

.sbdhm-related-link {
    color: var(--sbdhm-text);
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    transition: color var(--sbdhm-transition);
}

.sbdhm-related-link:hover {
    color: var(--sbdhm-saffron);
}

/* Biography Archive Catalog Styling */
.sbdhm-biography-archive-list {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin: 40px 0;
    padding: 0 20px;
}

.sbdhm-biography-archive-card {
    display: flex;
    background-color: var(--sbdhm-card-bg);
    border: 1px solid var(--sbdhm-gold);
    border-radius: var(--sbdhm-border-radius);
    overflow: hidden;
    box-shadow: 4px 4px 0px rgba(197, 160, 89, 0.1);
    transition: transform var(--sbdhm-transition), border-color var(--sbdhm-transition);
}

.sbdhm-biography-archive-card:hover {
    transform: translateY(-3px);
    border-color: var(--sbdhm-saffron);
}

.sbdhm-archive-card-image-container {
    width: 250px;
    flex-shrink: 0;
    border-right: 1px solid var(--sbdhm-gold);
}

.sbdhm-archive-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sbdhm-archive-card-content {
    padding: 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sbdhm-archive-card-title {
    font-family: var(--sbdhm-font-headings);
    font-size: 24px;
    margin-top: 5px;
    margin-bottom: 15px;
    font-weight: bold;
}

.sbdhm-archive-card-title a {
    color: var(--sbdhm-text);
    text-decoration: none;
}

.sbdhm-archive-card-title a:hover {
    color: var(--sbdhm-saffron);
}

.sbdhm-archive-card-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: var(--sbdhm-text);
    margin-bottom: 20px;
}

/* ==========================================================================
   Mobile layout (Under 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .sbdhm-bio-layout {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 20px auto;
    }

    .sbdhm-mobile-nav-toggle {
        display: inline-flex;
    }

    .sbdhm-bio-sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        height: 100vh;
        max-height: 100vh;
        z-index: 99999;
        transition: left 0.3s ease;
        border-radius: 0;
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
        border: none;
        border-right: 1px solid var(--sbdhm-gold);
    }

    .sbdhm-sidebar-open {
        left: 0;
    }

    .sbdhm-bio-content-container {
        padding: 25px;
        box-shadow: 4px 4px 0px rgba(197, 160, 89, 0.1);
    }

    .sbdhm-bio-chapter-title {
        font-size: 28px;
    }

    .sbdhm-bio-prose {
        font-size: 16px;
    }

    .sbdhm-chapter-navigation {
        flex-direction: column;
        gap: 15px;
    }

    .sbdhm-related-archives-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .sbdhm-biography-archive-card {
        flex-direction: column;
    }
    
    .sbdhm-archive-card-image-container {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--sbdhm-gold);
    }
}

/* ==========================================================================
   Print Stylesheet Support
   ========================================================================== */
@media print {
    body {
        background: #FFFFFF !important;
        color: #000000 !important;
        font-size: 12pt !important;
        line-height: 1.5 !important;
    }

    /* Hide screen elements */
    .sbdhm-progress-container,
    .sbdhm-bio-sidebar,
    .sbdhm-mobile-nav-toggle,
    .sbdhm-chapter-actions,
    .sbdhm-chapter-navigation,
    #site-navigation,
    #masthead,
    #colophon,
    .site-footer,
    .sbdhm-heading-anchor,
    .sbdhm-biography-archive-list {
        display: none !important;
    }

    /* Standard page breaks */
    .sbdhm-bio-layout {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .sbdhm-bio-content-container {
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
        background-image: none !important;
    }

    .sbdhm-bio-chapter-title {
        font-size: 28pt !important;
        margin-bottom: 10pt !important;
        page-break-after: avoid;
    }

    .sbdhm-bio-prose {
        orphans: 3;
        widows: 3;
    }

    .sbdhm-bio-prose h2,
    .sbdhm-bio-prose h3 {
        page-break-after: avoid;
    }

    .sbdhm-bio-quote-box {
        border: 1px solid #000000 !important;
        background: none !important;
        page-break-inside: avoid;
    }

    .sbdhm-bio-related-panel {
        page-break-inside: avoid;
        border: 1px solid #000000 !important;
        background: none !important;
        margin-top: 30pt !important;
    }

    .sbdhm-related-archives-grid {
        display: block !important;
    }

    .sbdhm-related-group {
        border: none !important;
        margin-bottom: 15pt !important;
        page-break-inside: avoid;
    }
}
