/* =========================================================
   datatelomere.com — Styles
   Fluorescence microscopy aesthetic, dark-field only
   ========================================================= */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0A0E12;
    --bg-secondary: #111B22;
    --accent-green: #39FF14;
    --accent-magenta: #E91E8C;
    --accent-cyan: #00E5FF;
    --accent-amber: #FFB300;
    --text-primary: #E8EDF2;
    --text-secondary: #7A8B9A;
    --band-violet: #9C27B0;
    --surface-gel: #1A2A35;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-accent: 'Outfit', sans-serif;
}

/* --- TTAGGG Background Pattern --- */
/* Repeating sequence wallpaper via SVG data URI */

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.65;
    overflow-x: hidden;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='20'%3E%3Ctext x='0' y='14' font-family='monospace' font-size='10' fill='%237A8B9A' opacity='0.05'%3ETTAGGG TTAGGG TTAGGG TTAGGG TTAGGG TTAGGG TTAGGG TTAGGG TTAGGG TTAGGG TTAGGG TTAGGG%3C/text%3E%3C/svg%3E");
}

/* --- Navigation --- */
#site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 14, 18, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: box-shadow 0.3s ease;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.8rem 2rem;
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.015em;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--accent-cyan);
}

.nav-band {
    height: 1px;
    background: var(--accent-green);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.nav-band.visible {
    opacity: 0.4;
}

/* --- Double Helix Scroll Indicator --- */
#helix-indicator {
    position: fixed;
    right: 12px;
    top: 80px;
    bottom: 20px;
    width: 24px;
    z-index: 999;
    pointer-events: none;
    opacity: 0.6;
}

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

.helix-strand {
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

/* --- Panels (Sections) --- */
.panel {
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 6rem 2rem 4rem;
    position: relative;
}

/* --- Section Titles --- */
.section-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: -0.015em;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 3rem;
    opacity: 0.9;
}

.section-title--bright {
    color: var(--accent-green);
    text-shadow: 0 0 40px rgba(57, 255, 20, 0.2);
}

/* --- Section Dividers (Chromosome Banding) --- */
.section-divider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10%;
}

.giemsa-band {
    height: 3px;
    background: var(--band-violet);
    border-radius: 1px;
    animation: giemsa-pulse 4s ease-in-out infinite;
}

.giemsa-band:nth-child(2n) {
    animation-delay: 1s;
}
.giemsa-band:nth-child(3n) {
    animation-delay: 2s;
}

@keyframes giemsa-pulse {
    0%, 100% { opacity: inherit; }
    50% { opacity: calc(var(--base-opacity, 0.5) + 0.08); }
}

/* --- Hero Section --- */
#hero {
    position: relative;
    overflow: hidden;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.hero-glow {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 20px 8px rgba(57, 255, 20, 0.3);
    opacity: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    transition: opacity 0.8s ease, width 1s ease, height 1s ease;
    pointer-events: none;
}

.hero-glow.active {
    opacity: 0.8;
}

.hero-glow.expanded {
    width: 300px;
    height: 300px;
    opacity: 0.08;
    background: radial-gradient(circle, var(--accent-green) 0%, transparent 70%);
    box-shadow: none;
}

.sequence-line {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--accent-green);
    letter-spacing: 0.04em;
    opacity: 0;
    white-space: nowrap;
    margin-bottom: 1.5rem;
    min-height: 1.5em;
    text-align: center;
}

.sequence-line.visible {
    opacity: 1;
}

.sequence-line.faded {
    opacity: 0.15;
    transition: opacity 1.5s ease;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.015em;
    text-align: center;
    margin-bottom: 1rem;
}

.title-char {
    display: inline-block;
    opacity: 0;
    transition: color 0.6s ease;
    color: var(--text-primary);
}

.title-char.revealed {
    opacity: 1;
}

.title-char.glow {
    text-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
}

.hero-subtitle {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.8s ease;
    text-align: center;
}

.hero-subtitle.visible {
    opacity: 1;
}

/* Chromosome Band (Hero) */
.chromosome-band {
    display: flex;
    gap: 2px;
    width: 60%;
    margin-top: 3rem;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 1.2s ease-in-out, opacity 0.5s ease;
}

.chromosome-band.drawn {
    opacity: 1;
    transform: scaleX(1);
}

.band-segment {
    height: 4px;
    background: var(--band-violet);
    border-radius: 1px;
}

/* --- Karyotype Grid (Hexagonal Honeycomb) --- */
#karyotype {
    padding-top: 5rem;
}

.hex-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 1100px;
    width: 100%;
    padding: 0 1rem;
}

.hex-cell {
    position: relative;
    background: var(--bg-secondary);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    padding: 3rem 2rem;
    aspect-ratio: 1 / 1.1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    opacity: 0;
    transform: scale(0.85);
}

.hex-cell.visible {
    opacity: 1;
    transform: scale(1);
}

/* Offset every other row for honeycomb effect */
.hex-cell:nth-child(4),
.hex-cell:nth-child(5),
.hex-cell:nth-child(6) {
    transform: translateX(50%);
}

.hex-cell:nth-child(4).visible,
.hex-cell:nth-child(5).visible,
.hex-cell:nth-child(6).visible {
    transform: translateX(50%) scale(1);
}

.hex-glow {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center, var(--accent-green) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(8px);
    pointer-events: none;
}

.hex-cell:hover .hex-glow {
    opacity: 0.15;
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: var(--bg-secondary);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    z-index: 0;
}

.hex-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--text-secondary);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    z-index: -1;
    opacity: 0.2;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.hex-cell:hover::after {
    opacity: 0.6;
}

.hex-cell[data-accent="#39FF14"]:hover::after { background: var(--accent-green); }
.hex-cell[data-accent="#E91E8C"]:hover::after { background: var(--accent-magenta); }
.hex-cell[data-accent="#00E5FF"]:hover::after { background: var(--accent-cyan); }
.hex-cell[data-accent="#FFB300"]:hover::after { background: var(--accent-amber); }
.hex-cell[data-accent="#9C27B0"]:hover::after { background: var(--band-violet); }

.hex-content {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.hex-label {
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-green);
}

.hex-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* --- Sequence Alignment Panel --- */
#alignment {
    align-items: flex-start;
    padding-top: 5rem;
}

.alignment-viewport {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.alignment-lane {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.alignment-lane.visible {
    opacity: 1;
    transform: translateX(0);
}

.lane-indicator {
    width: 4px;
    flex-shrink: 0;
    background: var(--accent-green);
}

.alignment-lane[data-track-color="#39FF14"] .lane-indicator { background: var(--accent-green); }
.alignment-lane[data-track-color="#E91E8C"] .lane-indicator { background: var(--accent-magenta); }
.alignment-lane[data-track-color="#00E5FF"] .lane-indicator { background: var(--accent-cyan); }
.alignment-lane[data-track-color="#FFB300"] .lane-indicator { background: var(--accent-amber); }

.lane-content {
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lane-label {
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.lane-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    line-height: 1.65;
    color: var(--text-primary);
    opacity: 0.85;
}

.lane-sequence {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--accent-green);
    background: rgba(57, 255, 20, 0.04);
    padding: 0.6rem 1rem;
    border-radius: 2px;
    overflow-x: auto;
    white-space: nowrap;
}

.variant-mark.cyan { color: var(--accent-cyan); font-weight: bold; }
.variant-mark.amber { color: var(--accent-amber); font-weight: bold; }
.variant-mark.magenta { color: var(--accent-magenta); font-weight: bold; }

/* --- Telomere Erosion Section --- */
.panel-erosion {
    padding-top: 5rem;
}

.erosion-blocks {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 1100px;
}

.erosion-block {
    background: var(--bg-secondary);
    border: 1px solid rgba(122, 139, 154, 0.15);
    border-left: 3px solid var(--accent-magenta);
    padding: 2rem 2.5rem;
    transition: width 0.6s ease, opacity 0.6s ease, border-color 0.3s ease;
    width: 100%;
}

.erosion-block:hover {
    border-left-color: var(--accent-green);
}

.erosion-heading {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.erosion-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    line-height: 1.65;
    color: var(--text-secondary);
}

/* --- Telomerase Restoration Section --- */
.panel-restoration {
    padding-top: 5rem;
}

.restoration-blocks {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 1100px;
}

.restoration-block {
    background: var(--surface-gel);
    border: 1px solid rgba(57, 255, 20, 0.15);
    border-left: 3px solid var(--accent-green);
    padding: 2rem 2.5rem;
    transition: width 0.6s ease, opacity 0.6s ease, border-color 0.3s ease;
    width: 100%;
}

.restoration-block:hover {
    border-left-color: var(--accent-cyan);
}

.restoration-heading {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    letter-spacing: -0.015em;
    color: var(--accent-green);
    margin-bottom: 0.75rem;
    text-shadow: 0 0 20px rgba(57, 255, 20, 0.15);
}

.restoration-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    line-height: 1.65;
    color: var(--text-primary);
    opacity: 0.9;
}

/* --- Footer (Gel Electrophoresis) --- */
.panel-footer {
    min-height: 60vh;
    justify-content: flex-end;
    padding-bottom: 3rem;
}

.gel-container {
    display: flex;
    gap: 2rem;
    width: 100%;
    max-width: 800px;
    align-items: flex-start;
}

.gel-lane {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.gel-band {
    background: var(--accent-cyan);
    border-radius: 1px;
    cursor: pointer;
    transition: height 0.15s ease, opacity 0.15s ease, box-shadow 0.2s ease;
    position: relative;
}

.gel-band:hover {
    opacity: 1 !important;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

.gel-band:hover::after {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-green);
    white-space: nowrap;
    background: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(57, 255, 20, 0.2);
    border-radius: 2px;
}

.spacer-band {
    cursor: default;
    background: var(--text-secondary);
}

.spacer-band:hover {
    box-shadow: none !important;
}

.spacer-band:hover::after {
    display: none;
}

.gel-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 0.5rem;
}

.marker-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

.footer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 800px;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(122, 139, 154, 0.1);
}

.footer-domain {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footer-sequence {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--accent-green);
    opacity: 0.4;
}

/* --- Erosion Canvas --- */
#erosion-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .hex-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hex-cell:nth-child(4),
    .hex-cell:nth-child(5),
    .hex-cell:nth-child(6) {
        transform: none;
    }

    .hex-cell:nth-child(4).visible,
    .hex-cell:nth-child(5).visible,
    .hex-cell:nth-child(6).visible {
        transform: scale(1);
    }

    .nav-links {
        gap: 1rem;
    }

    #helix-indicator {
        display: none;
    }
}

@media (max-width: 600px) {
    .hex-grid {
        grid-template-columns: 1fr;
    }

    .hex-cell {
        aspect-ratio: auto;
        clip-path: none;
        padding: 2rem 1.5rem;
        border-left: 3px solid var(--accent-green);
    }

    .hex-cell::before,
    .hex-cell::after {
        clip-path: none;
    }

    .nav-links {
        display: none;
    }

    .chromosome-band {
        width: 90%;
    }

    .erosion-block,
    .restoration-block {
        padding: 1.5rem;
    }

    .gel-band:hover::after {
        right: auto;
        left: calc(100% + 8px);
    }
}
