@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@300;400;600&display=swap');

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

:root {
    --crimson: #8B1A1A;
    --crimson-light: #a82020;
    --dark: #1a1a1a;
    --mid: #555;
    --muted: #999;
    --border: #ddd;
    --bg: #fafafa;
    --card-bg: #fff;
    --gold: #b8860b;
}

body {
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--dark);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 32px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.header h1 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-style: italic;
    color: var(--crimson);
    letter-spacing: 1px;
    font-weight: 700;
}

.subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 300;
}

/* Main Content */
.main-content {
    display: flex;
    gap: 30px;
    flex: 1;
    align-items: start;
    padding: 24px 0;
}

.left-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.reel-section {
    width: 420px;
    flex-shrink: 0;
}

/* Protein Viewer */
.viewer-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.protein-viewer {
    width: 100%;
    height: clamp(280px, 50vh, 500px);
    background: #0a0a0a;
    border-radius: 4px;
    border: 1px solid #ccc;
    overflow: hidden;
    position: relative;
}

.viewer-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}


.viewer-hint {
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.5px;
}

/* Protein Card */
.card-section {
    display: flex;
    justify-content: center;
}

.protein-card {
    width: 100%;
    background: var(--card-bg);
    border-radius: 4px;
    padding: 28px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--crimson);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.type-badge {
    padding: 4px 12px;
    border-radius: 2px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #fff;
    background: var(--crimson);
}

/* Type-specific badge colors — muted, professional */
.type-badge.enzyme        { background: #8B1A1A; }
.type-badge.structural    { background: #1a4a7a; }
.type-badge.signaling     { background: #1a6b3a; }
.type-badge.transport     { background: #7a4a1a; }
.type-badge.immune        { background: #2a6b6b; color: #fff; }
.type-badge.receptor      { background: #3a2a7a; }
.type-badge.motor         { background: #6a1a6a; }
.type-badge.storage       { background: #5a4a2a; }
.type-badge.nucleic-acid  { background: #2a4a7a; }
.type-badge.regulatory    { background: #5a2a5a; }
.type-badge.channel       { background: #1a5a6a; }
.type-badge.photosynthetic{ background: #2a5a1a; }
.type-badge.viral         { background: #7a1a1a; }
.type-badge.antibiotic    { background: #6a3a1a; }
.type-badge.chaperone     { background: #4a1a6a; }
.type-badge.de-novo       { background: var(--gold); color: #fff; letter-spacing: 1.5px; }

.pdb-badge {
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    color: var(--muted);
    letter-spacing: 1px;
}

.protein-name {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 1.7rem;
    font-style: italic;
    color: var(--dark);
    margin-bottom: 6px;
    font-weight: 700;
}

.protein-description {
    color: var(--mid);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Stats */
.stats-container {
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.stat-label {
    width: 110px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--muted);
    text-transform: uppercase;
}

.stat-bar-container {
    flex: 1;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease-out;
}

.bio-bar {
    background: var(--crimson);
}

.notoriety-bar {
    background: #444;
}

.stat-value {
    width: 30px;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: right;
    color: var(--dark);
}

/* Discovery Section */
.discovery-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 2px;
    margin-bottom: 20px;
}

.discovery-label {
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.discovery-year {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--crimson);
}

/* Fun Fact */
.fun-fact-section {
    background: #f9f4f4;
    border-radius: 2px;
    padding: 16px;
    border-left: 3px solid var(--crimson);
}

.fun-fact-header {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--crimson);
    margin-bottom: 10px;
    font-weight: 600;
}

.sparkle {
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.fun-fact-text {
    color: var(--mid);
    font-size: 0.9rem;
    line-height: 1.7;
    text-align: center;
    font-style: italic;
    font-family: 'Libre Baskerville', Georgia, serif;
}

/* Navigation */
.navigation {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 28px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.nav-btn {
    padding: 12px 28px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--dark);
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Source Sans 3', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover {
    border-color: var(--crimson);
    color: var(--crimson);
}

.today-btn {
    background: var(--crimson);
    border-color: var(--crimson);
    color: #fff;
}

.today-btn:hover {
    background: var(--crimson-light);
    border-color: var(--crimson-light);
    color: #fff;
}

.arrow {
    font-size: 0.75rem;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 2px solid #333;
    border-top-color: var(--crimson);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Streak badge */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 4px 12px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.5px;
    min-height: 28px;
}

.streak-badge:empty {
    display: none;
}

.streak-badge .streak-flame {
    animation: flicker 1.8s ease-in-out infinite alternate;
}

.streak-badge.streak-milestone {
    border-color: var(--gold);
    color: var(--gold);
}

@keyframes flicker {
    0%   { transform: scaleY(1); opacity: 1; }
    100% { transform: scaleY(1.1) translateY(-1px); opacity: 0.8; }
}

/* Cache status indicator */
.cache-indicator {
    text-align: center;
    font-size: 0.72rem;
    min-height: 1.1em;
    color: transparent;
    letter-spacing: 0.5px;
}

.cache-indicator.cached {
    color: #2a6b3a;
}

.cache-indicator.live {
    color: var(--muted);
}

/* Instagram reel section */
.reel-section {
    padding: 20px;
    background: var(--card-bg);
    border-radius: 4px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--crimson);
}

.reel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--crimson);
    margin-bottom: 16px;
}

.reel-container {
    display: flex;
    justify-content: center;
}

/* Disabled nav buttons */
.nav-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

/* Footer calendar link */
.site-footer {
    text-align: center;
    padding: 16px 0 8px;
    border-top: 1px solid var(--border);
}

.calendar-link {
    color: var(--crimson);
    text-decoration: none;
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.calendar-link:hover { opacity: 1; }

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .reel-section {
        width: 100%;
    }

    .header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 500px) {
    .navigation {
        flex-direction: column;
        align-items: center;
    }

    .nav-btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }

    .viewer-controls {
        flex-direction: column;
        align-items: center;
    }

    .protein-card {
        padding: 16px;
    }

    .protein-name {
        font-size: 1.4rem;
    }

    .stat-label {
        width: 80px;
        font-size: 0.6rem;
    }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    .main-content {
        flex-direction: row;
        gap: 15px;
    }

    .protein-viewer {
        height: clamp(180px, 65vw, 280px);
    }

    .header {
        padding: 8px 0;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.78rem;
        margin-top: 2px;
    }

    .navigation {
        padding: 10px 0;
    }
}
