/* ==========================================================================
   transactology.xyz - Dreamy Ethereal Retro / Marble + Neon
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0e0e12;
    --bg-deep-violet: #1a1028;
    --marble-white: #e8e0d8;
    --muted-gray: #6b6370;
    --neon-cyan: #00f0ff;
    --neon-magenta: #ff2d7b;
    --neon-lime: #a6ff00;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --spring-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    background-color: var(--bg-primary);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--marble-white);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    position: relative;
    /* Marble background texture via CSS gradients */
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 100px,
            rgba(232, 224, 216, 0.015) 100px,
            rgba(232, 224, 216, 0.015) 101px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 200px,
            rgba(232, 224, 216, 0.01) 200px,
            rgba(232, 224, 216, 0.01) 201px
        ),
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 300px,
            rgba(107, 99, 112, 0.02) 300px,
            rgba(107, 99, 112, 0.02) 302px
        ),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 500px,
            rgba(232, 224, 216, 0.008) 500px,
            rgba(232, 224, 216, 0.008) 503px
        );
    animation: marbleBreathing 30s ease-in-out infinite;
}

@keyframes marbleBreathing {
    0%, 100% { background-size: 100% 100%; }
    50% { background-size: 103% 103%; }
}

/* --- Cursor Glow --- */
#cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 45, 123, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    opacity: 0;
}

#cursor-glow.active {
    opacity: 1;
}

/* --- Particles Layer --- */
#particles-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.spore {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--neon-lime);
    opacity: 0.15;
    animation: sporeFloat linear infinite;
}

@keyframes sporeFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(-100vh) translateX(30px);
        opacity: 0;
    }
}

/* --- SVG Filters --- */
#svg-filters {
    position: absolute;
    width: 0;
    height: 0;
}

/* --- Sections --- */
.section {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 24px;
    position: relative;
    scroll-snap-align: start;
}

.section-hero {
    min-height: 100vh;
    background-color: var(--bg-primary);
}

.section-philosophy {
    background-color: var(--bg-deep-violet);
}

.section-methodology {
    background-color: var(--bg-primary);
}

.section-archive {
    background-color: var(--bg-deep-violet);
}

.section-signal {
    background-color: var(--bg-primary);
}

/* --- Section Background Numbers --- */
.section-bg-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 20rem;
    color: var(--marble-white);
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
    user-select: none;
    line-height: 1;
}

/* --- Marble Panels --- */
.marble-panel {
    position: relative;
    z-index: 2;
    max-width: 720px;
    width: 100%;
    padding: 48px 56px;
    /* Marble texture via layered gradients */
    background:
        linear-gradient(135deg, rgba(232, 224, 216, 0.04) 0%, transparent 50%),
        linear-gradient(225deg, rgba(107, 99, 112, 0.06) 0%, transparent 40%),
        repeating-linear-gradient(
            70deg,
            transparent,
            transparent 30px,
            rgba(232, 224, 216, 0.025) 30px,
            rgba(232, 224, 216, 0.025) 31px
        ),
        repeating-linear-gradient(
            160deg,
            transparent,
            transparent 50px,
            rgba(107, 99, 112, 0.02) 50px,
            rgba(107, 99, 112, 0.02) 52px
        ),
        linear-gradient(180deg, rgba(26, 16, 40, 0.6), rgba(14, 14, 18, 0.8));
    border: 1px solid rgba(232, 224, 216, 0.08);
    border-radius: 4px;
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(232, 224, 216, 0.05);
    transition: transform 0.4s var(--spring-ease), box-shadow 0.4s ease;
}

.marble-panel--wide {
    max-width: 960px;
}

.marble-panel:hover {
    transform: translateY(-4px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 45, 123, 0.06),
        inset 0 1px 0 rgba(232, 224, 216, 0.08);
}

/* --- Panel Corner Ornaments --- */
.marble-panel__corner {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.marble-panel__corner--tl {
    top: 8px;
    left: 8px;
    border-top: 1px solid var(--neon-magenta);
    border-left: 1px solid var(--neon-magenta);
    opacity: 0.4;
}

.marble-panel__corner--tr {
    top: 8px;
    right: 8px;
    border-top: 1px solid var(--neon-magenta);
    border-right: 1px solid var(--neon-magenta);
    opacity: 0.4;
}

.marble-panel__corner--bl {
    bottom: 8px;
    left: 8px;
    border-bottom: 1px solid var(--neon-magenta);
    border-left: 1px solid var(--neon-magenta);
    opacity: 0.4;
}

.marble-panel__corner--br {
    bottom: 8px;
    right: 8px;
    border-bottom: 1px solid var(--neon-magenta);
    border-right: 1px solid var(--neon-magenta);
    opacity: 0.4;
}

/* --- Typography --- */
h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 4rem;
    letter-spacing: -0.03em;
    color: var(--marble-white);
    margin-bottom: 16px;
    line-height: 1.1;
}

h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2.5rem;
    letter-spacing: -0.02em;
    color: var(--marble-white);
    margin-bottom: 20px;
    line-height: 1.2;
}

p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    color: rgba(232, 224, 216, 0.85);
    max-width: 600px;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 1.25rem;
    color: var(--muted-gray);
    line-height: 1.6;
}

.label {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.875rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--neon-cyan);
    display: block;
    margin-bottom: 16px;
}

/* --- Neon Flicker --- */
.neon-flicker {
    position: relative;
}

.neon-flicker.flickering {
    animation: neonFlick 0.15s ease-in-out;
}

@keyframes neonFlick {
    0%, 100% { opacity: 1; }
    25% { opacity: 0.85; }
    50% { opacity: 1; }
    75% { opacity: 0.88; }
}

/* --- Hover Lift --- */
.hover-lift {
    transition: transform 0.4s var(--spring-ease), box-shadow 0.4s ease;
    cursor: pointer;
}

.hover-lift:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 0 20px rgba(255, 45, 123, 0.3);
}

/* --- Reveal Panel Animation --- */
.reveal-panel {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-panel.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* stagger children */
.reveal-panel.revealed > *:nth-child(1) { transition-delay: 0ms; }
.reveal-panel.revealed > *:nth-child(2) { transition-delay: 80ms; }
.reveal-panel.revealed > *:nth-child(3) { transition-delay: 160ms; }
.reveal-panel.revealed > *:nth-child(4) { transition-delay: 240ms; }
.reveal-panel.revealed > *:nth-child(5) { transition-delay: 320ms; }
.reveal-panel.revealed > *:nth-child(6) { transition-delay: 400ms; }

/* --- Fern Dividers --- */
.fern-divider {
    width: 200px;
    margin: 40px auto 0;
    opacity: 0.7;
    z-index: 2;
    position: relative;
}

.fern-svg {
    width: 100%;
    height: auto;
    display: block;
}

.fern-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s ease-out;
}

.fern-divider.unfurled .fern-path {
    stroke-dashoffset: 0;
}

/* --- Archive Entries --- */
.archive-entries {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
    width: 100%;
}

.archive-entry {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(232, 224, 216, 0.03), rgba(26, 16, 40, 0.4));
    border: 1px solid rgba(232, 224, 216, 0.06);
    border-radius: 3px;
    transition: transform 0.4s var(--spring-ease), box-shadow 0.4s ease, border-color 0.3s ease;
}

.archive-entry:hover {
    border-color: rgba(255, 45, 123, 0.3);
}

.archive-entry__number {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--neon-magenta);
    min-width: 40px;
}

.archive-entry__title {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1.125rem;
    color: var(--marble-white);
    flex: 1;
}

.archive-entry__date {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted-gray);
}

/* --- Signal Link --- */
.signal-link {
    display: inline-block;
    margin-top: 24px;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    text-decoration: none;
    padding: 12px 28px;
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 3px;
    background: transparent;
    transition: all 0.4s var(--spring-ease);
}

.signal-link:hover {
    color: var(--marble-white);
    border-color: var(--neon-magenta);
    background: rgba(255, 45, 123, 0.08);
    box-shadow: 0 0 20px rgba(255, 45, 123, 0.3);
    transform: translateY(-6px) scale(1.02);
}

/* --- Footer --- */
.site-footer {
    padding: 60px 24px 40px;
    text-align: center;
    position: relative;
}

.footer-vein {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 30px;
    height: 2px;
}

.vein-line {
    width: 100%;
    height: 2px;
    display: block;
}

.footer-text {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1rem;
    color: var(--muted-gray);
    display: block;
    margin-bottom: 8px;
}

.footer-year {
    color: var(--muted-gray);
    font-size: 0.75rem;
    opacity: 0.6;
}

/* --- Accent Gradient Strip (between sections) --- */
.section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 1px;
    background: linear-gradient(135deg, var(--neon-magenta), var(--neon-cyan));
    opacity: 0.2;
}

.section-signal::after {
    display: none;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }
    h2 {
        font-size: 1.75rem;
    }
    .marble-panel {
        padding: 32px 28px;
    }
    .section-bg-number {
        font-size: 10rem;
    }
    .archive-entry {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    .archive-entry__number {
        font-size: 1.125rem;
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .reveal-panel {
        opacity: 1;
        transform: none;
    }
    .fern-path {
        stroke-dashoffset: 0;
    }
    #cursor-glow,
    #particles-layer {
        display: none;
    }
}
