/* ============================================================
   senggack.com - Styles
   Nocturnal observatory of human cognition
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    background-color: #0a0e27;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    color: #c8dce8;
    background-color: #0a0e27;
    overflow-x: hidden;
    font-size: clamp(16px, 1.8vw, 20px);
    line-height: 1.85;
}

/* ---------- Canvas Background ---------- */
#neural-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ---------- Opening Viewport ---------- */
.opening-viewport {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background-color: #0a0e27;
}

.opening-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.hangul-char {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(80px, 15vw, 200px);
    color: #7eb8da;
    opacity: 0;
    display: inline-block;
    text-shadow: 0 0 40px rgba(126, 184, 218, 0.3);
    transition: none;
}

.hangul-char.visible {
    opacity: 1;
    transform: scale(1);
}

.hangul-char.pulsing {
    text-shadow: 0 0 60px rgba(126, 184, 218, 0.4), 0 0 120px rgba(126, 184, 218, 0.2);
}

.hangul-char.dissolving {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.opening-viewport.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease-out;
}

/* ---------- Main Thought Stream ---------- */
.thought-stream {
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

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

/* ---------- Thought Sections ---------- */
.thought-section {
    position: relative;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10vh 1.5rem;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.thought-section:nth-child(even) {
    background-color: #131a3a;
}

.thought-section.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Thought Content ---------- */
.thought-content {
    max-width: 640px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.thought-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(36px, 6vw, 72px);
    letter-spacing: 0.15em;
    color: #e8f4ff;
    text-transform: uppercase;
    margin-bottom: 0.3em;
    line-height: 1.1;
    transition: color 0.3s ease;
}

.thought-title:hover {
    color: #4a8fb8;
}

.thought-korean {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(18px, 2.5vw, 28px);
    color: #d4a574;
    margin-bottom: 1.5em;
    letter-spacing: 0.05em;
}

.thought-body {
    color: #c8dce8;
    margin-bottom: 1.5em;
}

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

/* ---------- HUD Frame Overlay ---------- */
.hud-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(700px, 90vw);
    height: 500px;
    pointer-events: none;
    z-index: 1;
}

.hud-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.hud-bracket {
    fill: none;
    stroke: #3a5f8a;
    stroke-width: 1.5;
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    transition: stroke-dashoffset 0.8s ease-out;
}

.thought-section.in-view .hud-bracket {
    stroke-dashoffset: 0;
}

.hud-arc {
    fill: none;
    stroke: #3a5f8a;
    stroke-width: 0.8;
    stroke-dasharray: 6 4;
    stroke-dashoffset: 500;
    opacity: 0.3;
    transition: stroke-dashoffset 1.2s ease-out;
}

.thought-section.in-view .hud-arc {
    stroke-dashoffset: 0;
}

/* ---------- Hangul Watermarks ---------- */
.hangul-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(300px, 40vw, 500px);
    color: #c8dce8;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
    line-height: 1;
    user-select: none;
}

.hangul-watermark::after {
    content: attr(data-char);
}

/* ---------- Node Indicators ---------- */
.node-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #7eb8da;
    position: relative;
    z-index: 2;
    animation: node-pulse 3s ease-in-out infinite;
}

.node-start {
    margin-bottom: 2rem;
}

.node-end {
    margin-top: 2rem;
}

@keyframes node-pulse {
    0%, 100% {
        box-shadow: 0 0 4px rgba(126, 184, 218, 0.4);
        opacity: 0.6;
    }
    50% {
        box-shadow: 0 0 12px rgba(126, 184, 218, 0.8);
        opacity: 1;
    }
}

/* ---------- Pulse Ring ---------- */
.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 1px solid #7eb8da;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.thought-section.in-view .pulse-ring {
    animation: pulse-expand 1.5s ease-out forwards;
}

@keyframes pulse-expand {
    0% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(0.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.5);
    }
}

/* ---------- Neural Connection Lines ---------- */
.neural-connection {
    display: flex;
    justify-content: center;
    height: 15vh;
    padding: 0;
}

.connection-svg {
    width: 4px;
    height: 100%;
}

.synapse-line {
    fill: none;
    stroke: #3a5f8a;
    stroke-width: 1;
    opacity: 0.3;
}

/* ---------- Breathing Divider ---------- */
.breathing-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 3vh 0;
}

.divider-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #7eb8da;
    opacity: 0.3;
}

.breathing-divider.animate .divider-dot {
    animation: dot-breathe 2.1s ease-in-out infinite;
}

.breathing-divider.animate .divider-dot:nth-child(1) { animation-delay: 0s; }
.breathing-divider.animate .divider-dot:nth-child(2) { animation-delay: 0.3s; }
.breathing-divider.animate .divider-dot:nth-child(3) { animation-delay: 0.6s; }
.breathing-divider.animate .divider-dot:nth-child(4) { animation-delay: 0.9s; }
.breathing-divider.animate .divider-dot:nth-child(5) { animation-delay: 1.2s; }
.breathing-divider.animate .divider-dot:nth-child(6) { animation-delay: 1.5s; }
.breathing-divider.animate .divider-dot:nth-child(7) { animation-delay: 1.8s; }

@keyframes dot-breathe {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.5);
        background-color: #e8f4ff;
    }
}

/* ---------- Closing Section ---------- */
.closing-section {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vh 1.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.closing-section.in-view {
    opacity: 1;
    transform: translateY(0);
}

.closing-content {
    text-align: center;
}

.closing-korean {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(28px, 5vw, 56px);
    color: #7eb8da;
    margin-bottom: 0.5em;
    text-shadow: 0 0 30px rgba(126, 184, 218, 0.3);
}

.closing-english {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(16px, 2vw, 24px);
    letter-spacing: 0.3em;
    color: #3a5f8a;
    text-transform: uppercase;
}

/* ---------- Watermark slow rotation ---------- */
@keyframes watermark-rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.hangul-watermark {
    animation: watermark-rotate 120s linear infinite;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .hud-frame {
        width: 95vw;
        height: 400px;
    }

    .thought-section {
        min-height: 70vh;
        padding: 8vh 1.2rem;
    }

    .hangul-watermark {
        font-size: 250px;
    }

    .neural-connection {
        height: 10vh;
    }
}

@media (max-width: 480px) {
    .thought-section {
        min-height: 60vh;
    }

    .hud-frame {
        height: 350px;
    }

    .hangul-watermark {
        font-size: 200px;
    }
}
