/* ============================================================
   datatelomere.com - Fluorescence Microscopy Aesthetic
   ============================================================ */

/* Fonts: Cormorant Garamond, Inter, IBM Plex Mono (all Google Fonts)
   Palette: #0B0E1A, #111827, #00D4AA, #D946A8, #A0B4C8, #C8D6E5, #2A3A5C, #F0B429
   Layout: Timeline-vertical chromosome metaphor, left-aligned 680px column */

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

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

body {
    background-color: #0B0E1A;
    color: #A0B4C8;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 18px);
    line-height: 1.85;
    overflow-x: hidden;
}

/* --- Chromosome Position Indicator --- */
#chromosome-indicator {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    height: 40vh;
    width: 3px;
    z-index: 100;
    pointer-events: none;
}

#indicator-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #2A3A5C;
    border-radius: 2px;
    opacity: 0.5;
}

#indicator-trail {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 0%;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 212, 170, 0.15) 40%, #00D4AA 100%);
    opacity: 0.3;
    border-radius: 2px;
    transition: height 0.1s linear;
}

#indicator-dot {
    position: absolute;
    top: 0%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #00D4AA;
    border-radius: 50%;
    box-shadow: 0 0 12px #00D4AA, 0 0 24px rgba(0, 212, 170, 0.4);
    transition: top 0.1s linear;
    z-index: 2;
}

/* --- Telomere Cap Sections --- */
.telomere-cap {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0B0E1A;
    overflow: hidden;
}

/* --- Hero Section --- */
#hero {
    background: #0B0E1A;
}

.telomere-structure {
    position: relative;
    width: 400px;
    height: 300px;
}

#hero-svg {
    width: 100%;
    height: 100%;
}

.telomere-ellipse {
    transform-origin: center;
}

/* Breathing animation only applied after opening sequence reveals ellipses */
.telomere-ellipse.breathing {
    animation: telomere-breathe 6s ease-in-out infinite, telomere-hue-rotate 10s ease-in-out infinite alternate;
}

.te-1.breathing { animation-delay: 0s, 0s; }
.te-2.breathing { animation-delay: 0.5s, 0.7s; }
.te-3.breathing { animation-delay: 1.0s, 1.4s; }
.te-4.breathing { animation-delay: 1.5s, 2.1s; }
.te-5.breathing { animation-delay: 2.0s, 2.8s; }
.te-6.breathing { animation-delay: 2.5s, 3.5s; }
.te-7.breathing { animation-delay: 3.0s, 4.2s; }

@keyframes telomere-breathe {
    0%, 100% {
        transform: scale(1.0);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.03);
        opacity: 1.0;
    }
}

@keyframes telomere-hue-rotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(15deg); }
}

/* --- Hero Title --- */
#hero-title {
    text-align: center;
    margin-top: 24px;
    position: relative;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#typewriter-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(32px, 8vw, 100px);
    letter-spacing: 0.12em;
    color: #C8D6E5;
    position: absolute;
    opacity: 0;
    transition: opacity 0.6s ease;
    white-space: nowrap;
}

#hero-title-final {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(32px, 8vw, 100px);
    letter-spacing: 0.12em;
    color: #C8D6E5;
    opacity: 0;
    position: absolute;
    transition: opacity 0.6s ease;
    white-space: nowrap;
}

/* --- Hero Chromosome Line --- */
#hero-line {
    width: 2px;
    height: 120px;
    margin-top: 30px;
}

#hero-line svg {
    width: 2px;
    height: 120px;
}

#chromosome-line {
    transition: stroke-dashoffset 1s ease-out;
}

/* --- Chromosome Bands --- */
.chromosome-band {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.band-dark {
    background-color: #0D1117;
}

.band-navy {
    background-color: #111827;
}

/* Subtle G-banding pattern (Giemsa-stained chromosome reference) */
.chromosome-band::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 18px,
        rgba(0, 212, 170, 0.02) 18px,
        rgba(0, 212, 170, 0.02) 20px,
        transparent 20px,
        transparent 34px,
        rgba(0, 212, 170, 0.04) 34px,
        rgba(0, 212, 170, 0.04) 38px
    );
    pointer-events: none;
}

.band-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 20vw;
    color: #00D4AA;
    opacity: 0.03;
    pointer-events: none;
    user-select: none;
    line-height: 1;
}

.band-content {
    position: relative;
    max-width: 680px;
    margin-left: 15vw;
    padding: 120px 30px;
    z-index: 1;
}

/* --- Typography --- */
.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(32px, 5vw, 72px);
    letter-spacing: 0.02em;
    color: #C8D6E5;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.body-text {
    color: #A0B4C8;
    margin-bottom: 28px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #00D4AA;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #2A3A5C;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* Warning amber for data-integrity alerts */
.data-label.warning {
    color: #F0B429;
    border-top-color: #F0B429;
}

/* Fluorescent dot annotation for key terms (FISH probe reference) */
.body-text strong,
.body-text em {
    color: #C8D6E5;
    position: relative;
    font-style: normal;
}

.body-text strong {
    font-weight: 400;
}

.body-text strong::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, #00D4AA 0%, rgba(0, 212, 170, 0.4) 50%, transparent 100%);
    box-shadow: 0 0 6px rgba(0, 212, 170, 0.6);
}

.body-text em::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, #D946A8 0%, rgba(217, 70, 168, 0.4) 50%, transparent 100%);
    box-shadow: 0 0 6px rgba(217, 70, 168, 0.6);
}

/* Progressive disclosure - visible state */
.band-content.visible .section-title,
.band-content.visible .body-text,
.band-content.visible .data-label {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger the reveal timing */
.band-content.visible .section-title {
    transition-delay: 0s;
}

.band-content.visible .body-text:nth-child(2) {
    transition-delay: 0.15s;
}

.band-content.visible .body-text:nth-child(3) {
    transition-delay: 0.3s;
}

.band-content.visible .data-label {
    transition-delay: 0.45s;
}

/* --- Strand Connectors --- */
.strand-connector {
    width: 100%;
    height: 120px;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.strand-connector svg {
    width: 100px;
    height: 120px;
}

.sc-dark-to-navy {
    background: linear-gradient(to bottom, #0D1117, #111827);
}

.sc-navy-to-dark {
    background: linear-gradient(to bottom, #111827, #0D1117);
}

.sc-dark-to-void {
    background: linear-gradient(to bottom, #0D1117, #0B0E1A);
}

.sc-void-to-navy {
    background: linear-gradient(to bottom, #0B0E1A, #111827);
}

.sc-navy-to-void {
    background: linear-gradient(to bottom, #111827, #0B0E1A);
}

/* --- Centromere Constriction --- */
.centromere-section {
    position: relative;
    width: 100%;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0B0E1A;
    overflow: hidden;
}

.centromere-visual {
    width: 400px;
    height: 200px;
    position: relative;
}

.centromere-svg {
    width: 100%;
    height: 100%;
}

.centromere-ellipse {
    transition: all 1.2s ease;
}

/* Centromere pinch animation when active */
.centromere-section.active .centromere-left {
    transform: translateX(10px);
    opacity: 0.5;
}

.centromere-section.active .centromere-left-inner {
    transform: translateX(15px);
    opacity: 0.4;
}

.centromere-section.active .centromere-right {
    transform: translateX(-10px);
    opacity: 0.5;
}

.centromere-section.active .centromere-right-inner {
    transform: translateX(-15px);
    opacity: 0.4;
}

.centromere-content {
    text-align: center;
    margin-top: 24px;
}

.centromere-text-wrapper {
    max-width: 400px;
    margin: 0 auto;
    transition: clip-path 1s ease;
    clip-path: inset(0);
}

.centromere-section.active .centromere-text-wrapper {
    clip-path: inset(0 10% 0 10%);
}

.centromere-content .data-label {
    opacity: 1;
    transform: none;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    color: #D946A8;
}

.centromere-subtext {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #2A3A5C;
    letter-spacing: 0.05em;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 1s ease 0.5s;
}

.centromere-section.active .centromere-subtext {
    opacity: 1;
}

/* --- Terminal Cap --- */
.terminal-cap {
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#terminal-telomere {
    width: 400px;
    height: 300px;
    position: relative;
}

#dissolution-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#terminal-message {
    text-align: center;
    max-width: 680px;
    padding: 40px 30px;
    opacity: 0;
    transition: opacity 1.5s ease;
}

#terminal-message.visible {
    opacity: 1;
}

.terminal-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(32px, 5vw, 72px);
    letter-spacing: 0.08em;
    color: #C8D6E5;
    margin-bottom: 20px;
    opacity: 1;
    transform: none;
}

.terminal-text {
    color: #A0B4C8;
    margin-bottom: 24px;
    opacity: 1;
    transform: none;
}

.terminal-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #00D4AA;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 1;
    transform: none;
    border-top: none;
    padding-top: 0;
    margin-top: 20px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .band-content {
        margin-left: auto;
        margin-right: auto;
        padding: 80px 24px;
        max-width: 90%;
    }

    #chromosome-indicator {
        right: 12px;
    }

    .telomere-structure {
        width: 280px;
        height: 210px;
    }

    #terminal-telomere {
        width: 280px;
        height: 210px;
    }

    .centromere-visual {
        width: 280px;
        height: 140px;
    }

    .band-watermark {
        font-size: 30vw;
    }

    #hero-title {
        height: 70px;
    }

    .body-text strong::before,
    .body-text em::before {
        left: -10px;
        width: 5px;
        height: 5px;
    }
}

@media (max-width: 480px) {
    .band-content {
        padding: 60px 20px;
    }

    .telomere-structure {
        width: 220px;
        height: 165px;
    }

    #terminal-telomere {
        width: 220px;
        height: 165px;
    }

    .centromere-visual {
        width: 220px;
        height: 110px;
    }
}
