/* ===== CSS VARIABLES ===== */
:root {
    --navy: #1a237e;
    --navy-dark: #0d1442;
    --cream: #f5f5f0;
    --gold: #ffd700;
    --gold-dim: #b8860b;
    --text-dark: #1a1a1a;
    --text-muted: #666;
    --card-shadow: 0 8px 32px rgba(26, 35, 126, 0.25);
    --card-hover-shadow: 0 16px 48px rgba(26, 35, 126, 0.35);
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Carousel dimensions */
    --carousel-card-width: 280px;
    --carousel-card-height: 392px;
    --carousel-radius: 500px;

    /* Grid thumbnail dimensions */
    --thumb-width: 180px;
    --thumb-height: 252px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cream);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== HERO SECTION ===== */
.hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
    padding: 3rem 2rem;
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    text-align: center;
}

.molecular-bg {
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image:
        radial-gradient(circle at 20% 30%, var(--gold) 2px, transparent 2px),
        radial-gradient(circle at 80% 70%, var(--gold) 2px, transparent 2px),
        radial-gradient(circle at 50% 50%, var(--gold) 1px, transparent 1px);
    background-size: 120px 120px, 150px 150px, 80px 80px;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
}

.title {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: clamp(2.5rem, 8vw, 5rem);
    color: white;
    letter-spacing: 0.05em;
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.title-accent {
    color: var(--gold);
    display: block;
    font-size: 0.6em;
    letter-spacing: 0.2em;
}

.subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-weight: 400;
    margin-top: 0.75rem;
    letter-spacing: 0.05em;
}

/* ===== 3D CAROUSEL SECTION ===== */
.carousel-section {
    background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy) 40%, var(--cream) 100%);
    padding: 2rem 1rem 3rem;
    overflow: visible;
    position: relative;
}

.carousel-viewport {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
    overflow: visible;
}

.carousel-stage {
    width: 100%;
    height: calc(var(--carousel-card-height) + 80px);
    perspective: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.carousel-track {
    position: relative;
    width: var(--carousel-card-width);
    height: var(--carousel-card-height);
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-track.spinning {
    transition: transform 2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.carousel-card {
    position: absolute;
    width: var(--carousel-card-width);
    height: var(--carousel-card-height);
    backface-visibility: hidden;
    transform-style: preserve-3d;
    cursor: pointer;
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.carousel-card.center {
    z-index: 10;
}

.carousel-card:not(.center) {
    opacity: 0.7;
    filter: brightness(0.8);
}

.carousel-card:not(.center):hover {
    opacity: 0.9;
    filter: brightness(0.95);
}

.carousel-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
}

.carousel-card.flipped .carousel-card-inner {
    transform: rotateY(180deg);
}

.carousel-card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.carousel-card-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-card-front {
    background: var(--navy);
}

.carousel-card-back {
    background: white;
    transform: rotateY(180deg);
}

/* Carousel navigation buttons */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition-smooth);
    z-index: 20;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn svg {
    width: 24px;
    height: 24px;
}

.carousel-prev {
    left: 1rem;
}

.carousel-next {
    right: 1rem;
}

/* Carousel controls */
.carousel-controls {
    position: relative;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.spin-btn {
    position: relative;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gold);
    color: var(--navy-dark);
    border: none;
    border-radius: 30px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.spin-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(255, 215, 0, 0.6);
}

.spin-btn:active {
    transform: scale(0.98);
}

.spin-btn svg {
    width: 20px;
    height: 20px;
}

.carousel-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    text-align: center;
}

/* ===== CONTROLS ===== */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.15);
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.filter-group select {
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--navy);
}

.expand-toggle {
    padding: 0.75rem 1.25rem;
    background: var(--navy);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.expand-toggle:hover {
    background: var(--navy-dark);
}

.card-count {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: var(--navy);
    color: white;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== ERA SECTIONS ===== */
.era-sections {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.era-group {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.era-group.hidden {
    display: none;
}

.era-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
}

.era-header:hover {
    background: #f8f8f8;
}

.era-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.era-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.25rem;
    letter-spacing: 0.03em;
    color: var(--navy);
}

.era-count {
    background: var(--navy);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.era-chevron {
    width: 24px;
    height: 24px;
    stroke: var(--text-muted);
    transition: transform 0.3s ease;
}

.era-group.expanded .era-chevron {
    transform: rotate(180deg);
}

.era-cards {
    display: none;
    padding: 0 1rem 1rem;
}

.era-group.expanded .era-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--thumb-width), 1fr));
    gap: 1rem;
}

/* ===== THUMBNAIL CARDS ===== */
.thumb-wrapper {
    aspect-ratio: 5 / 7;
    cursor: pointer;
    perspective: 800px;
    animation: fadeIn 0.3s ease-out;
}

.thumb-wrapper.hidden {
    display: none;
}

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

.thumb {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
}

.thumb.flipped {
    transform: rotateY(180deg);
}

.thumb-wrapper:hover .thumb:not(.flipped) {
    transform: translateY(-4px) rotateY(8deg);
}

.thumb-wrapper:hover .thumb.flipped {
    transform: translateY(-4px) rotateY(172deg);
}

.thumb-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.thumb-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-front {
    background: var(--navy);
}

.thumb-back {
    background: white;
    transform: rotateY(180deg);
}

.thumb-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 0.5rem 0.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
    color: white;
}

.thumb-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== LIGHTBOX ===== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
    padding: 2rem;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav svg {
    width: 24px;
    height: 24px;
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

.lightbox-content {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 85vh;
}

.lightbox-card-container {
    perspective: 1500px;
}

.lightbox-card {
    width: 400px;
    max-width: 90vw;
    aspect-ratio: 5 / 7;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.lightbox-card.flipped {
    transform: rotateY(180deg);
}

.lightbox-card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-front {
    background: var(--navy);
}

.lightbox-back {
    background: white;
    transform: rotateY(180deg);
}

.lightbox-card-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lightbox-hint {
    color: rgba(255, 255, 255, 0.5);
    margin-top: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
}

/* ===== LOADING STATE ===== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-muted);
}

.helix-loader {
    width: 60px;
    height: 60px;
    position: relative;
    margin-bottom: 1rem;
}

.strand {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid var(--navy);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.strand-1 {
    border-color: var(--navy) transparent transparent transparent;
}

.strand-2 {
    border-color: transparent transparent var(--gold) transparent;
    animation-delay: -0.75s;
}

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

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    stroke: #ccc;
    margin-bottom: 1rem;
}

/* ===== FOOTER ===== */
footer {
    background: var(--navy-dark);
    color: white;
    padding: 2.5rem 2rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-content p {
    opacity: 0.8;
}

.footer-credit {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--gold);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    :root {
        --carousel-card-width: 240px;
        --carousel-card-height: 336px;
        --carousel-radius: 400px;
    }
}

@media (max-width: 900px) {
    :root {
        --carousel-card-width: 200px;
        --carousel-card-height: 280px;
        --carousel-radius: 320px;
        --thumb-width: 150px;
        --thumb-height: 210px;
    }

    .carousel-btn {
        width: 44px;
        height: 44px;
    }

    .carousel-btn svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 2rem 1.5rem;
    }

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

    .card-count {
        margin-left: 0;
        text-align: center;
    }

    .carousel-stage {
        height: calc(var(--carousel-card-height) + 60px);
    }

    .carousel-prev {
        left: 0.5rem;
    }

    .carousel-next {
        right: 0.5rem;
    }

    .lightbox-card {
        width: 320px;
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }

    .era-group.expanded .era-cards {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 480px) {
    :root {
        --carousel-card-width: 180px;
        --carousel-card-height: 252px;
        --carousel-radius: 200px;
        --thumb-width: 130px;
    }

    .carousel-section {
        padding: 1.5rem 0.5rem 2rem;
    }

    .carousel-btn {
        width: 36px;
        height: 36px;
    }

    .lightbox-card {
        width: 280px;
    }

    .spin-btn {
        padding: 0.6rem 1.2rem;
        font-size: 1rem;
    }

    .era-name {
        font-size: 1.1rem;
    }

    .era-group.expanded .era-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* ===== ABOUT SECTION ===== */
.about-section {
    background: linear-gradient(180deg, var(--cream) 0%, #e8e8e0 100%);
    padding: 4rem 2rem;
    border-top: 1px solid rgba(26, 35, 126, 0.1);
}

.about-content {
    max-width: 900px;
    margin: 0 auto;
}

.about-content h2 {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: 2.5rem;
    color: var(--navy);
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    text-align: center;
}

.about-content > p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

.about-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2.5rem;
}

.about-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(26, 35, 126, 0.08);
}

.about-card h3 {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: 1.4rem;
    color: var(--navy);
    letter-spacing: 0.03em;
    margin-bottom: 1rem;
}

.about-card ol {
    margin-left: 1.25rem;
    margin-bottom: 1.5rem;
}

.about-card ol li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.about-card p {
    line-height: 1.7;
    color: var(--text-dark);
}

.about-links,
.about-contact {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(26, 35, 126, 0.1);
}

.about-card a {
    color: var(--navy);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.about-card a:hover {
    color: var(--gold-dim);
    text-decoration: underline;
}

@media (max-width: 600px) {
    .about-section {
        padding: 3rem 1.5rem;
    }

    .about-content h2 {
        font-size: 2rem;
    }

    .about-content > p {
        font-size: 1rem;
        text-align: left;
    }

    .about-details {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .about-card {
        padding: 1.5rem;
    }
}

/* ===== UTILITY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
