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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    background: #FFF5E6;
    color: #1A3A4A;
    overflow-x: hidden;
    word-break: keep-all;
}

/* === Navigation Dots === */
#nav-dots {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 100;
}

.nav-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #79B8C8;
    background: transparent;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
    padding: 0;
}

.nav-dot.active {
    background: #F2994A;
    border-color: #F2994A;
}

/* === HUD Labels === */
.hud-label {
    position: fixed;
    font-family: 'Comfortaa', cursive;
    font-size: clamp(0.65rem, 1vw, 0.85rem);
    letter-spacing: 0.12em;
    color: #79B8C8;
    z-index: 90;
    opacity: 0.7;
}

#hud-top-left {
    top: 20px;
    left: 24px;
}

#hud-bottom-right {
    bottom: 20px;
    right: 24px;
}

.blink-cursor {
    animation: blink 1s step-end infinite;
}

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

/* === Sections === */
.section {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section-auto {
    min-height: auto;
    padding: 100px 0;
}

.section-heading {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #1A3A4A;
    margin-bottom: 60px;
    letter-spacing: -0.01em;
}

.section-heading-light {
    color: #FFF5E6;
}

/* === Section Dividers === */
.section-divider {
    width: 80%;
    height: 4px;
    border-radius: 2px;
    background: #F2994A;
    margin: 0 auto;
}

/* === HUD Arcs === */
.hud-arc {
    position: absolute;
    width: 200px;
    height: 200px;
    opacity: 0;
    transition: opacity 1s;
}

.hud-arc.visible {
    opacity: 1;
}

.hud-arc-1 {
    top: 40px;
    left: 40px;
    animation: hud-rotate 60s linear infinite;
}

.hud-arc-2 {
    bottom: 60px;
    right: 40px;
    animation: hud-rotate 45s linear infinite reverse;
}

.hud-arc-3 {
    top: 30%;
    right: 60px;
    animation: hud-rotate 80s linear infinite;
}

@keyframes hud-rotate {
    to { transform: rotate(360deg); }
}

/* === Jamo Decoration === */
.jamo-deco {
    position: absolute;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    color: #1A3A4A;
    opacity: 0.08;
    pointer-events: none;
    user-select: none;
}

/* === Status Dots === */
.status-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse-dot 3s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* === Console Section === */
#console {
    background: #FFF5E6;
}

.console-content {
    text-align: center;
    z-index: 10;
}

#title {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.06em;
    color: #1A3A4A;
    margin-bottom: 16px;
    line-height: 1.1;
}

.title-char {
    display: inline-block;
    opacity: 0;
    transform: scale(0.3);
}

.title-char.animate-in {
    animation: bounce-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.title-quest {
    font-size: 0.3em;
    color: #79B8C8;
    vertical-align: super;
    opacity: 0;
    transition: opacity 0.5s;
}

.title-quest.visible {
    opacity: 1;
}

@keyframes bounce-enter {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.invitation {
    font-family: 'Nunito', sans-serif;
    font-size: 1.2rem;
    color: #1A3A4A;
    opacity: 0;
    line-height: 1.85;
    margin-top: 24px;
}

.invitation.visible {
    opacity: 1;
}

/* === Scroll Chevron === */
.scroll-chevron {
    position: absolute;
    bottom: 32px;
    animation: bounce-chevron 2s ease-in-out infinite;
    cursor: pointer;
}

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

/* === Timeline Section === */
#timeline {
    background: #FFF5E6;
}

.timeline-container {
    position: relative;
    width: 65%;
    max-width: 800px;
    margin: 0 auto;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: #79B8C8;
    transform: translateX(-50%);
    transform-origin: top;
    scale: 1 0;
    transition: scale 0.5s;
}

.timeline-line.drawn {
    scale: 1 1;
    transition: scale 2s ease-out;
}

.timeline-card {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 64px;
    opacity: 0;
    transform: translateY(40px);
}

.timeline-card.animate-in {
    animation: card-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-content {
    background: #FFF5E6;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 4px 20px rgba(232, 213, 183, 0.5);
    flex: 1;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-content:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(232, 213, 183, 0.7);
}

.card-date {
    display: block;
    font-family: 'Comfortaa', cursive;
    font-weight: 500;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.12em;
    color: #1A3A4A;
    margin-bottom: 4px;
}

.card-location {
    display: block;
    font-family: 'Comfortaa', cursive;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: #79B8C8;
    margin-bottom: 12px;
}

.card-text {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.85;
    color: #1A3A4A;
    letter-spacing: 0.01em;
}

.card-diagram {
    width: 120px;
    min-width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.diagram-line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1s ease;
}

.timeline-card.animate-in .diagram-line {
    stroke-dashoffset: 0;
}

.card-right {
    flex-direction: row-reverse;
    text-align: right;
}

/* === Vocabulary Hub === */
#vocabulary {
    background: #0D2633;
    padding: 80px 20px;
}

.vocab-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 600px;
    width: 100%;
}

.vocab-cell {
    aspect-ratio: 1;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    transform: scale(0.5);
}

.vocab-cell.animate-in {
    animation: bounce-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.vocab-cell:hover {
    transform: scale(1.08);
}

/* Cell gradients */
.vocab-cell[data-index="0"] { background: linear-gradient(135deg, #F2994A, #E8D5B7); }
.vocab-cell[data-index="1"] { background: linear-gradient(135deg, #79B8C8, #DCD6F7); }
.vocab-cell[data-index="2"] { background: linear-gradient(135deg, #6FCF97, #79B8C8); }
.vocab-cell[data-index="3"] { background: linear-gradient(135deg, #EB5757, #F2994A); }
.vocab-cell[data-index="4"] { background: linear-gradient(135deg, #1A3A4A, #0D2633); }
.vocab-cell[data-index="5"] { background: linear-gradient(135deg, #DCD6F7, #FFF5E6); }
.vocab-cell[data-index="6"] { background: linear-gradient(135deg, #E8D5B7, #F2994A); }
.vocab-cell[data-index="7"] { background: linear-gradient(135deg, #79B8C8, #6FCF97); }
.vocab-cell[data-index="8"] { background: linear-gradient(135deg, #1A3A4A, #79B8C8); }

.vocab-term {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 2.5vw, 1.6rem);
    color: #FFF5E6;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
    pointer-events: none;
}

.vocab-cell[data-index="5"] .vocab-term {
    color: #1A3A4A;
    text-shadow: none;
}

/* Overlay */
.vocab-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 38, 51, 0.85);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.3s ease;
}

.vocab-overlay.hidden {
    display: none;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.vocab-expanded {
    background: #FFF5E6;
    border-radius: 12px;
    padding: 48px;
    max-width: 70vw;
    max-height: 70vh;
    text-align: center;
    animation: bounce-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vocab-expanded-term {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #1A3A4A;
    margin-bottom: 24px;
}

.vocab-expanded-def {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1rem, 1.6vw, 1.3rem);
    line-height: 1.85;
    color: #1A3A4A;
}

/* === Reflection Zone === */
#reflection {
    background: #FFF5E6;
    animation: bg-shift 10s ease-in-out infinite alternate;
}

@keyframes bg-shift {
    0% { background-color: #FFF5E6; }
    100% { background-color: #E8F4F8; }
}

.reflection-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.reflection-word {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(2.5rem, 7vw, 5rem);
    color: #1A3A4A;
    opacity: 0;
    transform: translateY(10px);
    line-height: 1.2;
}

.reflection-word.animate-in {
    animation: word-enter 0.5s ease forwards;
}

@keyframes word-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Responsive === */
@media (max-width: 768px) {
    .timeline-container {
        width: 90%;
    }

    .timeline-card {
        flex-direction: column;
    }

    .card-right {
        flex-direction: column;
        text-align: left;
    }

    .card-diagram {
        align-self: center;
    }

    .timeline-line {
        left: 20px;
    }

    .vocab-grid {
        max-width: 90vw;
    }

    #nav-dots {
        right: 12px;
    }

    .hud-arc {
        display: none;
    }

    .jamo-deco {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
