/* ============================================
   algoha.com - 알고서 하는거야?
   Dark-Academia + Bauhaus Rationalism
   ============================================ */

:root {
    --blackboard: #1a1a1e;
    --parchment: #f2ead3;
    --amber-ink: #c17f24;
    --slate-teal: #3d6b6e;
    --chalk: #e8e2d0;
    --deep-slate: #1e1e24;
    --cinnabar: #b5452a;
    --graphite: #6b6b72;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-slate);
    color: var(--chalk);
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    overflow-x: hidden;
    word-break: keep-all;
    line-break: strict;
}

/* --- Blackboard Noise Texture (SVG filter applied via pseudo-element) --- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Top Navigation --- */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2.5rem;
    border-bottom: 1px solid rgba(232, 226, 208, 0.15);
    background: rgba(26, 26, 30, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-logo {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 16px;
    color: var(--chalk);
    letter-spacing: 0.1em;
}

.lang-toggle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    color: var(--graphite);
    background: none;
    border: 1px solid var(--graphite);
    padding: 4px 12px;
    cursor: pointer;
    transition: color 0.3s, border-color 0.3s;
    letter-spacing: 0.05em;
}

.lang-toggle:hover {
    color: var(--amber-ink);
    border-color: var(--amber-ink);
}

/* --- Hero Section --- */
.hero {
    position: relative;
    height: 100vh;
    overflow: hidden;
    display: flex;
}

.hero-dark {
    position: absolute;
    inset: 0;
    background: var(--blackboard);
    clip-path: polygon(0 0, 68% 0, 32% 100%, 0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.hero-ghost-text {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    color: #2a2a2e;
    letter-spacing: 0.08em;
    user-select: none;
    white-space: nowrap;
    transform: translateX(-10%);
}

.hero-light {
    position: absolute;
    inset: 0;
    background: var(--parchment);
    clip-path: polygon(68% 0, 100% 0, 100% 100%, 32% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    animation: heroLightIn 1.5s ease-out 1.5s forwards;
}

@keyframes heroLightIn {
    to { opacity: 1; }
}

.hero-proclamation {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: var(--blackboard);
    letter-spacing: 0.08em;
    transform: translateX(10%);
}

.hero-chevron {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    opacity: 0;
    animation: chevronIn 1s ease-out 3s forwards;
}

.chevron-path {
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    animation: drawChevron 1s ease-out 3s forwards;
}

@keyframes chevronIn {
    to { opacity: 1; }
}

@keyframes drawChevron {
    to { stroke-dashoffset: 0; }
}

/* --- Examination Section (Timeline) --- */
.examination {
    position: relative;
    padding: 100px 0 120px;
    background: var(--deep-slate);
}

.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 40px;
}

.timeline-spine {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 0;
    background: var(--chalk);
    transform: translateX(-50%);
    transition: height 0.1s linear;
}

.timeline-node {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 60px 1fr;
    gap: 0;
    margin-bottom: 80px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

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

.node-marker {
    grid-column: 2;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10px;
    z-index: 5;
}

.node-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--amber-ink);
    border-radius: 50%;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 14px;
    color: var(--amber-ink);
    background: var(--deep-slate);
    transition: background 0.4s ease-out, color 0.4s ease-out;
}

.timeline-node.visible .node-number {
    background: var(--amber-ink);
    color: var(--deep-slate);
}

/* Lesson blocks alternate left/right */
.lesson-block {
    padding: 1.5rem 2rem;
    border-radius: 2px;
}

.lesson-right {
    grid-column: 3;
    grid-row: 1;
    border-left: 2px solid rgba(193, 127, 36, 0.3);
    padding-left: 2rem;
}

.lesson-left {
    grid-column: 1;
    grid-row: 1;
    text-align: right;
    border-right: 2px solid rgba(193, 127, 36, 0.3);
    padding-right: 2rem;
}

.lesson-block.pulse {
    animation: borderPulse 0.6s ease-out;
}

@keyframes borderPulse {
    0% { border-color: rgba(193, 127, 36, 0.3); }
    50% { border-color: rgba(193, 127, 36, 0.8); }
    100% { border-color: rgba(193, 127, 36, 0.3); }
}

.bilingual-pair {
    display: grid;
    grid-template-rows: auto auto;
    gap: 4px;
    margin-bottom: 1rem;
}

.text-ko {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    color: var(--chalk);
    letter-spacing: 0.02em;
}

.text-en {
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-size: 15px;
    color: var(--graphite);
    font-style: italic;
}

.lesson-body {
    color: var(--chalk);
    opacity: 0.85;
    font-size: 17px;
    line-height: 1.8;
    margin-bottom: 0.8rem;
}

.margin-note {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--graphite);
    font-weight: 400;
    opacity: 0.7;
}

/* --- Chalk Divider --- */
hr.chalk-line, .proof-section::before {
    border: none;
    border-top: 1px dashed rgba(232, 226, 208, 0.4);
}

/* --- Proof Section (Confrontation) --- */
.proof-section {
    position: relative;
    padding: 100px 0;
    background: var(--blackboard);
    transform: rotate(-3deg);
    margin: -40px -20px;
    padding-left: 20px;
    padding-right: 20px;
}

.proof-wrapper {
    transform: rotate(3deg);
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 40px;
}

.proof-split {
    display: grid;
    grid-template-columns: 2fr 1px 3fr;
    gap: 2rem;
    align-items: start;
}

.proof-divider {
    width: 1px;
    height: 100%;
    min-height: 200px;
    background: linear-gradient(to bottom, transparent, var(--chalk), transparent);
    opacity: 0.3;
}

.proof-side {
    padding: 2rem 1.5rem;
}

.proof-label {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    margin-bottom: 1.5rem;
    letter-spacing: 0.08em;
}

.proof-ignorance {
    filter: grayscale(1) brightness(0.7);
    transition: filter 0.4s ease;
}

.proof-ignorance:hover {
    filter: grayscale(1) brightness(0.5);
}

.proof-ignorance .proof-label {
    color: var(--cinnabar);
    filter: grayscale(0);
}

.proof-knowing {
    transition: filter 0.4s ease;
}

.proof-knowing:hover {
    filter: brightness(1.1);
}

.proof-knowing .proof-label {
    color: var(--slate-teal);
}

.proof-text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--chalk);
    opacity: 0.8;
    margin-bottom: 1.5rem;
}

.proof-visual {
    margin-top: 1rem;
}

.proof-diagram-small {
    width: 100%;
    max-width: 200px;
}

/* --- Diagram Section --- */
.diagram-section {
    padding: 80px 0;
    background: var(--deep-slate);
}

.diagram-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 40px;
}

.proof-flowchart {
    width: 100%;
    height: auto;
}

.flow-branch {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 3s ease-in-out;
}

.flow-branch.drawn {
    stroke-dashoffset: 0;
}

.flow-branch-ignorance.drawn {
    transition: stroke-dashoffset 1.5s ease-out;
}

.flow-label,
.flow-endpoint {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.flow-label.visible,
.flow-endpoint.visible {
    opacity: 1;
}

.flow-node {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.flow-node.visible {
    opacity: 1;
}

/* Diagram pulse */
.proof-flowchart.complete {
    animation: diagramPulse 1s ease-in-out;
}

@keyframes diagramPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* --- Conclusion Section --- */
.conclusion {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--parchment);
    padding: 80px 40px;
}

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

.conclusion-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--blackboard);
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 2rem;
    min-height: 1.2em;
}

.conclusion-phrase {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--blackboard);
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 1.5s ease-out;
    margin-bottom: 0.5rem;
}

.conclusion-phrase.visible {
    opacity: 1;
}

.conclusion-phrase-en {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: 16px;
    color: var(--graphite);
    font-style: italic;
    opacity: 0;
    transition: opacity 1.5s ease-out 0.5s;
}

.conclusion-phrase-en.visible {
    opacity: 1;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .hero-dark {
        clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
    }

    .hero-light {
        clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);
    }

    .hero-ghost-text {
        font-size: clamp(2rem, 8vw, 4rem);
        transform: none;
    }

    .hero-proclamation {
        font-size: clamp(1.8rem, 6vw, 3rem);
        transform: none;
    }

    .timeline-node {
        display: block;
        padding-left: 60px;
    }

    .node-marker {
        position: absolute;
        left: 0;
    }

    .lesson-left {
        text-align: left;
        border-right: none;
        border-left: 2px solid rgba(193, 127, 36, 0.3);
        padding-right: 0;
        padding-left: 1.5rem;
    }

    .timeline-spine {
        left: 20px;
    }

    .proof-section {
        transform: none;
        margin: 0;
    }

    .proof-wrapper {
        transform: none;
    }

    .proof-split {
        grid-template-columns: 1fr;
    }

    .proof-divider {
        width: 100%;
        height: 1px;
        min-height: 1px;
    }

    .top-nav {
        padding: 0.8rem 1.5rem;
    }
}
