/* ===========================================
   xanadu.wiki - Jewel-Tone Docuverse
   =========================================== */

:root {
    --obsidian-void: #0a0a14;
    --twilight-indigo: #121228;
    --midnight-sapphire: #1a1a3e;
    --imperial-amethyst: #7b2d8e;
    --emerald-frequency: #0f7b5f;
    --ruby-signal: #b5243a;
    --amber-transmission: #d4a843;
    --lunar-silver: #e2e0ef;
    --phantom-lavender: #9b97b8;
    --sapphire-pulse: #2d4a9b;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--obsidian-void);
    color: var(--lunar-silver);
    font-family: 'Nunito', sans-serif;
    font-size: 1.05rem;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

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

/* ===========================================
   Magnetic Navigation Dock
   =========================================== */
#magnetic-dock {
    position: fixed;
    bottom: -80px;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: bottom 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: linear-gradient(to top, rgba(10, 10, 20, 0.95), transparent);
    padding: 20px 0 24px;
}

#magnetic-dock.visible {
    bottom: 0;
}

.dock-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-node:hover {
    transform: scale(1.15);
}

.node-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--sapphire-pulse);
    border: 2px solid var(--phantom-lavender);
    transition: background 0.3s, box-shadow 0.3s;
}

.nav-node:hover .node-circle {
    background: var(--amber-transmission);
    box-shadow: 0 0 12px var(--amber-transmission), 0 0 24px rgba(212, 168, 67, 0.3);
}

.nav-node.active .node-circle {
    background: var(--amber-transmission);
    box-shadow: 0 0 8px var(--amber-transmission);
}

.node-label {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.75rem;
    color: var(--phantom-lavender);
    margin-top: 6px;
    letter-spacing: 0.05em;
    transition: color 0.3s;
}

.nav-node:hover .node-label {
    color: var(--amber-transmission);
}

.nav-link-line line {
    stroke: var(--phantom-lavender);
    stroke-width: 1;
    opacity: 0.3;
}

/* ===========================================
   Section: Hero - Transmission Received
   =========================================== */
.section-hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0a14 0%, #1a1a3e 40%, #121228 100%);
    overflow: hidden;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 20px;
}

.terminal-prompt {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

.prompt-symbol {
    font-family: 'Fira Code', monospace;
    font-size: 2rem;
    color: var(--emerald-frequency);
}

.typed-text {
    font-family: 'Righteous', cursive;
    font-size: 4.2rem;
    color: var(--amber-transmission);
    letter-spacing: 0.08em;
    text-shadow: 0 0 20px rgba(212, 168, 67, 0.4), 0 0 60px rgba(212, 168, 67, 0.15);
}

.blinking-cursor {
    font-family: 'Fira Code', monospace;
    font-size: 3.5rem;
    color: var(--amber-transmission);
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.hero-subtitle {
    font-family: 'Nunito', sans-serif;
    font-size: 1.2rem;
    color: var(--phantom-lavender);
    margin-top: 24px;
    opacity: 0;
    transition: opacity 0.8s ease;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

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

.hero-scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    animation: float 2.5s ease-in-out infinite;
}

.chevron-down {
    font-size: 2.5rem;
    color: var(--phantom-lavender);
    opacity: 0.5;
}

@keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(12px); }
}

/* ===========================================
   Wave-Form Dividers
   =========================================== */
.wave-divider {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
    z-index: 5;
}

.wave-divider svg {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
}

.wave-path {
    fill: none;
    stroke-width: 2;
    opacity: 0.3;
}

.wave-1 { stroke: var(--imperial-amethyst); opacity: 0.35; }
.wave-2 { stroke: var(--emerald-frequency); opacity: 0.25; }
.wave-3 { stroke: var(--sapphire-pulse); opacity: 0.2; }
.wave-4 { stroke: var(--amber-transmission); opacity: 0.3; }
.wave-5 { stroke: var(--ruby-signal); opacity: 0.2; }
.wave-6 { stroke: var(--imperial-amethyst); opacity: 0.25; }
.wave-7 { stroke: var(--emerald-frequency); opacity: 0.35; }
.wave-8 { stroke: var(--sapphire-pulse); opacity: 0.25; }

/* ===========================================
   Constellation Backgrounds
   =========================================== */
.constellation-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ===========================================
   Section: Docuverse
   =========================================== */
.section-docuverse {
    position: relative;
    padding: 120px 0;
    background: var(--obsidian-void);
    min-height: 100vh;
}

.section-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 40px;
    position: relative;
    z-index: 2;
}

.content-panel {
    background: var(--twilight-indigo);
    border: 1px solid rgba(155, 151, 184, 0.08);
    border-radius: 4px;
    padding: 48px 40px;
    margin-bottom: 120px;
    box-shadow: 0 4px 30px rgba(45, 74, 155, 0.12), 0 0 60px rgba(123, 45, 142, 0.06);
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s ease,
                opacity 0.6s ease;
    opacity: 0.3;
}

.content-panel.in-view {
    opacity: 1;
    transform: rotate(0deg) !important;
}

.content-panel:hover {
    box-shadow: 0 4px 40px rgba(45, 74, 155, 0.2), 0 0 80px rgba(123, 45, 142, 0.1);
}

.panel-accent-bar {
    width: 60px;
    height: 4px;
    background: var(--imperial-amethyst);
    border-radius: 2px;
    margin-bottom: 24px;
}

.panel-accent-bar.accent-emerald {
    background: var(--emerald-frequency);
}

.section-heading {
    font-family: 'Righteous', cursive;
    font-size: 3.2rem;
    color: var(--amber-transmission);
    letter-spacing: 0.08em;
    margin-bottom: 32px;
    text-shadow: 0 0 15px rgba(212, 168, 67, 0.2);
}

.center-heading {
    text-align: center;
}

.terminal-glyph {
    color: var(--phantom-lavender);
    opacity: 0.5;
    font-weight: 400;
}

.sub-heading {
    font-family: 'Righteous', cursive;
    font-size: 1.8rem;
    color: var(--amber-transmission);
    letter-spacing: 0.06em;
    margin-bottom: 16px;
}

.body-text {
    color: var(--lunar-silver);
    margin-bottom: 16px;
    font-size: 1.05rem;
    line-height: 1.7;
}

.body-text em {
    color: var(--amber-transmission);
    font-style: italic;
}

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

.terminal-block {
    background: rgba(10, 10, 20, 0.6);
    border: 1px solid rgba(155, 151, 184, 0.1);
    border-radius: 4px;
    padding: 20px 24px;
    margin-top: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--emerald-frequency);
    overflow-x: auto;
}

.terminal-response {
    color: var(--phantom-lavender);
    opacity: 0.7;
}

/* ===========================================
   Node-Link Diagram
   =========================================== */
.node-diagram {
    max-width: 500px;
    margin: 0 auto 60px;
    position: relative;
    z-index: 2;
}

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

.node-link {
    fill: none;
    stroke: var(--phantom-lavender);
    stroke-width: 1.5;
    opacity: 0.3;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.5s ease;
}

.node-link.animate {
    stroke-dashoffset: 0;
}

.diagram-node {
    fill: var(--midnight-sapphire);
    stroke: var(--imperial-amethyst);
    stroke-width: 2;
    animation: nodePulse 3s ease-in-out infinite;
}

.diagram-node:nth-child(5) { animation-delay: 0s; }
.diagram-node:nth-child(6) { animation-delay: 1s; }
.diagram-node:nth-child(7) { animation-delay: 2s; }

@keyframes nodePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ===========================================
   Section: Archive
   =========================================== */
.section-archive {
    position: relative;
    padding: 120px 0;
    background: var(--twilight-indigo);
    min-height: 100vh;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px;
    margin-top: 60px;
}

.archive-card {
    background: var(--midnight-sapphire);
    border-radius: 4px;
    padding: 36px 32px;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s ease,
                opacity 0.6s ease;
    opacity: 0.3;
    box-shadow: 0 3px 20px rgba(0, 0, 0, 0.3);
}

.archive-card.in-view {
    opacity: 1;
}

.archive-card:hover {
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(123, 45, 142, 0.1);
}

.card-border-accent {
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
}

[data-accent="amethyst"] .card-border-accent { background: var(--imperial-amethyst); }
[data-accent="emerald"] .card-border-accent { background: var(--emerald-frequency); }
[data-accent="ruby"] .card-border-accent { background: var(--ruby-signal); }
[data-accent="sapphire"] .card-border-accent { background: var(--sapphire-pulse); }
[data-accent="amber"] .card-border-accent { background: var(--amber-transmission); }

.card-tag {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.85rem;
    color: var(--imperial-amethyst);
    background: rgba(123, 45, 142, 0.15);
    padding: 3px 12px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 16px;
}

[data-accent="emerald"] .card-tag {
    color: var(--emerald-frequency);
    background: rgba(15, 123, 95, 0.15);
}

[data-accent="ruby"] .card-tag {
    color: var(--ruby-signal);
    background: rgba(181, 36, 58, 0.15);
}

[data-accent="sapphire"] .card-tag {
    color: var(--sapphire-pulse);
    background: rgba(45, 74, 155, 0.15);
}

[data-accent="amber"] .card-tag {
    color: var(--amber-transmission);
    background: rgba(212, 168, 67, 0.15);
}

.card-title {
    font-family: 'Righteous', cursive;
    font-size: 1.4rem;
    color: var(--lunar-silver);
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.card-text {
    color: var(--phantom-lavender);
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 20px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid rgba(155, 151, 184, 0.08);
}

.meta-date {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--phantom-lavender);
    opacity: 0.6;
}

.meta-glyph {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--amber-transmission);
    opacity: 0.4;
}

/* ===========================================
   Section: Reconnection
   =========================================== */
.section-reconnection {
    position: relative;
    padding: 120px 0 80px;
    background: var(--obsidian-void);
    min-height: 100vh;
}

.reconnection-intro {
    max-width: 600px;
    margin: 0 auto 60px;
    color: var(--phantom-lavender);
}

.reconnection-network {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 400px;
    margin: 0 auto;
}

#reconnection-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#reconnection-svg line {
    stroke: var(--phantom-lavender);
    stroke-width: 1;
    opacity: 0.15;
    transition: opacity 0.3s;
}

.resource-nodes {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.resource-node {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.resource-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--midnight-sapphire);
    border: 2px solid var(--imperial-amethyst);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.resource-node:hover .resource-circle {
    background: var(--imperial-amethyst);
    border-color: var(--amber-transmission);
    box-shadow: 0 0 16px var(--imperial-amethyst), 0 0 32px rgba(123, 45, 142, 0.3);
    transform: scale(1.2);
}

.resource-label {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.85rem;
    color: var(--lunar-silver);
    margin-top: 8px;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.resource-url {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: var(--phantom-lavender);
    opacity: 0.5;
    margin-top: 2px;
}

/* ===========================================
   Transmission End
   =========================================== */
.transmission-end {
    max-width: 600px;
    margin: 80px auto 0;
    padding: 0 40px;
    position: relative;
    z-index: 2;
}

.end-terminal {
    text-align: center;
    border-color: rgba(212, 168, 67, 0.15);
}

.end-terminal .blinking-cursor {
    font-size: 0.9rem;
}

/* ===========================================
   Transmission Bars
   =========================================== */
.content-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--amber-transmission), transparent);
    animation: transmissionSweep 8s linear infinite;
    opacity: 0.2;
}

@keyframes transmissionSweep {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 768px) {
    .typed-text {
        font-size: 2.4rem;
    }

    .prompt-symbol {
        font-size: 1.4rem;
    }

    .blinking-cursor {
        font-size: 2rem;
    }

    .section-heading {
        font-size: 2.2rem;
    }

    .content-panel {
        padding: 32px 24px;
        margin-bottom: 80px;
    }

    .section-inner {
        padding: 0 20px;
    }

    .archive-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .reconnection-network {
        height: 500px;
    }

    .dock-inner {
        gap: 4px;
    }

    .nav-link-line {
        width: 30px;
    }
}

@media (max-width: 480px) {
    .typed-text {
        font-size: 1.8rem;
    }

    .section-heading {
        font-size: 1.8rem;
    }

    .node-label {
        font-size: 0.65rem;
    }
}
