/* ============================================
   martialaw.quest - Organic Resistance Chronicle
   Palette:
     Deep Burgundy: #6A1A2A
     Warm Brown: #3A2A20
     Aged Cream: #F4ECD8
     Resistance Red: #C84040
     Cultural Gold: #D4A050
     Hope Green: #4A8A4A
   Fonts:
     Headings: Anybody (variable, width 130%)
     Body: Noto Sans KR (300, 400, 500)
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #F4ECD8;
    color: #3A2A20;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Background Organic Blobs --- */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50% 40% 60% 45% / 55% 45% 50% 40%;
    opacity: 0.06;
    animation: blobFloat 20s ease-in-out infinite;
}

.blob-1 {
    width: 600px;
    height: 550px;
    background: #6A1A2A;
    top: -10%;
    left: -5%;
    animation-delay: 0s;
    animation-duration: 25s;
}

.blob-2 {
    width: 450px;
    height: 500px;
    background: #D4A050;
    top: 20%;
    right: -8%;
    animation-delay: -5s;
    animation-duration: 22s;
    border-radius: 45% 55% 40% 60% / 50% 40% 55% 45%;
}

.blob-3 {
    width: 500px;
    height: 480px;
    background: #4A8A4A;
    top: 50%;
    left: 10%;
    animation-delay: -10s;
    animation-duration: 28s;
    border-radius: 55% 45% 50% 50% / 40% 60% 45% 55%;
}

.blob-4 {
    width: 380px;
    height: 400px;
    background: #C84040;
    top: 70%;
    right: 15%;
    animation-delay: -8s;
    animation-duration: 24s;
    border-radius: 40% 60% 55% 45% / 55% 40% 50% 50%;
}

.blob-5 {
    width: 520px;
    height: 480px;
    background: #6A1A2A;
    bottom: -5%;
    left: 40%;
    animation-delay: -15s;
    animation-duration: 30s;
    border-radius: 50% 50% 45% 55% / 45% 55% 50% 50%;
}

@keyframes blobFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        transform: translate(30px, -20px) rotate(5deg) scale(1.05);
    }
    50% {
        transform: translate(-15px, 25px) rotate(-3deg) scale(0.95);
    }
    75% {
        transform: translate(20px, 15px) rotate(4deg) scale(1.02);
    }
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

.hero-blob {
    position: relative;
    width: clamp(300px, 55vw, 600px);
    height: clamp(300px, 55vw, 600px);
    border-radius: 48% 52% 42% 58% / 55% 38% 62% 45%;
    background: radial-gradient(ellipse at 40% 40%, rgba(106, 26, 42, 0.08) 0%, rgba(106, 26, 42, 0.03) 70%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: heroBlobMorph 12s ease-in-out infinite, heroBlobFadeIn 2s ease-out forwards;
    opacity: 0;
    transform: scale(0.6);
    filter: url(#paper-texture);
}

@keyframes heroBlobMorph {
    0%, 100% {
        border-radius: 48% 52% 42% 58% / 55% 38% 62% 45%;
    }
    33% {
        border-radius: 55% 45% 58% 42% / 42% 55% 45% 58%;
    }
    66% {
        border-radius: 42% 58% 45% 55% / 58% 42% 55% 45%;
    }
}

@keyframes heroBlobFadeIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hero-content {
    text-align: center;
    padding: 2rem;
}

.hero-title {
    font-family: 'Anybody', sans-serif;
    font-weight: 800;
    font-stretch: 130%;
    font-size: clamp(3.5rem, 10vw, 8rem);
    color: #6A1A2A;
    line-height: 1.1;
    letter-spacing: -0.02em;
    animation: titleReveal 1.5s ease-out 0.5s forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes titleReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-subtitle {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.8vw, 1.3rem);
    color: #3A2A20;
    margin-top: 1rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    animation: subtitleReveal 1.5s ease-out 1s forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes subtitleReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Curved Dividers --- */
.curved-divider {
    position: relative;
    width: 100%;
    height: 120px;
    margin-top: -60px;
    z-index: 2;
}

.curved-divider svg {
    display: block;
    width: 100%;
    height: 100%;
}

.divider-path {
    fill: none;
    stroke: #D4A050;
    stroke-width: 2;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    opacity: 0.5;
    transition: stroke-dashoffset 2s ease-in-out;
}

.divider-path.drawn {
    stroke-dashoffset: 0;
}

/* --- Dancheong-Inspired Borders --- */
.dancheong-border {
    width: 80%;
    max-width: 900px;
    height: 24px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.dancheong-border.top {
    margin-bottom: 2rem;
}

.dancheong-border.bottom {
    margin-top: 2rem;
}

.dancheong-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            90deg,
            #6A1A2A 0px, #6A1A2A 8px,
            #D4A050 8px, #D4A050 16px,
            #4A8A4A 16px, #4A8A4A 24px,
            #C84040 24px, #C84040 32px,
            #D4A050 32px, #D4A050 40px
        );
    border-radius: 3px;
    opacity: 0.7;
}

.dancheong-border::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 4px;
    width: calc(100% - 8px);
    height: 8px;
    background:
        repeating-linear-gradient(
            90deg,
            #D4A050 0px, #D4A050 10px,
            #6A1A2A 10px, #6A1A2A 20px,
            #D4A050 20px, #D4A050 30px,
            #4A8A4A 30px, #4A8A4A 40px
        );
    border-radius: 2px;
    opacity: 0.5;
}

/* --- Chronicle Sections --- */
.chronicle-section {
    position: relative;
    padding: 4rem 2rem;
    z-index: 1;
    overflow: hidden;
}

.section-declaration {
    padding-top: 0;
}

/* --- Organic Containers --- */
.organic-container {
    position: relative;
    max-width: 800px;
    margin: 3rem auto;
    padding: 3rem 3.5rem;
    border-radius: 45% 55% 40% 60% / 50% 40% 55% 45%;
    background: rgba(244, 236, 216, 0.85);
    box-shadow: 0 8px 60px rgba(58, 42, 32, 0.06);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    filter: url(#paper-texture);
}

.organic-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.container-left {
    border-radius: 35% 65% 45% 55% / 50% 35% 65% 50%;
    margin-left: 5%;
    margin-right: auto;
}

.container-right {
    border-radius: 60% 40% 55% 45% / 45% 55% 40% 60%;
    margin-left: auto;
    margin-right: 5%;
}

.container-center {
    border-radius: 50% 50% 45% 55% / 55% 45% 50% 50%;
}

.container-wide {
    max-width: 900px;
    border-radius: 40% 60% 50% 50% / 50% 45% 55% 50%;
    padding: 4rem;
}

/* --- Shape Floats (for shape-outside) --- */
.shape-float {
    width: 120px;
    height: 120px;
    border-radius: 50% 45% 55% 40% / 40% 55% 45% 50%;
    float: left;
    shape-outside: ellipse(60px 60px at 60px 60px);
    margin: 0 1.5rem 1rem 0;
    background: radial-gradient(ellipse at center, rgba(212, 160, 80, 0.15) 0%, transparent 70%);
}

#shapeFloat2 {
    float: right;
    shape-outside: ellipse(60px 60px at 60px 60px);
    margin: 0 0 1rem 1.5rem;
    background: radial-gradient(ellipse at center, rgba(200, 64, 64, 0.1) 0%, transparent 70%);
    border-radius: 45% 55% 40% 60% / 55% 40% 60% 45%;
}

#shapeFloat3 {
    width: 100px;
    height: 100px;
    shape-outside: ellipse(50px 50px at 50px 50px);
    background: radial-gradient(ellipse at center, rgba(74, 138, 74, 0.12) 0%, transparent 70%);
    border-radius: 55% 45% 50% 50% / 45% 55% 50% 50%;
}

#shapeFloat4 {
    width: 140px;
    height: 140px;
    shape-outside: ellipse(70px 70px at 70px 70px);
    background: radial-gradient(ellipse at center, rgba(106, 26, 42, 0.1) 0%, transparent 70%);
    border-radius: 50% 50% 55% 45% / 50% 50% 45% 55%;
}

/* --- Content Wrap --- */
.content-wrap {
    overflow: hidden;
}

/* --- Typography --- */
.section-heading {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-stretch: 130%;
    font-size: clamp(2rem, 4.5vw, 3.8rem);
    color: #6A1A2A;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    position: relative;
}

.heading-en {
    display: block;
    font-family: 'Anybody', sans-serif;
    font-weight: 400;
    font-stretch: 110%;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    color: #D4A050;
    letter-spacing: 0.15em;
    margin-top: 0.3rem;
    text-transform: uppercase;
}

.body-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.8;
    color: #3A2A20;
    margin-bottom: 1.2rem;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* --- Organic Timeline --- */
.timeline-organic {
    position: relative;
    max-width: 800px;
    margin: 4rem auto 2rem;
    padding: 2rem 0;
}

.timeline-organic::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, #D4A050 10%, #D4A050 90%, transparent);
    transform: translateX(-50%);
    border-radius: 3px;
}

.timeline-node {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

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

.timeline-node::before {
    content: '';
    position: absolute;
    left: 50%;
    width: 16px;
    height: 16px;
    background: #6A1A2A;
    border: 3px solid #D4A050;
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 2;
    transition: background 0.3s ease, transform 0.3s ease;
}

.timeline-node:hover::before {
    background: #C84040;
    transform: translateX(-50%) scale(1.3);
}

.timeline-year {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-stretch: 130%;
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    color: #6A1A2A;
    width: 45%;
    text-align: right;
    padding-right: 3rem;
}

.timeline-node:nth-child(even) .timeline-year {
    text-align: left;
    padding-right: 0;
    padding-left: 3rem;
}

.timeline-label {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 500;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: #3A2A20;
    width: 45%;
    padding-left: 3rem;
}

.timeline-node:nth-child(even) .timeline-label {
    padding-left: 0;
    padding-right: 3rem;
    text-align: right;
}

/* --- Section Hope --- */
.section-hope {
    padding-bottom: 4rem;
}

/* --- Footer --- */
.site-footer {
    position: relative;
    padding: 4rem 2rem;
    text-align: center;
    z-index: 1;
    overflow: hidden;
}

.footer-blob {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 200px;
    background: radial-gradient(ellipse at center, rgba(106, 26, 42, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.footer-content {
    position: relative;
}

.footer-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: #6A1A2A;
    margin-bottom: 0.3rem;
}

.footer-text-en {
    font-family: 'Anybody', sans-serif;
    font-weight: 300;
    font-stretch: 120%;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: #D4A050;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
}

.footer-domain {
    font-family: 'Anybody', sans-serif;
    font-weight: 500;
    font-stretch: 130%;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: #3A2A20;
    opacity: 0.5;
    letter-spacing: 0.2em;
    text-transform: lowercase;
}

/* --- Magnetic Drift (applied via JS) --- */
.magnetic-drift {
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* --- Clip Path Section Transitions --- */
.section-declaration {
    clip-path: ellipse(120% 100% at 50% 0%);
}

.section-resistance {
    clip-path: ellipse(120% 100% at 50% 0%);
    margin-top: -40px;
}

.section-hope {
    clip-path: ellipse(120% 100% at 50% 0%);
    margin-top: -40px;
}

/* --- Selection Styling --- */
::selection {
    background: rgba(106, 26, 42, 0.2);
    color: #3A2A20;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .organic-container {
        border-radius: 30px !important;
        padding: 2rem 1.8rem;
        margin: 2rem 1rem;
    }

    .container-left,
    .container-right {
        margin-left: auto;
        margin-right: auto;
    }

    .shape-float {
        width: 80px;
        height: 80px;
        shape-outside: ellipse(40px 40px at 40px 40px);
    }

    #shapeFloat4 {
        width: 100px;
        height: 100px;
        shape-outside: ellipse(50px 50px at 50px 50px);
    }

    .timeline-organic::before {
        left: 20px;
    }

    .timeline-node,
    .timeline-node:nth-child(even) {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 40px;
        transform: translateX(0);
        opacity: 0;
        transform: translateY(20px);
    }

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

    .timeline-node::before {
        left: 20px;
    }

    .timeline-year,
    .timeline-node:nth-child(even) .timeline-year {
        width: 100%;
        text-align: left;
        padding: 0;
    }

    .timeline-label,
    .timeline-node:nth-child(even) .timeline-label {
        width: 100%;
        text-align: left;
        padding: 0;
    }

    .dancheong-border {
        width: 95%;
    }

    .hero-blob {
        width: clamp(260px, 80vw, 400px);
        height: clamp(260px, 80vw, 400px);
    }
}

@media (max-width: 480px) {
    .chronicle-section {
        padding: 2rem 1rem;
    }

    .organic-container {
        padding: 1.5rem 1.2rem;
    }

    .container-wide {
        padding: 2rem 1.5rem;
    }
}
