/* graphers.net - The Descent into Structure */

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

:root {
    --observatory-night: #0D1B2A;
    --deep-slate: #1B2838;
    --grid-blue: #1B3A5C;
    --compass-steel: #415A77;
    --chalk-blue: #7EB8DA;
    --phosphor-white: #E0EAFC;
    --graphite-warm: #8B7E6A;
    --function-gold: #C9A84C;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    background-color: var(--observatory-night);
    color: var(--phosphor-white);
    overflow-x: hidden;
    line-height: 1.75;
}

/* Coordinate Grid Background */
#coord-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(var(--grid-blue) 0.5px, transparent 0.5px),
        linear-gradient(90deg, var(--grid-blue) 0.5px, transparent 0.5px),
        linear-gradient(rgba(27,58,92,0.3) 0.25px, transparent 0.25px),
        linear-gradient(90deg, rgba(27,58,92,0.3) 0.25px, transparent 0.25px);
    background-size: 48px 48px, 48px 48px, 12px 12px, 12px 12px;
    opacity: 0;
    transition: opacity 1.5s ease;
    mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.8) 30%, rgba(0,0,0,0.1) 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.8) 30%, rgba(0,0,0,0.1) 80%);
}

#coord-grid.visible {
    opacity: 0.3;
}

/* Node Overlay */
#node-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.4;
}

.network-layer {
    width: 100%;
    height: 100%;
}

.pulse-node {
    animation: nodePulse 4s ease-in-out infinite;
}

.pulse-node:nth-child(odd) {
    animation-delay: 0.5s;
}

.pulse-node:nth-child(3n) {
    animation-delay: 1.2s;
}

.pulse-node:nth-child(4n) {
    animation-delay: 2s;
}

@keyframes nodePulse {
    0%, 100% { transform-origin: center; r: inherit; opacity: 0.8; }
    50% { opacity: 1; }
}

/* Scroll Progress Dot */
#scroll-dot {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--function-gold);
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.4);
    z-index: 100;
    transition: top 0.1s linear;
}

/* ==================== HERO SECTION ==================== */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 40px 20px;
}

.hero-content {
    text-align: center;
}

.hero-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.12em;
    color: var(--phosphor-white);
    text-transform: uppercase;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(-40px);
}

.hero-title .letter.animate {
    animation: bounceEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bounceEnter {
    0% { opacity: 0; transform: translateY(-40px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hero-subtitle {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--chalk-blue);
    opacity: 0;
    transition: opacity 1s ease;
    margin-top: 16px;
}

.hero-subtitle.visible {
    opacity: 1;
}

.hero-curve {
    position: absolute;
    bottom: 15%;
    left: 0;
    width: 100%;
    height: 100px;
    z-index: 1;
}

.path-trace {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 3s ease-in-out;
}

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

.scroll-chevron {
    position: absolute;
    bottom: 40px;
    animation: chevronBounce 2s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes chevronBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ==================== TIMELINE SPINE ==================== */
.timeline-spine {
    position: fixed;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--compass-steel);
    transform: translateX(-50%);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.timeline-spine.visible {
    opacity: 0.6;
}

/* Timeline Nodes */
.timeline-node {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 20px 0;
    z-index: 3;
}

.node-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chalk-blue);
    border: 2px solid var(--compass-steel);
    position: relative;
    z-index: 3;
}

.node-dot.pulse {
    animation: dotPulse 2s ease-in-out;
}

@keyframes dotPulse {
    0% { transform: scale(1); box-shadow: none; }
    50% { transform: scale(1.5); box-shadow: 0 0 12px rgba(126,184,218,0.5); }
    100% { transform: scale(1); box-shadow: none; }
}

/* ==================== CONTENT SECTIONS ==================== */
.content-section {
    position: relative;
    z-index: 2;
    padding: 40px 20px;
}

.diagonal-transition {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8vh;
    background: var(--deep-slate);
    clip-path: polygon(0 0, 100% 4vh, 100% 100%, 0 100%);
    opacity: 0.3;
    z-index: -1;
}

/* Content Cards */
.content-card {
    background: rgba(13, 27, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--grid-blue);
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    position: relative;
    z-index: 3;
    opacity: 0;
}

.card-left {
    margin: 20px auto 20px 10%;
}

.card-right {
    margin: 20px 10% 20px auto;
}

.card-center {
    margin: 20px auto;
    max-width: 600px;
}

.card-wide {
    max-width: 700px;
}

.bounce-enter-left {
    transform: translateX(-60px);
}

.bounce-enter-right {
    transform: translateX(60px);
}

.content-card.visible {
    opacity: 1;
    transform: translateX(0);
    animation: cardBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cardBounce {
    0% { opacity: 0; }
    100% { opacity: 1; transform: translateX(0); }
}

.card-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    color: var(--compass-steel);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 12px;
}

.section-header {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor-white);
    margin-bottom: 16px;
}

.card-body {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    font-size: 1.1rem;
    line-height: 1.75;
    color: var(--phosphor-white);
    opacity: 0.85;
}

.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.95rem;
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

.bento-cell {
    padding: 20px;
    border: 1px solid var(--grid-blue);
    border-radius: 8px;
    background: rgba(27, 40, 56, 0.5);
}

.bento-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    color: var(--chalk-blue);
    display: block;
    margin-bottom: 8px;
}

.bento-text {
    font-size: 0.95rem;
    opacity: 0.75;
    line-height: 1.6;
}

/* Curve Transitions */
.curve-transition {
    padding: 60px 0;
    max-width: 1000px;
    margin: 0 auto;
}

.curve-transition svg {
    width: 100%;
    height: 60px;
}

/* Generative Tree */
.generative-tree {
    padding: 40px 20px;
    max-width: 800px;
    margin: 0 auto;
}

.generative-tree svg {
    width: 100%;
    height: auto;
}

.tree-line {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 5s ease-in-out;
}

.tree-line.drawn {
    stroke-dashoffset: 0;
}

/* ==================== RETURN SECTION ==================== */
.return-section {
    position: relative;
    z-index: 2;
    padding: 120px 20px 80px;
    text-align: center;
}

.domain-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    color: var(--compass-steel);
    margin-top: 60px;
    text-align: center;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .card-left,
    .card-right {
        margin: 20px auto;
        max-width: 90%;
    }

    .bento-grid {
        grid-template-columns: 1fr;
    }

    .card-wide {
        max-width: 90%;
    }

    .timeline-spine {
        display: none;
    }

    .timeline-node {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .content-card {
        padding: 24px;
    }
}
