/* ============================================
   KNOWLEDGE CAPSULES LIBRARY — V4
   Award-winning dark premium design
   ============================================ */

/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800;900&family=Inter:wght@400;500;600;700;800&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
    /* Dark palette */
    --bg-deep: #060608;
    --bg-base: #0c0c12;
    --bg-surface: #111118;
    --bg-elevated: #18181f;
    --bg-hover: #1e1e28;
    --border: rgba(255,255,255,0.05);
    --border-subtle: rgba(255,255,255,0.03);
    --border-active: rgba(192,57,43,0.4);

    /* Accent */
    --accent: #c0392b;
    --accent-bright: #e74c3c;
    --accent-glow: rgba(192,57,43,0.2);
    --accent-subtle: rgba(192,57,43,0.08);

    /* Gold */
    --gold: #d4a853;
    --gold-dim: rgba(212,168,83,0.5);

    /* Text */
    --text-primary: #f0eee8;
    --text-secondary: #9a9aaa;
    --text-muted: #555568;
    --text-white: #ffffff;

    /* Effects */
    --glass: rgba(255,255,255,0.03);
    --glass-border: rgba(255,255,255,0.06);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px rgba(192,57,43,0.15);

    /* Radius */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50px;

    /* Timing */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration: 0.3s;
    --duration-slow: 0.6s;

    /* Fonts */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ===== NOISE TEXTURE ===== */
.noise-svg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.4;
    mix-blend-mode: overlay;
}

/* ===== HERO SECTION ===== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    overflow: hidden;
    text-align: center;
}

.hero-aurora {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 40%, rgba(192,57,43,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 80% 30%, rgba(126,87,194,0.08) 0%, transparent 50%),
        radial-gradient(ellipse 50% 50% at 50% 80%, rgba(212,168,83,0.06) 0%, transparent 50%);
    animation: auroraShift 12s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes auroraShift {
    0%   { background-position: 0% 0%, 100% 0%, 50% 100%; transform: scale(1); }
    50%  { background-position: 30% 20%, 70% 40%, 40% 60%; transform: scale(1.05); }
    100% { background-position: 10% 10%, 90% 20%, 60% 80%; transform: scale(1); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
}

.hero-logo {
    margin-bottom: 20px;
}

.hero-logo-img {
    width: 90px;
    height: 90px;
    border-radius: 22px;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(192,57,43,0.3);
    animation: heroFadeIn 0.8s var(--ease) both;
}

.hero-logo-fallback {
    width: 90px;
    height: 90px;
    background: var(--accent);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: white;
    margin: 0 auto;
    box-shadow: 0 8px 32px rgba(192,57,43,0.3);
    animation: heroFadeIn 0.8s var(--ease) both;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 900;
    color: var(--text-white);
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 8px;
    animation: heroFadeIn 0.8s var(--ease) 0.1s both;
}

.hero-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 16px;
    animation: heroFadeIn 0.8s var(--ease) 0.2s both;
}

.hero-tagline {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 40px;
    animation: heroFadeIn 0.8s var(--ease) 0.3s both;
}

@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Hero stats */
.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin-bottom: 36px;
    animation: heroFadeIn 0.8s var(--ease) 0.4s both;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-number {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 800;
    color: var(--text-white);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

/* Hero socials */
.hero-socials {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    animation: heroFadeIn 0.8s var(--ease) 0.5s both;
}

.hero-social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--glass);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--duration) var(--ease);
    backdrop-filter: blur(8px);
}

.hero-social-link:hover {
    color: var(--text-white);
    border-color: var(--border-active);
    background: var(--accent-subtle);
    transform: translateY(-2px);
}

/* Scroll hint */
.hero-scroll-hint {
    position: absolute;
    bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: hintBounce 2s ease-in-out infinite;
}

@keyframes hintBounce {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50%      { transform: translateY(8px); opacity: 1; }
}

/* ===== STICKY NAV ===== */
.sticky-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(6,6,8,0.8);
    backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    transition: box-shadow var(--duration) var(--ease);
}

.sticky-nav.scrolled {
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nav-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
}

.nav-logo-text {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: white;
}

.nav-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    color: var(--text-white);
}

.search-section {
    flex: 1;
    max-width: 420px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--duration) var(--ease);
}

.search-input {
    width: 100%;
    padding: 11px 18px 11px 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-family: var(--font-body);
    font-weight: 500;
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
    transition: all var(--duration) var(--ease);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow), 0 0 20px var(--accent-glow);
    background: var(--bg-elevated);
}

.search-input:focus ~ .search-icon,
.search-section:focus-within .search-icon {
    color: var(--accent-bright);
}

/* ===== FILTER BAR ===== */
.filter-bar {
    background: var(--bg-base);
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar { height: 0; }

.filter-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.filter-btn {
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: transparent;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--duration) var(--ease);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-icon { font-size: 14px; }

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--text-white);
    background: var(--accent-subtle);
    transform: translateY(-1px);
}

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-white);
    box-shadow: 0 4px 16px rgba(192,57,43,0.35);
    transform: translateY(-1px);
}

/* ===== COUNT BAR ===== */
.count-bar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ===== CAPSULE GRID ===== */
.capsule-grid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 24px 80px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 24px;
}

/* ===== CAPSULE CARD ===== */
.capsule-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    display: flex;
    flex-direction: column;
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;

    /* Staggered entrance */
    opacity: 0;
    transform: translateY(30px);
    animation: cardEnter 0.5s var(--ease) both;
}

@keyframes cardEnter {
    to { opacity: 1; transform: translateY(0); }
}

.capsule-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, transparent, var(--accent-glow), transparent);
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
    z-index: -1;
}

.capsule-card:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.capsule-card:hover::before {
    opacity: 1;
}

.card-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    background: linear-gradient(90deg,
        var(--bg-elevated) 0%,
        var(--bg-elevated) 25%,
        #1e1e2c 50%,
        var(--bg-elevated) 75%,
        var(--bg-elevated) 100%);
    background-size: 600px 100%;
    animation: thumb-shimmer 1.6s infinite linear;
    transition: transform 0.4s var(--ease), opacity 0.4s ease;
}

@keyframes thumb-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}

.card-thumbnail.pdf-thumb-loaded {
    object-fit: contain;
    background: #000;
    animation: none;
}

.capsule-card:hover .card-thumbnail {
    transform: scale(1.03);
}

.card-color-bar {
    height: 3px;
    width: 100%;
    position: relative;
}

.card-color-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    filter: blur(6px);
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
}

.capsule-card:hover .card-color-bar::after {
    opacity: 0.6;
}

.card-body {
    padding: 18px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 8px;
    line-height: 1.3;
    transition: color var(--duration) var(--ease);
}

.capsule-card:hover .card-title {
    color: var(--accent-bright);
}

.card-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
    flex: 1;
    margin-bottom: 16px;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tag-category {
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: var(--accent-subtle);
    color: var(--accent-bright);
    border: 1px solid rgba(192,57,43,0.15);
}

.tag-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Card read indicator dot */
.card-new-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(192,57,43,0.4);
}

/* ===== NO RESULTS ===== */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 100px 20px;
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 600;
}

/* ===== READER OVERLAY ===== */
.reader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(16px);
    animation: overlayIn 0.3s var(--ease);
}

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.reader-overlay.active { display: flex; }

.reader-container {
    width: 95vw;
    height: 95vh;
    max-width: 1200px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    animation: readerIn 0.35s var(--ease-bounce);
}

@keyframes readerIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Reading progress bar */
.reader-progress {
    height: 3px;
    background: var(--accent);
    width: 0%;
    transition: width 0.2s var(--ease);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    box-shadow: 0 0 8px var(--accent-glow);
}

.reader-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.reader-title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.reader-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-info {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 700;
    white-space: nowrap;
    font-family: var(--font-body);
}

.ctrl-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
}

.ctrl-btn:hover {
    background: var(--bg-hover);
    color: var(--text-white);
    border-color: var(--border-active);
}

.close-btn {
    background: rgba(192,57,43,0.12);
    border-color: rgba(192,57,43,0.2);
}

.close-btn:hover {
    background: rgba(192,57,43,0.25);
}

/* Reader body */
.reader-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--bg-deep);
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 80px;
    border: none;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    cursor: pointer;
    z-index: 10;
    border-radius: 12px;
    transition: all var(--duration) var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-white);
}

.nav-prev { left: 12px; }
.nav-next { right: 12px; }

.canvas-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 10px 70px;
    position: relative;
}

#pdfCanvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 4px 40px rgba(0,0,0,0.5);
    border-radius: 4px;
}

/* Loading spinner */
.loading-spinner {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    background: rgba(6,6,8,0.92);
    z-index: 5;
}

.loading-spinner.active { display: flex; }

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

/* Thumbnail strip */
.reader-footer {
    background: var(--bg-deep);
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.reader-footer::-webkit-scrollbar { height: 0; }

.thumbnail-strip {
    display: flex;
    gap: 6px;
    justify-content: center;
    min-width: min-content;
}

.thumb-page {
    width: 44px;
    height: 58px;
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    flex-shrink: 0;
    font-family: var(--font-body);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center top;
}

.thumb-page .thumb-num {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.55);
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.5;
    pointer-events: none;
}

/* While thumbnail is still loading just show number centred */
.thumb-page:not([style*="background-image"]) {
    font-size: 11px;
    color: var(--text-muted);
}
.thumb-page:not([style*="background-image"]) .thumb-num {
    display: none;
}

.thumb-page:hover {
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.thumb-page.active {
    border-color: var(--accent-bright);
    box-shadow: 0 0 0 1px var(--accent), 0 4px 12px rgba(192,57,43,0.35);
}

/* Keyboard shortcut toast */
.shortcut-toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
    z-index: 20;
    white-space: nowrap;
}

.shortcut-toast.visible {
    opacity: 1;
}

.shortcut-toast span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== SCROLL TO TOP ===== */
.scroll-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    transition: all var(--duration) var(--ease);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    backdrop-filter: blur(12px);
}

.scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-top:hover {
    background: var(--accent);
    color: var(--text-white);
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

/* ===== FOOTER ===== */
.kc-footer {
    text-align: center;
    padding: 60px 24px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.footer-glow {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 120px;
    background: radial-gradient(ellipse, rgba(192,57,43,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.footer-inner {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.footer-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    margin-bottom: 14px;
    object-fit: contain;
}

.footer-brand {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 4px;
}

.footer-tagline {
    font-size: 14px;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}

.footer-socials {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-socials a {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--duration) var(--ease);
}

.footer-socials a:hover {
    color: var(--accent-bright);
}

.footer-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
}

.footer-copy {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 900px) {
    .hero { min-height: 90vh; padding: 40px 20px; }
    .hero-stats { gap: 20px; }
    .stat-number { font-size: 28px; }
    .capsule-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 18px;
        padding: 12px 16px 60px;
    }
    .nav-inner { gap: 16px; }
    .nav-title { display: none; }
}

@media (max-width: 600px) {
    .hero { min-height: 85vh; padding: 30px 16px; }
    .hero-title { font-size: 32px; }
    .hero-tagline { font-size: 15px; }
    .hero-stats { gap: 16px; }
    .stat-number { font-size: 24px; }
    .hero-socials { flex-direction: column; gap: 10px; }
    .sticky-nav { padding: 10px 16px; }
    .capsule-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 8px 12px 50px;
    }
    .card-thumbnail { height: 120px; }
    .card-body { padding: 12px 14px 14px; }
    .card-title { font-size: 14px; }
    .card-description {
        font-size: 12px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .reader-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    .canvas-wrapper { padding: 10px 46px; }
    .nav-arrow { width: 34px; height: 56px; }
    .nav-prev { left: 4px; }
    .nav-next { right: 4px; }
    .filter-bar { padding: 10px 12px; }
    .filter-btn { padding: 6px 14px; font-size: 12px; }
    .shortcut-toast { display: none; }
}

@media (min-width: 1600px) {
    .capsule-grid { grid-template-columns: repeat(5, 1fr); }
    .card-thumbnail { height: 220px; }
    .card-title { font-size: 20px; }
}

/* Fullscreen reader */
.reader-container.fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
}

/* ===== FOCUS / ACCESSIBILITY ===== */
.filter-btn:focus-visible,
.ctrl-btn:focus-visible,
.capsule-card:focus-visible,
.scroll-top:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 2px;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .hero-aurora { animation: none; }
}

/* ===== NAV USER + LOGOUT ===== */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.nav-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-logout-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 12px 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}
.nav-logout-btn:hover {
    border-color: rgba(192,57,43,0.35);
    color: var(--accent-bright);
    background: rgba(192,57,43,0.06);
}
@media (max-width: 600px) {
    .nav-user-name { display: none; }
    .nav-logout-btn span { display: none; }
}

/* ===== WATCH BUTTON ===== */
/* Note: .watch-btn shares the .ctrl-btn class for hover transitions, but
   .ctrl-btn sets width:38px (icon-square). We override here so the icon +
   "Watch" label fit inside the button instead of overflowing visibly. */
.watch-btn {
    display: none;
    width: auto;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 13px 0 10px;
    border: none;
    border-radius: 8px;
    background: #ff0000;
    color: #fff;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(255, 0, 0, 0.3);
}
.watch-btn svg {
    flex-shrink: 0;
    color: #fff;
    width: 13px;
    height: 13px;
}
.watch-btn:hover {
    background: #cc0000;
    box-shadow: 0 4px 18px rgba(255, 0, 0, 0.45);
    transform: translateY(-1px);
}
.watch-btn.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: none;
    border: 1px solid var(--border);
}
.watch-btn.active svg { color: var(--text-secondary); }
.watch-btn.active:hover {
    background: var(--bg-hover);
    color: var(--text-white);
    transform: translateY(-1px);
}

/* ===== VIDEO PLAYER ===== */
.video-wrapper {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 8px;
    z-index: 2;
    container-type: size;
}
.video-wrapper.active {
    display: flex;
}
.video-wrapper iframe {
    /* Fit 16:9 perfectly inside any container — no cropping ever */
    width:  min(100cqw, calc(100cqh * 16 / 9));
    height: min(100cqh, calc(100cqw *  9 / 16));
    border: none;
    border-radius: 6px;
}

/* Make canvas-wrapper positioned so video can overlay it */
.canvas-wrapper {
    position: relative;
}
