/* =====================================================
   underdark.date — Styles
   Palette: #000000, #0a0010, #0d0d1a, #ff00ff, #00ffff, #39ff14, #b400ff, #ff0066, #ffffff
   Fonts: Noto Sans JP (100), Space Grotesk (400/700), Major Mono Display
   ===================================================== */

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

html {
    font-size: 16px;
    background: #000000;
    color: rgba(255,255,255,0.9);
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: #000000;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ---------- Scroll Container ---------- */
#scroll-container {
    width: 100vw;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

/* ---------- Sections ---------- */
.section {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    scroll-snap-align: start;
}

/* Noise overlay on every section */
.noise-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}
.noise-overlay::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    filter: url(#noise);
    opacity: 0.05;
    mix-blend-mode: overlay;
    background: rgba(255,255,255,0.03);
}

/* ---------- Typography Helpers ---------- */
.major-mono {
    font-family: 'Major Mono Display', monospace;
    text-transform: uppercase;
    letter-spacing: 0.3em;
}

.noto-thin {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 100;
}

/* ---------- Glitch-Char Animation ---------- */
@keyframes glitch-char {
    0%   { transform: none; opacity: 1; }
    92%  { transform: none; opacity: 1; }
    93%  { transform: translateX(-4px) scaleY(1.1); opacity: 0.8; filter: hue-rotate(90deg); }
    95%  { transform: translateX(3px); opacity: 0.9; }
    97%  { transform: none; opacity: 1; }
    100% { transform: none; opacity: 1; }
}

.kinetic-char {
    display: inline-block;
    animation: glitch-char 3s ease-in-out infinite;
}

/* ---------- Particle Drift ---------- */
@keyframes drift-up {
    from {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10%  { opacity: 1; }
    90%  { opacity: 0.6; }
    to {
        transform: translateY(-110vh) translateX(var(--drift, 0px));
        opacity: 0;
    }
}

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: drift-up var(--dur, 12s) var(--del, 0s) infinite linear;
}

/* ---------- Breathe (Pulse Circle) ---------- */
@keyframes breathe {
    0%, 100% {
        transform: scale(0.95);
        box-shadow: 0 0 20px 8px #ff00ff, inset 0 0 20px 4px rgba(255,0,255,0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 50px 20px #ff00ff, inset 0 0 40px 10px rgba(255,0,255,0.35);
    }
}

/* ---------- Orbit ---------- */
@keyframes orbit {
    from {
        transform: rotate(var(--start-angle)) translateX(150px) rotate(calc(-1 * var(--start-angle)));
    }
    to {
        transform: rotate(calc(var(--start-angle) + 360deg)) translateX(150px) rotate(calc(-1 * (var(--start-angle) + 360deg)));
    }
}

.orbit-letter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: 0 150px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0;
    animation: orbit 20s linear infinite;
}

/* ---------- Blink ---------- */
@keyframes blink {
    0%, 96%, 100% { height: 20px; }
    97%, 99%       { height: 2px; }
}

/* ---------- Glitch Face Tear ---------- */
@keyframes face-glitch {
    0%, 85%  { transform: none; filter: none; }
    86%      { transform: translateX(-6px); filter: hue-rotate(180deg) brightness(1.5); }
    87%      { transform: translateX(6px) skewX(5deg); }
    88%      { transform: none; filter: none; }
    89%      { transform: translateX(-3px); filter: hue-rotate(90deg); }
    90%      { transform: none; filter: none; }
    100%     { transform: none; filter: none; }
}

@keyframes face-rgb-split {
    0%, 88%  {
        text-shadow: none;
        filter: none;
    }
    89% {
        filter: drop-shadow(-3px 0 #ff00ff) drop-shadow(3px 0 #00ffff);
    }
    91% { filter: none; }
    100% { filter: none; }
}

/* ---------- Bubble Rise ---------- */
@keyframes bubble-rise {
    0%   { transform: translateY(0) translateX(0); opacity: 0; }
    10%  { opacity: var(--opacity, 0.5); }
    50%  { transform: translateY(-50vh) translateX(var(--drift, 0px)); }
    90%  { opacity: var(--opacity, 0.5); }
    100% { transform: translateY(-100vh) translateX(0); opacity: 0; }
}

.bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: bubble-rise var(--dur, 10s) var(--del, 0s) infinite linear;
}

/* ---------- RGB Split Text ---------- */
@keyframes rgb-split {
    0%, 90%  { text-shadow: none; }
    91%      { text-shadow: -3px 0 #ff00ff, 3px 0 #00ffff; }
    93%      { text-shadow: none; }
    95%      { text-shadow: -2px 0 #b400ff, 2px 0 #00ffff; }
    97%      { text-shadow: none; }
    100%     { text-shadow: none; }
}

/* ---------- Fade In ---------- */
@keyframes fade-in-void {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ---------- Section 1: Surface ---------- */
#surface {
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.surface-content {
    position: relative;
    z-index: 5;
    padding-left: 15vw;
}

.surface-question {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 100;
    font-size: clamp(28px, 5vw, 72px);
    color: rgba(255,255,255,0.92);
    letter-spacing: 0.05em;
    animation: fade-in-void 2.5s ease-out 0.5s both, rgb-split 6s ease-in-out 3s infinite;
    line-height: 1.2;
}

/* ---------- Section 2: Descent ---------- */
#descent {
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

#particle-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.descent-content {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 15vw;
    gap: 60px;
}

.kinetic-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(48px, 9vw, 128px);
    color: rgba(255,255,255,0.95);
    line-height: 1;
    letter-spacing: -0.02em;
    animation: rgb-split 5s ease-in-out 1s infinite;
}

#lure-small {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #ff00ff;
    box-shadow: 0 0 18px 6px #ff00ff, inset 0 0 12px 2px rgba(255,0,255,0.25);
    animation: breathe 2s ease-in-out infinite;
    align-self: center;
}

/* ---------- Section 3: Glitch ---------- */
#glitch {
    background: #0d0d1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glitch-content {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding-left: 15vw;
}

.glitch-face-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: face-glitch 5s ease-in-out infinite;
}

/* CSS Face */
.face {
    position: relative;
    width: 120px;
    height: 80px;
}

.eye {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #00ffff;
    box-shadow: 0 0 12px 4px #00ffff;
    top: 10px;
    animation: blink 4s ease-in-out infinite;
}

.eye.left  { left: 20px; animation-delay: 0s; }
.eye.right { right: 20px; animation-delay: 0.3s; }

.mouth {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: #ff00ff;
    box-shadow: 0 0 8px 3px #ff00ff;
}

.glitch-label {
    font-size: 12px;
    color: #00ffff;
    letter-spacing: 0.4em;
    animation: rgb-split 7s ease-in-out 2s infinite;
}

.glitch-coords {
    font-size: 11px;
    color: rgba(57,255,20,0.8);
    letter-spacing: 0.25em;
}

/* ---------- Section 4: Pulse ---------- */
#pulse {
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-content {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 80px;
}

.orbit-wrapper {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-lure {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #ff00ff;
    box-shadow: 0 0 30px 10px #ff00ff, inset 0 0 30px 5px rgba(255,0,255,0.3);
    animation: breathe 2s ease-in-out infinite;
    flex-shrink: 0;
}

.orbit-ring {
    position: absolute;
    width: 300px;
    height: 300px;
    top: 0;
    left: 0;
}

.pulse-face {
    animation: face-glitch 7s ease-in-out 2s infinite;
}

/* ---------- Section 5: Surface Break ---------- */
#surface-break {
    background: #0a0010;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.surface-break-content {
    position: relative;
    z-index: 5;
    padding-left: 15vw;
    display: flex;
    flex-direction: column;
    gap: 40px;
    max-width: 600px;
}

.surface-break-headline {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 100;
    font-size: clamp(36px, 6vw, 96px);
    color: rgba(255,255,255,0.95);
    letter-spacing: 0.05em;
    animation: fade-in-void 2s ease-out both, rgb-split 8s ease-in-out 4s infinite;
}

.terminal-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 24px;
}

.terminal-input {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 400;
    background: transparent;
    border: none;
    border-bottom: 1px solid #00ffff;
    color: rgba(255,255,255,0.9);
    padding: 8px 4px;
    width: 320px;
    outline: none;
    caret-color: #00ffff;
    letter-spacing: 0.05em;
    transition: border-color 0.3s;
}

.terminal-input::placeholder {
    color: rgba(0,255,255,0.35);
    font-style: italic;
}

.terminal-input:focus {
    border-bottom-color: #ff00ff;
    box-shadow: 0 2px 0 0 rgba(255,0,255,0.3);
}

.terminal-submit {
    background: transparent;
    border: 1px solid #ff00ff;
    color: #ff00ff;
    font-size: 12px;
    letter-spacing: 0.35em;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    font-family: 'Major Mono Display', monospace;
    text-transform: uppercase;
}

.terminal-submit:hover {
    background: rgba(255,0,255,0.12);
    box-shadow: 0 0 14px 3px rgba(255,0,255,0.4);
    color: #ffffff;
}

.terminal-status {
    font-size: 11px;
    color: rgba(57,255,20,0.8);
    letter-spacing: 0.3em;
    animation: cursor-blink 2s ease-in-out infinite;
}

/* ---------- Mushroom Motifs ---------- */
.mushroom-row {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    pointer-events: none;
    z-index: 4;
    display: flex;
    align-items: flex-end;
    gap: 0;
    overflow: hidden;
}

.mushroom {
    position: absolute;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mushroom-cap {
    border-radius: 50px 50px 0 0;
    background: #39ff14;
    box-shadow: 0 0 8px 3px rgba(57,255,20,0.6);
}

.mushroom-stem {
    background: rgba(57,255,20,0.6);
    box-shadow: 0 0 4px 1px rgba(57,255,20,0.4);
}

@keyframes mushroom-pulse {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}

/* ---------- Bubbles Container ---------- */
.bubbles-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    overflow: hidden;
}

/* ---------- Scroll Indicator ---------- */
@keyframes scroll-hint {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50%        { opacity: 0.7; transform: translateY(6px); }
}

#surface::after {
    content: '';
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(255,0,255,0.5));
    animation: scroll-hint 2s ease-in-out infinite;
    z-index: 6;
}
