/* ============================================
   hangul.day -- Styles
   Sepia-toned history meets parallax storytelling
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --ancient-parchment: #3d3120;
    --brush-ink: #1a1508;
    --timeline-bronze: #8b7355;
    --oat-paper: #d4c9a8;
    --clean-white: #fafafa;
    --flag-red: #c60c30;
    --flag-blue: #003478;
    --gold-foil: #b8941e;
    --modern-text: #27272a;
    --progress: 0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    line-height: 1.8;
    color: var(--brush-ink);
    background-color: var(--ancient-parchment);
    overflow-x: hidden;
    position: relative;
}

/* --- Background Transition Layer --- */
#bg-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: var(--ancient-parchment);
    transition: background-color 0.05s linear;
}

/* --- Sections Base --- */
.section {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

/* ============================================
   SECTION 1: HERO -- The Royal Edict
   ============================================ */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

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

/* Brush stroke decorations */
.brush-stroke {
    position: absolute;
    color: rgba(26, 21, 8, 0.15);
    pointer-events: none;
    z-index: 1;
}

.brush-stroke-1 {
    top: 10%;
    left: -5%;
    width: 40vw;
    max-width: 400px;
    transform: rotate(-15deg);
}

.brush-stroke-2 {
    bottom: 15%;
    right: -3%;
    width: 30vw;
    max-width: 300px;
    transform: rotate(10deg);
}

.brush-stroke svg {
    width: 100%;
    height: auto;
}

/* Vertical classical text */
.vertical-text {
    writing-mode: vertical-rl;
    display: inline-flex;
    gap: 1.5rem;
    margin-bottom: 3rem;
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--oat-paper);
    letter-spacing: 0.15em;
    opacity: 0.85;
    height: 40vh;
    max-height: 400px;
}

.vertical-text .classical-text {
    text-align: start;
}

.hero-title {
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: var(--oat-paper);
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.hero-subtitle {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.875rem;
    color: var(--timeline-bronze);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-year {
    font-family: 'EB Garamond', serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--gold-foil);
    letter-spacing: 0.3em;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--timeline-bronze);
    font-family: 'EB Garamond', serif;
    font-size: 0.8rem;
    opacity: 0.7;
    animation: fadeInUp 2s ease-out 1s both;
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 2px solid var(--timeline-bronze);
    border-bottom: 2px solid var(--timeline-bronze);
    transform: rotate(45deg);
    margin: 0.75rem auto 0;
    animation: bounceArrow 2s ease-in-out infinite;
}

@keyframes bounceArrow {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(8px); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 0.7; transform: translate(-50%, 0); }
}

/* ============================================
   TIMELINE VERTICAL LINE
   ============================================ */
#timeline-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: var(--timeline-bronze);
    z-index: 0;
    top: 100vh;
    height: 0;
    opacity: 0.6;
}

/* ============================================
   SECTION 2: HISTORICAL TIMELINE
   ============================================ */
.timeline-section {
    padding: 6rem 2rem;
    position: relative;
}

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

/* Timeline Node */
.timeline-node {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6rem;
    position: relative;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.timeline-node:nth-child(odd) {
    flex-direction: row;
    transform: translateX(-30px);
}

.timeline-node:nth-child(even) {
    flex-direction: row-reverse;
    transform: translateX(30px);
}

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

/* Year Medallion */
.year-medallion {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--gold-foil);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: background-color 0.6s ease, border-color 0.6s ease;
    z-index: 2;
    position: relative;
}

.year-medallion span {
    font-family: 'EB Garamond', serif;
    font-size: 0.85rem;
    color: var(--gold-foil);
    transition: color 0.6s ease;
}

.timeline-node.filled .year-medallion {
    background: var(--gold-foil);
}

.timeline-node.filled .year-medallion span {
    color: var(--ancient-parchment);
}

/* Node Content */
.node-content {
    flex: 1;
    padding: 0 2rem;
}

.node-title {
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    margin-bottom: 0.25rem;
    transition: color 0.5s ease;
}

.node-title-en {
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.875rem;
    color: var(--timeline-bronze);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.node-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.8;
    max-width: 400px;
    transition: color 0.5s ease;
}

.timeline-node:nth-child(even) .node-content {
    text-align: right;
}

.timeline-node:nth-child(even) .node-text {
    margin-left: auto;
}

/* ============================================
   SECTION 3: TRANSFORMATION GALLERY
   ============================================ */
.gallery-section {
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    position: relative;
    overflow: hidden;
}

.gallery-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    width: 100%;
}

.gallery-heading {
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 800;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 0.5rem;
    transition: color 0.5s ease;
}

.gallery-description {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--timeline-bronze);
    margin-bottom: 4rem;
    line-height: 1.6;
}

.parallax-layers {
    position: relative;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4rem;
}

.parallax-layer {
    text-align: center;
    transition: transform 0.1s linear;
}

.parallax-layer p {
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 700;
    transition: color 0.5s ease;
}

.layer-ancient {
    opacity: 0.3;
}

.layer-ancient p {
    font-size: clamp(1.5rem, 4vw, 3rem);
    letter-spacing: 0.15em;
}

.layer-middle {
    opacity: 0.6;
}

.layer-middle p {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    letter-spacing: 0.1em;
}

.layer-modern {
    opacity: 1;
}

.layer-modern p {
    font-size: clamp(2rem, 6vw, 4rem);
    letter-spacing: 0.05em;
}

.layer-label {
    display: block;
    margin-top: 0.5rem;
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.8rem;
    color: var(--timeline-bronze);
    line-height: 1.6;
}

/* ============================================
   SECTION 4: CELEBRATION
   ============================================ */
.celebration-section {
    background: var(--clean-white);
    color: var(--modern-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.celebration-content {
    text-align: center;
    max-width: 800px;
    position: relative;
    z-index: 2;
}

/* Taegeuk */
.taegeuk {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 3rem;
    position: relative;
    overflow: hidden;
    animation: rotateTaegeuk 20s linear infinite;
    border: 2px solid var(--modern-text);
}

.taegeuk-red,
.taegeuk-blue {
    position: absolute;
    width: 100%;
    height: 50%;
}

.taegeuk-red {
    top: 0;
    background: var(--flag-red);
    border-radius: 50px 50px 0 0;
}

.taegeuk-red::after {
    content: '';
    position: absolute;
    bottom: -25px;
    left: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--flag-red);
}

.taegeuk-blue {
    bottom: 0;
    background: var(--flag-blue);
    border-radius: 0 0 50px 50px;
}

.taegeuk-blue::after {
    content: '';
    position: absolute;
    top: -25px;
    right: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--flag-blue);
}

@keyframes rotateTaegeuk {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.celebration-title {
    font-family: 'Black Han Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--modern-text);
    margin-bottom: 0.25rem;
    line-height: 1.1;
}

.celebration-subtitle {
    font-family: 'EB Garamond', serif;
    font-size: 1.2rem;
    color: var(--timeline-bronze);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.celebration-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--modern-text);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Hangul Showcase */
.hangul-showcase {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.showcase-char {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    border-radius: 8px;
    cursor: default;
    transition: transform 0.3s ease, color 0.3s ease, background-color 0.3s ease;
    background: transparent;
    color: var(--modern-text);
    border: 2px solid var(--modern-text);
}

.showcase-char:hover {
    transform: scale(1.2) rotate(-5deg);
    background: var(--flag-red);
    color: var(--clean-white);
    border-color: var(--flag-red);
}

.showcase-char:nth-child(even):hover {
    background: var(--flag-blue);
    border-color: var(--flag-blue);
}

/* Celebration Quote */
.celebration-quote {
    margin-top: 2rem;
}

.celebration-quote blockquote {
    border: none;
    padding: 0;
}

.celebration-quote blockquote p {
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 700;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: var(--modern-text);
    line-height: 1.8;
    margin-bottom: 0.75rem;
}

.celebration-quote cite {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.875rem;
    color: var(--timeline-bronze);
}

/* Confetti container */
#confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.confetti-char {
    position: absolute;
    font-family: 'Black Han Sans', sans-serif;
    font-size: 1.5rem;
    opacity: 0.12;
    pointer-events: none;
    animation: confettiFall linear infinite;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-10%) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.12;
    }
    90% {
        opacity: 0.12;
    }
    100% {
        transform: translateY(110vh) rotate(360deg);
        opacity: 0;
    }
}

/* ============================================
   FOOTER
   ============================================ */
#footer {
    background: var(--modern-text);
    color: var(--oat-paper);
    text-align: center;
    padding: 3rem 2rem;
}

.footer-text {
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.footer-sub {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--timeline-bronze);
    line-height: 1.6;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .timeline-node:nth-child(odd),
    .timeline-node:nth-child(even) {
        flex-direction: column;
        align-items: center;
        text-align: center;
        transform: translateY(20px);
    }

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

    .timeline-node:nth-child(even) .node-content {
        text-align: center;
    }

    .timeline-node:nth-child(even) .node-text {
        margin-left: auto;
        margin-right: auto;
    }

    .node-content {
        padding: 1rem 0;
    }

    .node-text {
        max-width: 100%;
    }

    #timeline-line {
        left: 50%;
    }

    .vertical-text {
        height: 30vh;
        gap: 1rem;
    }

    .showcase-char {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .vertical-text {
        height: 25vh;
        font-size: clamp(1rem, 3vw, 1.5rem);
    }

    .parallax-layers {
        gap: 3rem;
    }
}
