/* =============================================
   license.broker — Goblincore Crystal Cavern
   ============================================= */

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

:root {
    --cavern-dark: #0D0F0A;
    --card-surface: #1A1D16;
    --neon-lichen: #00FF88;
    --amber-crystal: #FF6B2B;
    --violet-crystal: #B388FF;
    --moss-border: #2A3025;
    --stone-text: #A8B09E;
    --deep-chamber: #050805;
    --pure-black: #000000;
}

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

body {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.75;
    color: var(--stone-text);
    background-color: var(--pure-black);
    overflow-x: hidden;
}

/* --- Cavern Overlay (Opening Sequence) --- */
#cavern-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--pure-black);
    z-index: 9999;
    pointer-events: none;
    opacity: 1;
    transition: opacity 300ms ease;
}

#cavern-overlay.fade-out {
    opacity: 0;
}

/* --- Parallax Section Base --- */
.parallax-section {
    position: relative;
    width: 100%;
    overflow: hidden;
}

#cavern-mouth {
    height: 100vh;
    background-color: var(--cavern-dark);
}

#mycelium-section {
    min-height: 120vh;
    background-color: var(--cavern-dark);
    padding: 8vh 0;
}

#crystal-chamber {
    min-height: 100vh;
    background-color: var(--deep-chamber);
    padding: 10vh 0;
}

/* --- Parallax Layers --- */
.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}

.parallax-fg {
    position: relative;
    z-index: 3;
}

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

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

/* --- Mycelium SVG Network --- */
.mycelium-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 2s ease;
}

.mycelium-svg.visible {
    opacity: 1;
}

.mycelium-svg circle {
    fill: var(--neon-lichen);
    opacity: 0.08;
    transition: opacity 0.6s ease;
}

.mycelium-svg circle.glow {
    opacity: 0.18;
}

.mycelium-svg line,
.mycelium-svg path {
    stroke: var(--neon-lichen);
    stroke-width: 0.5;
    fill: none;
    opacity: 0.08;
}

/* --- Crystal Cluster (Hero Upper-Right) --- */
.cluster-top-right {
    position: absolute;
    top: 6vh;
    right: 6vw;
    width: 320px;
    height: 320px;
}

.crystal {
    position: absolute;
    background: transparent;
    opacity: 0;
}

.crystal-1 {
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
    border-bottom: 70px solid var(--neon-lichen);
    top: 40px;
    left: 60px;
    transform: rotate(-12deg);
    filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.3));
}

.crystal-2 {
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-bottom: 55px solid var(--neon-lichen);
    top: 20px;
    left: 110px;
    transform: rotate(5deg);
    filter: drop-shadow(0 0 25px rgba(0, 255, 136, 0.35));
}

.crystal-3 {
    width: 0;
    height: 0;
    border-left: 28px solid transparent;
    border-right: 28px solid transparent;
    border-bottom: 90px solid var(--amber-crystal);
    top: 60px;
    left: 150px;
    transform: rotate(-3deg);
    filter: drop-shadow(0 0 30px rgba(255, 107, 43, 0.3));
}

.crystal-4 {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 45px solid var(--violet-crystal);
    top: 30px;
    left: 210px;
    transform: rotate(8deg);
    filter: drop-shadow(0 0 18px rgba(179, 136, 255, 0.35));
}

.crystal-5 {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 65px solid var(--neon-lichen);
    top: 80px;
    left: 250px;
    transform: rotate(-7deg);
    filter: drop-shadow(0 0 22px rgba(0, 255, 136, 0.25));
}

.crystal.glow {
    opacity: 1;
    transition: opacity 400ms ease;
}

/* --- Stalactites (Hero Midground) --- */
.stalactite {
    position: absolute;
    top: 0;
    width: 80px;
    background: linear-gradient(to bottom, var(--cavern-dark), transparent);
    opacity: 0.4;
}

.stalactite-1 {
    left: 10%;
    height: 180px;
    width: 50px;
    clip-path: polygon(30% 0%, 70% 0%, 55% 100%, 45% 100%);
    background: linear-gradient(to bottom, var(--moss-border), transparent);
}

.stalactite-2 {
    left: 30%;
    height: 250px;
    width: 70px;
    clip-path: polygon(25% 0%, 75% 0%, 58% 100%, 42% 100%);
    background: linear-gradient(to bottom, var(--card-surface), transparent);
}

.stalactite-3 {
    left: 55%;
    height: 150px;
    width: 40px;
    clip-path: polygon(20% 0%, 80% 0%, 60% 100%, 40% 100%);
    background: linear-gradient(to bottom, var(--moss-border), transparent);
}

.stalactite-4 {
    left: 72%;
    height: 200px;
    width: 60px;
    clip-path: polygon(30% 0%, 70% 0%, 55% 100%, 45% 100%);
    background: linear-gradient(to bottom, var(--card-surface), transparent);
}

.stalactite-5 {
    left: 88%;
    height: 130px;
    width: 35px;
    clip-path: polygon(25% 0%, 75% 0%, 55% 100%, 45% 100%);
    background: linear-gradient(to bottom, var(--moss-border), transparent);
}

/* --- Site Title (Hero Foreground) --- */
.site-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.05em;
    color: var(--neon-lichen);
    position: absolute;
    bottom: 18vh;
    left: 6vw;
    opacity: 0;
    transform: translateX(-100px);
    text-shadow: 0 0 40px rgba(0, 255, 136, 0.2);
}

.site-title.slide-in {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.site-subtitle {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--moss-border);
    position: absolute;
    bottom: 14vh;
    left: 6vw;
    opacity: 0;
    transform: translateX(-60px);
}

.site-subtitle.slide-in {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 200ms,
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 200ms;
}

/* --- Section Headers --- */
.section-header {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    color: var(--neon-lichen);
    padding: 4vh 6vw;
    opacity: 0.6;
    text-transform: lowercase;
    letter-spacing: 0.03em;
}

.chamber-header {
    color: var(--violet-crystal);
}

/* --- Content Cards (Mycelium Section) --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
    padding: 6vh 6vw;
    max-width: 1400px;
    margin: 0 auto;
}

.cavern-card {
    background-color: var(--card-surface);
    border: 1px solid var(--moss-border);
    padding: 2rem 2rem 2.5rem;
    position: relative;
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: translateX(-40px) rotate(0deg);
    transition: opacity 500ms ease, transform 500ms ease;
}

.cavern-card.revealed {
    opacity: 1;
    transform: translateX(0) rotate(var(--rotation, 0deg));
}

.card-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--neon-lichen);
    text-transform: lowercase;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    color: var(--stone-text);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.card-body {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.75;
    color: var(--stone-text);
    opacity: 0.85;
}

/* Card hover shimmer */
.cavern-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid var(--neon-lichen);
    opacity: 0;
    transition: opacity 300ms ease;
    pointer-events: none;
}

.cavern-card:hover::after {
    opacity: 0.15;
}

/* --- Crystal Chamber (Section 3) --- */
.crystal-mid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4vw;
    flex-wrap: wrap;
    padding: 10vh 6vw;
    position: relative;
}

.crystal-formation {
    flex: 0 0 auto;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 600ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 600ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.crystal-formation.grown {
    opacity: 1;
    transform: scale(1);
}

.crystal-shape {
    position: relative;
    width: 280px;
    height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.green-crystal {
    clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
    border: none;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.08) 0%, rgba(0, 255, 136, 0.02) 100%);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.15);
}

.green-crystal::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
    background: transparent;
    border: 1px solid var(--neon-lichen);
    opacity: 0.5;
}

.amber-crystal {
    clip-path: polygon(30% 0%, 70% 0%, 100% 35%, 85% 100%, 15% 100%, 0% 35%);
    background: linear-gradient(135deg, rgba(255, 107, 43, 0.08) 0%, rgba(255, 107, 43, 0.02) 100%);
    box-shadow: 0 0 30px rgba(255, 107, 43, 0.15);
}

.amber-crystal::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(30% 0%, 70% 0%, 100% 35%, 85% 100%, 15% 100%, 0% 35%);
    background: transparent;
    border: 1px solid var(--amber-crystal);
    opacity: 0.5;
}

.violet-crystal {
    clip-path: polygon(50% 0%, 100% 20%, 90% 80%, 50% 100%, 10% 80%, 0% 20%);
    background: linear-gradient(135deg, rgba(179, 136, 255, 0.08) 0%, rgba(179, 136, 255, 0.02) 100%);
    box-shadow: 0 0 30px rgba(179, 136, 255, 0.15);
}

.violet-crystal::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 20%, 90% 80%, 50% 100%, 10% 80%, 0% 20%);
    background: transparent;
    border: 1px solid var(--violet-crystal);
    opacity: 0.5;
}

.crystal-content {
    text-align: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 300ms ease 600ms;
}

.crystal-formation.grown .crystal-content {
    opacity: 1;
}

.crystal-content h3 {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    text-transform: lowercase;
}

#crystal-green .crystal-content h3 {
    color: var(--neon-lichen);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

#crystal-amber .crystal-content h3 {
    color: var(--amber-crystal);
    text-shadow: 0 0 20px rgba(255, 107, 43, 0.3);
}

#crystal-violet .crystal-content h3 {
    color: var(--violet-crystal);
    text-shadow: 0 0 20px rgba(179, 136, 255, 0.3);
}

.crystal-content p {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--stone-text);
    opacity: 0.8;
}

/* Ambient background crystals in Crystal Chamber */
.deep-crystal-cluster {
    position: absolute;
    width: 100%;
    height: 100%;
}

.ambient-crystal {
    position: absolute;
    opacity: 0.06;
}

.ambient-1 {
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 130px solid var(--neon-lichen);
    top: 15%;
    left: 8%;
    transform: rotate(-15deg);
    filter: drop-shadow(0 0 40px rgba(0, 255, 136, 0.15));
}

.ambient-2 {
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 100px solid var(--amber-crystal);
    top: 60%;
    right: 12%;
    transform: rotate(10deg);
    filter: drop-shadow(0 0 35px rgba(255, 107, 43, 0.15));
}

.ambient-3 {
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-bottom: 80px solid var(--violet-crystal);
    bottom: 20%;
    left: 75%;
    transform: rotate(-8deg);
    filter: drop-shadow(0 0 30px rgba(179, 136, 255, 0.12));
}

/* --- Sediment Footer --- */
#sediment-footer {
    background: linear-gradient(to bottom, var(--cavern-dark), var(--pure-black));
    padding: 8vh 6vw;
    text-align: center;
}

.footer-text {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--moss-border);
    letter-spacing: 0.08em;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .cluster-top-right {
        top: 4vh;
        right: 2vw;
        width: 200px;
        height: 200px;
        transform: scale(0.7);
        transform-origin: top right;
    }

    .card-grid {
        grid-template-columns: 1fr;
        padding: 4vh 4vw;
        gap: 1.5rem;
    }

    .crystal-mid {
        flex-direction: column;
        align-items: center;
        gap: 3rem;
        padding: 6vh 4vw;
    }

    .crystal-shape {
        width: 240px;
        height: 290px;
    }

    .site-title {
        bottom: 20vh;
        left: 4vw;
    }

    .site-subtitle {
        bottom: 16vh;
        left: 4vw;
    }

    .section-header {
        padding: 3vh 4vw;
    }
}

@media (max-width: 480px) {
    .crystal-shape {
        width: 200px;
        height: 250px;
    }

    .cluster-top-right {
        transform: scale(0.5);
    }
}

/* --- Section Mycelium (Section 2 background) --- */
.section-mycelium {
    opacity: 0;
    transition: opacity 1.5s ease;
}

.section-mycelium.visible {
    opacity: 1;
}
