/* ============================================
   20241204.com - A Cabinet of Aquatic Curiosities
   Dark-Academia meets Marine Biology
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --color-oxblood: #1a0a0a;
    --color-gilt: #c9a84c;
    --color-parchment: #e8dcc8;
    --color-ink: #0d0d0d;
    --color-amber: #d4943a;
    --color-teal: #1a3a3a;
    --color-cream: #f0e6d3;
    --color-sepia: #8a7a66;
    --color-brass: #b8942e;
    --color-deep: #0a1a1a;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Cormorant Garamond', Garamond, serif;
    --font-mono: 'Space Mono', 'Courier New', monospace;

    --bg-depth: #1a0a0a;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.7;
    color: var(--color-cream);
    background-color: var(--bg-depth);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Water Caustic Overlay --- */
.water-caustic {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
}

.water-caustic::before,
.water-caustic::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
}

.water-caustic::before {
    background: radial-gradient(ellipse at 30% 40%, #c9a84c 0%, transparent 50%),
                radial-gradient(ellipse at 70% 60%, #c9a84c 0%, transparent 50%),
                radial-gradient(ellipse at 50% 30%, #c9a84c 0%, transparent 40%);
    animation: caustic1 20s ease-in-out infinite;
}

.water-caustic::after {
    background: radial-gradient(ellipse at 60% 50%, #c9a84c 0%, transparent 45%),
                radial-gradient(ellipse at 40% 70%, #c9a84c 0%, transparent 50%),
                radial-gradient(ellipse at 20% 20%, #c9a84c 0%, transparent 35%);
    animation: caustic2 30s ease-in-out infinite;
}

@keyframes caustic1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(5%, 3%) rotate(2deg); }
    66% { transform: translate(-3%, -5%) rotate(-1deg); }
}

@keyframes caustic2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-4%, 6%) rotate(-2deg); }
    50% { transform: translate(6%, -3%) rotate(1deg); }
    75% { transform: translate(-2%, -4%) rotate(3deg); }
}

/* --- Header: Library Shelf Strip --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: linear-gradient(180deg, var(--color-oxblood) 0%, rgba(26, 10, 10, 0.95) 100%);
    border-bottom: 1px solid rgba(184, 148, 46, 0.3);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-brass), transparent);
    opacity: 0.5;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 40px;
}

.header-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-gilt);
    letter-spacing: 0.05em;
}

.header-links {
    list-style: none;
    display: flex;
    gap: 32px;
}

.header-links a {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-sepia);
    text-decoration: none;
    transition: color 0.3s ease;
}

.header-links a:hover {
    color: var(--color-gilt);
}

/* --- Hero Section --- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--color-oxblood);
}

.hero-duotone-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(201, 168, 76, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
}

.hero-ornament {
    margin: 0 auto;
    width: 200px;
}

.hero-ornament-top {
    margin-bottom: 30px;
}

.hero-ornament-bottom {
    margin-top: 30px;
}

.ornament-line {
    width: 100%;
    height: auto;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    color: var(--color-cream);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 12px;
}

.hero-title-dot {
    color: var(--color-gilt);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 300;
    font-style: italic;
    color: var(--color-sepia);
    letter-spacing: 0.05em;
    margin-bottom: 40px;
}

.hero-specimen {
    margin: 20px auto 20px;
    max-width: 400px;
}

.hero-fish {
    width: 100%;
    height: auto;
    opacity: 0.85;
}

.hero-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-sepia);
    margin-top: 10px;
}

/* Scroll Indicator - Bubble Trail */
.scroll-indicator {
    position: relative;
    margin-top: 50px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.bubble {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-gilt);
    opacity: 0;
    animation: bubbleFloat 2.5s ease-in-out infinite;
}

.bubble-1 { animation-delay: 0s; width: 4px; height: 4px; }
.bubble-2 { animation-delay: 0.3s; width: 5px; height: 5px; }
.bubble-3 { animation-delay: 0.6s; }
.bubble-4 { animation-delay: 0.9s; width: 5px; height: 5px; }
.bubble-5 { animation-delay: 1.2s; width: 4px; height: 4px; }

@keyframes bubbleFloat {
    0% { opacity: 0; transform: translateY(0); }
    30% { opacity: 0.6; }
    60% { opacity: 0.3; }
    100% { opacity: 0; transform: translateY(30px); }
}

/* --- Timeline Section --- */
.timeline-section {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 100px 40px 60px;
    z-index: 2;
}

/* Central Brass Timeline Rule */
.timeline-rule {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    transform: translateX(-50%);
    width: 3px;
    z-index: 0;
}

.timeline-rule-line {
    position: sticky;
    top: 60px;
    width: 3px;
    height: calc(100vh - 120px);
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--color-brass) 10%,
        var(--color-gilt) 50%,
        var(--color-brass) 90%,
        transparent 100%
    );
    opacity: 0.6;
    border-radius: 2px;
}

.timeline-rule-line::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(201, 168, 76, 0.15) 50%,
        transparent 100%
    );
}

/* --- Timeline Entries --- */
.timeline-entry {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 80px;
    z-index: 2;
}

.timeline-entry-left {
    flex-direction: row;
    padding-right: calc(50% + 40px);
}

.timeline-entry-right {
    flex-direction: row-reverse;
    padding-left: calc(50% + 40px);
}

/* Initial hidden states for animation */
.timeline-entry-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.timeline-entry-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.timeline-entry.visible {
    opacity: 1;
    transform: translateX(0);
}

/* --- Timeline Medallions --- */
.timeline-medallion {
    position: absolute;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    width: 64px;
    height: 64px;
    z-index: 5;
    transition: transform 1s ease;
}

.medallion-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 8px rgba(201, 168, 76, 0.3));
}

.timeline-medallion.rotated {
    transform: translateX(-50%) rotate(360deg);
}

/* --- Timeline Panels --- */
.timeline-panel {
    position: relative;
    background: rgba(26, 10, 10, 0.7);
    border: 1px solid rgba(184, 148, 46, 0.25);
    padding: 36px 32px;
    backdrop-filter: blur(4px);
}

.timeline-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(184, 148, 46, 0.1);
    margin: 3px;
    pointer-events: none;
}

/* Scale pattern background */
.timeline-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 0% 0%, rgba(201, 168, 76, 0.03) 50%, transparent 50%),
        radial-gradient(circle at 100% 0%, rgba(201, 168, 76, 0.03) 50%, transparent 50%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    pointer-events: none;
    opacity: 0.5;
}

.panel-left {
    margin-right: 0;
}

.panel-right {
    margin-left: 0;
}

/* Gilt Corner Ornaments */
.panel-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    z-index: 3;
    transition: transform 0.3s ease;
}

.panel-corner-tl {
    top: -1px;
    left: -1px;
    border-top: 2px solid var(--color-brass);
    border-left: 2px solid var(--color-brass);
}

.panel-corner-tr {
    top: -1px;
    right: -1px;
    border-top: 2px solid var(--color-brass);
    border-right: 2px solid var(--color-brass);
}

.panel-corner-bl {
    bottom: -1px;
    left: -1px;
    border-bottom: 2px solid var(--color-brass);
    border-left: 2px solid var(--color-brass);
}

.panel-corner-br {
    bottom: -1px;
    right: -1px;
    border-bottom: 2px solid var(--color-brass);
    border-right: 2px solid var(--color-brass);
}

.timeline-panel:hover .panel-corner {
    transform: scale(1.3);
}

.panel-date {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-brass);
    margin-bottom: 12px;
}

.panel-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--color-cream);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    line-height: 1.2;
}

.panel-taxonomy {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-sepia);
    margin-bottom: 20px;
    font-style: normal;
}

.panel-body {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    color: var(--color-parchment);
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.panel-body:last-child {
    margin-bottom: 0;
}

/* --- Betta Fin Dividers --- */
.betta-divider {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px 0;
    z-index: 2;
}

.betta-fin-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.betta-fin-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.betta-fin-path-secondary {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.4s ease-in-out 0.2s;
}

.betta-divider.visible .betta-fin-path,
.betta-divider.visible .betta-fin-path-secondary {
    stroke-dashoffset: 0;
}

/* --- Coral Divider --- */
.coral-divider {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px 0;
    z-index: 2;
}

.coral-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.coral-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s ease-in-out;
}

.coral-divider.visible .coral-path {
    stroke-dashoffset: 0;
}

/* Stagger each coral branch */
.coral-divider.visible .coral-path:nth-child(1) { transition-delay: 0s; }
.coral-divider.visible .coral-path:nth-child(2) { transition-delay: 0.15s; }
.coral-divider.visible .coral-path:nth-child(3) { transition-delay: 0.25s; }
.coral-divider.visible .coral-path:nth-child(4) { transition-delay: 0.35s; }
.coral-divider.visible .coral-path:nth-child(5) { transition-delay: 0.45s; }
.coral-divider.visible .coral-path:nth-child(6) { transition-delay: 0.1s; }
.coral-divider.visible .coral-path:nth-child(7) { transition-delay: 0.2s; }
.coral-divider.visible .coral-path:nth-child(8) { transition-delay: 0.3s; }
.coral-divider.visible .coral-path:nth-child(9) { transition-delay: 0.4s; }
.coral-divider.visible .coral-path:nth-child(10) { transition-delay: 0.5s; }

/* --- Aquarium Full-Bleed Panel --- */
.aquarium-panel {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 60px;
    margin-bottom: 60px;
    background: linear-gradient(
        135deg,
        var(--color-teal) 0%,
        var(--color-oxblood) 40%,
        var(--color-ink) 100%
    );
}

.aquarium-duotone {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(201, 168, 76, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 30%, rgba(212, 148, 58, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(26, 58, 58, 0.4) 0%, transparent 60%);
    mix-blend-mode: screen;
    pointer-events: none;
}

.aquarium-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 700px;
    padding: 80px 40px;
}

.aquarium-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--color-cream);
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

.aquarium-text {
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 1.3vw, 1.2rem);
    line-height: 1.8;
    color: var(--color-parchment);
    font-style: italic;
}

/* --- Deep Ocean Footer --- */
.deep-ocean-footer {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 80px 40px;
}

.footer-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        var(--bg-depth) 0%,
        var(--color-deep) 30%,
        #050a0a 100%
    );
}

.footer-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 600px;
}

.footer-ornament {
    margin: 0 auto 30px;
    width: 200px;
}

.footer-ornament-svg {
    width: 100%;
    height: auto;
}

.footer-text {
    font-family: var(--font-body);
    font-size: clamp(1.1rem, 1.5vw, 1.3rem);
    font-style: italic;
    color: var(--color-sepia);
    line-height: 1.9;
    margin-bottom: 24px;
}

.footer-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(138, 122, 102, 0.5);
}

.footer-sea-fans {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.sea-fan-left {
    position: absolute;
    left: 20px;
    bottom: 0;
    width: 150px;
    height: auto;
}

.sea-fan-right {
    position: absolute;
    right: 20px;
    bottom: 0;
    width: 150px;
    height: auto;
}

/* --- Bioluminescent Particles --- */
.bioluminescent-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    bottom: -10px;
    left: var(--x);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--color-gilt);
    opacity: 0;
    animation: particleRise var(--duration) ease-in-out var(--delay) infinite;
}

.particle::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.4) 0%, transparent 70%);
}

@keyframes particleRise {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0);
    }
    10% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.25;
        transform: translateY(-120px) translateX(15px);
    }
    90% {
        opacity: 0.1;
    }
    100% {
        opacity: 0;
        transform: translateY(-280px) translateX(-10px);
    }
}

/* --- Responsive Design --- */
@media (max-width: 900px) {
    .timeline-rule {
        left: 30px;
    }

    .timeline-medallion {
        left: 30px;
    }

    .timeline-entry-left,
    .timeline-entry-right {
        padding-left: 70px;
        padding-right: 0;
        flex-direction: row;
    }

    .timeline-entry-right {
        flex-direction: row;
    }

    .header-links {
        gap: 16px;
    }

    .header-links a {
        font-size: 9px;
    }
}

@media (max-width: 600px) {
    .header-nav {
        padding: 10px 20px;
    }

    .header-links {
        gap: 10px;
    }

    .header-links a {
        font-size: 8px;
        letter-spacing: 0.1em;
    }

    .timeline-section {
        padding: 80px 16px 40px;
    }

    .timeline-panel {
        padding: 24px 20px;
    }

    .aquarium-content {
        padding: 60px 24px;
    }

    .hero-content {
        padding: 20px;
    }

    .footer-content {
        padding: 0 20px;
    }
}

/* --- Selection Styles --- */
::selection {
    background: rgba(201, 168, 76, 0.3);
    color: var(--color-cream);
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-oxblood);
}

::-webkit-scrollbar-thumb {
    background: var(--color-brass);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gilt);
}