/* ============================================
   TRANSACTOLOGY.NET - SEAPUNK RESEARCH STATION
   ============================================ */

/* Global Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    --color-bg-deep: #060e1a;
    --color-bg-mid: #0a1628;
    --color-bg-surface: #0f2847;
    --color-accent-primary: #4ecdc4;
    --color-accent-secondary: #1a6b8a;
    --color-text-primary: #e8f4f8;
    --color-text-secondary: #7ab8c9;
    --color-alert: #ff6b35;

    --scroll-progress: 0;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    background: linear-gradient(170deg, #060e1a 0%, #0a1628 35%, #0f2847 70%, #122d4f 100%);
    color: var(--color-text-primary);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    perspective: 1200px;
    scroll-behavior: smooth;
}

/* Typography */
h1, h2, h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.02em;
}

h1 {
    font-size: clamp(2.8rem, 7vw, 5rem);
}

h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    color: var(--color-text-primary);
    margin-bottom: 0.5em;
}

h3 {
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
}

p {
    margin-bottom: 1.5em;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    max-width: 68ch;
}

code, .monospace {
    font-family: 'Overpass Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 1vw, 0.88rem);
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Layer -400: Background Circuit Board */
.circuit-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -400;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(26, 107, 138, 0.03) 0px,
            transparent 1px,
            transparent 400px,
            rgba(26, 107, 138, 0.03) 401px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(26, 107, 138, 0.03) 0px,
            transparent 1px,
            transparent 400px,
            rgba(26, 107, 138, 0.03) 401px
        ),
        linear-gradient(170deg, #060e1a 0%, #0a1628 35%, #0f2847 70%, #122d4f 100%);
    background-attachment: fixed;
    opacity: 1;
    animation: sonarPulse 8s ease-in-out infinite;
}

@keyframes sonarPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.1); }
}

/* Layer -200: Particle field (data plankton) */
.particle-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -200;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #4ecdc4;
    border-radius: 50%;
    box-shadow: 0 0 6px #4ecdc4;
    opacity: 0.6;
    animation: drift linear infinite;
}

@keyframes drift {
    0% {
        transform: translateX(0) translateY(0);
        opacity: 0.6;
    }
    100% {
        transform: translateX(var(--drift-x)) translateY(var(--drift-y));
        opacity: 0.3;
    }
}

/* Layer +100: Foreground silt (blurred particulates) */
.foreground-silt {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
    overflow: hidden;
}

.silt-blob {
    position: absolute;
    background: radial-gradient(ellipse at center, rgba(26, 107, 138, 0.08) 0%, transparent 70%);
    filter: blur(40px);
    opacity: 0.8;
    animation: siltDrift 75s ease-in-out infinite;
}

@keyframes siltDrift {
    0%, 100% { transform: translateX(-10vw) translateY(-10vh); }
    50% { transform: translateX(10vw) translateY(10vh); }
}

/* Layer +200: HUD Overlay */
.hud-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    pointer-events: none;
}

.nav-indicators {
    position: fixed;
    top: 2rem;
    left: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: auto;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--color-accent-primary);
    opacity: 0.4;
    transition: all 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.nav-dot.active {
    background: var(--color-accent-primary);
    opacity: 1;
    box-shadow: 0 0 12px var(--color-accent-primary);
}

.depth-gauge {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    font-family: 'Overpass Mono', monospace;
    font-size: 0.7rem;
    color: var(--color-accent-primary);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    pointer-events: auto;
}

.audio-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Overpass Mono', monospace;
    font-size: 1rem;
    color: var(--color-accent-primary);
    opacity: 0.4;
    cursor: pointer;
    transition: all 300ms ease;
    z-index: 201;
    pointer-events: auto;
}

.audio-toggle:hover {
    opacity: 0.8;
}

.audio-icon {
    display: block;
}

/* Main Content Container */
.content-container {
    position: relative;
    z-index: 0;
    width: 100%;
    min-height: 600vh;
}

/* Hero Section */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.hero-content {
    text-align: center;
    opacity: 0;
    animation: heroFadeIn 2.5s ease-out 0.5s forwards;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.hero-title {
    font-size: clamp(3rem, 12vw, 6rem);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: var(--color-text-primary);
    text-shadow:
        0 0 10px rgba(78, 205, 196, 0.4),
        0 0 40px rgba(78, 205, 196, 0.15),
        0 0 80px rgba(78, 205, 196, 0.05);
    animation: glowPulse 4s ease-in-out infinite;
    margin-bottom: 0.5em;
}

@keyframes glowPulse {
    0%, 100% {
        text-shadow:
            0 0 10px rgba(78, 205, 196, 0.3),
            0 0 40px rgba(78, 205, 196, 0.1),
            0 0 80px rgba(78, 205, 196, 0.02);
    }
    50% {
        text-shadow:
            0 0 10px rgba(78, 205, 196, 0.5),
            0 0 40px rgba(78, 205, 196, 0.2),
            0 0 80px rgba(78, 205, 196, 0.08);
    }
}

.hero-subtitle {
    font-family: 'Nunito Sans', sans-serif;
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 400;
    color: var(--color-text-secondary);
    letter-spacing: 0.02em;
    animation: subtitleFade 0.6s ease-out 2.5s backwards;
}

@keyframes subtitleFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.hero-divider {
    width: 60vw;
    max-width: 800px;
    height: 1px;
    background: linear-gradient(to right,
        transparent 0%,
        var(--color-accent-primary) 50%,
        transparent 100%);
    opacity: 0.4;
    margin: 2em auto;
    animation: dividerDraw 0.8s ease-out 3.5s backwards;
}

@keyframes dividerDraw {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 60vw;
        opacity: 0.4;
    }
}

.scroll-indicator {
    margin-top: 3em;
    animation: chevronPulse 1.2s ease-in-out 4s infinite;
}

.chevron {
    display: inline-block;
    font-size: 1.5rem;
    color: var(--color-accent-primary);
    opacity: 0.5;
}

@keyframes chevronPulse {
    0%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(6px);
    }
}

/* Content Sections */
.content-section {
    position: relative;
    min-height: 100vh;
    padding: 4rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.content-section::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--color-accent-secondary);
    opacity: 0.3;
}

/* Depth Indicator */
.depth-indicator {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.depth-label {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.65rem;
    color: var(--color-accent-secondary);
    opacity: 0.5;
    transform: rotate(-90deg);
    text-align: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
}

/* Glassmorphic Cards */
.glassmorphic-card {
    background: rgba(15, 40, 71, 0.55);
    backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid rgba(78, 205, 196, 0.12);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow:
        0 8px 32px rgba(6, 14, 26, 0.5),
        inset 0 1px 0 rgba(78, 205, 196, 0.08);
    max-width: 70vw;
    width: 100%;
    opacity: 0;
    transform: translateY(60px) translateZ(-50px);
    animation: cardEnter 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
    transition: all 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(60px) translateZ(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

.glassmorphic-card:hover {
    transform: translateY(-4px);
    border-color: rgba(78, 205, 196, 0.25);
    box-shadow:
        0 12px 48px rgba(6, 14, 26, 0.6),
        inset 0 1px 0 rgba(78, 205, 196, 0.12);
}

.card-label {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-accent-primary);
    opacity: 0.7;
    margin-bottom: 0.75em;
}

.card-divider {
    height: 1px;
    background: linear-gradient(to right,
        var(--color-accent-primary) 0%,
        transparent 100%);
    opacity: 0.15;
    margin: 1em 0 1.5em 0;
}

.card-content {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
}

.main-text {
    grid-column: 1 / 5;
}

.marginalia {
    grid-column: 5 / 7;
    display: flex;
    flex-direction: column;
    gap: 1.5em;
}

.margin-item {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    opacity: 0.8;
    line-height: 1.5;
    padding: 0.75rem;
    border-left: 2px solid var(--color-accent-secondary);
    padding-left: 1rem;
}

.margin-item strong {
    color: var(--color-accent-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 0.25em;
}

/* Content Grid Layout */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1200px;
    width: 100%;
}

.glassmorphic-card.card-offset {
    margin-top: 5rem;
}

/* Transaction Diagram */
.transaction-diagram {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 2rem auto;
}

.diagram-node {
    filter: drop-shadow(0 0 4px rgba(78, 205, 196, 0.3));
}

.diagram-edge {
    animation: dashFlow 3s linear infinite;
}

@keyframes dashFlow {
    to {
        stroke-dashoffset: -10;
    }
}

/* Data Table */
.data-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 2rem 0;
    font-family: 'Overpass Mono', monospace;
    font-size: 0.9rem;
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(78, 205, 196, 0.1);
}

.table-row.header {
    border-bottom: 1px solid rgba(78, 205, 196, 0.3);
    color: var(--color-accent-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

.table-cell {
    padding: 0.5rem 0;
    color: var(--color-text-secondary);
}

/* Transit Zones */
.transit-zone {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 4rem 2rem;
}

.transit-zone.final-zone {
    min-height: 50vh;
}

.coral-ornament {
    width: 200px;
    height: 200px;
    opacity: 0;
    animation: coralGrow 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes coralGrow {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.closure-text {
    text-align: center;
    font-family: 'Overpass Mono', monospace;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    opacity: 0.6;
    letter-spacing: 0.05em;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        background-attachment: fixed;
    }

    .nav-indicators {
        display: none;
    }

    .depth-gauge {
        bottom: 1rem;
        right: 1rem;
        font-size: 0.6rem;
    }

    .audio-toggle {
        top: 1rem;
        right: 1rem;
    }

    .content-section {
        padding: 2rem 1rem;
        min-height: auto;
    }

    .depth-indicator {
        display: none;
    }

    .glassmorphic-card {
        max-width: calc(100vw - 2rem);
        padding: 1.5rem;
    }

    .card-content {
        grid-template-columns: 1fr;
    }

    .main-text {
        grid-column: 1 / -1;
    }

    .marginalia {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 1rem;
    }

    .margin-item {
        flex: 1;
        font-size: 0.75rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .glassmorphic-card.card-offset {
        margin-top: 0;
    }

    .transit-zone {
        min-height: 25vh;
    }

    .hero-section {
        padding: 2rem;
    }

    p {
        font-size: 1rem;
    }

    h2 {
        font-size: clamp(1.4rem, 4vw, 1.8rem);
    }
}

/* Loading animation for body */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-deep);
    z-index: -1;
    animation: fadeOut 0.8s ease-out 0.3s forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Additional utility animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
