/* ============================================
   gabs.feedback - Neuroscience Dopamine Dashboard
   ============================================ */

:root {
    --cortex: #1A1726;
    --synapse: #252233;
    --axon-white: #E8E4F0;
    --dendrite-mist: #9B93A8;
    --dopamine: #C76B8A;
    --teal: #5B9E9E;
    --saffron: #D4A854;
    --slate: #4A5568;
    --spark: #A78BFA;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background: var(--cortex);
    color: var(--axon-white);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 1.65;
    overflow-x: hidden;
}

/* --- SCENE 1: CORTEX SURFACE --- */
.cortex-surface {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#blobCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.cortex-content {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 0 24px;
}

.cortex-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.6rem, 5.5vw, 4.8rem);
    letter-spacing: -0.02em;
    color: var(--axon-white);
    opacity: 0;
    animation: titleReveal 1.5s ease-out 0.3s forwards;
}

@keyframes titleReveal {
    0% { opacity: 0; transform: translateY(20px); filter: blur(8px); }
    100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.cortex-sub {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    color: var(--dendrite-mist);
    margin-top: 16px;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.8s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.scroll-pulse {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

.pulse-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--spark);
    animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 0.4; transform: translateY(0) scale(1); }
    50% { opacity: 0.8; transform: translateY(8px) scale(1.4); }
}

/* --- SCENE 2: SYNAPTIC DASHBOARD --- */
.dashboard-zone {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(40px, 6vw, 80px) clamp(16px, 3vw, 40px);
}

.dendrite-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.dendrite-path {
    fill: none;
    stroke: #7B6B8A;
    stroke-width: 1;
    opacity: 0;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.5s ease-out, opacity 0.5s ease;
}

.dendrite-path.active {
    opacity: 0.4;
    stroke-dashoffset: 0;
}

.panel-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

/* --- Neuro Panels --- */
.neuro-panel {
    background: var(--synapse);
    border-radius: 32px 48px 24px 40px / 40px 24px 48px 32px;
    padding: clamp(24px, 3vw, 36px);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) scale(0.97);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
    border: 1px solid rgba(167, 139, 250, 0.08);
}

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

.neuro-panel::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), transparent 60%);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    pointer-events: none;
}

.panel-wide {
    grid-column: span 2;
}

.panel-tall {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.panel-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    letter-spacing: 0.01em;
    color: var(--axon-white);
    margin-bottom: 16px;
}

.panel-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 1.65;
    color: var(--dendrite-mist);
    max-width: 40em;
}

.panel-label {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.2vw, 0.9rem);
    line-height: 1.4;
    color: var(--dendrite-mist);
    margin-top: 12px;
}

.data-readout {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--dopamine);
    display: block;
    text-align: center;
    margin: 16px 0;
}

.readout-unit {
    font-size: 0.5em;
    color: var(--dendrite-mist);
    margin-left: 4px;
}

/* --- Waveform SVGs --- */
.waveform {
    width: 100%;
    height: 60px;
    margin: 12px 0;
}

.waveform-wide {
    height: 80px;
}

.wave-path {
    stroke: var(--dopamine);
    opacity: 0.6;
}

.wave-path.wave-2,
.wave-path.wave-5 {
    stroke: var(--teal);
    opacity: 0.4;
}

.wave-path.wave-3 {
    stroke: var(--saffron);
    opacity: 0.5;
}

/* --- SCENE 3: DEEP LAYER --- */
.deep-layer {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    overflow: hidden;
}

#deepCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.insight-float {
    position: relative;
    z-index: 5;
    max-width: 480px;
    background: rgba(37, 34, 51, 0.85);
    border-radius: 32px 24px 40px 28px / 28px 40px 24px 36px;
    padding: clamp(24px, 3vw, 36px);
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.insight-float.visible {
    opacity: 1;
    transform: translateY(0);
}

.insight-1 {
    align-self: flex-start;
    margin-left: 10%;
}

.insight-2 {
    align-self: flex-end;
    margin-right: 8%;
}

.insight-3 {
    align-self: center;
}

.insight-text {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 1.65;
    color: var(--axon-white);
}

/* --- SCENE 4: NUCLEUS --- */
.nucleus-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#nucleusCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.nucleus-ring {
    position: relative;
    z-index: 5;
    width: clamp(300px, 60vw, 500px);
    height: clamp(300px, 60vw, 500px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nucleus-statement {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.nucleus-statement.visible {
    opacity: 1;
}

.ns-1 { top: -10%; left: 50%; transform: translateX(-50%); }
.ns-2 { right: -20%; top: 50%; transform: translateY(-50%); }
.ns-3 { bottom: -10%; left: 50%; transform: translateX(-50%); }
.ns-4 { left: -20%; top: 50%; transform: translateY(-50%); }

.ns-line {
    display: block;
    width: 40px;
    height: 1px;
    background: var(--spark);
    opacity: 0.4;
}

.ns-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: clamp(0.85rem, 1.3vw, 1rem);
    color: var(--axon-white);
    white-space: nowrap;
}

.nucleus-domain {
    position: relative;
    z-index: 5;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 1.1vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--dendrite-mist);
    opacity: 0.4;
    margin-top: 60px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .panel-wide {
        grid-column: span 1;
    }

    .panel-tall {
        grid-row: span 1;
    }

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

    .insight-1,
    .insight-2 {
        margin-left: 5%;
        margin-right: 5%;
        align-self: center;
    }

    .ns-1, .ns-3 { left: 50%; transform: translateX(-50%); }
    .ns-2 { right: -10%; }
    .ns-4 { left: -10%; }
}

@media (max-width: 480px) {
    .nucleus-ring {
        width: 260px;
        height: 260px;
    }

    .nucleus-statement {
        white-space: normal;
    }

    .ns-2 { right: -5%; }
    .ns-4 { left: -5%; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .cortex-title,
    .cortex-sub {
        animation: none;
        opacity: 1;
    }

    .pulse-dot {
        animation: none;
    }

    .neuro-panel,
    .insight-float,
    .nucleus-statement {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .dendrite-path {
        opacity: 0.4;
        stroke-dashoffset: 0;
        transition: none;
    }
}
