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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #080c14;
    color: #c8d6e5;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* === NOISE OVERLAY === */
#noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    filter: url(#noise);
    width: 100%;
    height: 100%;
}

/* === LEFT NAVIGATION === */
#star-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 24px;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.nav-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background-color: #2d4a7a;
}

.nav-diamond {
    position: relative;
    width: 6px;
    height: 6px;
    background-color: #5b8cc9;
    transform: rotate(45deg);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    z-index: 2;
}

.nav-diamond:hover {
    transform: rotate(45deg) scale(1.4);
    background-color: #c9a84c;
}

.nav-diamond.active {
    background-color: #c9a84c;
}

.nav-tooltip {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%) translateX(-8px) rotate(-45deg);
    opacity: 0;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e8eef5;
    background-color: #1a2744;
    padding: 4px 10px;
    border-radius: 2px;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-diamond:hover .nav-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0) rotate(-45deg);
}

/* === HERO === */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #080c14;
    overflow: hidden;
}

#constellation-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    animation: constellation-drift 7200s linear infinite;
    transform-origin: center;
}

@keyframes constellation-drift {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

#korean-label {
    font-family: 'Noto Serif KR', serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: #c9a84c;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fade-in 1s ease 0.3s forwards;
}

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

#hero-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    color: #e8eef5;
    white-space: nowrap;
    min-height: 1.2em;
}

#cursor {
    color: #f0f3f7;
    animation: blink 1s step-end infinite;
    font-weight: 400;
}

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

#hero-subtitle {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: #c8d6e5;
    margin-top: 1.5rem;
    min-height: 1.5em;
}

/* === CONTENT SECTIONS === */
.content-section {
    padding: 4rem 3rem 4rem 3.5rem;
    min-height: 50vh;
}

.section-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3rem;
}

.divider-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #2d4a7a;
}

.divider-star {
    position: relative;
    z-index: 1;
    background-color: inherit;
    padding: 0 12px;
}

/* Fix divider star background to match section */
#origins .divider-star { background-color: #0d1117; }
#discoveries .divider-star { background-color: #0f1520; }
#languages .divider-star { background-color: #111827; }
#crossings .divider-star { background-color: #131b2e; }

.section-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.25rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e8eef5;
    margin-bottom: 2rem;
    text-align: center;
}

/* === ENTRY GRID === */
.entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.entry-card {
    background-color: #0d1117;
    border: 1px solid #1a2744;
    border-radius: 2px;
    padding: 1.5rem;
    transition: background-color 0.4s ease;
    opacity: 0;
    transform: translateY(12px);
}

.entry-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: background-color 0.4s ease, opacity 0.5s ease-out, transform 0.5s ease-out;
}

.entry-card:hover {
    background-color: #111827;
}

.entry-card.span-2 {
    grid-column: span 2;
}

.entry-icon {
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.entry-icon line,
.entry-icon circle,
.entry-icon ellipse,
.entry-icon polygon {
    transition: stroke 0.3s ease, fill 0.3s ease;
}

.entry-card:hover .entry-icon {
    transform: scale(1.15);
}

.entry-card:hover .entry-icon line { stroke: #c9a84c; }
.entry-card:hover .entry-icon circle:not([fill="#0d1117"]) { stroke: #c9a84c; fill: #c9a84c; }
.entry-card:hover .entry-icon ellipse { stroke: #c9a84c; }
.entry-card:hover .entry-icon polygon { fill: #c9a84c; }
/* Preserve unfilled circles */
.entry-card:hover .entry-icon circle[fill="none"] { fill: none; stroke: #c9a84c; }

.entry-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.25rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e8eef5;
    margin-bottom: 0.75rem;
    position: relative;
    display: inline-block;
}

.entry-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background-color: #c9a84c;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.entry-card:hover .entry-title::after {
    transform: scaleX(1);
}

.entry-desc {
    color: #c8d6e5;
    margin-bottom: 1rem;
}

.entry-date {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5b8cc9;
}

/* === FINAL MARKER === */
.final-marker {
    text-align: center;
    padding: 4rem 2rem 6rem;
    background-color: #131b2e;
}

.final-text {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-weight: 300;
    color: #5b8cc9;
    margin-top: 1rem;
    font-size: 1rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    #star-nav {
        display: none;
    }

    .content-section {
        padding: 3rem 1.5rem;
    }

    .entry-grid {
        grid-template-columns: 1fr;
    }

    .entry-card.span-2 {
        grid-column: span 1;
    }

    #constellation-bg circle:nth-child(even) {
        display: none;
    }

    #constellation-bg line:nth-child(even) {
        display: none;
    }
}
