/* telomere.dev — Editorial Science Journal */
/* Color Palette:
   Deep Indigo: #1a1440
   Warm Off-White: #f0ece4
   Signal Orange: #ff6b35
   Electric Cerulean: #0077b6
   Slate Lavender: #6b6490
   Deep Charcoal: #2a2636
   Bio Green: #2d936c
   Faded Coral: #d4726a
*/

:root {
    --deep-indigo: #1a1440;
    --warm-off-white: #f0ece4;
    --signal-orange: #ff6b35;
    --electric-cerulean: #0077b6;
    --slate-lavender: #6b6490;
    --deep-charcoal: #2a2636;
    --bio-green: #2d936c;
    --faded-coral: #d4726a;
    --split-left: 45;
    --split-right: 55;
    --icon-stroke-width: 1.5px;
    --icon-opacity: 1;
    --bg-pattern-opacity: 0.04;
    --gutter-width: 3px;
    --erosion-desaturation: 0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Source Serif 4', Georgia, serif;
    color: var(--deep-charcoal);
    background: var(--deep-indigo);
}

.journal-container {
    position: relative;
}

/* ===================== GUTTER ===================== */
.gutter {
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(var(--split-left) * 1%);
    width: var(--gutter-width);
    z-index: 100;
    transition: width 0.4s ease, left 0.6s ease;
    overflow: hidden;
    cursor: crosshair;
}

.gutter:hover {
    width: 8px;
}

.gutter:hover .gutter-label {
    opacity: 1;
}

.gutter-pulse {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg,
        var(--signal-orange) 0%,
        transparent 20%,
        var(--signal-orange) 40%,
        transparent 60%,
        var(--signal-orange) 80%,
        transparent 100%
    );
    background-size: 100% 200%;
    animation: gutterPulse 3s linear infinite;
}

@keyframes gutterPulse {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% 200%; }
}

.gutter-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: var(--warm-off-white);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-shadow: 0 0 4px var(--signal-orange);
}

/* ===================== REPLICATION UNITS ===================== */
.replication-unit {
    height: 100vh;
    display: grid;
    grid-template-columns: calc(var(--split-left) * 1fr) calc(var(--split-right) * 1fr);
    scroll-snap-align: start;
    position: relative;
}

/* ===================== INDEX STRAND (Left) ===================== */
.index-strand {
    background: var(--deep-indigo);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.index-strand .strand-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    z-index: 2;
    position: relative;
}

.strand-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 8px,
        rgba(107, 100, 144, 0.06) 8px,
        rgba(107, 100, 144, 0.06) 9px
    );
    pointer-events: none;
}

.section-number {
    font-family: 'Righteous', cursive;
    font-size: clamp(6rem, 15vw, 12rem);
    color: var(--signal-orange);
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: opacity 0.6s ease, font-size 0.6s ease;
}

.section-label {
    font-family: 'Familjen Grotesk', 'IBM Plex Mono', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--slate-lavender);
    line-height: 1.4;
    text-align: center;
    max-width: 200px;
}

/* ===================== EXPRESSION STRAND (Right) ===================== */
.expression-strand {
    background: var(--warm-off-white);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.expression-strand .strand-content {
    padding: 3rem 4rem;
    max-width: 680px;
    z-index: 2;
    position: relative;
}

.hex-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: var(--bg-pattern-opacity);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%230077b6' stroke-width='1'/%3E%3C/svg%3E");
    background-size: 56px 100px;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

/* ===================== BODY TEXT ===================== */
.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--deep-charcoal);
    margin-bottom: 1.5rem;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* ===================== SECTION 1: ORIGIN ===================== */
.icon-diamond {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto 3rem;
}

.icon-diamond-item {
    position: absolute;
    color: var(--deep-indigo);
    animation: iconBreathe 4s ease-in-out infinite;
    animation-delay: var(--delay);
    transition: transform 0.8s ease;
}

.icon-diamond-item:nth-child(1) { top: 0; left: 50%; transform: translateX(-50%); }
.icon-diamond-item:nth-child(2) { top: 50%; right: 0; transform: translateY(-50%); }
.icon-diamond-item:nth-child(3) { bottom: 0; left: 50%; transform: translateX(-50%); }
.icon-diamond-item:nth-child(4) { top: 50%; left: 0; transform: translateY(-50%); }

.icon-diamond.revealed .icon-diamond-item:nth-child(1) { transform: translateX(-50%) rotate(5deg) translateY(-20px); }
.icon-diamond.revealed .icon-diamond-item:nth-child(2) { transform: translateY(-50%) rotate(5deg) translateX(20px); }
.icon-diamond.revealed .icon-diamond-item:nth-child(3) { transform: translateX(-50%) rotate(5deg) translateY(20px); }
.icon-diamond.revealed .icon-diamond-item:nth-child(4) { transform: translateY(-50%) rotate(5deg) translateX(-20px); }

.icon-diamond.revealed .connect-line {
    animation: drawLine 1.2s ease forwards;
}

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

.connecting-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: var(--signal-orange);
    opacity: 0.4;
}

@keyframes iconBreathe {
    0%, 100% { scale: 1; }
    50% { scale: 1.03; }
}

.origin-text {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===================== SECTION 2: REPLICATION ===================== */
.inline-icon {
    display: inline-block;
    vertical-align: baseline;
    color: var(--deep-indigo);
    margin: 0 0.25rem;
    opacity: var(--icon-opacity);
}

.reveal-para {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-para.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-para svg path,
.reveal-para svg rect,
.reveal-para svg circle,
.reveal-para svg line,
.reveal-para svg polyline,
.reveal-para svg ellipse,
.reveal-para svg polygon {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease 0.3s;
}

.reveal-para.visible svg path,
.reveal-para.visible svg rect,
.reveal-para.visible svg circle,
.reveal-para.visible svg line,
.reveal-para.visible svg polyline,
.reveal-para.visible svg ellipse,
.reveal-para.visible svg polygon {
    stroke-dashoffset: 0;
}

/* ===================== SECTION 3: EXPRESSION ===================== */
.icon-glossary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.glossary-card {
    border: 1px solid var(--deep-indigo);
    border-radius: 2px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    color: var(--deep-indigo);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.3s ease;
}

.glossary-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.glossary-card:hover {
    border-color: var(--signal-orange);
}

.glossary-card .bio-icon {
    opacity: var(--icon-opacity);
}

.card-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--deep-charcoal);
    font-weight: 400;
}

.card-desc {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--slate-lavender);
}

/* ===================== SECTION 4: SENESCENCE ===================== */
.senescence-content .body-text {
    font-size: 1.25rem;
    line-height: 1.8;
}

.decay-word {
    color: var(--faded-coral);
    font-style: italic;
}

.senescence-text {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

[data-section="4"] .section-number {
    opacity: 0.6;
}

[data-section="4"] .bio-icon,
[data-section="4"] .inline-icon {
    stroke-width: 1px;
}

/* ===================== SECTION 5: TERMINUS ===================== */
.terminus-gradient {
    background: linear-gradient(180deg, var(--warm-off-white) 0%, var(--deep-indigo) 100%);
}

.terminus-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 3rem;
}

.terminus-statement {
    font-family: 'Righteous', cursive;
    font-size: clamp(2rem, 5vw, 4rem);
    text-align: center;
    color: var(--warm-off-white);
    line-height: 1.3;
    letter-spacing: 0.02em;
    max-width: 800px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.terminus-statement.visible {
    opacity: 1;
    transform: translateY(0);
}

[data-section="5"] .section-number {
    opacity: 0.3;
    font-size: clamp(3rem, 8vw, 6rem);
}

[data-section="5"] .telomere-cap-final {
    color: var(--slate-lavender);
    opacity: 0.3;
    margin-top: 1rem;
}

[data-section="5"] .index-strand {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ===================== BIO ICONS GENERAL ===================== */
.bio-icon {
    transition: transform 0.3s ease, opacity 0.6s ease;
    animation: iconBreathe 4s ease-in-out infinite;
}

.bio-icon:hover {
    transform: scale(1.1);
}

/* ===================== SECTION-SPECIFIC SPLITS ===================== */
[data-section="1"] { grid-template-columns: 45fr 55fr; }
[data-section="2"] { grid-template-columns: 42fr 58fr; }
[data-section="3"] { grid-template-columns: 38fr 62fr; }
[data-section="4"] { grid-template-columns: 30fr 70fr; }
[data-section="5"] { grid-template-columns: 15fr 85fr; }

/* ===================== EROSION STATES ===================== */
[data-section="4"] .hex-pattern {
    opacity: 0.02;
}

[data-section="5"] .hex-pattern {
    opacity: 0.01;
}

[data-section="5"] .gutter-pulse {
    animation: none;
    opacity: 0.3;
}

/* ===================== NAV CLICK INTERACTION ===================== */
.index-strand .strand-content {
    cursor: pointer;
}

.index-strand .strand-content:hover .section-number {
    text-shadow: 0 0 40px rgba(255, 107, 53, 0.4);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .replication-unit {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto 1fr;
        height: auto;
        min-height: 100vh;
    }

    .index-strand {
        padding: 2rem;
        min-height: 30vh;
    }

    .expression-strand .strand-content {
        padding: 2rem;
    }

    .gutter {
        display: none;
    }

    .icon-glossary {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .section-number {
        font-size: clamp(3rem, 10vw, 6rem);
    }

    .icon-diamond {
        width: 200px;
        height: 200px;
    }

    html {
        scroll-snap-type: none;
    }
}

@media (max-width: 480px) {
    .icon-glossary {
        grid-template-columns: 1fr;
    }

    .expression-strand .strand-content {
        padding: 1.5rem;
    }
}

/* ===================== SUB-HEADLINES (Familjen Grotesk) ===================== */
.section-label,
.gutter-label {
    font-family: 'Familjen Grotesk', sans-serif;
}
