/* ============================================
   hangul.name — Dark-Academia Calligraphic
   Timeline-Vertical Layout
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #1a1510;
    color: #b8a88c;
    font-family: 'Crimson Text', serif;
    font-size: 16px;
    line-height: 1.8;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Timeline SVG (Central Vertical Line) --- */
.timeline-svg {
    position: fixed;
    top: 0;
    left: 40%;
    width: 2px;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

.timeline-svg line {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: none;
}

.timeline-svg.animated line {
    animation: drawTimeline 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* --- Navigation Panel --- */
.nav-panel {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 160px;
    padding: 20px 16px;
    z-index: 100;
    background: rgba(26, 21, 16, 0.92);
    border-left: 2px solid #8b7355;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.nav-panel.visible {
    opacity: 1;
    transform: translateX(0);
}

.nav-title {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 14px;
    color: #d4c4a0;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.nav-link {
    display: block;
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 13px;
    color: #7a6a52;
    text-decoration: none;
    padding: 6px 0;
    padding-left: 16px;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 1px solid #8b7355;
    border-radius: 50%;
    transform: translateY(-50%);
    transition: background 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #d4c4a0;
}

.nav-link.active::before {
    background: #8b7355;
}

.nav-link[data-era="explorer"]::before {
    border-color: #6b9e82;
}

.nav-link[data-era="explorer"].active::before {
    background: #6b9e82;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 40%;
    z-index: 2;
}

.hero-node {
    position: absolute;
    left: calc(40% - 8px);
    top: 50%;
    transform: translateY(-50%) scale(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-node.visible {
    transform: translateY(-50%) scale(1);
}

.hero-node .node-circle {
    width: 16px;
    height: 16px;
}

.hero-content {
    padding-left: 48px;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 1s ease, transform 1s ease;
}

.hero-content.visible {
    opacity: 1;
    transform: translateX(0);
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 40px;
    color: #d4c4a0;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}

.hero-subtitle {
    font-family: 'Crimson Text', serif;
    font-weight: 400;
    font-size: 16px;
    color: #b8a88c;
    max-width: 480px;
    opacity: 0;
    transition: opacity 1s ease 0.4s;
}

.hero-subtitle.visible {
    opacity: 1;
}

/* --- Timeline Container --- */
.timeline-container {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 80px;
    z-index: 2;
}

/* --- Era Labels --- */
.era-label {
    position: relative;
    padding: 40px 0 20px;
    padding-left: calc(40% + 48px);
}

.era-label-kr {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 36px;
    color: #d4c4a0;
    letter-spacing: 0.02em;
    display: block;
}

.era-label-en {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 28px;
    color: #d4c4a0;
    letter-spacing: 0.02em;
    display: block;
    margin-top: 4px;
}

/* --- Timeline Eras --- */
.timeline-era {
    padding: 20px 0;
}

/* --- Timeline Nodes --- */
.timeline-node {
    position: relative;
    margin-bottom: 80px;
    display: flex;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* --- Node Connector --- */
.node-connector {
    position: absolute;
    left: 40%;
    top: 20px;
    display: flex;
    align-items: center;
    z-index: 3;
}

.node-dot {
    width: 16px;
    height: 16px;
    position: absolute;
    left: -8px;
    top: -7px;
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timeline-node.revealed .node-dot {
    transform: scale(1);
}

.connector-svg {
    width: 40px;
    height: 2px;
}

.connector-svg line {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    transition: stroke-dashoffset 0.4s ease 0.15s;
}

.timeline-node.revealed .connector-svg line {
    stroke-dashoffset: 0;
}

/* --- Right-side content blocks --- */
.node-right .node-connector {
    left: 40%;
}

.node-right .node-content {
    margin-left: calc(40% + 48px);
    margin-right: 24px;
}

/* --- Left-side content blocks --- */
.node-left .node-connector {
    left: calc(40% - 40px);
}

.node-left .node-connector .connector-svg {
    transform: scaleX(-1);
}

.node-left .node-content {
    margin-left: 24px;
    margin-right: calc(60% + 8px);
    text-align: right;
}

/* --- Node Content --- */
.node-content {
    position: relative;
    padding: 32px;
    background: rgba(34, 28, 20, 0.6);
    border-radius: 2px;
    overflow: hidden;
}

.node-content.candlelight::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(212, 196, 160, 0.03) 0%, transparent 70%);
    pointer-events: none;
}

.node-content h2 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 28px;
    color: #d4c4a0;
    letter-spacing: 0.02em;
    margin-bottom: 16px;
}

.node-content p {
    font-family: 'Crimson Text', serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.8;
    color: #b8a88c;
    margin-bottom: 12px;
}

.node-content em {
    font-weight: 600;
    color: #d4c4a0;
}

/* --- Korean Display --- */
.korean-display {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 48px;
    color: #e8dcc8;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

/* --- Hanja Watermark --- */
.hanja-watermark {
    position: absolute;
    top: 16px;
    right: 24px;
    font-family: 'Noto Serif KR', serif;
    font-weight: 200;
    font-size: 120px;
    color: #221c14;
    z-index: 0;
    pointer-events: none;
    transition: color 0.4s ease;
    line-height: 1;
    user-select: none;
}

.node-content:hover .hanja-watermark {
    color: rgba(139, 115, 85, 0.2);
}

.node-left .hanja-watermark {
    right: auto;
    left: 24px;
}

/* --- Name Seal (도장) --- */
.name-seal {
    display: inline-block;
    width: 32px;
    height: 32px;
    background: #b34233;
    border-radius: 2px;
    color: #ffffff;
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 18px;
    text-align: center;
    line-height: 32px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

/* --- Marginalia --- */
.marginalia {
    font-family: 'Courier Prime', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.03em;
    color: #7a6a52;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(139, 115, 85, 0.2);
}

/* --- Genealogy Tree --- */
.genealogy-tree {
    width: 200px;
    height: 140px;
    margin-bottom: 16px;
}

/* --- Explorer Section --- */
.explorer-section {
    padding: 80px 0;
    position: relative;
}

.explorer-container {
    display: flex;
    gap: 40px;
    margin-left: calc(40% - 160px);
    margin-right: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.explorer-container.revealed {
    opacity: 1;
    transform: translateY(0);
}

.explorer-left {
    flex: 0 0 240px;
}

.explorer-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 28px;
    color: #6b9e82;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}

.explorer-desc {
    font-family: 'Crimson Text', serif;
    font-size: 15px;
    color: #7a6a52;
    margin-bottom: 24px;
}

/* --- Surname List --- */
.surname-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 400px;
    overflow-y: auto;
}

.surname-btn {
    background: transparent;
    border: 1px solid rgba(139, 115, 85, 0.2);
    padding: 10px 16px;
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 32px;
    color: #e8dcc8;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.surname-btn:hover {
    background: rgba(139, 115, 85, 0.1);
    border-color: #8b7355;
}

.surname-btn.selected {
    background: rgba(139, 115, 85, 0.15);
    border-color: #8b7355;
    font-size: 48px;
    padding: 16px;
    color: #d4c4a0;
}

/* --- Explorer Detail Panel --- */
.explorer-detail {
    flex: 1;
    min-height: 300px;
    padding: 32px;
    background: rgba(34, 28, 20, 0.6);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.detail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 240px;
}

.detail-placeholder-char {
    font-family: 'Noto Serif KR', serif;
    font-weight: 200;
    font-size: 80px;
    color: #221c14;
    margin-bottom: 16px;
}

.detail-placeholder-text {
    font-family: 'Crimson Text', serif;
    font-size: 15px;
    color: #7a6a52;
}

.detail-content {
    animation: slideInDetail 0.5s ease forwards;
}

@keyframes slideInDetail {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.detail-hanja {
    position: absolute;
    top: 16px;
    right: 24px;
    font-family: 'Noto Serif KR', serif;
    font-weight: 200;
    font-size: 120px;
    color: #221c14;
    line-height: 1;
    pointer-events: none;
}

.detail-hangul {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 72px;
    color: #e8dcc8;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

.detail-seal {
    display: inline-block;
    width: 32px;
    height: 32px;
    background: #b34233;
    border-radius: 2px;
    color: #ffffff;
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 18px;
    text-align: center;
    line-height: 32px;
    margin-bottom: 16px;
}

.detail-meaning {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 20px;
    color: #d4c4a0;
    margin-bottom: 8px;
}

.detail-hanja-label {
    font-family: 'Courier Prime', monospace;
    font-size: 13px;
    color: #7a6a52;
    letter-spacing: 0.03em;
    margin-bottom: 16px;
}

.detail-origin {
    font-family: 'Crimson Text', serif;
    font-size: 16px;
    line-height: 1.8;
    color: #b8a88c;
}

/* --- Footer --- */
.site-footer {
    position: relative;
    padding: 40px 24px;
    text-align: center;
    z-index: 2;
}

.footer-line {
    width: 60px;
    height: 2px;
    background: #8b7355;
    margin: 0 auto 20px;
}

.footer-text {
    font-family: 'Courier Prime', monospace;
    font-size: 13px;
    color: #7a6a52;
    letter-spacing: 0.03em;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .timeline-svg {
        left: 24px;
    }

    .hero {
        padding-left: 56px;
    }

    .hero-title {
        font-size: 28px;
    }

    .nav-panel {
        display: none;
    }

    .era-label {
        padding-left: 56px;
    }

    .era-label-kr {
        font-size: 28px;
    }

    .era-label-en {
        font-size: 20px;
    }

    .node-right .node-content,
    .node-left .node-content {
        margin-left: 56px;
        margin-right: 16px;
        text-align: left;
    }

    .node-connector {
        left: 24px !important;
    }

    .node-left .node-connector .connector-svg {
        transform: scaleX(1);
    }

    .node-left .hanja-watermark {
        left: auto;
        right: 24px;
    }

    .korean-display {
        font-size: 36px;
    }

    .hanja-watermark {
        font-size: 80px;
    }

    .explorer-container {
        flex-direction: column;
        margin-left: 56px;
    }

    .explorer-left {
        flex: none;
    }

    .detail-hangul {
        font-size: 48px;
    }

    .detail-hanja {
        font-size: 80px;
    }
}
