/* Google Fonts Import - Bold Typography System */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-color: #0d1a14;
    --card-bg: rgba(24, 40, 32, 0.92);
    --card-border: rgba(140, 160, 120, 0.2);
    --accent-color: #8fae7b;
    --accent-light: #b8d4a0;
    --accent-glow: rgba(143, 174, 123, 0.35);
    --text-primary: #f4f2ec;
    --text-secondary: #b8c4a8;
    --text-muted: #6a7860;
    --timeline-line: rgba(143, 174, 123, 0.4);
    --bird-link-color: #d4a574;
    --bird-link-hover: #e8c094;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

.loading-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 2rem;
    opacity: 0.9;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(143, 174, 123, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--accent-glow);
}

.loading-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Libre Baskerville', Georgia, serif;
    line-height: 1.85;
    overflow-x: hidden;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    text-align: center;
    padding: 6rem 1.5rem 4rem;
    margin-bottom: 3rem;
    background: radial-gradient(ellipse at top, rgba(201, 149, 108, 0.06) 0%, transparent 70%);
    position: relative;
}

header::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    margin: 1.5rem auto 0;
    opacity: 0.6;
}

h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text-primary);
    text-shadow: 0 2px 40px rgba(201, 149, 108, 0.15);
}

.subtitle {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 1rem;
}

/* Timeline Container */
.timeline {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 80px;
}

/* Hide default vertical line - now using dot nav */
.timeline::after {
    display: none;
}

/* Sticky Dot Navigation */
.dot-nav {
    position: fixed;
    left: 50%;
    top: 100px;
    transform: translateX(-50%);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.dot-nav.visible {
    opacity: 1;
}

.dot-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.4;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    cursor: pointer;
}

.dot:hover {
    opacity: 0.8;
    transform: scale(1.3);
}

.dot.active {
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    opacity: 1;
    box-shadow: 0 0 12px rgba(212, 165, 116, 0.6);
}

.dot.passed {
    background: var(--accent-color);
    opacity: 0.7;
}

/* Timeline Item (Card) */
.container {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.container.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Remove old dot connectors */
.container::after {
    display: none;
}

/* Pull alternating entries up for overlap */
.container.right,
.container.left:not(:first-child) {
    margin-top: -100px;
}

.container:first-child {
    margin-top: 0;
}

.left {
    left: 0;
}

.right {
    left: 50%;
}

.left::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 28px;
    width: 0;
    z-index: 1;
    right: 28px;
    border: medium solid transparent;
    border-width: 12px 0 12px 12px;
    border-left-color: rgba(200, 170, 130, 0.3);
}

.right::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 28px;
    width: 0;
    z-index: 1;
    left: 28px;
    border: medium solid transparent;
    border-width: 12px 12px 12px 0;
    border-right-color: rgba(200, 170, 130, 0.3);
}

/* Content Card */
.content {
    padding: 2.25rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.content:hover {
    transform: translateY(-6px);
    border-color: var(--accent-color);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.35),
        0 0 30px var(--accent-glow),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

/* Date Badge - Journal Style */
.date {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    padding: 0;
    padding-left: 0.75rem;
    background: transparent;
    color: var(--accent-color);
    border-radius: 0;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    border: none;
    border-left: 3px solid var(--accent-color);
}

/* Section Headings - Expressive Serif */
.content h2 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.85rem;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Body Text - Elegant Readability */
.content p {
    font-family: 'Libre Baskerville', Georgia, serif;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.85;
    margin-bottom: 1.25rem;
}

.content p em {
    font-style: italic;
    color: var(--accent-light);
}

/* Bird Name Links - Distinctive Styling */
.bird-link {
    color: var(--bird-link-color);
    text-decoration: none;
    font-weight: 700;
    font-variant: small-caps;
    letter-spacing: 0.02em;
    position: relative;
    transition: color 0.2s ease;
}

.bird-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--bird-link-color) 0%, transparent 100%);
    transform: scaleX(0.3);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.bird-link:hover {
    color: var(--bird-link-hover);
}

.bird-link:hover::after {
    transform: scaleX(1);
    background: linear-gradient(90deg, var(--bird-link-hover) 0%, transparent 100%);
}

/* Blockquote Styling */
blockquote {
    margin: 1.5rem 0 1.75rem 0;
    padding: 1.25rem 1.75rem;
    background: rgba(201, 149, 108, 0.06);
    border-left: 3px solid var(--accent-color);
    border-radius: 0 12px 12px 0;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

blockquote ul {
    margin: 1rem 0 0.5rem 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-style: normal;
    font-size: 0.8rem;
    line-height: 1.6;
}

blockquote li {
    margin-bottom: 0.35rem;
}

/* Read More Collapsible */
.collapsible-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.collapsible-content.expanded {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(201, 149, 108, 0.3);
    border-radius: 0;
    color: var(--accent-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0.5rem 0;
    margin: 0.25rem 0 0.75rem;
    transition: all 0.25s ease;
}

.read-more-btn::after {
    content: '↓';
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.read-more-btn.expanded::after {
    transform: rotate(180deg);
}

.read-more-btn:hover {
    color: var(--accent-light);
    border-bottom-color: var(--accent-color);
}

/* Media Handling */
.media-container {
    display: flex;
    gap: 8px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    position: relative;
}

.media-item {
    flex: 1 1 calc(50% - 4px);
    min-width: calc(50% - 4px);
    border-radius: 10px;
    overflow: visible;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Inner wrapper to clip the hover scale effect */
.media-item video,
.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 10px;
    clip-path: inset(0 round 10px);
}

.media-item:hover img,
.media-item:hover video {
    transform: scale(1.05);
}

/* Zoomed media items with focal point */
.media-item.zoomed {
    aspect-ratio: 4/3;
    overflow: hidden;
}

.media-item.zoomed img {
    object-fit: cover;
    transform: scale(var(--zoom, 1.5));
    transform-origin: var(--focus, center);
    transition: transform 0.3s ease;
}

.media-item.zoomed:hover img {
    transform: scale(calc(var(--zoom, 1.5) * 1.05));
}

/* LQIP Blur-up Effect */
.media-item.lqip {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.media-item.lqip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    background-size: cover;
    background-position: center;
    filter: blur(20px);
    transform: scale(1.1);
    border-radius: 10px;
    z-index: 1;
    transition: opacity 0.5s ease;
}

.media-item.lqip.loaded::before {
    opacity: 0;
}

.media-item.lqip img,
.media-item.lqip video {
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.media-item.lqip.loaded img,
.media-item.lqip.loaded video {
    opacity: 1;
}

/* Floating Caption Below Media - appears on hover, floats over content */
.media-caption-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.9);
    color: var(--text-primary);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 0.8rem;
    line-height: 1.5;
    text-align: left;
    border-radius: 0 0 8px 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 20;
    pointer-events: none;
}

.media-item:hover .media-caption-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.media-caption-overlay .bird-link {
    color: var(--bird-link-color);
    text-decoration: none;
    font-weight: 700;
    font-variant: small-caps;
}

.media-caption-overlay .bird-link:hover {
    color: var(--bird-link-hover);
}

img.full-width {
    flex: 1 1 100%;
}

/* Media Queries */
@media screen and (max-width: 768px) {

    /* Hide dot nav on mobile for cleaner experience */
    .dot-nav {
        display: none;
    }

    /* Reduce header size on mobile */
    header {
        padding: 3.5rem 1rem 3rem;
        margin-bottom: 1rem;
    }

    header::after {
        font-size: 1.5rem;
        margin-top: 1rem;
    }

    /* Adjust timeline padding */
    .timeline {
        padding: 1rem;
        padding-top: 40px;
    }

    .container {
        width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Remove arrow pointers on mobile */
    .container::before {
        display: none;
    }

    .left,
    .right {
        left: 0;
    }

    /* Remove overlap on mobile - stack cards normally */
    .container.right,
    .container.left:not(:first-child) {
        margin-top: 0;
    }

    /* Smaller card padding on mobile */
    .content {
        padding: 1.5rem;
    }

    .content h2 {
        font-size: 1.5rem;
        line-height: 1.25;
    }

    .content p {
        font-size: 0.9rem;
        line-height: 1.75;
    }

    .date {
        font-size: 0.7rem;
        padding: 0.35rem 0.6rem;
        padding-left: 0.6rem;
    }

    /* Stack media items vertically on mobile */
    .media-container {
        flex-direction: column;
    }

    .media-item {
        flex: 1 1 100%;
        max-width: 100%;
    }

    /* Ensure zoomed images still work properly on mobile */
    .media-item.zoomed {
        aspect-ratio: 4/3;
    }
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-modal.show {
    opacity: 1;
}

.lightbox-content-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-content {
    max-width: 800px;
    max-height: 80vh;
    border-radius: 12px;
    border: none;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

/* Lightbox Caption */
.lightbox-caption {
    text-align: left;
    color: var(--text-secondary);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.7;
    margin-top: 1.25rem;
    padding: 0;
    max-width: 800px;
    width: 100%;
    align-self: flex-start;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}

.lightbox-modal.show .lightbox-caption {
    opacity: 1;
    transform: translateY(0);
}

.lightbox-caption:empty {
    display: none;
}

.lightbox-caption .bird-link {
    color: var(--bird-link-color);
    text-decoration: none;
    font-weight: 700;
    font-variant: small-caps;
    letter-spacing: 0.02em;
    position: relative;
    transition: color 0.2s ease;
}

.lightbox-caption .bird-link:hover {
    color: var(--bird-link-hover);
}

/* Lightbox Buttons - Base */
.lightbox-btn {
    position: absolute;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1010;
    padding: 0;
    line-height: 1;
}

.lightbox-btn:hover {
    background: rgba(212, 165, 116, 0.3);
    border-color: var(--accent-color);
    transform: scale(1.1);
}

/* Close Button */
.close-btn {
    top: 20px;
    right: 20px;
    font-size: 1.8rem;
}

/* Nav Buttons */
.nav-btn {
    top: 50%;
}

.nav-btn:hover {
    transform: translateY(-50%) scale(1.1);
}

.prev-btn {
    left: 20px;
    transform: translateY(-50%);
}

.next-btn {
    right: 20px;
    transform: translateY(-50%);
}

@media screen and (max-width: 768px) {
    .prev-btn {
        left: 10px;
    }

    .next-btn {
        right: 10px;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}