/* ============================================
   datatelomere.com — Styles
   McBling × Bioinformatics Editorial
   ============================================ */

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

html {
    scroll-behavior: smooth;
    cursor: none;
}

body {
    background: #0d0d0d;
    color: #b8b0a0;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    cursor: none;
}

/* ---- Scanline Reveal ---- */
.scanline {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, #c9a84c, #f0d680, #c9a84c, transparent);
    z-index: 10000;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
}
.scanline.active {
    animation: scanlineReveal 0.6s ease-out forwards;
}
@keyframes scanlineReveal {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(100vh); opacity: 0; }
}

/* ---- Custom Cursor ---- */
.cursor-crosshair {
    position: fixed;
    width: 12px; height: 12px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: width 0.3s, height 0.3s, opacity 0.2s;
}
.cursor-crosshair::before,
.cursor-crosshair::after {
    content: '';
    position: absolute;
    background: #c9a84c;
}
.cursor-crosshair::before {
    width: 100%; height: 1px;
    top: 50%; left: 0;
    transform: translateY(-50%);
}
.cursor-crosshair::after {
    width: 1px; height: 100%;
    left: 50%; top: 0;
    transform: translateX(-50%);
}
.cursor-crosshair.active { opacity: 1; }
.cursor-crosshair.hovering {
    width: 24px; height: 24px;
    animation: cursorRotate 3s linear infinite;
}
@keyframes cursorRotate { to { transform: rotate(360deg); } }

.cursor-glow {
    position: fixed;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201,168,76,0.15), transparent 70%);
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
}

/* Click pulse */
.click-pulse {
    position: fixed;
    width: 60px; height: 60px;
    border-radius: 50%;
    border: 1px solid rgba(201,168,76,0.4);
    pointer-events: none;
    z-index: 9997;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}
.click-pulse.fire {
    animation: clickPulseAnim 0.3s ease-out forwards;
}
@keyframes clickPulseAnim {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0.4; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ---- Scroll Progress ---- */
#scroll-progress {
    position: fixed;
    right: 0; top: 0;
    width: 2px; height: 100vh;
    z-index: 999;
}
#scroll-progress-fill {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 0%;
    background: #c9a84c;
    transition: height 0.1s linear;
}
.scroll-diamond {
    position: absolute;
    right: -3px;
    width: 8px; height: 8px;
    background: #c9a84c;
    transform: rotate(45deg) translateY(-50%);
    opacity: 0.3;
    transition: opacity 0.4s, box-shadow 0.4s;
}
.scroll-diamond.near {
    opacity: 1;
    box-shadow: 0 0 8px rgba(201,168,76,0.6);
}

/* ---- HUD Readout ---- */
#hud-readout {
    position: fixed;
    bottom: 16px; left: 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c9a84c;
    opacity: 0.6;
    z-index: 998;
    display: flex;
    gap: 8px;
}
.hud-sep { opacity: 0.3; }

/* ---- Radial Nav ---- */
.nav-diamond {
    position: fixed;
    top: 24px; right: 24px;
    color: #c9a84c;
    font-size: 16px;
    cursor: none;
    z-index: 1001;
    transition: transform 0.3s;
}
.nav-diamond:hover { transform: scale(1.3); }
.nav-diamond.open { transform: rotate(45deg); }

.radial-nav {
    position: fixed;
    top: 60px; right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}
.radial-nav.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}
.radial-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a6a4e;
    text-decoration: none;
    transition: color 0.2s;
    cursor: none;
}
.radial-link:hover { color: #f0d680; }

/* ---- Spread Base ---- */
.spread {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Isometric grid background */
.spread::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(201,168,76,0.04) 0px, rgba(201,168,76,0.04) 0.5px, transparent 0.5px, transparent 40px),
        repeating-linear-gradient(60deg, rgba(201,168,76,0.03) 0px, rgba(201,168,76,0.03) 0.5px, transparent 0.5px, transparent 40px),
        repeating-linear-gradient(120deg, rgba(201,168,76,0.03) 0px, rgba(201,168,76,0.03) 0.5px, transparent 0.5px, transparent 40px);
    pointer-events: none;
    z-index: 0;
}

/* Scanlines overlay */
.spread::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(201,168,76,0.02) 3px,
        rgba(201,168,76,0.02) 3.5px,
        transparent 3.5px,
        transparent 7px
    );
    pointer-events: none;
    z-index: 0;
}

.spread-inner {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: clamp(2rem, 4vw, 5rem);
    display: flex;
    align-items: center;
}

/* ---- 12-Column Grid ---- */
.grid-12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
    width: 100%;
}
.col-1-4 { grid-column: 1 / 5; }
.col-1-8 { grid-column: 1 / 9; }
.col-2-7 { grid-column: 2 / 8; }
.col-5-13 { grid-column: 5 / 13; }
.col-8-13 { grid-column: 8 / 13; }
.col-9-13 { grid-column: 9 / 13; }

/* Magazine 3-col grid (25/50/25) */
.grid-magazine {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 2rem;
    width: 100%;
    align-items: start;
    padding-top: 4rem;
}

/* ---- HUD Frame (corner brackets) ---- */
.hud-frame {
    position: relative;
    padding: 1.5rem;
}
.hud-frame::before, .hud-frame::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 1px solid #c9a84c;
    opacity: 0;
    transition: opacity 0.4s;
}
.hud-frame::before { top: -8px; left: -8px; border-right: none; border-bottom: none; }
.hud-frame::after { bottom: -8px; right: -8px; border-left: none; border-top: none; }
.hud-frame.visible::before, .hud-frame.visible::after { opacity: 1; }

/* ---- Typography ---- */
.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: #e8dcc8;
    line-height: 0.95;
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.3);
}
.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-4px);
}
.hero-title .char.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.15s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-sub {
    font-family: 'Anybody', sans-serif;
    font-size: clamp(1rem, 1.6vw, 1.4rem);
    font-weight: 400;
    font-stretch: 120%;
    font-style: italic;
    color: #c9a84c;
    line-height: 1.2;
    margin-top: 1.5rem;
    opacity: 0;
    filter: blur(3px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.hero-sub.revealed { opacity: 1; filter: blur(0); }

.spread-headline {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: #e8dcc8;
    line-height: 1;
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.3);
    margin-bottom: 1.5rem;
    opacity: 0;
    filter: blur(3px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a6a4e;
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 0.4s 0.1s;
}

.body-text {
    max-width: 38em;
    margin-bottom: 1.2rem;
    opacity: 0;
    filter: blur(3px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pull-quote {
    font-family: 'Anybody', sans-serif;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    font-weight: 400;
    font-stretch: 120%;
    font-style: italic;
    color: #c9a84c;
    line-height: 1.2;
    margin-top: 2rem;
    padding-left: 1.5rem;
    border-left: 2px solid #c9a84c;
    opacity: 0;
    filter: blur(3px);
    transition: opacity 0.6s 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.6s 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.spread.in-view .spread-headline,
.spread.in-view .data-label,
.spread.in-view .body-text,
.spread.in-view .pull-quote {
    opacity: 1;
    filter: blur(0);
}

/* ---- Hero ---- */
.spread-hero {
    background: #0d0d0d;
}
.spread-hero .spread-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4rem;
}
.hero-viz {
    position: relative;
    flex: 0 0 auto;
    width: clamp(250px, 35vw, 450px);
}
.hero-text {
    position: relative;
    flex: 1;
    max-width: 600px;
}
.gold-rule-v {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 2px;
    height: 100%;
    background: #c9a84c;
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.spread-hero.in-view .gold-rule-v { transform: scaleY(1); }

/* DNA Helix SVG animation */
.dna-helix { width: 100%; height: auto; }
.helix-strand {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.2s ease-out;
}
.spread-hero.in-view .helix-strand { stroke-dashoffset: 0; }
.helix-rung { opacity: 0; transition: opacity 0.4s; }
.spread-hero.in-view .helix-rung { opacity: 0.5; transition-delay: calc(var(--i, 0) * 80ms + 800ms); }
.telomere-cap { transition: opacity 0.5s 1.4s; }
.spread-hero.in-view .telomere-cap { opacity: 1; }
.data-cube { transition: opacity 0.3s; }
.spread-hero.in-view .data-cube { opacity: 0.7; transition-delay: calc(var(--i, 0) * 100ms + 1.6s); }

/* Isometric decoration cubes */
.iso-cube {
    position: absolute;
    width: 20px; height: 20px;
    background: linear-gradient(135deg, #c9a84c, #7a6a4e);
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.5s 1.8s;
}
.spread-hero.in-view .iso-cube { opacity: 0.3; }
.iso-cube-1 { top: 10%; right: 10%; }
.iso-cube-2 { bottom: 20%; left: 5%; width: 14px; height: 14px; }
.iso-cube-3 { top: 50%; right: 2%; width: 10px; height: 10px; }

/* ---- Spread Backgrounds ---- */
.spread-biology { background: #0d0d0d; }
.spread-vault { background: #1a1207; }
.spread-decay { background: #0d0d0d; }
.spread-clock { background: #1a1207; }

/* ---- SVG Illustrations in Spreads ---- */
.chromosome-svg, .vault-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
    margin: 0 auto;
    display: block;
}
.iso-element {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s calc(var(--delay, 0) * 80ms), transform 0.5s calc(var(--delay, 0) * 80ms);
}
.spread.in-view .iso-element {
    opacity: 1;
    transform: translateY(0);
}

/* Rhinestone sparkles */
.rhinestone {
    position: absolute;
    width: 6px; height: 6px;
    pointer-events: none;
}
.rhinestone::before, .rhinestone::after {
    content: '';
    position: absolute;
    background: #f0d680;
}
.rhinestone::before { width: 100%; height: 1px; top: 50%; }
.rhinestone::after { height: 100%; width: 1px; left: 50%; }
.r1 { top: 15%; right: 20%; animation: sparkleFlicker 2s ease-in-out infinite; }
.r2 { top: 40%; right: 10%; animation: sparkleFlicker 2.5s ease-in-out infinite 0.5s; }
.r3 { bottom: 25%; right: 30%; animation: sparkleFlicker 1.8s ease-in-out infinite 1s; }
.r4 { bottom: 10%; right: 15%; animation: sparkleFlicker 3s ease-in-out infinite 0.3s; }
.r5 { top: 20%; left: 15%; animation: sparkleFlicker 2.2s ease-in-out infinite 0.7s; }
.r6 { bottom: 30%; left: 25%; animation: sparkleFlicker 2.8s ease-in-out infinite; }
@keyframes sparkleFlicker {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

/* ---- Canvas (Decay Simulator) ---- */
.canvas-wrapper {
    position: relative;
    background: rgba(201,168,76,0.03);
}
#decay-canvas {
    display: block;
    width: 100%;
    height: auto;
}
.canvas-label {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a6a4e;
}
.canvas-label.top-left { top: 8px; left: 12px; }
.canvas-label.bottom-right { bottom: 8px; right: 12px; }

/* Hayflick limit accent */
.hayflick-accent { color: #ff2d7b; }

/* ---- Spread 4: Clock ---- */
.gutter-left, .gutter-right {
    display: flex;
    align-items: center;
}
.gutter-quote {
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    border-left: none;
    border-top: 2px solid #c9a84c;
    padding-left: 0;
    padding-top: 1rem;
}
.main-col { padding: 0 1rem; }
.clock-rings-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}
.clock-rings { width: 250px; height: 250px; }
.clock-ring {
    stroke-dasharray: 900;
    stroke-dashoffset: 900;
    transition: stroke-dashoffset 1.5s ease-out;
}
.spread-clock.in-view .clock-ring { stroke-dashoffset: 0; }

/* ---- Closing Spread ---- */
.spread-closing {
    background: linear-gradient(180deg, #0d0d0d 0%, #1a1207 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.closing-content {
    text-align: center;
    padding: clamp(2rem, 4vw, 5rem);
    max-width: 700px;
}
.closing-headline {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: #e8dcc8;
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.3);
    line-height: 1;
    margin-bottom: 1.5rem;
    opacity: 0;
    filter: blur(3px);
    transition: opacity 0.8s, filter 0.8s;
}
.closing-sub {
    font-family: 'Anybody', sans-serif;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    font-weight: 400;
    font-stretch: 120%;
    font-style: italic;
    color: #b8b0a0;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 0.8s 0.3s;
}
.spread-closing.in-view .closing-headline,
.spread-closing.in-view .closing-sub {
    opacity: 1;
    filter: blur(0);
}
.closing-loop {
    margin-top: 3rem;
}
.telomere-loop {
    width: 80px; height: 80px;
    animation: breatheLoop 4s ease-in-out infinite;
}
@keyframes breatheLoop {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
}

/* ---- Sparkle Particles ---- */
#sparkle-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 997;
    overflow: hidden;
}
.sparkle-particle {
    position: absolute;
    pointer-events: none;
}
.sparkle-particle::before, .sparkle-particle::after {
    content: '';
    position: absolute;
    background: #f0d680;
}
.sparkle-particle::before {
    width: var(--size); height: 1px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.sparkle-particle::after {
    width: 1px; height: var(--size);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .grid-12 { grid-template-columns: 1fr; }
    .col-1-4, .col-1-8, .col-2-7, .col-5-13, .col-8-13, .col-9-13 { grid-column: 1 / -1; }
    .grid-magazine { grid-template-columns: 1fr; }
    .spread-hero .spread-inner { flex-direction: column; gap: 2rem; }
    .hero-viz { width: 60vw; }
    .gold-rule-v { display: none; }
}
