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

:root {
    --ocean-navy: #0d1b2a;
    --dark-teal: #1b4332;
    --burnt-sienna: #c4623d;
    --sea-green: #52b788;
    --parchment: #f4e8d0;
    --parchment-dark: #e8d5b5;
    --muted-rose: #b5838d;
    --warm-gold: #e9c46a;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Lora', Georgia, serif;
    background: var(--ocean-navy);
    color: var(--parchment);
    overflow-x: hidden;
    line-height: 1.6;
}

/* === Hero === */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ocean-navy);
    overflow: hidden;
}

#particle-field {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(82,183,136,0.6), rgba(13,27,42,0.2));
    animation: particleFloat linear infinite;
    pointer-events: none;
}

@keyframes particleFloat {
    0% { transform: translateY(0) translateX(0); opacity: 0.6; }
    50% { opacity: 1; }
    100% { transform: translateY(-100vh) translateX(30px); opacity: 0; }
}

.iridescent-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(82,183,136,0.08), transparent 60%),
                radial-gradient(ellipse at 70% 30%, rgba(27,67,50,0.1), transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(181,131,141,0.06), transparent 50%);
    z-index: 2;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: left;
    max-width: 600px;
    padding: 0 40px;
}

.hero-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: clamp(48px, 10vw, 120px);
    letter-spacing: 0.05em;
    line-height: 1;
    color: var(--parchment);
    margin-bottom: 24px;
}

.hero-dot {
    color: var(--burnt-sienna);
}

.hero-subtitle {
    font-family: 'Lora', serif;
    font-size: clamp(16px, 2vw, 20px);
    color: var(--parchment-dark);
    font-weight: 400;
    max-width: 480px;
    line-height: 1.7;
}

.hero-helix {
    position: absolute;
    right: 8%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    height: 70vh;
    max-height: 600px;
    opacity: 0.7;
}

.dna-helix {
    height: 100%;
    width: auto;
}

.helix-strand-1, .helix-strand-2 {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawHelix 3s ease-out forwards;
}

.helix-strand-2 {
    animation-delay: 0.5s;
}

.helix-rung {
    opacity: 0;
    animation: fadeInRung 0.5s ease forwards;
}
.helix-rung:nth-child(3) { animation-delay: 1s; }
.helix-rung:nth-child(4) { animation-delay: 1.3s; }
.helix-rung:nth-child(5) { animation-delay: 1.6s; }
.helix-rung:nth-child(6) { animation-delay: 1.9s; }
.helix-rung:nth-child(7) { animation-delay: 2.2s; }
.helix-rung:nth-child(8) { animation-delay: 2.5s; }
.helix-rung:nth-child(9) { animation-delay: 2.8s; }

@keyframes drawHelix {
    to { stroke-dashoffset: 0; }
}

@keyframes fadeInRung {
    to { opacity: 0.5; }
}

/* === Bubbles === */
#bubbles-hero {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(82,183,136,0.6), rgba(13,27,42,0.4));
    box-shadow: inset -2px -2px 4px rgba(255,255,255,0.2);
    animation: rise var(--duration) var(--delay) infinite ease-in;
    bottom: -100px;
    left: var(--x);
    width: var(--size);
    height: var(--size);
    opacity: 0.7;
}

@keyframes rise {
    0% { transform: translateY(0) scale(1); opacity: 0.7; }
    100% { transform: translateY(-120vh) scale(1.1); opacity: 0; }
}

/* === Z-Pattern Sections === */
.z-section {
    display: flex;
    align-items: center;
    min-height: 80vh;
    padding: 60px 5%;
    position: relative;
    background: var(--dark-teal);
}

.z-section:nth-child(odd) {
    flex-direction: row;
    background: var(--ocean-navy);
}

.z-section:nth-child(even) {
    flex-direction: row-reverse;
    background: var(--dark-teal);
}

.z-text, .z-image {
    flex: 1;
    padding: 40px;
}

/* === Paper-Aged Panels === */
.panel {
    background: linear-gradient(135deg, #f4e8d0, #e8d5b5);
    filter: sepia(0.2) contrast(1.05);
    padding: 48px 40px;
    position: relative;
    color: var(--ocean-navy);
    border-radius: 2px;
}

.panel::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 14px;
    background: linear-gradient(135deg, #f4e8d0, #e8d5b5);
    clip-path: polygon(0% 100%, 2% 60%, 5% 80%, 8% 40%, 12% 70%, 16% 30%, 20% 65%, 25% 45%, 30% 80%, 35% 50%, 40% 75%, 45% 35%, 50% 70%, 55% 45%, 60% 80%, 65% 55%, 70% 75%, 75% 40%, 80% 65%, 85% 50%, 90% 80%, 95% 60%, 100% 100%);
    filter: sepia(0.2) contrast(1.05);
}

.panel::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    right: 0;
    height: 14px;
    background: linear-gradient(135deg, #f4e8d0, #e8d5b5);
    clip-path: polygon(0% 0%, 3% 50%, 7% 20%, 11% 55%, 15% 30%, 20% 60%, 25% 25%, 30% 50%, 35% 20%, 40% 45%, 45% 65%, 50% 30%, 55% 55%, 60% 20%, 65% 50%, 70% 30%, 75% 55%, 80% 25%, 85% 50%, 90% 20%, 95% 45%, 100% 0%);
    filter: sepia(0.2) contrast(1.05);
}

.section-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: clamp(36px, 5vw, 80px);
    letter-spacing: 0.04em;
    line-height: 1.05;
    color: var(--ocean-navy);
    margin-bottom: 20px;
}

.finding-label {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: var(--burnt-sienna);
    margin-bottom: 16px;
    min-height: 1.6em;
    position: relative;
    line-height: 1.6;
}

.finding-label.typewriter {
    overflow: hidden;
}

.finding-label.typewriter::after {
    content: '|';
    animation: cursorBlink 0.6s step-end infinite;
    color: var(--burnt-sienna);
    font-weight: 700;
}

.finding-label.typewriter-done::after {
    display: none;
}

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

.panel-body {
    font-family: 'Lora', serif;
    font-size: 16px;
    line-height: 1.8;
    color: #2a2a2a;
    font-weight: 400;
}

/* === SVG Motifs === */
.z-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.motif-svg {
    width: 100%;
    max-width: 360px;
    height: auto;
    opacity: 0.8;
}

/* === Bubble Transitions === */
.bubble-transition {
    position: relative;
    height: 120px;
    overflow: hidden;
    background: linear-gradient(to bottom, var(--dark-teal), var(--ocean-navy));
}

.z-section:nth-child(odd) + .bubble-transition {
    background: linear-gradient(to bottom, var(--ocean-navy), var(--dark-teal));
}

.bubble-transition .bubble {
    position: absolute;
    bottom: -20px;
}

/* === Footer === */
#footer {
    position: relative;
    background: var(--ocean-navy);
    text-align: center;
    padding: 80px 40px;
    overflow: hidden;
}

.footer-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--parchment);
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.footer-mono {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--sea-green);
    letter-spacing: 0.15em;
    opacity: 0.6;
    position: relative;
    z-index: 2;
}

/* === Grain Overlay on panels === */
.panel {
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.06'/%3E%3C/svg%3E"),
        linear-gradient(135deg, #f4e8d0, #e8d5b5);
}

/* === Responsive === */
@media (max-width: 768px) {
    .z-section,
    .z-section:nth-child(odd),
    .z-section:nth-child(even) {
        flex-direction: column;
        padding: 40px 20px;
    }

    .z-text, .z-image {
        padding: 20px;
    }

    .hero-helix {
        right: -5%;
        opacity: 0.3;
    }

    .hero-content {
        padding: 0 20px;
    }

    .section-title {
        font-size: clamp(32px, 8vw, 60px);
    }
}
