/* tanso.wiki - Carbon Encyclopedia Terminal */
/* Colors: #1B1F24, #000000, #3A4149, #454B54, #C8CCD0, #7EB8C9, #8ABFA2, #D4A85C, #5C6370, #5CA4BF */

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

:root {
    --carbon-charcoal: #1B1F24;
    --true-black: #000000;
    --phosphor-dim: #3A4149;
    --slate-frame: #454B54;
    --readout-white: #C8CCD0;
    --hud-cyan: #7EB8C9;
    --phosphor-green: #8ABFA2;
    --amber-alert: #D4A85C;
    --annotation-gray: #5C6370;
    --cursor-glow: #5CA4BF;
}

html {
    scroll-behavior: smooth;
}

body {
    width: 100%;
    min-height: 100vh;
    background: var(--true-black);
    color: var(--readout-white);
    font-family: 'Overpass Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.6vw, 1.05rem);
    line-height: 1.78;
    letter-spacing: 0.02em;
    overflow-x: hidden;
}

/* Bezel Frame */
.bezel-frame {
    position: relative;
    margin: 12px;
    border: 2px solid var(--slate-frame);
    min-height: calc(100vh - 24px);
    background: var(--carbon-charcoal);
    overflow: hidden;
}

/* Scanline Overlay */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.015) 2px,
        rgba(255, 255, 255, 0.015) 3px
    );
    pointer-events: none;
    z-index: 100;
}

/* Cursor Ghost */
.cursor-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 200;
    transform: translate(-24px, -24px);
    transition: none;
}

.cursor-ghost.hover svg circle {
    r: 12;
    stroke-opacity: 0.7;
}

.cursor-ghost.hover svg line {
    stroke-opacity: 0.7;
    transform-origin: center;
}

/* HUD Strip */
.hud-strip {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    height: 40px;
    background: rgba(27, 31, 36, 0.95);
    border-bottom: 1px solid var(--phosphor-dim);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 150;
}

.hud-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--annotation-gray);
    transition: opacity 0.15s ease;
}

.progress-arc {
    flex-shrink: 0;
}

.hud-cursor-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--phosphor-green);
    animation: hudBlink 1s step-end infinite;
    margin-left: auto;
}

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

/* Console Viewport */
.console-viewport {
    position: relative;
    padding-top: 60px;
    padding-bottom: 40px;
}

/* Gutter Annotations */
.gutter-annotation {
    position: absolute;
    left: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--annotation-gray);
    transform: rotate(-90deg);
    transform-origin: left center;
    white-space: nowrap;
}

/* Data Panels */
.data-panel {
    max-width: 860px;
    margin: 40px auto;
    border: 1px solid var(--phosphor-dim);
    background: var(--carbon-charcoal);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.data-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.panel-tall {
    min-height: 80vh;
}

/* Panel Titlebar */
.panel-titlebar {
    height: 28px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid var(--phosphor-dim);
    gap: 10px;
}

.titlebar-dots {
    display: flex;
    gap: 5px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--phosphor-dim);
}

.titlebar-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--annotation-gray);
}

/* Panel Content */
.panel-content {
    padding: 30px 40px;
}

/* Typography */
.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hud-cyan);
    margin-bottom: 8px;
}

.subsection-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    color: var(--phosphor-green);
    margin-bottom: 8px;
}

.body-text {
    color: var(--readout-white);
    margin-bottom: 16px;
}

.data-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--annotation-gray);
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--phosphor-dim);
}

/* Orbital Diagram */
.orbital-diagram {
    float: right;
    width: 160px;
    margin: 0 0 20px 20px;
}

.orbital-diagram svg {
    width: 100%;
    height: auto;
}

/* Full Dock Sections */
.full-dock {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
}

/* HUD Brackets */
.hud-brackets .bracket {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 24px;
    color: var(--phosphor-dim);
    opacity: 0.2;
}

.bracket.tl { top: 20px; left: 20px; }
.bracket.tr { top: 20px; right: 20px; }
.bracket.bl { bottom: 20px; left: 20px; }
.bracket.br { bottom: 20px; right: 20px; }

.crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 18px;
    color: var(--hud-cyan);
    opacity: 0.15;
    pointer-events: none;
}

/* Lattice Container */
.lattice-container {
    width: 400px;
    height: 400px;
    max-width: 80vw;
    max-height: 60vh;
}

.lattice-container svg {
    width: 100%;
    height: 100%;
}

.dock-caption {
    font-family: 'Overpass Mono', monospace;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    color: var(--readout-white);
    margin-top: 20px;
    text-align: center;
    max-width: 500px;
}

.dock-annotation {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    color: var(--annotation-gray);
}

.dock-annotation.left { left: 40px; bottom: 60px; }
.dock-annotation.right { right: 40px; bottom: 60px; }

/* Allotrope Rows */
.allotrope-row {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(58, 65, 73, 0.5);
}

.allotrope-illustration {
    flex-shrink: 0;
    width: 120px;
}

.allotrope-illustration svg {
    width: 100%;
    height: auto;
}

.allotrope-text {
    flex: 1;
}

/* Path Draw Animation */
.path-draw line,
.path-draw circle,
.path-draw polygon,
.path-draw rect,
.path-draw path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.path-draw.drawn line,
.path-draw.drawn circle,
.path-draw.drawn polygon,
.path-draw.drawn rect,
.path-draw.drawn path {
    stroke-dashoffset: 0;
}

/* Gauge */
.gauge-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.gauge-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--annotation-gray);
    text-transform: uppercase;
    width: 100px;
    flex-shrink: 0;
}

.gauge {
    flex: 1;
    height: 4px;
    background: var(--phosphor-dim);
    border-radius: 2px;
    overflow: hidden;
    max-width: 200px;
}

.gauge-fill {
    height: 100%;
    width: var(--fill);
    background: var(--amber-alert);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s ease-out 0.3s;
}

.allotrope-row.visible .gauge-fill {
    transform: scaleX(1);
}

/* Timeline */
.timeline-container {
    position: relative;
    height: 70vh;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 40px 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--phosphor-dim);
}

.timeline-node {
    position: relative;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.timeline-node.visible {
    opacity: 1;
}

.timeline-node.left {
    padding-right: 55%;
    justify-content: flex-end;
}

.timeline-node.right {
    padding-left: 55%;
    justify-content: flex-start;
}

.node-dot {
    position: absolute;
    left: calc(50% - 4px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--phosphor-dim);
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.timeline-node.visible .node-dot {
    background: var(--phosphor-green);
    box-shadow: 0 0 8px rgba(138, 191, 162, 0.5);
}

.node-content {
    display: flex;
    flex-direction: column;
}

.node-year {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--hud-cyan);
}

.node-text {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.8rem;
    color: var(--readout-white);
    line-height: 1.5;
}

/* Molecules */
.molecule-row {
    display: flex;
    gap: 30px;
    margin: 20px 0;
}

.molecule {
    text-align: center;
}

.molecule svg {
    width: 80px;
    height: 80px;
}

.molecule-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--annotation-gray);
    display: block;
    margin-top: 4px;
}

/* Carbon Cycle */
.cycle-container {
    width: 400px;
    height: 400px;
    max-width: 80vw;
    max-height: 70vh;
}

.cycle-svg {
    width: 100%;
    height: 100%;
}

.cycle-path {
    transition: stroke-dashoffset 1.5s ease;
}

.cycle-path.drawn {
    stroke-dashoffset: 0;
}

.cycle-label {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.cycle-label.visible {
    opacity: 1;
}

/* Terminal Cursor */
.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--phosphor-green);
    animation: termBlink 1.06s step-end infinite;
    vertical-align: middle;
    margin-left: 4px;
}

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

/* Footer */
.footer-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--annotation-gray);
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--phosphor-dim);
}

/* Responsive */
@media (max-width: 768px) {
    .bezel-frame {
        margin: 0;
        border: none;
    }

    .gutter-annotation {
        display: none;
    }

    .cursor-ghost {
        display: none;
    }

    .data-panel {
        margin: 20px 2.5vw;
        max-width: 95vw;
    }

    .panel-content {
        padding: 20px;
    }

    .full-dock {
        height: 90vh;
    }

    .hud-strip {
        top: 0;
        left: 0;
        right: 0;
    }

    .allotrope-row {
        flex-direction: column;
    }

    .allotrope-illustration {
        width: 80px;
    }

    .orbital-diagram {
        float: none;
        margin: 0 auto 20px;
    }

    .timeline-node.left,
    .timeline-node.right {
        padding-left: 55%;
        padding-right: 0;
        justify-content: flex-start;
    }
}
