/* =============================================
   iggi.dev — Botanical Folio Stylesheet
   ============================================= */

:root {
    --aged-parchment: #f4ede4;
    --warm-cream: #ebe3d6;
    --dark-loam: #2c2416;
    --bark-brown: #6b5a45;
    --living-moss: #4a7c59;
    --young-shoot: #7db58a;
    --autumn-light: #c9a96e;
    --forest-floor: #1a1510;
    --lichen-blush: #c4a08a;
    --faded-ink: #8b7355;
    --muted-stone: #a89b8c;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.85;
    color: var(--dark-loam);
    background-color: var(--aged-parchment);
    background-image:
        radial-gradient(ellipse at 50% 30%, transparent 50%, rgba(26, 21, 16, 0.04) 100%);
    -webkit-font-smoothing: antialiased;
}

/* ---- Folio Container ---- */
.folio-container {
    width: 100%;
}

/* ---- Folio Sections ---- */
.folio {
    min-height: 100vh;
    position: relative;
    padding: 6vh 8vw;
    scroll-snap-align: start;
    overflow: hidden;
}

.folio-i {
    background-color: var(--aged-parchment);
}

.folio-ii {
    background-color: var(--aged-parchment);
}

.folio-iii {
    background-color: var(--warm-cream);
}

.folio-iv {
    background-color: var(--aged-parchment);
}

.folio-v {
    background-color: var(--aged-parchment);
}

/* ---- Plate Numbers ---- */
.plate-number {
    display: block;
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--muted-stone);
    opacity: 0.6;
    letter-spacing: 0.1em;
    margin-bottom: 2vh;
}

/* ---- Folio Navigation ---- */
.folio-nav {
    position: fixed;
    bottom: 50%;
    right: 2vw;
    transform: translateY(50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.folio-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--living-moss);
    background: transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    padding: 0;
}

.dot-fill {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--living-moss);
    transform: scale(0);
    transition: transform 0.4s ease-out;
}

.folio-dot.active .dot-fill {
    transform: scale(1);
}

/* ---- Corner Flourishes ---- */
.corner-flourish {
    position: absolute;
    pointer-events: none;
}

.corner-flourish.top-left {
    top: 3vh;
    left: 3vw;
}

.corner-flourish.bottom-right {
    bottom: 3vh;
    right: 3vw;
}

/* ---- Decorative Rules ---- */
.decorative-rule {
    width: 200px;
    margin: 1.5rem 0;
}

.rule-line {
    width: 100%;
    height: 12px;
}

/* ---- Typography ---- */
h1, .site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 6rem);
    letter-spacing: 0.02em;
    color: var(--dark-loam);
    line-height: 1.1;
}

h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    letter-spacing: 0.02em;
    color: var(--dark-loam);
    margin-bottom: 2rem;
    line-height: 1.2;
}

h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--bark-brown);
    margin-bottom: 0.8rem;
}

h4 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--dark-loam);
    margin-bottom: 0.4rem;
}

p {
    max-width: 38em;
    margin-bottom: 1.5rem;
}

p + p {
    text-indent: 1.5em;
}

.first-paragraph {
    text-indent: 0;
}

.subtitle {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    color: var(--bark-brown);
    max-width: 30em;
}

.korean-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--living-moss);
    opacity: 0.7;
    margin-top: 1.5rem;
    letter-spacing: 0.15em;
}

/* ---- Folio I — Title Page ---- */
.folio-i-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80vh;
    gap: 4vw;
}

.folio-i-text {
    flex: 0 0 40%;
    padding-top: 8vh;
}

.folio-i-illustration {
    flex: 0 0 55%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-stone {
    width: 100%;
    max-width: 500px;
    height: auto;
    opacity: 0.92;
}

/* ---- Folio II — The Specimen ---- */
.folio-ii-content {
    display: flex;
    gap: 6vw;
    align-items: flex-start;
    min-height: 80vh;
}

.folio-ii-illustration {
    flex: 0 0 40%;
    display: flex;
    justify-content: center;
    padding-top: 4vh;
}

.sporophyte-detail {
    width: 100%;
    max-width: 400px;
    height: auto;
    opacity: 0.92;
}

.folio-ii-text {
    flex: 1;
    padding-top: 2vh;
    position: relative;
}

/* ---- Margin Notes ---- */
.margin-note {
    position: relative;
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.margin-note p {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: var(--faded-ink);
    max-width: 25em;
    line-height: 1.5;
    text-indent: 0;
    margin-bottom: 0;
}

.margin-note-right {
    margin-left: auto;
    text-align: right;
    transform: translateX(10px);
}

.margin-note-left {
    margin-right: auto;
    transform: translateX(-10px);
}

.margin-note.revealed {
    opacity: 1;
    transform: translateX(0);
}

.note-connector {
    display: block;
    width: 40px;
    height: 1px;
    background: var(--lichen-blush);
    margin-bottom: 0.5rem;
}

.margin-note-right .note-connector {
    margin-left: auto;
}

/* ---- Folio III — The Habitat ---- */
.folio-iii {
    background-color: #3d5c42;
    color: var(--aged-parchment);
}

.folio-iii .plate-number {
    color: var(--lichen-blush);
}

.folio-iii-content {
    position: relative;
    min-height: 80vh;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    align-items: center;
    justify-content: center;
    padding: 4vh 0;
}

.habitat-item {
    max-width: 320px;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.habitat-item[data-reveal='left'] {
    transform: translateX(-15px);
}

.habitat-item[data-reveal='right'] {
    transform: translateX(15px);
}

.habitat-item.revealed {
    opacity: 1;
    transform: translateX(0);
}

.habitat-text {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.9rem, 1.2vw, 1.05rem);
    color: var(--warm-cream);
    line-height: 1.5;
    max-width: 22em;
}

.habitat-item-1 { align-self: flex-start; }
.habitat-item-2 { align-self: flex-start; margin-top: 5vh; }
.habitat-item-3 { align-self: flex-end; }
.habitat-item-4 { align-self: flex-end; margin-top: 3vh; }

.habitat-map {
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
}

.habitat-map svg {
    width: 100%;
    height: auto;
    opacity: 0.85;
}

.spot-illustration {
    flex-shrink: 0;
}

.connecting-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.4;
}

/* ---- Folio IV — The Growth ---- */
.folio-iv-content {
    display: flex;
    gap: 4vw;
    min-height: 80vh;
    align-items: stretch;
}

.growth-text-area {
    flex: 1;
    padding-top: 2vh;
}

.growth-stage {
    margin-bottom: 3rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--lichen-blush);
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.growth-stage[data-reveal='left'] {
    transform: translateX(-10px);
}

.growth-stage.revealed {
    opacity: 1;
    transform: translateX(0);
}

.growth-vine-area {
    flex: 0 0 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.vine-svg {
    width: 100%;
    max-width: 150px;
    height: auto;
}

.vine-path {
    stroke-dasharray: 2200;
    stroke-dashoffset: 2200;
    transition: stroke-dashoffset 0.1s linear;
}

/* ---- Folio V — The Stillness ---- */
.folio-v-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    gap: 4rem;
}

/* ---- Specimen Cards ---- */
.specimen-cards {
    display: flex;
    gap: 2.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 4rem;
}

.specimen-card {
    width: 280px;
    height: 180px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.specimen-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 4px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-front {
    background: var(--warm-cream);
    border: 1px solid var(--lichen-blush);
    box-shadow: 2px 3px 8px rgba(26, 21, 16, 0.08);
}

.card-back {
    background: var(--warm-cream);
    border: 1px solid var(--lichen-blush);
    box-shadow: 2px 3px 8px rgba(26, 21, 16, 0.08);
    transform: rotateY(180deg);
    text-align: center;
}

.card-illustration {
    width: 120px;
    height: 100px;
    margin-bottom: 0.5rem;
}

.card-label {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--muted-stone);
    letter-spacing: 0.05em;
}

.card-classification {
    font-family: 'Caveat', cursive;
    font-size: 0.9rem;
    color: var(--faded-ink);
    font-style: italic;
    margin-bottom: 0.5rem;
    text-indent: 0;
}

.card-description {
    font-family: 'Caveat', cursive;
    font-size: 0.9rem;
    color: var(--bark-brown);
    line-height: 1.4;
    max-width: 22em;
    text-indent: 0;
    margin-bottom: 0;
}

.specimen-card:hover .card-inner {
    transform: translateY(-3px);
    box-shadow: 2px 6px 12px rgba(26, 21, 16, 0.12);
}

.specimen-card.flipped:hover .card-inner {
    transform: rotateY(180deg) translateY(-3px);
}

/* ---- Stillness Center ---- */
.stillness-center {
    text-align: center;
}

.stillness-domain {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: var(--bark-brown);
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-bottom: 2rem;
}

.drifting-spore {
    animation: drift 8s ease-in-out infinite;
}

@keyframes drift {
    0%, 100% { transform: translateY(0) translateX(0); opacity: 0.6; }
    25% { transform: translateY(15px) translateX(5px); opacity: 0.8; }
    50% { transform: translateY(30px) translateX(-3px); opacity: 0.5; }
    75% { transform: translateY(20px) translateX(8px); opacity: 0.7; }
}

/* ---- Footer ---- */
.folio-footer {
    margin-top: 4rem;
    text-align: center;
}

.footer-rule {
    margin: 0 auto 1.5rem auto;
}

.footer-text {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--muted-stone);
    opacity: 0.6;
    text-align: center;
    max-width: none;
}

/* ---- Moss Illustrations Common ---- */
.moss-illustration {
    opacity: 0.92;
}

/* ---- Depth of Field Effect ---- */
.folio .moss-illustration {
    filter: blur(0.5px);
    transition: filter 0.3s ease;
}

.folio.in-view .moss-illustration {
    filter: blur(0);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .folio {
        padding: 4vh 5vw;
    }

    .folio-i-content {
        flex-direction: column;
        text-align: center;
    }

    .folio-i-text {
        flex: none;
        padding-top: 4vh;
    }

    .folio-i-illustration {
        flex: none;
        width: 90vw;
    }

    .folio-ii-content {
        flex-direction: column;
    }

    .folio-ii-illustration {
        flex: none;
        width: 80vw;
        margin: 0 auto;
    }

    .folio-ii-text {
        flex: none;
    }

    .folio-iv-content {
        flex-direction: column;
    }

    .growth-vine-area {
        flex: none;
        order: -1;
        height: 300px;
    }

    .vine-svg {
        max-height: 300px;
    }

    .margin-note {
        padding: 0.8rem 0;
        margin-left: 1.5em;
    }

    .margin-note p {
        font-style: italic;
    }

    .margin-note-right {
        text-align: left;
        margin-left: 1.5em;
    }

    .folio-nav {
        right: 1vw;
    }

    .specimen-cards {
        flex-direction: column;
        align-items: center;
    }

    .specimen-card {
        width: 260px;
    }

    .habitat-item {
        max-width: 90vw;
    }

    p {
        max-width: 90vw;
    }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .vine-path {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
    }

    .drifting-spore {
        animation: none;
    }

    .margin-note,
    .habitat-item,
    .growth-stage {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .folio .moss-illustration {
        filter: none;
        transition: none;
    }

    .card-inner {
        transition: none;
    }

    .dot-fill {
        transition: none;
    }
}
