/* ==========================================
   digitaltelomere.com — Styles
   Bioluminescent Laboratory Aesthetic
   ========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #080812;
    color: #A8B8C8;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* --- Microscope Vignette Overlay --- */
#vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: radial-gradient(
        ellipse 70vmin 70vmin at center,
        transparent 55%,
        rgba(8, 8, 18, 0.4) 70%,
        #080812 100%
    );
    animation: vignettePulse 6s ease-in-out infinite;
    transition: background 3s ease;
}

#vignette-overlay.senescent {
    background: radial-gradient(
        ellipse 70vmin 70vmin at center,
        transparent 55%,
        rgba(232, 168, 64, 0.05) 65%,
        rgba(232, 168, 64, 0.08) 75%,
        #080812 100%
    );
}

@keyframes vignettePulse {
    0%, 100% {
        background-size: 100% 100%;
    }
    50% {
        background-size: 104% 104%;
    }
}

/* --- Magnification Level Sections --- */
.magnification-level {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#organism-level {
    min-height: 100vh;
    background-color: #080812;
}

#cellular-level {
    min-height: 120vh;
    background-color: #0C1020;
    transition: background-color 1.5s ease;
}

#chromosomal-level {
    min-height: 150vh;
    background-color: #0C1020;
    transition: background-color 1.5s ease;
}

#molecular-level {
    min-height: 100vh;
    background-color: #080812;
    transition: background-color 1.5s ease;
}

#sequence-level {
    min-height: 80vh;
    background-color: #080812;
    transition: background-color 1.5s ease;
}

/* --- Level Content --- */
.level-content {
    position: relative;
    z-index: 10;
    max-width: 40%;
    text-align: center;
    padding: 4rem 1.5rem;
}

@media (max-width: 768px) {
    .level-content {
        max-width: 85%;
    }
}

/* --- Typography --- */
.domain-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(2rem, 4.5vw, 3.8rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #E0F0FF;
    line-height: 1.1;
    margin-bottom: 0.25em;
}

.domain-suffix {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.6rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #5C7A8A;
    line-height: 1.1;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(2rem, 4.5vw, 3.8rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #E0F0FF;
    line-height: 1.1;
    margin-bottom: 2rem;
}

/* Character reveal animation for titles */
.section-title .char,
.domain-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.section-title .char.revealed,
.domain-title .char.revealed {
    opacity: 1;
    transform: translateY(0);
}

.body-text {
    max-width: 38ch;
    margin: 0 auto;
}

.body-text p {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    color: #A8B8C8;
    line-height: 1.75;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.body-text p.visible {
    opacity: 1;
    transform: translateY(0);
}

.pull-quote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.6rem, 3vw, 2.8rem);
    color: #D94F8A;
    line-height: 1.4;
    margin-bottom: 3rem;
    border: none;
    padding: 0;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.pull-quote.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Telomere End-Cap Dots --- */
.telomere-cap {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #00E5CC, #6B3FA0);
    box-shadow: 0 0 20px #00E5CC, 0 0 40px rgba(0, 229, 204, 0.3);
    position: relative;
    z-index: 10;
    transition: opacity 2s ease;
}

.telomere-cap-top {
    margin-bottom: 2rem;
}

.telomere-cap-bottom {
    margin-top: 2rem;
}

.telomere-cap.dimmed {
    opacity: 0.15;
    box-shadow: 0 0 8px rgba(0, 229, 204, 0.2);
}

/* --- Cell Division Animation (Organism Level) --- */
.cell-division-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    z-index: 1;
}

.cell {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        #00E5CC 0%,
        #6B3FA0 40%,
        transparent 70%
    );
    box-shadow:
        0 0 60px rgba(217, 79, 138, 0.2),
        0 0 120px rgba(0, 229, 204, 0.1);
    top: 50%;
    left: 50%;
}

.cell-a {
    animation: cellDriftLeft 12s ease-in-out infinite;
}

.cell-b {
    animation: cellDriftRight 12s ease-in-out infinite;
}

@keyframes cellDriftLeft {
    0%, 100% {
        transform: translate(-50%, -50%) translateX(-10px);
    }
    40% {
        transform: translate(-50%, -50%) translateX(-80px);
    }
    60% {
        transform: translate(-50%, -50%) translateX(-80px);
    }
}

@keyframes cellDriftRight {
    0%, 100% {
        transform: translate(-50%, -50%) translateX(10px);
    }
    40% {
        transform: translate(-50%, -50%) translateX(80px);
    }
    60% {
        transform: translate(-50%, -50%) translateX(80px);
    }
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00E5CC;
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(10px);
    }
}

/* --- Tissue Background (Cellular Level) --- */
.tissue-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-radial-gradient(
            circle at 25% 25%,
            transparent 0px,
            transparent 18px,
            rgba(0, 229, 204, 0.03) 18px,
            rgba(0, 229, 204, 0.03) 20px,
            transparent 20px,
            transparent 60px
        ),
        repeating-radial-gradient(
            circle at 75% 60%,
            transparent 0px,
            transparent 22px,
            rgba(107, 63, 160, 0.04) 22px,
            rgba(107, 63, 160, 0.04) 24px,
            transparent 24px,
            transparent 70px
        ),
        repeating-radial-gradient(
            circle at 50% 80%,
            transparent 0px,
            transparent 14px,
            rgba(0, 229, 204, 0.025) 14px,
            rgba(0, 229, 204, 0.025) 16px,
            transparent 16px,
            transparent 50px
        );
    opacity: 0.8;
    z-index: 1;
}

/* --- Chromosome SVGs (Chromosomal Level) --- */
.chromosome-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    pointer-events: none;
}

.chromosome {
    width: 120px;
    height: 400px;
    opacity: 0.3;
}

.chromosome-left {
    margin-right: 15vw;
}

.chromosome-right {
    margin-left: 15vw;
}

.chromosome-arm,
.chromosome-arm-mirror {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 2s ease-out;
}

.chromosome.drawn .chromosome-arm,
.chromosome.drawn .chromosome-arm-mirror {
    stroke-dashoffset: 0;
}

.telomere-svg-dot {
    filter: drop-shadow(0 0 8px #00E5CC);
}

/* --- Double Helix Background (Molecular Level) --- */
.helix-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200%;
    background:
        repeating-conic-gradient(
            from 0deg at 48% 50%,
            #1A2030 0deg,
            transparent 3deg,
            transparent 12deg,
            #1A2030 15deg,
            transparent 18deg,
            transparent 180deg
        ),
        repeating-conic-gradient(
            from 180deg at 52% 50%,
            #1A2030 0deg,
            transparent 3deg,
            transparent 12deg,
            #1A2030 15deg,
            transparent 18deg,
            transparent 180deg
        );
    background-size: 60px 60px;
    opacity: 0.15;
    animation: helixScroll 60s linear infinite;
    z-index: 1;
}

@keyframes helixScroll {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 -600px;
    }
}

/* --- Base-Pair Stream (Sequence Level) --- */
.base-pair-stream {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.base-pair-column {
    position: absolute;
    top: 100%;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    line-height: 1.6;
    opacity: 0.12;
    white-space: nowrap;
    animation: streamUp 30s linear infinite;
}

@keyframes streamUp {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-200vh);
    }
}

.base-a { color: #2DD882; }
.base-t { color: #D94F8A; }
.base-c { color: #00E5CC; }
.base-g { color: #E8A840; }

/* --- Pull Quote --- */
.pull-quote {
    max-width: 38ch;
    margin-left: auto;
    margin-right: auto;
}

/* --- Regenerate Dot --- */
.regenerate-container {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.regenerate-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, #00E5CC, #6B3FA0);
    border: none;
    cursor: pointer;
    box-shadow: 0 0 20px #00E5CC, 0 0 40px rgba(0, 229, 204, 0.3);
    animation: regeneratePulse 2s ease-in-out infinite;
    position: relative;
    padding: 0;
    outline: none;
    transition: box-shadow 0.3s ease;
}

.regenerate-dot:hover {
    box-shadow: 0 0 40px #00E5CC, 0 0 80px rgba(0, 229, 204, 0.5);
}

@keyframes regeneratePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.regenerate-label {
    display: block;
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: #5C7A8A;
    letter-spacing: 0.08em;
    white-space: nowrap;
    pointer-events: none;
}

/* --- Senescence Text --- */
.senescence-text {
    transition: color 3s ease;
}

.senescent .senescence-text {
    color: #E8A840;
}

/* --- Staggered fade-in for body text paragraphs --- */
.body-text p:nth-child(1) { transition-delay: 0s; }
.body-text p:nth-child(2) { transition-delay: 0.15s; }
.body-text p:nth-child(3) { transition-delay: 0.3s; }
.body-text p:nth-child(4) { transition-delay: 0.45s; }
.body-text p:nth-child(5) { transition-delay: 0.6s; }

/* --- Smooth scroll behavior for regeneration --- */
html.regenerating {
    scroll-behavior: smooth;
}

/* --- Selection color --- */
::selection {
    background: rgba(0, 229, 204, 0.2);
    color: #E0F0FF;
}
