/* =============================================
   SIRRUNA LIBRARY - NEW EDITORIAL DESIGN
   Bold Hero + FT Newspaper Grid
   ============================================= */

/* Ensure peachy paper background */
body {
    background: var(--paper, #FFF8F2);
}

/* =====================
   HERO SECTION
   ===================== */
.library-hero {
    padding: 48px 0 40px;
    position: relative;
    overflow: hidden;
    max-width: 960px;
    margin: 0 auto;
}

.library-hero::before {
    content: 'LIBRARY';
    position: absolute;
    top: 0;
    left: -10px;
    font-family: var(--serif);
    font-size: clamp(100px, 15vw, 160px);
    font-weight: 300;
    color: var(--paper-dark);
    letter-spacing: -0.02em;
    z-index: 0;
    user-select: none;
    pointer-events: none;
    line-height: 1;
}

.library-hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.library-hero-tagline {
    font-family: var(--serif);
    font-size: clamp(32px, 4vw, 42px);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.library-hero-tagline em {
    font-style: italic;
    color: var(--burgundy);
}

.library-hero-right {
    border-left: 1px solid var(--rule);
    padding-left: 32px;
}

.library-hero-intro {
    font-size: 15px;
    color: var(--ink-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
}

.library-hero-search {
    display: flex;
    gap: 0;
}

.library-hero-search input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--rule);
    border-right: none;
    background: white;
    font-size: 14px;
    font-family: var(--sans);
    color: var(--ink);
}

.library-hero-search input::placeholder {
    color: var(--ink-tertiary);
}

.library-hero-search input:focus {
    outline: none;
    border-color: var(--ink);
}

.library-hero-search button {
    padding: 12px 24px;
    background: var(--ink);
    color: white;
    border: 1px solid var(--ink);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--sans);
}

.library-hero-search button:hover {
    background: var(--burgundy);
    border-color: var(--burgundy);
}

/* =====================
   MAIN CONTENT GRID
   ===================== */
.library-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 0 64px;
}

.library-grid {
    display: grid;
    grid-template-columns: 1fr 1px 240px;
    gap: 32px;
    padding-top: 24px;
}

.library-grid-divider {
    background: var(--rule);
}

/* =====================
   LEFT COLUMN - FEATURED + LATEST
   ===================== */
.library-main-col {
    display: flex;
    flex-direction: column;
}

/* Featured Article - Start Here */
.library-featured {
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--rule);
}

.library-featured-label {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: white;
    background: var(--burgundy);
    padding: 4px 10px;
    margin-bottom: 12px;
}

.library-featured h2 {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 12px;
}

.library-featured h2 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

.library-featured h2 a:hover {
    color: var(--burgundy);
}

.library-featured p {
    font-size: 15px;
    color: var(--ink-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.library-featured .meta {
    font-size: 12px;
    color: var(--ink-tertiary);
}

.library-featured .meta .author {
    color: var(--ink-secondary);
}

/* Latest Section Header */
.library-latest-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--burgundy);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--burgundy);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.library-latest-header a {
    font-weight: 400;
    color: var(--burgundy);
    text-decoration: none;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.library-latest-header a:hover {
    text-decoration: underline;
}

.library-latest-header .chevron-icon {
    flex-shrink: 0;
}

/* Latest Article Items */
.library-latest-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
    transition: background 0.15s;
}

.library-latest-item:last-child {
    border-bottom: none;
}

.library-latest-item:hover {
    background: var(--paper-dark);
    margin: 0 -12px;
    padding: 16px 12px;
}

.library-latest-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.library-latest-item .category {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Bookmark button in latest items */
.library-latest-bookmark {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--burgundy);
    opacity: 0.5;
    transition: opacity 0.15s;
}

.library-latest-bookmark:hover {
    opacity: 1;
}

.library-latest-bookmark.active {
    opacity: 1;
}

.library-latest-bookmark svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Category Colors */
.library-latest-item .category.fundamentals,
.category-fundamentals { color: var(--burgundy); }

.library-latest-item .category.infrastructure,
.category-infrastructure { color: #5a7a6f; }

.library-latest-item .category.defi,
.category-defi { color: var(--teal); }

.library-latest-item .category.institutional,
.category-institutional { color: var(--gold); }

.library-latest-item .category.investment,
.category-investment { color: #6b5b4f; }

.library-latest-item .category.coins,
.category-coins { color: #7a5a8a; }

.library-latest-item .category.emerging,
.category-emerging { color: #5a6b7a; }

.library-latest-item h3 {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 4px;
}

.library-latest-item h3 a {
    color: inherit;
    text-decoration: none;
}

.library-latest-item:hover h3 a {
    color: var(--burgundy);
}

.library-latest-item .meta {
    font-size: 11px;
    color: var(--ink-tertiary);
}

/* =====================
   SIDEBAR - MOST READ / MY READS / BROWSE
   ===================== */
.library-sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Tabs */
.library-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--burgundy);
}

.library-tab {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-tertiary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: var(--sans);
    transition: color 0.15s;
}

.library-tab:hover {
    color: var(--ink-secondary);
}

.library-tab.active {
    color: var(--burgundy);
}

/* Tab Content Container - Fixed height to prevent BROWSE from jumping */
.library-reads-section {
    height: 420px;
    display: flex;
    flex-direction: column;
}

/* Tab Content */
.library-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.library-tab-content.active {
    display: block;
}

/* Ranked Items */
.library-ranked-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
    transition: background 0.15s;
    align-items: flex-start;
}

.library-ranked-item:last-child {
    border-bottom: none;
}

.library-ranked-item:hover {
    background: var(--paper-dark);
    margin: 0 -8px;
    padding: 10px 8px;
}

.library-rank {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 300;
    color: var(--rule);
    min-width: 20px;
    line-height: 1;
}

.library-ranked-content {
    flex: 1;
    min-width: 0;
}

.library-ranked-item h4 {
    font-family: var(--serif);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 2px;
    color: var(--ink);
}

.library-ranked-item:hover h4 {
    color: var(--burgundy);
}

.library-ranked-item .meta {
    font-size: 10px;
    color: var(--ink-tertiary);
}

/* Bookmark button in ranked items */
.library-ranked-bookmark {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--burgundy);
    opacity: 0.6;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.library-ranked-bookmark:hover {
    opacity: 1;
}

.library-ranked-bookmark.active {
    opacity: 1;
}

.library-ranked-bookmark svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* My Reads - Progress */
.library-myread-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
}

.library-myread-item:last-child {
    border-bottom: none;
}

.library-myread-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.library-myread-item h4 {
    font-family: var(--serif);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 6px;
    color: var(--ink);
    flex: 1;
}

.library-progress-bar {
    height: 3px;
    background: var(--rule);
    border-radius: 2px;
    overflow: hidden;
}

.library-progress-fill {
    height: 100%;
    background: var(--teal);
    transition: width 0.3s;
}

.library-myread-item .meta {
    font-size: 10px;
    color: var(--ink-tertiary);
    margin-top: 4px;
}

.library-myreads-empty {
    font-size: 12px;
    color: var(--ink-tertiary);
    font-style: italic;
    padding: 16px 0;
    line-height: 1.5;
}

.library-myreads-empty a {
    color: var(--burgundy);
    text-decoration: none;
}

.library-myreads-empty a:hover {
    text-decoration: underline;
}

/* Browse Topics */
.library-browse {
    padding-top: 16px;
    border-top: 1px solid var(--rule);
}

.library-browse h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--burgundy);
    margin-bottom: 12px;
}

/* No search results */
.library-no-results {
    font-size: 14px;
    color: var(--ink-tertiary);
    font-style: italic;
    padding: 24px 0;
}

.library-topic-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.library-topic-link {
    font-size: 12px;
    color: var(--ink-secondary);
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    transition: color 0.15s;
}

.library-topic-link:hover {
    color: var(--burgundy);
}

.library-topic-link .count {
    color: var(--ink-tertiary);
    font-size: 10px;
}

/* =====================
   ARTICLE READER VIEW
   ===================== */
.article-reader {
    display: none;
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 0 80px;
}

.article-reader.active {
    display: block;
}

.article-reader-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--rule);
}

.article-reader-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-secondary);
    text-decoration: none;
    margin-bottom: 24px;
}

.article-reader-back:hover {
    color: var(--burgundy);
}

.article-reader-category {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--burgundy);
    margin-bottom: 12px;
}

.article-reader-title {
    font-family: var(--serif);
    font-size: 36px;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 16px;
}

.article-reader-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--ink-secondary);
    margin-top: 24px;
}

.article-reader-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-reader-author img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Article actions - PDF, Email, Bookmark */
.article-reader-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.article-action-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--burgundy);
    opacity: 0.6;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-action-btn:hover {
    opacity: 1;
}

.article-action-btn.active,
.article-bookmark-btn.active {
    opacity: 1;
}

.article-bookmark-btn.active svg path {
    fill: var(--burgundy);
}

.article-reader-content {
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.8;
    color: var(--ink);
}

.article-reader-content p {
    margin-bottom: 1.5em;
}

.article-reader-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 2em 0 1em;
}

.article-reader-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 1.5em 0 0.75em;
}

.article-reader-content blockquote {
    border-left: 3px solid var(--burgundy);
    padding-left: 24px;
    margin: 1.5em 0;
    font-style: italic;
    color: var(--ink-secondary);
}

.article-reader-content ul,
.article-reader-content ol {
    margin: 1.5em 0;
    padding-left: 1.5em;
}

.article-reader-content li {
    margin-bottom: 0.5em;
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 768px) {
    .library-hero {
        padding: 32px 0;
    }
    
    .library-hero::before {
        font-size: 80px;
        top: 10px;
    }
    
    .library-hero-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .library-hero-right {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--rule);
        padding-top: 24px;
    }
    
    .library-hero-tagline {
        font-size: 28px;
    }
    
    .library-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .library-grid-divider {
        display: none;
    }
    
    .library-sidebar {
        border-top: 2px solid var(--ink);
        padding-top: 24px;
    }
    
    .library-featured h2 {
        font-size: 24px;
    }
    
    .article-reader-title {
        font-size: 28px;
    }
}

/* =====================
   LIBRARY VIEW TOGGLE
   ===================== */
.library-view {
    display: block;
}

.library-view.hidden {
    display: none;
}

/* =====================
   TOAST NOTIFICATION
   ===================== */
.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--ink);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-notification.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
