/* =============================================
   ronpa.day - Deep-Sea Debate Arena
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --abyssal-black: #020B18;
    --midnight-trench: #061A2E;
    --pressure-blue: #0C2D4A;
    --bioluminescent-cyan: #00E5CC;
    --warning-magenta: #FF2D6B;
    --hydrothermal-gold: #FFB830;
    --desaturated-ocean: #94B8C9;
    --ice-glow: #E0F4FF;
    --deep-mist: #1A3A52;
    --teal-mid: #00B8A3;
    --teal-deep: #00907F;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: linear-gradient(180deg, var(--abyssal-black) 0%, #030D1C 30%, #041320 60%, var(--abyssal-black) 100%);
    background-attachment: fixed;
    color: var(--desaturated-ocean);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.75;
    overflow-x: hidden;
    min-height: 100vh;
}

/* CRT Scan Lines Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 229, 204, 0.03) 0px,
        rgba(0, 229, 204, 0.03) 1px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0;
    transition: opacity 0.6s ease;
}

body.crt-active::after {
    opacity: 1;
}

/* --- Surface Caustics Overlay --- */
#caustics-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0.03;
    background:
        radial-gradient(ellipse 600px 400px at 20% 30%, #B0F0FF, transparent),
        radial-gradient(ellipse 500px 350px at 70% 60%, #B0F0FF, transparent),
        radial-gradient(ellipse 450px 300px at 50% 20%, #B0F0FF, transparent);
    animation: causticsDrift 25s ease-in-out infinite;
}

@keyframes causticsDrift {
    0%, 100% {
        background-position: 0% 0%, 100% 100%, 50% 50%;
    }
    33% {
        background-position: 30% 20%, 70% 40%, 20% 80%;
    }
    66% {
        background-position: 60% 50%, 30% 70%, 80% 30%;
    }
}

/* --- Bioluminescent Particle Field --- */
#particle-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 1s ease;
}

body.particles-active #particle-field {
    opacity: 1;
}

.particle {
    position: absolute;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: var(--color);
    opacity: var(--opacity);
    left: var(--x);
    top: var(--y);
    animation: particleDrift var(--dur) cubic-bezier(0.42, 0, 0.58, 1) var(--delay) infinite;
    box-shadow: 0 0 8px var(--color);
}

@keyframes particleDrift {
    0% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -50px) scale(1.2);
    }
    50% {
        transform: translate(-20px, -20px) scale(0.8);
    }
    75% {
        transform: translate(40px, 30px) scale(1.1);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

/* --- Sonar Ping Navigation --- */
#sonar-nav {
    position: fixed;
    top: 28px;
    right: 28px;
    z-index: 500;
    opacity: 0;
    transition: opacity 0.5s ease;
}

body.sonar-active #sonar-nav {
    opacity: 1;
}

#sonar-ping {
    width: 44px;
    height: 44px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sonar-dot {
    width: 8px;
    height: 8px;
    background: var(--bioluminescent-cyan);
    border-radius: 50%;
    position: absolute;
    z-index: 2;
    box-shadow: 0 0 10px rgba(0, 229, 204, 0.6);
}

.sonar-ring {
    position: absolute;
    border: 1px solid var(--bioluminescent-cyan);
    border-radius: 50%;
    opacity: 0;
}

.sonar-ring-1 {
    width: 20px;
    height: 20px;
    animation: sonarPing 3s ease-out 0s infinite;
}

.sonar-ring-2 {
    width: 20px;
    height: 20px;
    animation: sonarPing 3s ease-out 0.8s infinite;
}

.sonar-ring-3 {
    width: 20px;
    height: 20px;
    animation: sonarPing 3s ease-out 1.6s infinite;
}

@keyframes sonarPing {
    0% {
        width: 8px;
        height: 8px;
        opacity: 0.4;
    }
    100% {
        width: 44px;
        height: 44px;
        opacity: 0;
    }
}

/* Sonar Radial Menu */
#sonar-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
}

#sonar-menu.sonar-menu-closed .sonar-menu-item {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
}

#sonar-menu.sonar-menu-open .sonar-menu-item {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sonar-menu-item {
    position: absolute;
    display: block;
    padding: 6px 14px;
    background: var(--midnight-trench);
    border: 1px solid var(--deep-mist);
    border-radius: 20px;
    color: var(--bioluminescent-cyan);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 0 15px rgba(0, 229, 204, 0.1);
    transition: all 0.3s ease;
}

.sonar-menu-item:hover {
    border-color: var(--bioluminescent-cyan);
    box-shadow: 0 0 25px rgba(0, 229, 204, 0.25);
    background: var(--pressure-blue);
}

/* Radial positions for 6 items */
#sonar-menu .sonar-menu-item:nth-child(1) { left: -60px; top: 50px; }
#sonar-menu .sonar-menu-item:nth-child(2) { left: -90px; top: 90px; }
#sonar-menu .sonar-menu-item:nth-child(3) { left: -80px; top: 130px; }
#sonar-menu .sonar-menu-item:nth-child(4) { left: -50px; top: 170px; }
#sonar-menu .sonar-menu-item:nth-child(5) { left: -70px; top: 210px; }
#sonar-menu .sonar-menu-item:nth-child(6) { left: -55px; top: 250px; }

#sonar-menu.sonar-menu-open .sonar-menu-item:nth-child(1) { transition-delay: 0s; }
#sonar-menu.sonar-menu-open .sonar-menu-item:nth-child(2) { transition-delay: 0.05s; }
#sonar-menu.sonar-menu-open .sonar-menu-item:nth-child(3) { transition-delay: 0.1s; }
#sonar-menu.sonar-menu-open .sonar-menu-item:nth-child(4) { transition-delay: 0.15s; }
#sonar-menu.sonar-menu-open .sonar-menu-item:nth-child(5) { transition-delay: 0.2s; }
#sonar-menu.sonar-menu-open .sonar-menu-item:nth-child(6) { transition-delay: 0.25s; }

/* --- Depth Counter --- */
#depth-counter {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 500;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--warning-magenta);
    text-shadow: 0 0 15px rgba(255, 45, 107, 0.4);
    opacity: 0;
    transition: opacity 0.5s ease;
}

body.depth-active #depth-counter {
    opacity: 1;
}

.depth-label {
    margin-right: 0.5em;
    opacity: 0.7;
}

.depth-value {
    font-size: 1.1em;
}

.depth-unit {
    margin-left: 0.15em;
    opacity: 0.7;
}

/* --- Pressure Column (Breathing Container) --- */
.pressure-column {
    max-width: 730px;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 4vw, 3rem);
    position: relative;
    animation: breatheWidth 16s ease-in-out infinite, breatheDrift 20s ease-in-out infinite;
}

@keyframes breatheWidth {
    0%, 100% { max-width: 680px; }
    50% { max-width: 780px; }
}

@keyframes breatheDrift {
    0%, 100% { margin-left: auto; margin-right: auto; transform: translateX(0); }
    33% { transform: translateX(2%); }
    66% { transform: translateX(-2%); }
}

/* --- Depth Sections --- */
.depth-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    padding: clamp(3rem, 8vh, 6rem) 0;
}

/* --- Hero Section --- */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#hero .pressure-column {
    text-align: center;
}

#hero-title {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(5rem, 20vw, 14rem);
    letter-spacing: 0.15em;
    line-height: 1.2;
    color: var(--bioluminescent-cyan);
    text-transform: uppercase;
    text-shadow:
        0 0 30px rgba(0, 229, 204, 0.4),
        0 0 60px rgba(0, 229, 204, 0.15);
    margin-bottom: 1.5rem;
}

/* Inflated 3D effect for hero */
.hero-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    text-shadow:
        0 1px #00D4BC,
        0 2px #00C3AC,
        0 3px #00B29C,
        0 4px #00A18C,
        0 5px #00907F,
        0 6px #007F6F,
        0 7px #006E5F,
        0 8px #005D4F,
        0 0 30px rgba(0, 229, 204, 0.4),
        0 0 60px rgba(0, 229, 204, 0.15),
        0 0 100px rgba(0, 229, 204, 0.08);
    transition: opacity 0.3s ease, transform 0.3s ease, text-shadow 0.5s ease;
}

.hero-letter.visible {
    opacity: 1;
    transform: translateY(0) perspective(400px) rotateX(-2deg);
}

#hero-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.5em;
    color: var(--warning-magenta);
    text-shadow: 0 0 20px rgba(255, 45, 107, 0.4);
    opacity: 0;
    transition: opacity 0.8s ease;
}

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

/* --- Inflated 3D Typography (Section Headings) --- */
.inflated-3d-sm {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(2.5rem, 8vw, 6rem);
    letter-spacing: 0.15em;
    line-height: 1.4;
    color: var(--bioluminescent-cyan);
    text-transform: uppercase;
    text-shadow:
        0 0 30px rgba(0, 229, 204, 0.4),
        0 0 60px rgba(0, 229, 204, 0.15);
    margin-bottom: 2rem;
}

.inflated-word {
    display: inline-block;
    text-shadow:
        0 1px #00D4BC,
        0 2px #00C3AC,
        0 3px #00B29C,
        0 4px #00A18C,
        0 5px #00907F,
        0 6px #007F6F,
        0 0 30px rgba(0, 229, 204, 0.4),
        0 0 60px rgba(0, 229, 204, 0.15);
    transform: perspective(400px) rotateX(-2deg);
}

.section-heading {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
}

/* --- Argument Blocks --- */
.argument-block {
    background: var(--midnight-trench);
    border: 1px solid var(--deep-mist);
    border-radius: 24px;
    padding: clamp(2rem, 5vw, 4rem);
    margin-bottom: 2.5rem;
    box-shadow:
        0 0 40px rgba(0, 229, 204, 0.06),
        inset 0 1px 0 rgba(0, 229, 204, 0.1);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
    position: relative;
}

.argument-block:hover {
    border-color: rgba(0, 229, 204, 0.4);
    box-shadow:
        0 0 60px rgba(0, 229, 204, 0.12),
        inset 0 1px 0 rgba(0, 229, 204, 0.15);
}

/* --- Body Text --- */
.body-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--desaturated-ocean);
    margin-bottom: 1.2rem;
}

.body-text:last-child {
    margin-bottom: 0;
}

.highlight-text {
    color: var(--ice-glow);
    font-weight: 500;
}

/* --- Counter Headings --- */
.counter-heading {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    letter-spacing: 0.1em;
    color: var(--bioluminescent-cyan);
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(0, 229, 204, 0.3);
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.gold-text {
    color: var(--hydrothermal-gold);
    text-shadow: 0 0 20px rgba(255, 184, 48, 0.4), 0 0 40px rgba(255, 184, 48, 0.15);
}

/* --- Refutation Blocks --- */
.refutation-block {
    border-color: var(--deep-mist);
    position: relative;
    overflow: hidden;
}

.refutation-marker {
    position: absolute;
    top: 16px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refutation-symbol {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.4rem;
    color: var(--warning-magenta);
    text-shadow: 0 0 10px rgba(255, 45, 107, 0.5);
}

.refutation-label {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.65rem;
    letter-spacing: 0.3em;
    color: var(--warning-magenta);
    text-shadow: 0 0 10px rgba(255, 45, 107, 0.4);
}

/* Refutation shake animation */
@keyframes refute {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-3px); }
    20% { transform: translateX(3px); }
    30% { transform: translateX(-3px); }
    40% { transform: translateX(3px); }
    50% { transform: translateX(-2px); }
    60% { transform: translateX(2px); }
    70% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
    90% { transform: translateX(0); }
}

.refutation-block.refute-active {
    animation: refute 0.4s ease;
    border-color: var(--warning-magenta);
    box-shadow:
        0 0 40px rgba(255, 45, 107, 0.15),
        inset 0 1px 0 rgba(255, 45, 107, 0.2);
}

/* --- Pressure Wave Transitions --- */
.pressure-wave {
    height: 8vh;
    position: relative;
    z-index: 10;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--deep-mist) 20%,
        var(--pressure-blue) 50%,
        var(--deep-mist) 80%,
        transparent 100%
    );
    opacity: 0.3;
    animation: pressureCompress 8s ease-in-out infinite;
}

@keyframes pressureCompress {
    0%, 100% {
        clip-path: inset(0 40% 0 40%);
        opacity: 0.1;
    }
    50% {
        clip-path: inset(0 5% 0 5%);
        opacity: 0.3;
    }
}

/* --- Pressure Gauge Motif --- */
.pressure-gauge {
    position: relative;
    margin-bottom: 2rem;
    opacity: 0.6;
}

.pressure-gauge-sm {
    width: 40px;
    height: 20px;
    border: 2px solid var(--deep-mist);
    border-bottom: none;
    border-radius: 40px 40px 0 0;
}

.pressure-gauge-md {
    width: 60px;
    height: 30px;
    border: 2px solid var(--deep-mist);
    border-bottom: none;
    border-radius: 60px 60px 0 0;
}

.pressure-gauge-lg {
    width: 80px;
    height: 40px;
    border: 2px solid var(--deep-mist);
    border-bottom: none;
    border-radius: 80px 80px 0 0;
}

.gauge-indicator {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--warning-magenta);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 45, 107, 0.6);
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    animation: gaugeMove 6s ease-in-out infinite;
}

.pressure-gauge-sm .gauge-indicator {
    animation: gaugeMoveSmall 6s ease-in-out infinite;
}

.pressure-gauge-md .gauge-indicator {
    animation: gaugeMoveMedium 6s ease-in-out infinite;
}

.pressure-gauge-lg .gauge-indicator {
    animation: gaugeMoveLarge 6s ease-in-out infinite;
}

@keyframes gaugeMoveSmall {
    0%, 100% { left: 5px; bottom: 3px; }
    50% { left: 31px; bottom: 15px; }
}

@keyframes gaugeMoveMedium {
    0%, 100% { left: 5px; bottom: 3px; }
    50% { left: 51px; bottom: 25px; }
}

@keyframes gaugeMoveLarge {
    0%, 100% { left: 8px; bottom: 3px; }
    50% { left: 68px; bottom: 35px; }
}

/* --- Chevron Warning Bands --- */
.chevron-band {
    height: 40px;
    margin: 2rem 0;
    background: repeating-linear-gradient(
        45deg,
        var(--pressure-blue),
        var(--pressure-blue) 10px,
        transparent 10px,
        transparent 20px
    );
    opacity: 0.3;
    border-radius: 4px;
}

/* --- Dot Matrix Section --- */
.dot-matrix-section {
    position: relative;
    padding: 2rem 0;
}

.dot-matrix-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50px;
    right: -50px;
    bottom: 0;
    background: radial-gradient(circle 2px at center, var(--deep-mist) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
    pointer-events: none;
    z-index: -1;
}

/* --- Scroll Appearance Animations --- */
.appear-on-scroll {
    opacity: 0;
    transform: translateY(40px) scale(1.08);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.appear-on-scroll.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Section entrance pulse */
.depth-section.section-pulse {
    animation: sectionPulse 0.6s ease;
}

@keyframes sectionPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.015); }
    100% { transform: scale(1); }
}

/* --- The Abyss Footer --- */
.abyss-section {
    min-height: 150vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--abyssal-black);
}

.abyss-text {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: 1.2rem;
    letter-spacing: 0.15em;
    color: var(--desaturated-ocean);
    text-transform: uppercase;
    opacity: 0.4;
    animation: abyssPulse 4s ease-in-out infinite;
}

@keyframes abyssPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

/* --- Final Argument Block (Gold) --- */
.final-argument {
    border-color: rgba(255, 184, 48, 0.2);
    box-shadow:
        0 0 40px rgba(255, 184, 48, 0.08),
        inset 0 1px 0 rgba(255, 184, 48, 0.1);
}

.final-argument:hover {
    border-color: rgba(255, 184, 48, 0.4);
    box-shadow:
        0 0 60px rgba(255, 184, 48, 0.15),
        inset 0 1px 0 rgba(255, 184, 48, 0.15);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #hero-title {
        font-size: clamp(3rem, 18vw, 6rem);
    }

    .section-heading {
        font-size: clamp(1.4rem, 6vw, 2.5rem);
    }

    .argument-block {
        padding: clamp(1.5rem, 4vw, 2.5rem);
        border-radius: 18px;
    }

    #sonar-nav {
        top: 16px;
        right: 16px;
    }

    #depth-counter {
        bottom: 16px;
        left: 16px;
    }

    .sonar-menu-item {
        font-size: 0.55rem;
        padding: 5px 10px;
    }

    #sonar-menu .sonar-menu-item:nth-child(1) { left: -50px; top: 45px; }
    #sonar-menu .sonar-menu-item:nth-child(2) { left: -75px; top: 80px; }
    #sonar-menu .sonar-menu-item:nth-child(3) { left: -65px; top: 115px; }
    #sonar-menu .sonar-menu-item:nth-child(4) { left: -45px; top: 150px; }
    #sonar-menu .sonar-menu-item:nth-child(5) { left: -60px; top: 185px; }
    #sonar-menu .sonar-menu-item:nth-child(6) { left: -50px; top: 220px; }
}

/* Selection color */
::selection {
    background: rgba(0, 229, 204, 0.3);
    color: var(--ice-glow);
}

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

::-webkit-scrollbar-track {
    background: var(--abyssal-black);
}

::-webkit-scrollbar-thumb {
    background: var(--deep-mist);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--pressure-blue);
}
