/* telomere.digital — neubrutalist molecular biology zine */

:root {
    --orange: #e8622a;
    --gold: #f0a830;
    --parchment: #faf0e6;
    --cream: #fff5eb;
    --sage: #6b8f71;
    --coral: #ff4757;
    --ink: #1a1a1a;
    --shadow: 4px 4px 0 var(--ink);
    --shadow-sm: 3px 3px 0 var(--ink);
    --border: 4px solid var(--ink);
    --border-sm: 3px solid var(--ink);
    --sidebar-w: 280px;
}

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

html, body {
    background: var(--parchment);
    color: var(--ink);
    font-family: 'Nunito', 'Inter', system-ui, sans-serif;
    font-weight: 600;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--orange);
    border-right: var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.25rem;
    z-index: 100;
    overflow: hidden;
}

.sidebar-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: var(--border-sm);
}

.logo-mark {
    display: flex;
    gap: 6px;
    margin-bottom: 0.75rem;
}

.logo-dot {
    width: 18px;
    height: 18px;
    background: var(--ink);
    border: var(--border-sm);
    display: inline-block;
}

.logo-dot.alt { background: var(--parchment); }

.sidebar-title {
    font-family: 'Lilita One', 'Inter', sans-serif;
    font-size: 1.6rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 0.35rem;
}

.sidebar-title .dot {
    color: var(--parchment);
    background: var(--ink);
    padding: 0 4px;
    display: inline-block;
    margin: 0 1px;
}

.sidebar-sub {
    font-family: 'Space Mono', 'Inter', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--parchment);
    border: var(--border-sm);
    box-shadow: var(--shadow-sm);
    color: var(--ink);
    text-decoration: none;
    padding: 0.55rem 0.6rem;
    font-family: 'Nunito', 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    transition: box-shadow 200ms ease, border-color 200ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
    cursor: pointer;
}

.nav-item .nav-num {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    background: var(--ink);
    color: var(--parchment);
    padding: 2px 5px;
    border: 2px solid var(--ink);
    flex-shrink: 0;
}

.nav-item .nav-label {
    flex: 1;
    line-height: 1.1;
}

.nav-item:hover {
    box-shadow: 4px 4px 0 var(--orange);
    border-color: var(--orange);
    transform: translate(-1px, -1px);
}

.nav-item.active {
    background: var(--ink);
    color: var(--parchment);
    box-shadow: 0 0 0 var(--ink);
    border-color: var(--ink);
    transform: translate(3px, 3px);
}

.nav-item.active .nav-num {
    background: var(--orange);
    color: var(--ink);
}

/* Progress track */
.progress-track {
    position: relative;
    width: 14px;
    height: 100px;
    background: var(--parchment);
    border: var(--border-sm);
    margin: 1rem auto 0.75rem auto;
    flex-shrink: 0;
}

.progress-thumb {
    position: absolute;
    left: -3px;
    top: 0;
    width: 14px;
    height: 14px;
    background: var(--orange);
    border: var(--border-sm);
    transition: top 100ms linear;
}

/* Mountain silhouette at sidebar base */
.mountain-range {
    position: relative;
    height: 90px;
    margin: 0 -1.25rem -1.5rem -1.25rem;
    overflow: hidden;
}

.mountain {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 80px;
}

.mountain.m1 {
    background: var(--sage);
    clip-path: polygon(0% 100%, 10% 55%, 22% 85%, 38% 30%, 55% 80%, 70% 40%, 88% 75%, 100% 50%, 100% 100%);
    opacity: 1;
    bottom: 10px;
    z-index: 1;
}

.mountain.m2 {
    background: var(--ink);
    clip-path: polygon(0% 100%, 8% 70%, 24% 40%, 42% 75%, 58% 35%, 75% 80%, 92% 45%, 100% 65%, 100% 100%);
    opacity: 1;
    bottom: 0;
    z-index: 2;
}

.mountain.m3 {
    background: var(--parchment);
    clip-path: polygon(0% 100%, 15% 80%, 30% 95%, 50% 70%, 68% 92%, 85% 75%, 100% 90%, 100% 100%);
    opacity: 1;
    bottom: -30px;
    z-index: 3;
    height: 60px;
}

.mountain.m4 { display: none; }

.mountain.ground {
    background: var(--ink);
    height: 14px;
    bottom: 0;
    z-index: 4;
    clip-path: none;
}

/* menu toggle (mobile) */
.menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 200;
    background: var(--coral);
    color: var(--ink);
    border: var(--border);
    box-shadow: var(--shadow);
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    font-size: 0.85rem;
}

/* ============ MAIN CONTENT ============ */
.content {
    margin-left: var(--sidebar-w);
    width: calc(100vw - var(--sidebar-w));
    min-height: 100vh;
}

.block {
    padding: clamp(2rem, 4vw, 4rem) clamp(1.25rem, 4vw, 3.5rem);
    border-bottom: var(--border);
    position: relative;
    min-height: 70vh;
}

.block-inner {
    max-width: 1400px;
    margin: 0 auto;
}

.block-intro { background: var(--parchment); }
.block-ttaggg { background: var(--gold); }
.block-decay { background: var(--cream); }
.block-hayflick { background: var(--sage); }
.block-telomerase { background: var(--coral); }
.block-field { background: var(--parchment); }
.block-manifesto { background: var(--gold); }

.block-head {
    margin-bottom: 1.5rem;
}

.badge {
    display: inline-block;
    background: var(--ink);
    color: var(--parchment);
    font-family: 'Space Mono', 'Nunito', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.7rem;
    border: var(--border-sm);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.badge.alt {
    background: var(--coral);
    color: var(--ink);
}

.block-title {
    font-family: 'Lilita One', 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 4.5rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.block-title .underline-pop {
    display: inline-block;
    position: relative;
    padding-bottom: 8px;
    background-image: linear-gradient(var(--orange), var(--orange));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 100% 8px;
}

.kicker {
    max-width: 820px;
    font-size: clamp(1.02rem, 1.3vw, 1.2rem);
    line-height: 1.55;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--ink);
}

.block-telomerase .kicker,
.block-hayflick .kicker { color: var(--ink); }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card {
    border: var(--border-sm);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.25rem 1.4rem;
    position: relative;
    transition: box-shadow 200ms ease, border-color 200ms ease, transform 200ms ease;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    color: var(--ink);
}

.card:hover {
    box-shadow: 4px 4px 0 var(--orange);
    border-color: var(--orange);
    transform: translate(-2px, -2px);
}

.card-parchment { background: var(--parchment); }
.card-cream { background: var(--cream); }
.card-gold { background: var(--gold); }
.card-sage { background: var(--sage); color: var(--parchment); }
.card-sage h3 { color: var(--parchment); }
.card-coral { background: var(--coral); }

.card h3 {
    font-family: 'Lilita One', 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1.4rem;
    line-height: 1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.card p { font-size: 0.96rem; font-weight: 600; line-height: 1.55; }

.mono {
    font-family: 'Space Mono', 'Inter', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--ink);
    color: var(--parchment);
    padding: 0.5rem 0.65rem;
    border: var(--border-sm);
    display: inline-block;
    word-break: break-all;
    line-height: 1.3;
}

.card-sage .mono { background: var(--parchment); color: var(--ink); }

.rot-tag {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--coral);
    color: var(--ink);
    font-family: 'Space Mono', monospace;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 3px 7px;
    border: var(--border-sm);
    box-shadow: 3px 3px 0 var(--ink);
    transform: rotate(3deg);
    text-transform: uppercase;
    white-space: nowrap;
}

.rot-tag.alt {
    transform: rotate(-3deg);
    background: var(--gold);
    top: auto;
    bottom: -10px;
    right: 10px;
}

/* ============ INTRO: CONCENTRIC RINGS ============ */
.rings {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 0.4rem;
}
.rings .ring {
    position: absolute;
    border-radius: 50%;
    border: 4px solid var(--ink);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.rings .r1 { width: 100px; height: 100px; background: var(--orange); }
.rings .r2 { width: 72px; height: 72px; background: var(--gold); border-width: 4px; }
.rings .r3 { width: 46px; height: 46px; background: var(--coral); border-width: 4px; }
.rings .r4 { width: 20px; height: 20px; background: var(--ink); }

/* brick stack */
.stack {
    margin-top: auto;
    position: relative;
    height: 70px;
}
.stack .brick {
    position: absolute;
    width: 80px;
    height: 22px;
    border: 3px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
}
.stack .b1 { left: 0; top: 0; background: var(--coral); }
.stack .b2 { left: 12px; top: 12px; background: var(--gold); }
.stack .b3 { left: 24px; top: 24px; background: var(--sage); }
.stack .b4 { left: 36px; top: 36px; background: var(--orange); }
.stack .b5 { left: 48px; top: 48px; background: var(--parchment); }

/* ============ TTAGGG waveform ============ */
.wave {
    width: 100%;
    max-width: 1200px;
    height: 120px;
    display: block;
    background: var(--parchment);
    border: var(--border-sm);
    box-shadow: var(--shadow);
    margin: 0 0 2rem 0;
    padding: 0.5rem;
}

/* ============ DECAY diagram ============ */
.decay-diagram {
    background: var(--parchment);
    border: var(--border-sm);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.decay-row {
    display: grid;
    grid-template-columns: 90px 1fr 60px;
    gap: 0.75rem;
    align-items: center;
}

.decay-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.decay-bar {
    height: 22px;
    background: var(--orange);
    border: 3px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    transition: width 600ms ease-out;
}
.decay-bar.full { width: 100%; }
.decay-bar.b80 { width: 82%; background: var(--gold); }
.decay-bar.b60 { width: 64%; background: var(--gold); }
.decay-bar.b40 { width: 47%; background: var(--coral); }
.decay-bar.b20 { width: 29%; background: var(--coral); }
.decay-bar.b5 { width: 5%; background: var(--ink); }

.decay-len {
    font-family: 'Lilita One', 'Inter', sans-serif;
    font-size: 1.1rem;
    text-align: right;
}

/* ============ Tally marks ============ */
.tally {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.tally span {
    width: 10px;
    height: 22px;
    background: var(--ink);
    display: inline-block;
}
.tally span:nth-child(5n) {
    transform: rotate(-20deg) translate(-4px, 0);
    margin-right: 6px;
}

/* ============ helix dots ============ */
.helix {
    display: flex;
    gap: 6px;
    margin-top: auto;
    align-items: flex-end;
    height: 60px;
}
.helix .h-dot {
    width: 16px;
    height: 16px;
    background: var(--ink);
    border-radius: 50%;
    border: 2px solid var(--ink);
}
.helix .h-dot.alt {
    background: var(--gold);
    margin-top: 24px;
}
.helix .h-dot:nth-child(2n) { transform: translateY(12px); }
.helix .h-dot:nth-child(2n+1) { transform: translateY(-10px); }

/* ============ Field notes ============ */
.card.note {
    font-family: 'Space Mono', monospace;
}
.card.note h3 { font-family: 'Lilita One', sans-serif; }

/* ============ Manifesto ============ */
.manifesto {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-width: 900px;
}

.m-line {
    font-family: 'Lilita One', 'Inter', sans-serif;
    font-size: clamp(1.3rem, 2.5vw, 2.1rem);
    line-height: 1.15;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    background: var(--parchment);
    border: var(--border-sm);
    box-shadow: var(--shadow);
    padding: 0.8rem 1.1rem;
    color: var(--ink);
    transition: box-shadow 200ms ease, border-color 200ms ease, transform 200ms ease;
}
.m-line:hover {
    box-shadow: 4px 4px 0 var(--orange);
    border-color: var(--orange);
    transform: translate(-2px, -2px);
}

.m-num {
    font-family: 'Space Mono', monospace;
    display: inline-block;
    background: var(--ink);
    color: var(--parchment);
    padding: 2px 8px;
    margin-right: 0.6rem;
    font-size: 0.8em;
    vertical-align: middle;
}

.m-line:nth-child(odd) { transform: rotate(-0.6deg); }
.m-line:nth-child(even) { transform: rotate(0.6deg); }

.signoff {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 900px;
}

.stamp {
    display: inline-block;
    background: var(--coral);
    color: var(--ink);
    font-family: 'Lilita One', sans-serif;
    font-size: 1.8rem;
    padding: 0.6rem 1rem;
    border: var(--border);
    box-shadow: var(--shadow);
    transform: rotate(-2deg);
    align-self: flex-start;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.colophon {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--parchment);
    border: var(--border-sm);
    padding: 0.75rem 1rem;
    max-width: 900px;
}

/* ============ Reveal animation ============ */
.reveal {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
    will-change: opacity, transform;
}

.block.even .reveal {
    transform: translateX(-40px);
}

.reveal.in {
    opacity: 1;
    transform: translateX(0);
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
    :root { --sidebar-w: 240px; }
    .block-title { font-size: clamp(1.8rem, 6vw, 3.2rem); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 250ms ease;
        width: 80vw;
        max-width: 320px;
    }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block; }
    .content {
        margin-left: 0;
        width: 100vw;
        padding-top: 60px;
    }
    .block { min-height: auto; padding: 2rem 1.25rem; }
    .block-title { font-size: clamp(1.6rem, 8vw, 2.6rem); }
    .decay-row { grid-template-columns: 70px 1fr 50px; gap: 0.5rem; }
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--parchment); }
::-webkit-scrollbar-thumb { background: var(--ink); border: 2px solid var(--parchment); }
