/* ============================================
   계엄령.quest - Styles
   Cottagecore Chronicle: Split-Screen Diptych
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Palette: Ethereal Blue Cottagecore */
    --meadow-cream: #f8f3ec;
    --warm-parchment: #faf5ee;
    --ethereal-blue: #6b8cae;
    --dried-rose: #c4a882;
    --sage: #8fae7f;
    --woodland-brown: #3d2e22;
    --bark-gray: #6b5d52;
    --aged-gold: #b8860b;
    --frost: #ffffff;
    --winter-sky: #4a6fa5;

    /* Typography */
    --hero-size: clamp(2.2rem, 6vw, 4.5rem);
    --chapter-title-size: clamp(1.5rem, 3vw, 2.5rem);
    --body-size: clamp(0.95rem, 1.3vw, 1.1rem);
    --accent-size: clamp(0.8rem, 1.1vw, 0.95rem);

    /* Spacing & Layout */
    --gutter: 2rem;
    --section-gap: 3rem;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-size: var(--body-size);
    line-height: 1.8;
    color: var(--woodland-brown);
    background-color: var(--meadow-cream);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

h2 {
    font-style: italic;
    font-weight: 700;
}

/* --- Layout: Split-Screen Diptych --- */
.page-wrapper {
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    min-height: 100vh;
    gap: 0;
}

.left-panel {
    position: sticky;
    top: 0;
    height: 100vh;
    background-color: var(--meadow-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.divider-line {
    background: linear-gradient(180deg, transparent, transparent 8px, rgba(196, 168, 130, 0.3) 8px, rgba(196, 168, 130, 0.3) 12px);
    background-size: 12px 100%;
    width: 2px;
    background-position: 0 0;
}

.right-panel {
    background-color: var(--warm-parchment);
    padding: clamp(2rem, 4vw, 4rem);
    overflow-y: scroll;
}

/* --- Botanical Background (Left Panel) --- */
.botanical-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    z-index: 0;
    pointer-events: none;
}

.fern-pattern {
    position: absolute;
    width: 80px;
    height: 160px;
}

.fern-1 {
    top: 10%;
    left: 15%;
    transform: rotate(-20deg) scaleX(-1);
}

.fern-2 {
    top: 40%;
    right: 20%;
    transform: rotate(15deg);
}

.fern-3 {
    bottom: 20%;
    left: 10%;
    transform: rotate(25deg);
}

.fern-4 {
    top: 60%;
    right: 15%;
    transform: rotate(-10deg) scaleX(-1);
}

/* Parallax effect on scroll */
.fern-pattern {
    animation: parallax-drift 20s infinite ease-in-out;
}

@keyframes parallax-drift {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(20px); }
}

/* --- Glassmorphic Card Container --- */
.glassmorphic-card-container {
    position: relative;
    width: 320px;
    height: 380px;
    z-index: 10;
}

.glassmorphic-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(16px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 8px 24px rgba(107, 140, 174, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 500ms ease;
}

.glassmorphic-card.card-active {
    opacity: 1;
}

.card-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.card-illustration {
    width: 100%;
    height: 100%;
    max-width: 240px;
    max-height: 240px;
}

/* --- Hero Section --- */
.hero-section {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: var(--section-gap);
    padding: 4rem 0;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    animation: hero-fade-in 1200ms ease forwards;
    animation-delay: 2400ms;
}

.hero-title {
    font-size: var(--hero-size);
    color: var(--ethereal-blue);
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.05em;
    line-height: 1;
    min-height: var(--hero-size);
}

.hero-subtitle {
    font-family: 'Cormorant SC', serif;
    font-size: calc(var(--hero-size) * 0.5);
    color: var(--ethereal-blue);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

@keyframes hero-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Typewriter Cursor --- */
.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--aged-gold);
    margin-left: 0.1em;
    animation: cursor-blink 530ms step-end infinite;
}

@keyframes cursor-blink {
    0%, 49% {
        background-color: var(--aged-gold);
    }
    50%, 100% {
        background-color: transparent;
    }
}

/* --- Bubble Dividers --- */
.bubble-divider {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: var(--section-gap) 0;
    opacity: 0;
    animation: bubbles-fade-in 800ms ease forwards;
    animation-delay: 3000ms;
}

.bubble {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--dried-rose);
    opacity: 0;
    animation: bubble-pop-in 200ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.bubble:nth-child(1) { animation-delay: 3100ms; }
.bubble:nth-child(2) { animation-delay: 3150ms; }
.bubble:nth-child(3) { animation-delay: 3200ms; }
.bubble:nth-child(4) { animation-delay: 3250ms; }
.bubble:nth-child(5) { animation-delay: 3300ms; }
.bubble:nth-child(6) { animation-delay: 3350ms; }
.bubble:nth-child(7) { animation-delay: 3400ms; }

.bubble-center {
    width: 10px;
    height: 10px;
}

@keyframes bubble-pop-in {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.bubble:hover {
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(107, 140, 174, 0.3);
    transition: transform 300ms ease, box-shadow 300ms ease;
}

/* --- Chapter Sections --- */
.chapter {
    margin-bottom: var(--section-gap);
    opacity: 0;
    animation: chapter-fade-in 600ms ease forwards;
}

.chapter[data-chapter="chapter1"] {
    animation-delay: 2800ms;
}

.chapter[data-chapter="chapter2"] {
    animation-delay: 2900ms;
}

.chapter[data-chapter="chapter3"] {
    animation-delay: 3000ms;
}

.chapter[data-chapter="chapter4"] {
    animation-delay: 3100ms;
}

@keyframes chapter-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chapter-heading {
    font-size: var(--chapter-title-size);
    color: var(--ethereal-blue);
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
    min-height: var(--chapter-title-size);
}

.chapter-body {
    font-size: var(--body-size);
    line-height: 1.8;
    color: var(--woodland-brown);
    max-width: 60ch;
}

/* Typewriter effect for chapter headings */
.chapter-heading.typewriter {
    min-height: var(--chapter-title-size);
}

/* --- Closing Section --- */
.closing-section {
    margin-top: 6rem;
    margin-bottom: 6rem;
    text-align: center;
    padding: 3rem;
    border-top: 1px solid var(--dried-rose);
    border-bottom: 1px solid var(--dried-rose);
}

.closing-text {
    font-size: var(--body-size);
    line-height: 1.8;
    color: var(--bark-gray);
    max-width: 60ch;
    margin: 0 auto;
    font-style: italic;
}

/* --- Responsive: Tablet & Mobile --- */
@media (max-width: 1024px) {
    .page-wrapper {
        grid-template-columns: 1fr 1px 1fr;
    }

    .left-panel {
        height: 60vh;
        position: relative;
        top: auto;
        sticky: unset;
    }

    .glassmorphic-card-container {
        width: 240px;
        height: 280px;
    }
}

@media (max-width: 768px) {
    .page-wrapper {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .left-panel {
        height: 50vh;
        width: 100%;
        position: relative;
        top: 0;
        sticky: unset;
    }

    .divider-line {
        display: none;
    }

    .right-panel {
        padding: 2rem;
    }

    .hero-section {
        min-height: 40vh;
        padding: 2rem 0;
    }

    .chapter {
        margin-bottom: 2.5rem;
    }

    .botanical-background {
        opacity: 0.02;
    }
}

@media (max-width: 480px) {
    :root {
        --gutter: 1rem;
        --section-gap: 2rem;
    }

    .right-panel {
        padding: 1.5rem;
    }

    .hero-section {
        padding: 1rem 0;
    }

    .chapter-heading {
        font-size: 1.5rem;
    }

    .bubble-divider {
        gap: 12px;
    }

    .closing-section {
        padding: 2rem 1.5rem;
    }
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .typewriter-cursor {
        animation: none;
        background-color: var(--aged-gold);
    }
}

/* --- Print Styles --- */
@media print {
    body::after {
        display: none;
    }

    .left-panel {
        display: none;
    }

    .divider-line {
        display: none;
    }

    .page-wrapper {
        grid-template-columns: 1fr;
    }

    .right-panel {
        padding: 0;
    }

    .typewriter-cursor {
        display: none;
    }
}
