/* ============================================================
   miris.monster — Goblincore Apothecary Catalog
   Design: Parallax descent, muted earth tones, CSS-only imagery
   ============================================================ */

/* --- Custom Properties --- */
:root {
    --bg-surface: #e8e0d4;
    --bg-deep: #3b352c;
    --text-peat: #4a4238;
    --text-peat-light: #d4c4a8;
    --text-weathered-oak: #6b5e4f;
    --text-bark-brown: #5c5346;
    --accent-toadstool: #b8883a;
    --accent-lichen: #7a8c64;
    --highlight-foxfire: #c9a84c;
    --border-mycelium: #7a6e5d;
    --hover-spore: #d4c4a8;
    --text-dried-sage: #8a7e6e;

    --bg-current: var(--bg-surface);
    --text-current: var(--text-peat);
    --scroll-pct: 0;

    --font-display: 'Josefin Sans', sans-serif;
    --font-heading: 'DM Sans', sans-serif;
    --font-body: 'Crimson Text', serif;
}

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

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: var(--text-peat);
    background-color: var(--bg-surface);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.05s linear, color 0.05s linear;
}

/* --- Strata / Sections --- */
.stratum {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.stratum--surface {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.stratum--roots-1,
.stratum--roots-2,
.stratum--roots-3,
.stratum--roots-4 {
    padding: clamp(3rem, 8vh, 6rem) 0;
}

.stratum--cavern {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(4rem, 10vh, 8rem) 0;
}

/* --- Parallax Layers --- */
.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.parallax-layer--fg {
    position: relative;
    pointer-events: auto;
}

.parallax-layer--bg {
    z-index: 1;
}

.parallax-layer--mid {
    z-index: 2;
}

.parallax-layer--fg {
    z-index: 3;
}

/* --- Spore Dots --- */
.spore-dot {
    position: absolute;
    width: var(--dot-size, 6px);
    height: var(--dot-size, 6px);
    left: var(--dot-x, 50%);
    top: var(--dot-y, 50%);
    background-color: var(--highlight-foxfire);
    border-radius: 50%;
    opacity: var(--dot-opacity, 0.25);
    will-change: transform;
    animation: spore-breathe var(--breathe-dur, 5s) ease-in-out infinite alternate;
    animation-delay: var(--breathe-delay, 0s);
}

@keyframes spore-breathe {
    0% { opacity: var(--dot-opacity, 0.15); }
    100% { opacity: calc(var(--dot-opacity, 0.15) + 0.15); }
}

/* Stagger breathe timing via nth-child */
.spore-dot:nth-child(1) { --breathe-dur: 4.2s; --breathe-delay: 0s; }
.spore-dot:nth-child(2) { --breathe-dur: 5.8s; --breathe-delay: 1.2s; }
.spore-dot:nth-child(3) { --breathe-dur: 3.7s; --breathe-delay: 0.5s; }
.spore-dot:nth-child(4) { --breathe-dur: 6.3s; --breathe-delay: 2.1s; }
.spore-dot:nth-child(5) { --breathe-dur: 4.9s; --breathe-delay: 0.8s; }
.spore-dot:nth-child(6) { --breathe-dur: 5.1s; --breathe-delay: 1.7s; }
.spore-dot:nth-child(7) { --breathe-dur: 3.4s; --breathe-delay: 0.3s; }
.spore-dot:nth-child(8) { --breathe-dur: 6.7s; --breathe-delay: 1.9s; }
.spore-dot:nth-child(9) { --breathe-dur: 4.5s; --breathe-delay: 2.5s; }
.spore-dot:nth-child(10) { --breathe-dur: 5.5s; --breathe-delay: 0.7s; }

/* --- Mushroom Silhouettes --- */
.mushroom {
    display: inline-block;
    position: relative;
    transform: rotate(var(--rot, 0deg));
    transform-origin: bottom center;
    width: var(--cap, 14px);
    height: calc(var(--h, 20px) + var(--cap, 14px) / 2);
}

.mushroom::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--cap, 14px);
    height: calc(var(--cap, 14px) / 2);
    background-color: var(--accent-toadstool);
    opacity: 0.2;
    border-radius: calc(var(--cap, 14px) / 2) calc(var(--cap, 14px) / 2) 0 0;
}

.mushroom::after {
    content: '';
    position: absolute;
    top: calc(var(--cap, 14px) / 2);
    left: 50%;
    transform: translateX(-50%);
    width: var(--stem-w, 4px);
    height: var(--h, 20px);
    background-color: var(--accent-toadstool);
    opacity: 0.2;
    border-radius: 0 0 1px 1px;
}

/* Mushroom growth animation */
.mushroom-cluster .mushroom {
    transform: rotate(var(--rot, 0deg)) scaleY(0);
    transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
    transition-delay: var(--grow-delay, 0ms);
}

.mushroom-cluster.is-visible .mushroom {
    transform: rotate(var(--rot, 0deg)) scaleY(1);
}

.mushroom-cluster .mushroom:nth-child(1) { --grow-delay: 0ms; }
.mushroom-cluster .mushroom:nth-child(2) { --grow-delay: 120ms; }
.mushroom-cluster .mushroom:nth-child(3) { --grow-delay: 240ms; }
.mushroom-cluster .mushroom:nth-child(4) { --grow-delay: 360ms; }
.mushroom-cluster .mushroom:nth-child(5) { --grow-delay: 480ms; }

/* Mushroom cluster positioning */
.mushroom-cluster {
    position: absolute;
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

.mushroom-cluster--hero {
    bottom: 20%;
    left: 15%;
}

.mushroom-cluster--left {
    top: 10%;
    left: 5%;
}

.mushroom-cluster--right {
    top: 15%;
    right: 8%;
}

.mushroom-cluster--center {
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
}

.mushroom-cluster--right-deep {
    bottom: 15%;
    right: 12%;
}

.mushroom-cluster--final {
    position: relative;
    justify-content: center;
    margin-top: 2rem;
}

/* --- Hero Content --- */
.hero-content {
    text-align: center;
    position: relative;
    padding: 2rem;
}

.domain-name {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.8rem, 7vw, 6rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-bark-brown);
    line-height: 1.1;
    position: relative;
    z-index: 2;
}

.descent-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 3rem;
    animation: gentle-bob 3s ease-in-out infinite;
}

.descent-arrow .mushroom--arrow {
    transform: rotate(180deg);
    transform-origin: center center;
}

@keyframes gentle-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(12px); }
}

/* --- Watermark Numbers --- */
.watermark-number {
    position: absolute;
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 8rem;
    color: var(--text-peat);
    opacity: 0.06;
    top: 0;
    left: 10%;
    line-height: 1;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.watermark-number--final {
    font-size: 10rem;
    left: 50%;
    transform: translateX(-50%);
}

/* --- Content Blocks --- */
.content-block {
    position: relative;
    max-width: 520px;
    padding: clamp(2rem, 4vh, 3rem) clamp(1.5rem, 3vw, 2.5rem);
}

.content-block--left {
    margin-left: 12%;
    margin-right: auto;
}

.content-block--right {
    margin-right: 12%;
    margin-left: auto;
}

.content-block--narrow {
    max-width: 460px;
}

/* --- Corner Brackets --- */
.corner-bracket {
    position: absolute;
    width: 20px;
    height: 20px;
}

.corner-bracket--tl {
    top: 0;
    left: 0;
}

.corner-bracket--tl::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 1px;
    background-color: var(--text-dried-sage);
    opacity: 0.4;
}

.corner-bracket--tl::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 20px;
    background-color: var(--text-dried-sage);
    opacity: 0.4;
}

.corner-bracket--br {
    bottom: 0;
    right: 0;
}

.corner-bracket--br::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 1px;
    background-color: var(--text-dried-sage);
    opacity: 0.4;
}

.corner-bracket--br::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 1px;
    height: 20px;
    background-color: var(--text-dried-sage);
    opacity: 0.4;
}

/* --- Typography --- */
.section-heading {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.04em;
    color: var(--text-weathered-oak);
    margin-bottom: 1rem;
    transition: color 0.05s linear;
}

.body-text {
    color: var(--text-peat);
    margin-bottom: 1.2rem;
    transition: color 0.05s linear;
}

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

/* --- Mycelium Line --- */
.mycelium-line {
    border: none;
    height: 1px;
    background: repeating-linear-gradient(
        90deg,
        var(--border-mycelium) 0px,
        var(--border-mycelium) 4px,
        transparent 4px,
        transparent 16px
    );
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

/* --- Torn Edge Separators --- */
.torn-edge {
    position: relative;
    height: 60px;
    margin: -30px 0;
    z-index: 10;
}

.torn-edge--1 {
    clip-path: polygon(0% 20%, 5% 45%, 12% 25%, 18% 55%, 25% 30%, 33% 60%, 40% 35%, 48% 50%, 55% 25%, 62% 55%, 70% 30%, 78% 50%, 85% 20%, 92% 45%, 100% 25%, 100% 100%, 0% 100%);
}

.torn-edge--2 {
    clip-path: polygon(0% 40%, 7% 20%, 15% 50%, 22% 30%, 30% 55%, 38% 25%, 45% 50%, 52% 35%, 60% 55%, 68% 20%, 75% 45%, 82% 30%, 90% 50%, 95% 25%, 100% 40%, 100% 100%, 0% 100%);
}

.torn-edge--3 {
    clip-path: polygon(0% 30%, 8% 50%, 14% 25%, 20% 45%, 28% 20%, 35% 55%, 42% 30%, 50% 50%, 58% 25%, 65% 45%, 72% 20%, 80% 50%, 88% 30%, 95% 55%, 100% 35%, 100% 100%, 0% 100%);
}

.torn-edge--4 {
    clip-path: polygon(0% 45%, 6% 25%, 13% 50%, 20% 35%, 27% 55%, 35% 20%, 42% 45%, 50% 30%, 57% 55%, 65% 25%, 72% 50%, 80% 35%, 87% 55%, 93% 30%, 100% 45%, 100% 100%, 0% 100%);
}

.torn-edge--5 {
    clip-path: polygon(0% 35%, 5% 55%, 12% 30%, 19% 50%, 26% 25%, 34% 45%, 41% 20%, 49% 50%, 56% 30%, 63% 55%, 71% 25%, 78% 45%, 86% 20%, 93% 50%, 100% 30%, 100% 100%, 0% 100%);
}

/* --- Specimen Cards --- */
.specimen-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.specimen-card {
    position: relative;
    border: 1px solid var(--border-mycelium);
    border-radius: 2px;
    background-color: rgba(232, 224, 212, 0.5);
    box-shadow: 2px 3px 0 rgba(74, 66, 56, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    perspective: 800px;
    transform-style: preserve-3d;
}

.specimen-card:hover {
    box-shadow: 3px 5px 0 rgba(74, 66, 56, 0.18);
}

.specimen-label {
    background-color: var(--hover-spore);
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-mycelium);
}

.label-text {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-dried-sage);
}

.specimen-body {
    padding: 1.2rem 1.5rem;
}

.specimen-title {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--text-weathered-oak);
    margin-bottom: 0.6rem;
    font-style: italic;
}

.specimen-desc {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-peat);
    margin-bottom: 0.8rem;
}

.specimen-date {
    display: block;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-dried-sage);
    margin-top: 0.5rem;
}

.specimen-card--deep {
    margin-bottom: 1.5rem;
}

/* --- Final Specimen Circle --- */
.final-specimen {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.specimen-circle {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 1px solid var(--border-mycelium);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(232, 224, 212, 0.15);
    box-shadow: 0 0 40px rgba(201, 168, 76, 0.1);
    perspective: 800px;
    transform-style: preserve-3d;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.specimen-circle:hover {
    box-shadow: 0 0 60px rgba(201, 168, 76, 0.18);
}

.specimen-circle-inner {
    text-align: center;
    padding: 2rem;
    max-width: 220px;
}

.specimen-circle-inner .label-text {
    display: block;
    margin-bottom: 0.8rem;
}

.circle-divider {
    width: 40px;
    height: 1px;
    background-color: var(--highlight-foxfire);
    opacity: 0.5;
    margin: 0 auto 0.8rem;
}

.specimen-circle-inner .specimen-desc {
    font-size: 0.85rem;
    line-height: 1.6;
}

.specimen-circle-inner .specimen-date {
    font-size: 0.65rem;
    margin-top: 0.8rem;
}

/* --- Cavern Content --- */
.cavern-content {
    text-align: center;
    position: relative;
    max-width: 400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.cavern-closing {
    margin-top: 2rem;
}

.closing-text {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--hover-spore);
    opacity: 0.8;
    line-height: 1.8;
}

/* --- Reveal Animation --- */
.reveal-up {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 800ms cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 800ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.reveal-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Horizontal Rules (Ledger Style) --- */
.stratum--roots-1 .content-block::after,
.stratum--roots-3 .content-block::after {
    content: '';
    display: block;
    height: 1px;
    margin-top: 2rem;
    background: repeating-linear-gradient(
        90deg,
        var(--border-mycelium) 0px,
        var(--border-mycelium) 2px,
        transparent 2px,
        transparent 8px
    );
    opacity: 0.3;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-block--left {
        margin-left: 8%;
        margin-right: 4%;
    }

    .content-block--right {
        margin-right: 8%;
        margin-left: 4%;
    }

    .content-block {
        max-width: 100%;
    }

    .watermark-number {
        font-size: 5rem;
    }

    .watermark-number--final {
        font-size: 6rem;
    }

    .specimen-circle {
        width: 240px;
        height: 240px;
    }

    .specimen-circle-inner {
        padding: 1.5rem;
        max-width: 190px;
    }

    .mushroom-cluster--hero {
        left: 8%;
    }

    .mushroom-cluster--right {
        right: 4%;
    }

    .mushroom-cluster--left {
        left: 3%;
    }
}

@media (max-width: 480px) {
    .domain-name {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .content-block--left,
    .content-block--right {
        margin-left: 6%;
        margin-right: 6%;
    }

    .specimen-body {
        padding: 1rem;
    }

    .specimen-circle {
        width: 200px;
        height: 200px;
    }

    .specimen-circle-inner {
        padding: 1rem;
        max-width: 160px;
    }

    .specimen-circle-inner .specimen-desc {
        font-size: 0.75rem;
    }
}
