/* ============================================
   mujun.wiki — Deep-Sea Encyclopedia of Contradictions
   Colors: #134074, #8ecae6, #5fa8d3, #072035, #fb8500, #0b2545, #b8d4e3, #13315c
   Fonts: Source Serif 4, Inter, JetBrains Mono, Lora
   ============================================ */

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    background: #0b2545;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #b8d4e3;
    background: #0b2545;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Depth layers */
.depth-layer {
    min-height: 100vh;
    position: relative;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

/* Depth gradient per section */
#surface {
    background: linear-gradient(180deg, #13315c 0%, #0b2545 100%);
}

#mesopelagic {
    background: linear-gradient(180deg, #0b2545 0%, #072035 100%);
}

#bathypelagic {
    background: linear-gradient(180deg, #072035 0%, #061a2e 100%);
}

#abyssopelagic {
    background: linear-gradient(180deg, #061a2e 0%, #041220 100%);
}

#hadal {
    background: linear-gradient(180deg, #041220 0%, #020a14 100%);
}

/* Depth indicator */
.depth-indicator {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 10;
}

.depth-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #5fa8d3;
    opacity: 0.6;
    letter-spacing: 0.05em;
}

/* ========== SURFACE / HERO ========== */
#surface {
    flex-direction: column;
    overflow: hidden;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

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

.domain-title {
    font-family: 'Source Serif 4', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    color: #8ecae6;
    margin-bottom: 0.3rem;
    opacity: 0;
    animation: fadeRise 2s ease-out 0.5s forwards;
}

.domain-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: #5fa8d3;
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeRise 2s ease-out 1s forwards;
}

.tagline {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    color: #b8d4e3;
    max-width: 600px;
    margin: 0 auto 3rem;
    opacity: 0;
    animation: fadeRise 2s ease-out 1.5s forwards;
}

.scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #5fa8d3;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    opacity: 0;
    animation: fadeRise 2s ease-out 2s forwards, pulse 3s ease-in-out 4s infinite;
}

.scroll-arrow {
    animation: bobDown 2s ease-in-out infinite;
}

@keyframes fadeRise {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

/* ========== SECTION CONTENT ========== */
.section-content {
    max-width: 1100px;
    width: 100%;
    z-index: 2;
    position: relative;
}

.section-header {
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: #8ecae6;
    margin-bottom: 2.5rem;
    text-align: center;
}

/* ========== BLOB MORPHING ========== */
@keyframes blobMorph1 {
    0%   { border-radius: 48% 52% 43% 57% / 51% 45% 55% 49%; }
    33%  { border-radius: 42% 58% 50% 50% / 45% 55% 45% 55%; }
    66%  { border-radius: 55% 45% 48% 52% / 50% 42% 58% 50%; }
    100% { border-radius: 48% 52% 43% 57% / 51% 45% 55% 49%; }
}

@keyframes blobMorph2 {
    0%   { border-radius: 52% 48% 55% 45% / 48% 52% 45% 55%; }
    33%  { border-radius: 45% 55% 42% 58% / 55% 48% 52% 45%; }
    66%  { border-radius: 50% 50% 48% 52% / 42% 58% 50% 50%; }
    100% { border-radius: 52% 48% 55% 45% / 48% 52% 45% 55%; }
}

@keyframes blobMorph3 {
    0%   { border-radius: 44% 56% 50% 50% / 53% 47% 50% 50%; }
    33%  { border-radius: 50% 50% 44% 56% / 47% 53% 56% 44%; }
    66%  { border-radius: 56% 44% 53% 47% / 50% 50% 44% 56%; }
    100% { border-radius: 44% 56% 50% 50% / 53% 47% 50% 50%; }
}

.blob-panel {
    animation: blobMorph1 20s ease-in-out infinite;
    background: rgba(19, 64, 116, 0.3);
    border: 1px solid rgba(142, 202, 230, 0.1);
    padding: 2.5rem;
    backdrop-filter: blur(4px);
}

/* ========== BLOB GRID (Paradox Index) ========== */
.blob-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.blob-card {
    padding: 2rem;
    background: rgba(19, 64, 116, 0.25);
    border: 1px solid rgba(142, 202, 230, 0.08);
    transition: transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
    position: relative;
    overflow: hidden;
}

.blob-card:nth-child(1) { animation: blobMorph1 18s ease-in-out infinite; }
.blob-card:nth-child(2) { animation: blobMorph2 22s ease-in-out infinite; }
.blob-card:nth-child(3) { animation: blobMorph3 20s ease-in-out infinite; }
.blob-card:nth-child(4) { animation: blobMorph1 24s ease-in-out infinite; }

.blob-card:hover {
    transform: scale(1.03);
    border-color: rgba(251, 133, 0, 0.3);
    box-shadow: 0 0 30px rgba(251, 133, 0, 0.08);
}

.blob-card[data-spear="true"]::before {
    content: '矛';
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    font-size: 1.2rem;
    opacity: 0.15;
    color: #fb8500;
}

.blob-card[data-shield="true"]::before {
    content: '盾';
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    font-size: 1.2rem;
    opacity: 0.15;
    color: #8ecae6;
}

.blob-inner h3 {
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-size: 1.3rem;
    color: #8ecae6;
    margin-bottom: 0.5rem;
}

.blob-inner .mono-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #fb8500;
    margin-bottom: 1rem;
    letter-spacing: 0.03em;
}

.blob-inner p:last-child {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #b8d4e3;
    opacity: 0.85;
}

/* ========== CONTRADICTION ENGINE ========== */
.engine-container {
    padding: 3rem;
    background: rgba(7, 32, 53, 0.6);
}

.engine-display {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 2rem;
}

.thesis-panel,
.antithesis-panel {
    padding: 1.5rem;
    animation: blobMorph2 16s ease-in-out infinite;
    background: rgba(19, 64, 116, 0.3);
    border: 1px solid rgba(142, 202, 230, 0.1);
}

.label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: #5fa8d3;
    display: block;
    margin-bottom: 0.8rem;
}

.thesis-panel p,
.antithesis-panel p {
    font-family: 'Lora', serif;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #b8d4e3;
}

.collision-zone {
    display: flex;
    align-items: center;
    justify-content: center;
}

.collision-symbol {
    font-size: 2rem;
    color: #fb8500;
    animation: pulse 2s ease-in-out infinite;
}

.synthesis-output {
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    animation: blobMorph3 18s ease-in-out infinite;
    background: rgba(251, 133, 0, 0.08);
    border: 1px solid rgba(251, 133, 0, 0.15);
}

.synthesis-output p {
    font-family: 'Source Serif 4', serif;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #8ecae6;
}

.generate-btn {
    display: block;
    margin: 0 auto;
    padding: 0.8rem 2.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    color: #0b2545;
    background: #fb8500;
    border: none;
    cursor: pointer;
    border-radius: 48% 52% 43% 57% / 51% 45% 55% 49%;
    animation: blobMorph1 12s ease-in-out infinite;
    transition: background 0.3s ease, transform 0.3s ease;
}

.generate-btn:hover {
    background: #8ecae6;
    transform: scale(1.05);
}

/* ========== ETYMOLOGY ========== */
.etymology-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.kanji-display {
    text-align: center;
    padding: 3rem 2rem;
}

.kanji-pair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.kanji-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.kanji-char {
    font-size: clamp(3rem, 8vw, 6rem);
    color: #8ecae6;
    font-weight: 300;
    line-height: 1;
}

.kanji-reading {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #fb8500;
    letter-spacing: 0.1em;
}

.kanji-meaning {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #5fa8d3;
}

.kanji-separator {
    opacity: 0.5;
}

.origin-story {
    padding: 2.5rem;
    animation: blobMorph2 22s ease-in-out infinite;
    background: rgba(19, 64, 116, 0.25);
    border: 1px solid rgba(142, 202, 230, 0.08);
}

.lora-text {
    font-family: 'Lora', serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #b8d4e3;
}

.lora-text em {
    color: #fb8500;
    font-style: italic;
}

/* ========== HADAL ZONE ========== */
.hadal-content {
    text-align: center;
    padding: 3rem 2.5rem;
    background: rgba(7, 32, 53, 0.5);
}

.deep-quote {
    margin-bottom: 2rem;
}

.deep-quote p {
    font-family: 'Source Serif 4', serif;
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    line-height: 1.7;
    color: #e8e8e4;
    font-style: italic;
    margin-bottom: 1rem;
}

.deep-quote cite {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #5fa8d3;
    font-style: normal;
}

.pressure-reading {
    margin: 2rem 0;
    padding: 1rem;
    border-top: 1px solid rgba(142, 202, 230, 0.1);
    border-bottom: 1px solid rgba(142, 202, 230, 0.1);
}

.pressure-reading .mono-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #fb8500;
    letter-spacing: 0.05em;
}

.closing-text {
    font-family: 'Lora', serif;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #b8d4e3;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.85;
}

/* ========== BIOLUMINESCENT GLOW on hover ========== */
.blob-card::after,
.blob-panel::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(142, 202, 230, 0.08) 0%, transparent 70%);
    transition: width 0.6s ease, height 0.6s ease;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

.blob-card:hover::after {
    width: 300px;
    height: 300px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .engine-display {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .collision-zone {
        padding: 1rem 0;
    }

    .kanji-pair {
        gap: 1.5rem;
    }

    .depth-layer {
        padding: 3rem 1.2rem;
    }
}

/* ========== SCROLL REVEAL ========== */
.section-content,
.surface-content {
    opacity: 1;
}

.reveal-hidden {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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