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

:root {
    --abyssal-navy: #0a1628;
    --bioluminescent-teal: #00e5a0;
    --aurora-violet: #7b2ff7;
    --coral-pink: #ff6b9d;
    --deep-cerulean: #0d47a1;
    --phosphor-cyan: #00fff0;
    --warm-sand: #f5e6c8;
    --glitch-magenta: #ff00ff;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--abyssal-navy);
    color: var(--warm-sand);
    overflow-x: hidden;
    line-height: 1.6;
}

/* === Depth Gauge === */
.depth-gauge {
    position: fixed;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 30px;
    z-index: 100;
    pointer-events: none;
}

.depth-line {
    position: absolute;
    left: 50%;
    top: 10%;
    bottom: 10%;
    width: 2px;
    background: var(--bioluminescent-teal);
    opacity: 0.4;
    transform: translateX(-50%);
}

.depth-dot {
    position: absolute;
    left: 50%;
    top: 10%;
    width: 10px;
    height: 10px;
    background: var(--bioluminescent-teal);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 12px rgba(0, 229, 160, 0.6);
    transition: top 0.1s linear;
}

.depth-markers {
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.depth-markers span {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bioluminescent-teal);
    text-shadow: 0 0 8px rgba(0, 229, 160, 0.4);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

/* === Sections === */
.section {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

/* === Section 1: Surface === */
.section-surface {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a1628 0%, #0d47a1 30%, #7b2ff7 60%, #00e5a0 100%);
    background-size: 400% 400%;
    animation: auroraShift 12s ease infinite;
}

@keyframes auroraShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.caustics-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 120px 100px at 20% 30%, rgba(0, 255, 240, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 180px 150px at 70% 60%, rgba(0, 229, 160, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 100px 80px at 50% 80%, rgba(0, 255, 240, 0.04) 0%, transparent 70%);
    animation: causticDrift 8s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes causticDrift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(20px, -15px) scale(1.05); }
}

.hero-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.hero-title {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(4rem, 12vw, 10rem);
    color: var(--phosphor-cyan);
    text-shadow: 0 0 30px rgba(0, 255, 240, 0.3);
    margin-bottom: 0.5rem;
}

.hero-title span {
    display: inline-block;
    animation: swim 3s ease-in-out infinite;
}

.hero-title span:nth-child(1) { animation-delay: 0s; }
.hero-title span:nth-child(2) { animation-delay: 0.3s; }
.hero-title span:nth-child(3) { animation-delay: 0.6s; }

@keyframes swim {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.hero-subtitle {
    font-family: 'Nunito', sans-serif;
    font-size: 1.2rem;
    color: rgba(245, 230, 200, 0.7);
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
}

.input-wrapper {
    position: relative;
}

#hero-input {
    width: min(500px, 80vw);
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 229, 160, 0.3);
    border-radius: 50px;
    color: var(--warm-sand);
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

#hero-input::placeholder {
    color: rgba(0, 229, 160, 0.5);
    font-family: 'Space Mono', monospace;
}

#hero-input:focus {
    border-color: var(--phosphor-cyan);
    box-shadow: 0 0 20px rgba(0, 255, 240, 0.2);
}

/* === Bubbles === */
.bubbles-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -20px;
    border-radius: 50%;
    background: rgba(0, 255, 240, 0.15);
    animation: rise linear infinite;
}

@keyframes rise {
    0% { transform: translateY(0) translateX(0); opacity: 1; }
    25% { transform: translateY(-25vh) translateX(5px); }
    50% { transform: translateY(-50vh) translateX(-3px); }
    75% { transform: translateY(-75vh) translateX(4px); }
    100% { transform: translateY(-105vh) translateX(0); opacity: 0; }
}

/* === Section 2: Timeline === */
.section-timeline {
    padding: 6rem 2rem;
    background: linear-gradient(180deg, #0d47a1 0%, #0a1628 100%);
}

.timeline-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    padding: 2rem 0;
}

.timeline-spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--deep-cerulean);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 4rem;
    display: flex;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-item:nth-child(odd) {
    flex-direction: row;
    padding-right: calc(50% + 2rem);
}

.timeline-item:nth-child(even) {
    flex-direction: row-reverse;
    padding-left: calc(50% + 2rem);
}

.timeline-node {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timeline-item.visible .timeline-node {
    transform: translateX(-50%) scale(1);
}

.fish-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 6px rgba(0, 229, 160, 0.5));
}

.timeline-card {
    background: rgba(245, 230, 200, 0.06);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 229, 160, 0.12);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
}

.timeline-card.warning {
    border-color: rgba(255, 107, 157, 0.2);
}

.card-title {
    font-family: 'Dela Gothic One', cursive;
    font-size: 1.3rem;
    color: var(--phosphor-cyan);
    margin-bottom: 0.8rem;
    background: linear-gradient(90deg, #00fff0, #7b2ff7, #00e5a0);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: auroraText 4s ease infinite;
}

@keyframes auroraText {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.timeline-card p {
    font-family: 'Nunito', sans-serif;
    color: rgba(245, 230, 200, 0.8);
    line-height: 1.7;
}

/* === Section 3: Aquarium === */
.section-aquarium {
    min-height: 100vh;
    background: var(--deep-cerulean);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.aquarium-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.aquarium-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(0, 229, 160, 0.3);
    animation: float 10s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); opacity: 0.3; }
    50% { transform: translateY(-30px) translateX(10px); opacity: 0.7; }
}

.aquarium-content {
    text-align: center;
    z-index: 2;
    position: relative;
    width: min(700px, 90vw);
}

.aquarium-title {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--phosphor-cyan);
    margin-bottom: 0.5rem;
}

.aquarium-desc {
    color: rgba(245, 230, 200, 0.6);
    margin-bottom: 2rem;
    font-size: 1rem;
}

#aquarium-input {
    width: 100%;
    min-height: 120px;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 229, 160, 0.2);
    border-radius: 16px;
    color: var(--warm-sand);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    outline: none;
    resize: none;
    transition: all 0.3s ease;
}

#aquarium-input:focus {
    border-color: var(--phosphor-cyan);
    box-shadow: 0 0 20px rgba(0, 255, 240, 0.15);
}

#aquarium-input::placeholder {
    color: rgba(0, 229, 160, 0.4);
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
}

.fish-tank {
    position: relative;
    width: 100%;
    height: 300px;
    margin-top: 2rem;
    border-radius: 16px;
    overflow: hidden;
}

.fish-tank .fish {
    position: absolute;
    width: 48px;
    height: 32px;
    transition: opacity 2s ease;
}

.fish-tank .fish.angelfish {
    animation: swimPath 6s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(0, 229, 160, 0.5));
}

.fish-tank .fish.clownfish {
    animation: bounce 2s ease infinite;
}

.fish-tank .fish.glitchfish {
    animation: glitchSwim 0.3s steps(3) infinite;
    filter: drop-shadow(0 0 6px rgba(255, 107, 157, 0.6));
}

@keyframes swimPath {
    0% { transform: translate(0, 0); }
    25% { transform: translate(50px, -20px); }
    50% { transform: translate(100px, 0); }
    75% { transform: translate(50px, 20px); }
    100% { transform: translate(0, 0); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes glitchSwim {
    0% { transform: translate(0, 0) skewX(0); }
    33% { transform: translate(3px, -2px) skewX(2deg); }
    66% { transform: translate(-2px, 1px) skewX(-1deg); }
    100% { transform: translate(0, 0) skewX(0); }
}

.glitch-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    z-index: 10;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 0, 255, 0.03) 2px,
        rgba(255, 0, 255, 0.03) 4px
    );
    transition: opacity 0.1s;
}

.glitch-overlay.active {
    opacity: 1;
    animation: glitchScan 300ms steps(1) forwards;
}

@keyframes glitchScan {
    0%, 100% { clip-path: inset(0); transform: translateX(0); }
    25% { clip-path: inset(40% 0 30% 0); transform: translateX(4px); }
    50% { clip-path: inset(10% 0 60% 0); transform: translateX(-3px); }
    75% { clip-path: inset(70% 0 5% 0); transform: translateX(6px); }
}

/* === Section 4: Deep === */
.section-deep {
    padding: 6rem 2rem;
    background: var(--abyssal-navy);
}

.timeline-container.dark .timeline-spine {
    background: rgba(255, 107, 157, 0.2);
}

.timeline-node.warning .fish-icon {
    filter: drop-shadow(0 0 6px rgba(255, 107, 157, 0.5));
}

/* === Section 5: Ocean Floor === */
.section-floor {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--abyssal-navy);
    position: relative;
}

.floor-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.floor-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.proverb-kr {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--phosphor-cyan);
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(0, 255, 240, 0.2);
}

.proverb-en {
    font-family: 'Nunito', sans-serif;
    font-style: italic;
    font-size: 1.1rem;
    color: rgba(245, 230, 200, 0.6);
}

.final-fish {
    position: absolute;
    top: 50%;
    left: -100px;
    animation: crossViewport 20s linear infinite;
}

.angelfish-final {
    width: 64px;
    height: 32px;
    opacity: 0.7;
}

@keyframes crossViewport {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 200px)); }
}

/* === Responsive === */
@media (max-width: 768px) {
    .depth-gauge { display: none; }
    
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        flex-direction: column;
        padding-left: 3rem;
        padding-right: 0;
    }
    
    .timeline-spine {
        left: 1rem;
    }
    
    .timeline-node {
        left: 1rem;
    }
}
