/* nonri.org — Tidal Vaporwave */

:root {
    --bg-deep: #0b0b1e;
    --bg-mid: #0e1430;
    --color-primary: #5ec4d4;
    --color-secondary: #b8a9d4;
    --color-signal: #82b4dc;
    --color-text: #c8d4e0;
    --color-heading: #e8eef6;
    --color-warm: #d4a0b0;
    --color-glow: #3ad8c8;
    --border-glass: rgba(130, 180, 220, 0.12);
    --font-display: 'Megrim', cursive;
    --font-body: 'Instrument Sans', sans-serif;
    --font-mono: 'Victor Mono', monospace;
    --glow-text: 0 0 8px rgba(94, 196, 212, 0.5), 0 0 24px rgba(94, 196, 212, 0.2), 0 0 48px rgba(94, 196, 212, 0.1);
    --glow-box: 0 0 12px rgba(58, 216, 200, 0.15), inset 0 0 12px rgba(58, 216, 200, 0.05);
    --ease-settle: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --pulse-duration: 3s;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.72;
    color: var(--color-text);
    background: var(--bg-deep);
    overflow-x: hidden;
    min-height: 100vh;
    background-size: 400% 400%;
    animation: deepWater 30s ease infinite;
}

@keyframes deepWater {
    0% { background-color: #0b0b1e; }
    25% { background-color: #0a0e22; }
    50% { background-color: #091020; }
    75% { background-color: #0a0e22; }
    100% { background-color: #0b0b1e; }
}

/* Scan-line overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(11, 11, 30, 0.08) 2px,
        rgba(11, 11, 30, 0.08) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* =================== INTRO SCREEN =================== */
#intro-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-deep);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#intro-screen.exit {
    animation: introExit 800ms var(--ease-settle) forwards;
}

@keyframes introExit {
    to {
        transform: translateY(-100vh);
    }
}

#intro-screen.hidden {
    display: none;
}

#intro-line {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scaleX(0);
    width: 60vw;
    height: 1px;
    background: var(--color-primary);
    opacity: 0.4;
    transform-origin: center;
}

#intro-line.animate {
    animation: lineExpand 1000ms var(--ease-settle) forwards;
}

@keyframes lineExpand {
    to {
        transform: translate(-50%, -50%) scaleX(1);
    }
}

#sonar-ping {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 200vw;
    height: 200vw;
    border-radius: 50%;
    border: 1px solid var(--color-primary);
    opacity: 0;
    pointer-events: none;
}

#sonar-ping.animate {
    animation: sonarPing 1500ms ease-out forwards;
}

@keyframes sonarPing {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

.intro-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--color-heading);
    text-shadow: var(--glow-text);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0;
    transform: translateY(10px);
    position: relative;
    z-index: 1;
}

.intro-title.show {
    animation: titleFadeIn 700ms ease forwards;
}

@keyframes titleFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#intro-title-top {
    margin-bottom: -0.2em;
}

/* =================== GRID INTERFERENCE =================== */
#grid-interference {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.grid-layer {
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    background-image:
        linear-gradient(rgba(130, 180, 220, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(130, 180, 220, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
}

.grid-layer-a {
    transform: rotate(3deg);
    opacity: 1;
}

.grid-layer-b {
    background-image:
        linear-gradient(rgba(130, 180, 220, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(130, 180, 220, 0.06) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: rotate(-3deg);
    opacity: 1;
}

/* =================== VERTICAL NAVIGATION =================== */
#wave-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 64px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    z-index: 100;
    opacity: 0;
    transition: opacity 600ms ease;
}

#wave-nav.visible {
    opacity: 1;
}

.nav-item {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-decoration: none;
    color: var(--color-heading);
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    opacity: 0.5;
    transition: opacity 400ms ease;
    position: relative;
}

.nav-item:hover,
.nav-item.active {
    opacity: 1;
}

.nav-indicator {
    display: block;
    width: 2px;
    height: 0px;
    background: var(--color-primary);
    transition: height 400ms ease;
}

.nav-item.active .nav-indicator {
    height: 40px;
    animation: pulseIndicator 2s ease-in-out infinite;
}

@keyframes pulseIndicator {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* =================== MAIN CONTENT =================== */
#main-content {
    position: relative;
    z-index: 1;
    padding: 100vh 0 200px 0;
    margin-left: 64px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

/* =================== ACETATE PANELS =================== */
.acetate-panel {
    position: relative;
    max-width: 840px;
    width: calc(100% - 4rem);
    padding: 3rem 3.5rem;
    margin: 2rem auto;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(14, 20, 48, 0.65);
    border: 1px solid var(--border-glass);
    border-radius: 2px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.acetate-panel.visible {
    opacity: 1;
    transform: translateY(0) rotate(var(--rotation, 0deg));
}

.acetate-panel:hover {
    transform: translateY(0) rotate(0deg) !important;
    transition: transform 600ms var(--ease-bounce);
}

/* Rotation offsets */
.depth-1 { --rotation: -1.2deg; margin-left: 10%; }
.depth-2 { --rotation: 1.5deg; margin-right: 5%; margin-left: auto; }
.depth-3 { --rotation: -0.8deg; margin-left: 15%; margin-top: -3rem; }
.depth-4 { --rotation: 1.8deg; margin-right: 10%; margin-left: auto; margin-top: -2rem; }
.depth-5 { --rotation: -0.5deg; margin-left: 8%; margin-top: -3rem; }

/* Depth-based darkening */
.depth-1 { background: rgba(14, 20, 48, 0.55); }
.depth-2 { background: rgba(14, 20, 48, 0.62); }
.depth-3 { background: rgba(14, 20, 48, 0.70); }
.depth-4 { background: rgba(14, 20, 48, 0.78); }
.depth-5 { background: rgba(10, 14, 36, 0.88); }

/* Neon glow on panels */
.acetate-panel.visible {
    box-shadow: var(--glow-box);
}

/* =================== SECTION HEADINGS =================== */
.section-heading {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: var(--color-heading);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    text-shadow: var(--glow-text);
    background-image: linear-gradient(135deg, var(--color-primary), var(--color-secondary), var(--color-warm));
    background-size: 100% 2px;
    background-position: bottom;
    background-repeat: no-repeat;
    background-clip: padding-box;
    padding-bottom: 0.3em;
    opacity: 0;
}

.section-heading.typed {
    opacity: 1;
}

.section-heading .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--color-primary);
    margin-left: 4px;
    vertical-align: text-bottom;
    animation: blinkCursor 600ms step-end infinite;
}

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

/* =================== SECTION BODY =================== */
.section-body {
    opacity: 0;
    transition: opacity 500ms ease;
}

.section-body.show {
    opacity: 1;
}

.section-body p {
    margin-bottom: 1.2rem;
    color: var(--color-text);
    font-weight: 400;
    line-height: 1.72;
}

.section-body p:last-of-type {
    margin-bottom: 0.8rem;
}

/* Metadata text */
.metadata {
    font-family: var(--font-mono);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(0.7rem, 1.2vw, 0.82rem);
    letter-spacing: 0.06em;
    color: var(--color-signal);
    opacity: 0.7;
    display: block;
    margin-top: 1rem;
}

/* =================== TIDE CHARTS =================== */
.tide-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 60px;
    margin-bottom: 1.5rem;
}

.tide-bar {
    width: 3px;
    background: var(--color-signal);
    border-radius: 1px;
    transition: height 0.8s var(--ease-bounce);
}

.tide-chart:hover .tide-bar {
    animation: tideShift 0.8s var(--ease-bounce) forwards;
}

/* =================== WAVE DIVIDERS =================== */
.wave-divider {
    margin-top: 2rem;
    overflow: visible;
}

.wave-divider svg {
    width: 100%;
    height: 60px;
}

.wave-path {
    fill: none;
    stroke: var(--color-signal);
    stroke-width: 1.5;
    opacity: 0.5;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease;
}

.acetate-panel.visible .wave-path {
    animation: waveFlow 4s linear infinite;
    stroke-dashoffset: 0;
}

@keyframes waveFlow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -200; }
}

/* =================== CHROMATIC ABERRATION =================== */
.chromatic-target {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.chromatic-target::before,
.chromatic-target::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    mix-blend-mode: screen;
    transition: opacity 300ms ease;
    border-radius: 2px;
}

.chromatic-target::before {
    background: var(--color-primary);
    transform: translateX(-2px);
}

.chromatic-target::after {
    background: var(--color-warm);
    transform: translateX(2px);
}

.chromatic-active .chromatic-target::before,
.chromatic-active .chromatic-target::after {
    opacity: 0.03;
    animation: chromaticFade 1200ms ease forwards;
}

@keyframes chromaticFade {
    0% { opacity: 0.03; }
    30% { opacity: 0.04; }
    100% { opacity: 0; }
}

/* =================== PULSE ATTENTION =================== */
.pulse-element {
    animation: pulseAttention var(--pulse-duration) ease-in-out infinite;
}

@keyframes pulseAttention {
    0%, 100% { box-shadow: 0 0 0 rgba(94, 196, 212, 0); }
    50% { box-shadow: 0 0 12px rgba(94, 196, 212, 0.25); }
}

.pulse-element:hover {
    animation-play-state: paused;
    box-shadow: 0 0 12px rgba(94, 196, 212, 0.25);
}

/* =================== SONAR FOOTER =================== */
#sonar-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    z-index: 100;
    display: flex;
    align-items: center;
    pointer-events: none;
}

#footer-waveform {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#sonar-wave {
    fill: none;
    stroke: var(--color-signal);
    stroke-width: 1.5;
    opacity: 0.4;
}

.footer-coords {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 2rem;
    padding-left: 80px;
    font-family: var(--font-mono);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(0.7rem, 1.2vw, 0.82rem);
    letter-spacing: 0.06em;
    color: var(--color-signal);
    opacity: 0.5;
}

/* =================== RESPONSIVE =================== */
@media (max-width: 768px) {
    #wave-nav {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 56px;
        flex-direction: row;
        gap: 0;
        justify-content: space-around;
        background: rgba(11, 11, 30, 0.9);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border-glass);
    }

    .nav-item {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 0.65rem;
        letter-spacing: 0.1em;
    }

    .nav-indicator {
        display: none;
    }

    #main-content {
        margin-left: 0;
        padding-top: 100vh;
        padding-bottom: 120px;
    }

    .acetate-panel {
        width: calc(100% - 2rem);
        padding: 2rem 1.5rem;
        margin: 1rem auto;
        /* Remove rotation on mobile */
        --rotation: 0deg !important;
    }

    .depth-1,
    .depth-2,
    .depth-3,
    .depth-4,
    .depth-5 {
        margin-left: auto;
        margin-right: auto;
        --rotation: 0deg;
    }

    .depth-3,
    .depth-4,
    .depth-5 {
        margin-top: -3rem;
    }

    #sonar-footer {
        bottom: 56px;
    }

    .footer-coords {
        padding-left: 1rem;
        gap: 1rem;
        font-size: 0.65rem;
    }

    #grid-interference {
        display: none;
    }
}

/* Emphasis text */
.section-body strong,
.section-body em {
    font-weight: 500;
    color: var(--color-heading);
}

/* Links / interactive elements */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 300ms ease;
}

a:hover {
    color: var(--color-secondary);
}

/* Selection */
::selection {
    background: rgba(94, 196, 212, 0.25);
    color: var(--color-heading);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: rgba(130, 180, 220, 0.2);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(130, 180, 220, 0.4);
}
