/* DNA Helix Navigation Styles */
.dna-nav {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    width: 120px;
    height: 80vh;
    max-height: 500px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.dna-helix-nav {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* DNA Strand Animations */
.dna-strand {
    animation: strandPulse 3s ease-in-out infinite;
}

.strand-1 {
    animation-delay: 0s;
}

.strand-2 {
    animation-delay: 1.5s;
}

@keyframes strandPulse {
    0%, 100% {
        stroke-opacity: 0.8;
        filter: drop-shadow(0 0 2px currentColor);
    }
    50% {
        stroke-opacity: 1;
        filter: drop-shadow(0 0 6px currentColor);
    }
}

/* Base pairs animation */
.base-pairs line {
    animation: basePairGlow 2s ease-in-out infinite;
}

.base-pairs line:nth-child(odd) {
    animation-delay: 0.5s;
}

@keyframes basePairGlow {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
}

/* Navigation nucleotide points */
.nav-point {
    cursor: pointer;
    text-decoration: none;
}

.nav-nucleotide {
    fill: #ffffff;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.nav-nucleotide-ring {
    fill: none;
    stroke: #ffffff;
    stroke-width: 2;
    opacity: 0;
    transition: all 0.3s ease;
}

.nav-point:hover .nav-nucleotide {
    opacity: 1;
    transform-origin: center;
    filter: drop-shadow(0 0 8px #ffffff);
}

.nav-point:hover .nav-nucleotide-ring {
    opacity: 0.8;
    animation: ringPulse 1s ease-in-out infinite;
}

.nav-point.active .nav-nucleotide {
    /* fill: #ffd700; */
    opacity: 0;
    filter: drop-shadow(0 0 10px #ffd700);
}

.nav-point.active .nav-text {
    opacity: 0;
}

.nav-point .transcription-line, .nav-point .transcription-label {
    opacity: 0;
}

.nav-point.active .transcription-label {
    transition: x 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                y 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 700;
    letter-spacing: 0.5px;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6));
    opacity: 1;
}

.nav-point.active .transcription-line {
    animation: transcriptionGlow 2s ease-in-out infinite;
    opacity: 1;
}

/* .nav-point.active .nav-nucleotide-ring {
    opacity: 0;
    stroke: #ffd700;
    animation: ringPulse 1.5s ease-in-out infinite;
} */

@keyframes ringPulse {
    0%, 100% {
        stroke-width: 2;
        opacity: 0.8;
    }
    50% {
        stroke-width: 3;
        opacity: 1;
    }
}

/* Navigation text labels */
.nav-text {
    fill: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    text-anchor: start;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-point:hover .nav-text {
    opacity: 1;
}
/* .nav-point.active .nav-text {
    opacity: 1;
} */

/* DNA Polymerase Enzyme */
.dna-polymerase {
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    /* transform-origin: center; */
    animation: polymeraseIdle 2s ease-in-out infinite;
}

@keyframes polymeraseIdle {
    0%, 100% {
        transform: translate(50px, 50px) scale(1) rotate(0deg);
    }
    25% {
        transform: translate(50px, 50px) scale(1.05) rotate(2deg);
    }
    50% {
        transform: translate(50px, 50px) scale(1) rotate(0deg);
    }
    75% {
        transform: translate(50px, 50px) scale(1.05) rotate(-2deg);
    }
}

/* Polymerase active animation when moving */
.dna-polymerase.moving {
    animation: polymeraseMoving 0.3s ease-in-out infinite;
}

@keyframes polymeraseMoving {
    0%, 100% {
        transform: scale(1.1) rotate(0deg);
    }
    50% {
        transform: scale(1.15) rotate(3deg);
    }
}

/* Polymerase at different positions (vertical) */
.dna-polymerase[data-position="0"] {
    animation: polymerasePos0 2s ease-in-out infinite;
}
.dna-polymerase[data-position="1"] {
    animation: polymerasePos1 2s ease-in-out infinite;
}
.dna-polymerase[data-position="2"] {
    animation: polymerasePos2 2s ease-in-out infinite;
}
.dna-polymerase[data-position="3"] {
    animation: polymerasePos3 2s ease-in-out infinite;
}
.dna-polymerase[data-position="4"] {
    animation: polymerasePos4 2s ease-in-out infinite;
}

@keyframes polymerasePos0 {
    0%, 100% { transform: translate(50px, 50px) scale(1) rotate(0deg); }
    25% { transform: translate(48px, 50px) scale(1.05) rotate(2deg); }
    75% { transform: translate(52px, 50px) scale(1.05) rotate(-2deg); }
}
@keyframes polymerasePos1 {
    0%, 100% { transform: translate(50px, 140px) scale(1) rotate(0deg); }
    25% { transform: translate(48px, 140px) scale(1.05) rotate(2deg); }
    75% { transform: translate(52px, 140px) scale(1.05) rotate(-2deg); }
}
@keyframes polymerasePos2 {
    0%, 100% { transform: translate(50px, 230px) scale(1) rotate(0deg); }
    25% { transform: translate(48px, 230px) scale(1.05) rotate(2deg); }
    75% { transform: translate(52px, 230px) scale(1.05) rotate(-2deg); }
}
@keyframes polymerasePos3 {
    0%, 100% { transform: translate(50px, 320px) scale(1) rotate(0deg); }
    25% { transform: translate(48px, 320px) scale(1.05) rotate(2deg); }
    75% { transform: translate(52px, 320px) scale(1.05) rotate(-2deg); }
}
@keyframes polymerasePos4 {
    0%, 100% { transform: translate(50px, 410px) scale(1) rotate(0deg); }
    25% { transform: translate(48px, 410px) scale(1.05) rotate(2deg); }
    75% { transform: translate(52px, 410px) scale(1.05) rotate(-2deg); }
}

/* ============================================
   DNA Strand Unzipping Effect Styles
   ============================================ */

/* DNA Segment base styles */
.dna-segment {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Strand segments - default closed state */
.strand-segment {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Base pairs in segments */
.segment-pairs .base-pair {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* ---- Unzipped state for active segment ---- */
.dna-segment.unzipped .strand-1 {
    transform: translateX(-8px);
    filter: drop-shadow(0 0 4px #46dff0);
}

.dna-segment.unzipped .strand-2 {
    transform: translateX(8px);
    filter: drop-shadow(0 0 4px #e90c59);
}

.dna-segment[data-segment="1"].unzipped .strand-1 {
    d: path("M 54 80 Q 75 90, 50 115 Q 25 135, 58.5 170"); /* Example of a more "open" curve */
}

.dna-segment[data-segment="1"].partially-unzipped-next .strand-1 {
    d: path("M 52 80 Q 75 90, 50 115 Q 25 135, 55 170"); 
}


.dna-segment[data-segment="1"].unzipped .strand-2 {
    d: path("M 46 80 Q 25 90, 50 115 Q 75 135, 40 170"); /* Example of a more "open" curve */
}

.dna-segment[data-segment="1"].partially-unzipped-next .strand-2 {
    d: path("M 47 80 Q 25 90, 50 115 Q 75 135, 45 170"); 
}


.dna-segment[data-segment="2"].unzipped .strand-1 {
    d: path("M 54 170 Q 75 180, 50 205 Q 25 225, 59 260"); /* Example of a more "open" curve */
}

.dna-segment[data-segment="2"].partially-unzipped-next .strand-1 {
    d: path("M 52 170 Q 75 180, 50 205 Q 25 225, 55 260"); 
}


.dna-segment[data-segment="2"].unzipped .strand-2 {
    d: path("M 46 170 Q 25 180, 50 205 Q 75 225, 40 260"); /* Example of a more "open" curve */
}

.dna-segment[data-segment="2"].partially-unzipped-next .strand-2 {
    d: path("M 47 170 Q 25 180, 50 205 Q 75 225, 45 260"); 
}


.dna-segment[data-segment="3"].unzipped .strand-1 {
    d: path("M 54 260 Q 75 270, 50 295 Q 25 315, 59 350"); /* Example of a more "open" curve */
}

.dna-segment[data-segment="3"].partially-unzipped-next .strand-1 {
    d: path("M 52 260 Q 75 270, 50 295 Q 25 315, 55 350"); 
}


.dna-segment[data-segment="3"].unzipped .strand-2 {
    d: path("M 46 260 Q 25 270, 50 295 Q 75 315, 40 350"); /* Example of a more "open" curve */
}

.dna-segment[data-segment="3"].partially-unzipped-next .strand-2 {
    d: path("M 47 260 Q 25 270, 50 295 Q 75 315, 45 350"); 
}


.dna-segment[data-segment="4"].unzipped .strand-1 {
    d: path("M 54 350 Q 75 360, 50 385 Q 25 405, 59 440"); /* Example of a more "open" curve */
}

.dna-segment[data-segment="4"].unzipped .strand-2 {
    d: path("M 46 350 Q 25 360, 50 385 Q 75 405, 40 440"); /* Example of a more "open" curve */
}

/* Base pairs break apart when unzipped */
.dna-segment.unzipped .segment-pairs .base-pair {
    opacity: 0;
    transform: scaleX(0);
}

/* Show "broken" base pair halves effect */
.dna-segment.unzipped .segment-pairs {
    opacity: 0.3;
}

/* ---- Partially unzipped states for adjacent segments ---- */
.dna-segment.partially-unzipped-prev .strand-1 {
    transform: translateX(-4px);
}

.dna-segment.partially-unzipped-prev .strand-2 {
    transform: translateX(4px);
}

.dna-segment.partially-unzipped-prev .segment-pairs .base-pair {
    opacity: 0.2;
    transform: scaleX(0.5);
}

.dna-segment.partially-unzipped-next .strand-1 {
    transform: translateX(-4px);
}

.dna-segment.partially-unzipped-next .strand-2 {
    transform: translateX(4px);
}

.dna-segment.partially-unzipped-next .segment-pairs .base-pair {
    opacity: 0.2;
    transform: scaleX(0.5);
}

/* ---- Reading strand highlight ---- */
.dna-segment.unzipped .strand-2 {
    stroke-width: 4;
    animation: readingStrand 1s ease-in-out infinite;
}

@keyframes readingStrand {
    0%, 100% {
        filter: drop-shadow(0 0 4px #e90c59);
    }
    50% {
        filter: drop-shadow(0 0 8px #e90c59) drop-shadow(0 0 12px #e90c59);
    }
}

/* Dimmed strand (not being read) */
.dna-segment.unzipped .strand-1 {
    stroke-opacity: 0.5;
}

/* ---- Polymerase reading animation ---- */
.dna-polymerase.reading {
    animation: polymeraseReading 0.8s ease-in-out infinite;
}

@keyframes polymeraseReading {
    0%, 100% {
        transform: scale(1.1);
        filter: url(#polymeraseGlow) drop-shadow(0 0 6px #ffd700);
    }
    50% {
        transform: scale(1.15);
        filter: url(#polymeraseGlow) drop-shadow(0 0 12px #ffd700);
    }
}

/* ---- Unzip direction indicator ---- */
.dna-segment.unzipped::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, #46dff0, #e90c59);
    animation: unzipGlow 1s ease-in-out infinite;
}

@keyframes unzipGlow {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* ---- Nucleotide particles effect when unzipping ---- */
.dna-segment.unzipped .base-pair::before,
.dna-segment.unzipped .base-pair::after {
    opacity: 0;
    animation: nucleotideFloat 2s ease-out infinite;
}

@keyframes nucleotideFloat {
    0% {
        opacity: 0.8;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.5);
    }
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive styles */
@media (max-width: 768px) {
    .dna-nav {
        width: 100px;
        left: 10px;
        padding: 8px;
    }
    
    .nav-text {
        font-size: 8px;
    }
}

@media (max-width: 480px) {
    .dna-nav {
        width: 60px;
        left: 5px;
        padding: 5px;
        border-radius: 15px;
    }
    
    .nav-text {
        display: none;
    }
    
    .nav-nucleotide {
        r: 6;
    }
    
    .nav-nucleotide-ring {
        r: 10;
    }
}

/* ============================================
   Transcription Line & Label Styles
   ============================================ */

.transcription-output {
    transition: opacity 0.5s ease;
}

.transcription-output.active {
    opacity: 1 !important;
}

.transcription-line {
    transition: x2 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                y1 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                y2 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                x1 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 3px #ffd700);
    animation: transcriptionGlow 2s ease-in-out infinite;
}

@keyframes transcriptionGlow {
    0%, 100% {
        filter: drop-shadow(0 0 2px #ffd700);
        stroke-opacity: 0.8;
    }
    50% {
        filter: drop-shadow(0 0 6px #ffd700) drop-shadow(0 0 10px rgba(255, 215, 0, 0.4));
        stroke-opacity: 1;
    }
}

