/* ==========================================================================
   telomere.dev — bio-code exploration page
   Palette: Lab Dark #0a0e18 / Panel #141824 / Text #d0d8e8
            A #ff6b6b · T #4ecdc4 · G #45b7d1 · C #f9ca24 · Helix #e8e8e8
   ========================================================================== */

:root {
    --lab-dark: #0a0e18;
    --panel: #141824;
    --panel-2: #1a1f2e;
    --text: #d0d8e8;
    --text-dim: #8892a8;
    --adenine: #ff6b6b;
    --thymine: #4ecdc4;
    --guanine: #45b7d1;
    --cytosine: #f9ca24;
    --helix: #e8e8e8;
    --line: rgba(232, 232, 232, 0.08);

    --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --font-body: "IBM Plex Sans", "Inter", system-ui, sans-serif;
    --font-code: "IBM Plex Mono", "Menlo", "Consolas", monospace;
}

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

html, body {
    background: var(--lab-dark);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    position: relative;
}

#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
}

main, header.site-header, footer.site-foot {
    position: relative;
    z-index: 1;
}

a {
    color: inherit;
    text-decoration: none;
}

code, pre {
    font-family: var(--font-code);
    font-size: 0.85rem;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--helix);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.4rem 2.5rem;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
    background: rgba(10, 14, 24, 0.6);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
}

.brand-mark svg {
    animation: brand-spin 18s linear infinite;
}

.brand-name {
    color: var(--helix);
}

.brand-dot {
    color: var(--adenine);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-family: var(--font-code);
    font-size: 0.82rem;
    color: var(--text-dim);
}

.site-nav a {
    transition: color 220ms ease;
}

.site-nav a:hover {
    color: var(--thymine);
}

.nav-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-dim);
    font-size: 0.75rem;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--thymine);
    box-shadow: 0 0 10px var(--thymine);
    animation: pulse 2.4s ease-in-out infinite;
}

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

@keyframes brand-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 4rem;
    padding: 6rem 2.5rem 5rem;
    max-width: 1400px;
    margin: 0 auto;
    align-items: center;
    min-height: 80vh;
}

.eyebrow {
    font-family: var(--font-code);
    font-size: 0.8rem;
    color: var(--thymine);
    margin-bottom: 1.5rem;
    letter-spacing: 0.04em;
}

.hero-title {
    font-size: clamp(2.4rem, 5.5vw, 4.6rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.025em;
    margin-bottom: 1.6rem;
}

.title-helix {
    background: linear-gradient(120deg, var(--adenine), var(--cytosine), var(--guanine), var(--thymine));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-shift 12s ease infinite;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-sub {
    font-size: 1.08rem;
    color: var(--text);
    max-width: 38ch;
    margin-bottom: 2.5rem;
    opacity: 0.85;
}

.hero-meta {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.meta-block {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.meta-label {
    font-family: var(--font-code);
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.meta-value {
    font-family: var(--font-code);
    font-size: 0.95rem;
    color: var(--helix);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.6rem;
    font-family: var(--font-code);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    border-radius: 6px;
    transition: all 240ms ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn.primary {
    background: var(--thymine);
    color: var(--lab-dark);
    font-weight: 500;
}

.btn.primary:hover {
    background: var(--helix);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(78, 205, 196, 0.5);
}

.btn.ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--line);
}

.btn.ghost:hover {
    border-color: var(--thymine);
    color: var(--thymine);
}

.btn.large {
    padding: 1.1rem 2.2rem;
    font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   Hero visual: CSS double helix
   -------------------------------------------------------------------------- */

.hero-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.helix-stage {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 540px;
    perspective: 1200px;
}

.helix {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    animation: helix-spin 14s linear infinite;
}

@keyframes helix-spin {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

.rung {
    position: absolute;
    left: 50%;
    width: 220px;
    height: 4px;
    transform-origin: 0 50%;
    transform-style: preserve-3d;
    margin-left: -110px;
    display: flex;
    align-items: center;
}

.rung-bar {
    flex: 1;
    height: 1.5px;
    background: linear-gradient(90deg, var(--base-a), var(--base-b));
    opacity: 0.35;
}

.rung-node {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 12px currentColor;
}

.rung-node.left {
    background: var(--base-a);
    color: var(--base-a);
}

.rung-node.right {
    background: var(--base-b);
    color: var(--base-b);
}

.helix-axis {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(232, 232, 232, 0.18), transparent);
    transform: translateX(-0.5px);
    pointer-events: none;
}

.helix-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3.5rem;
    text-align: center;
    font-family: var(--font-code);
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.caption-line {
    display: block;
    letter-spacing: 0.12em;
}

/* --------------------------------------------------------------------------
   Section heads
   -------------------------------------------------------------------------- */

.section-head {
    max-width: 1400px;
    margin: 0 auto 3rem;
    padding: 0 2.5rem;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0 1.5rem;
    align-items: baseline;
}

.section-num {
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--thymine);
    grid-row: 1 / span 2;
    align-self: flex-start;
    padding-top: 0.4rem;
}

.section-head h2 {
    font-size: clamp(1.8rem, 3.2vw, 2.4rem);
    font-weight: 600;
    color: var(--helix);
    margin-bottom: 0.5rem;
}

.section-head h2 em {
    font-style: normal;
    font-family: var(--font-code);
    font-size: 0.6em;
    color: var(--text-dim);
    margin-left: 0.6rem;
    font-weight: 400;
}

.section-head p {
    color: var(--text);
    opacity: 0.75;
    max-width: 60ch;
}

/* --------------------------------------------------------------------------
   Experiment / split panels
   -------------------------------------------------------------------------- */

.experiment {
    padding: 5rem 0 6rem;
    border-top: 1px solid var(--line);
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2.5rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: var(--panel-2);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-code);
    font-size: 0.78rem;
    color: var(--text-dim);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-a { background: var(--adenine); }
.dot-t { background: var(--thymine); }
.dot-g { background: var(--guanine); }
.dot-c { background: var(--cytosine); }

.filename {
    margin-left: auto;
    color: var(--text);
}

.code-panel .code {
    padding: 1.5rem;
    overflow-x: auto;
    flex: 1;
    background:
        linear-gradient(180deg, transparent 0, transparent 100%),
        var(--panel);
    line-height: 1.7;
}

.code code {
    color: var(--text);
}

.c-comment { color: #6f7a91; font-style: italic; }
.c-key { color: var(--guanine); }
.c-fn { color: var(--cytosine); }
.c-type { color: var(--thymine); }
.c-num { color: var(--adenine); }

/* visual panel */
.visual-panel {
    background: var(--panel);
    display: flex;
    flex-direction: column;
}

.viz {
    flex: 1;
    background:
        radial-gradient(circle at 30% 30%, rgba(78, 205, 196, 0.07), transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(255, 107, 107, 0.07), transparent 60%),
        var(--lab-dark);
    border-bottom: 1px solid var(--line);
    padding: 1.5rem;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viz svg {
    width: 100%;
    height: auto;
    max-height: 320px;
}

.svg-label {
    font-family: var(--font-code);
    font-size: 11px;
}

.controls {
    padding: 1.4rem 1.5rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ctrl {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ctrl-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--font-code);
    font-size: 0.78rem;
    color: var(--text-dim);
}

.ctrl-label em {
    font-style: normal;
    color: var(--thymine);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--panel-2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--thymine);
    border: 2px solid var(--lab-dark);
    cursor: pointer;
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.5);
    transition: transform 160ms ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.18);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--thymine);
    border: 2px solid var(--lab-dark);
    cursor: pointer;
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.5);
}

/* --------------------------------------------------------------------------
   Research log
   -------------------------------------------------------------------------- */

.research-log {
    padding: 5rem 0 6rem;
    border-top: 1px solid var(--line);
}

.log-entries {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.log-entry {
    border-left: 3px solid var(--thymine);
    padding-left: 1.5rem;
    margin: 0.5rem 0;
    transition: border-color 240ms ease, transform 240ms ease;
}

.log-entry:hover {
    transform: translateX(4px);
}

.log-entry:nth-child(1) { border-left-color: var(--adenine); }
.log-entry:nth-child(2) { border-left-color: var(--thymine); }
.log-entry:nth-child(3) { border-left-color: var(--guanine); }
.log-entry:nth-child(4) { border-left-color: var(--cytosine); }

.log-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.7rem;
}

.log-date {
    font-family: var(--font-code);
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 0.06em;
}

.log-tag {
    font-family: var(--font-code);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: var(--panel-2);
}

.tag-a { color: var(--adenine); }
.tag-t { color: var(--thymine); }
.tag-g { color: var(--guanine); }
.tag-c { color: var(--cytosine); }

.log-entry h3 {
    font-size: 1.25rem;
    margin-bottom: 0.6rem;
    color: var(--helix);
}

.log-entry p {
    color: var(--text);
    opacity: 0.82;
    max-width: 70ch;
}

.log-entry code {
    color: var(--cytosine);
    background: var(--panel);
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
}

/* --------------------------------------------------------------------------
   Sequence stream
   -------------------------------------------------------------------------- */

.sequence-section {
    padding: 5rem 0 6rem;
    border-top: 1px solid var(--line);
}

.seq-window {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-left: 2.5rem;
    margin-right: 2.5rem;
    font-family: var(--font-code);
}

.seq-prompt {
    color: var(--thymine);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--line);
}

.seq-stream {
    font-size: 0.95rem;
    line-height: 1.8;
    letter-spacing: 0.18em;
    word-break: break-all;
    min-height: 140px;
    color: var(--text-dim);
}

.base-A { color: var(--adenine); }
.base-T { color: var(--thymine); }
.base-G { color: var(--guanine); }
.base-C { color: var(--cytosine); }

.legend {
    display: flex;
    gap: 1.6rem;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 1.4rem auto 0;
    padding: 0 2.5rem;
    font-family: var(--font-code);
    font-size: 0.82rem;
    color: var(--text-dim);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    box-shadow: 0 0 8px currentColor;
}

/* --------------------------------------------------------------------------
   CTA
   -------------------------------------------------------------------------- */

.cta {
    padding: 6rem 2.5rem;
    border-top: 1px solid var(--line);
}

.cta-inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.cta-pre {
    font-family: var(--font-code);
    color: var(--cytosine);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.cta h2 {
    font-size: clamp(1.8rem, 3.6vw, 2.8rem);
    margin-bottom: 1rem;
}

.cta-sub {
    color: var(--text);
    opacity: 0.8;
    margin-bottom: 2rem;
}

.cta-sub code {
    color: var(--thymine);
    background: var(--panel);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-foot {
    border-top: 1px solid var(--line);
    background: var(--panel);
    padding: 4rem 2.5rem 2rem;
}

.foot-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto 2.5rem;
}

.foot-title {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--helix);
    margin-bottom: 0.8rem;
    font-size: 1rem;
}

.foot-grid p,
.foot-grid li {
    color: var(--text);
    opacity: 0.7;
    font-size: 0.92rem;
}

.foot-grid ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.foot-grid a {
    transition: color 200ms ease;
}

.foot-grid a:hover {
    color: var(--thymine);
}

.foot-bar {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    font-family: var(--font-code);
    font-size: 0.78rem;
    color: var(--text-dim);
}

.foot-bases {
    letter-spacing: 0.6em;
    color: var(--helix);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 960px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 3rem;
        padding: 3.5rem 1.5rem 4rem;
    }

    .helix-stage {
        height: 440px;
    }

    .split {
        grid-template-columns: 1fr;
        padding: 0 1.5rem;
    }

    .section-head {
        padding: 0 1.5rem;
    }

    .log-entries {
        padding: 0 1.5rem;
    }

    .seq-window {
        margin-left: 1.5rem;
        margin-right: 1.5rem;
    }

    .legend {
        padding: 0 1.5rem;
    }

    .cta {
        padding: 4rem 1.5rem;
    }

    .foot-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-header {
        padding: 1.1rem 1.5rem;
    }

    .site-nav {
        gap: 1rem;
        font-size: 0.78rem;
    }

    .site-nav .nav-status {
        display: none;
    }
}

@media (max-width: 600px) {
    .site-nav a {
        display: none;
    }
    .foot-grid {
        grid-template-columns: 1fr;
    }
    .foot-bar {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .helix,
    .brand-mark svg,
    .title-helix,
    .status-dot {
        animation: none !important;
    }
}
