/* ==========================================
   xity.quest - McBling Botanical Greenhouse
   ========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.65;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    color: #1E1E14;
    background-color: #FFF8EB;
    overflow-x: hidden;
    position: relative;
}

/* --- Parchment Noise Texture --- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Greenhouse Frame --- */
.greenhouse-frame {
    position: fixed;
    inset: 8px;
    z-index: 999;
    pointer-events: none;
    border: 2px double #B8926A;
    border-radius: 4px;
}

.corner-leaf {
    position: absolute;
}

.corner-leaf--tl {
    top: -4px;
    left: -4px;
}

.corner-leaf--tr {
    top: -4px;
    right: -4px;
}

.corner-leaf--bl {
    bottom: -4px;
    left: -4px;
}

.corner-leaf--br {
    bottom: -4px;
    right: -4px;
}

/* --- Ambient Leaf Drift --- */
.leaf-drift-container {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.drift-leaf {
    position: absolute;
    opacity: 0.15;
    will-change: transform;
}

/* --- Chamber Base Styles --- */
.chamber {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    padding-block: clamp(3rem, 8vh, 6rem);
    padding-inline: clamp(2rem, 5vw, 4rem);
    transition: background-color 0.8s ease;
}

/* --- ATRIUM --- */
.chamber--atrium {
    background-color: #FFF8EB;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.atrium-content {
    position: relative;
    z-index: 3;
    max-width: 900px;
    width: 100%;
}

.atrium-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.08em;
    line-height: 1.0;
    color: #1E1E14;
    text-shadow: 2px 2px 0px rgba(212, 162, 78, 0.3);
    margin-bottom: 1.5rem;
    display: inline-block;
}

.letter {
    display: inline-block;
    animation: letterDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: translateY(-100%) rotate(15deg);
}

.letter.dot {
    color: #D4A24E;
}

@keyframes letterDrop {
    from {
        transform: translateY(-100%) rotate(15deg);
        opacity: 0;
    }
    to {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
}

.atrium-tagline {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-variant: small-caps;
    letter-spacing: 0.03em;
    font-size: clamp(0.95rem, 1.8vw, 1.3rem);
    color: #8B6F4E;
    margin-bottom: 3rem;
    line-height: 1.8;
}

/* Background Decorative Leaves */
.bg-leaf {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

.bg-leaf--1 {
    top: 10%;
    right: 5%;
}

.bg-leaf--2 {
    bottom: 15%;
    left: 3%;
}

/* --- CARD SYSTEM --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: minmax(200px, auto);
    gap: clamp(1rem, 2.5vw, 2rem);
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 248, 235, 0.85), rgba(245, 235, 210, 0.75));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
    overflow: hidden;
    padding: clamp(1rem, 3vw, 2rem);
    padding-top: calc(clamp(1rem, 3vw, 2rem) + 3px);
    opacity: 0;
    transform: translateY(30px) scale(0.97);
    transition: opacity 0.6s ease, transform 0.6s ease;
    transition-delay: calc(var(--card-index, 0) * 80ms);
    display: flex;
    flex-direction: column;
}

.card.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.card--featured {
    grid-row: span 2;
    box-shadow: inset 0 0 30px rgba(212, 162, 78, 0.08);
}

.card--atrium-featured {
    max-width: 600px;
    margin: 0 auto;
    grid-row: span 1;
}

/* Card Top Border */
.card-top-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--border-color, #D4A24E);
    transition: background 0.4s ease;
}

.card:hover .card-top-border {
    background: linear-gradient(90deg, #D4A24E, #C4698A, #7B9E6B);
}

/* Card Leaf Pin */
.card-leaf-pin {
    position: absolute;
    top: 12px;
    right: 12px;
    transition: transform 0.3s ease;
}

.card:hover .card-leaf-pin {
    transform: rotate(15deg) !important;
}

/* Card Icon */
.card-icon {
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 0 4px rgba(212, 162, 78, 0.4));
}

/* Card Label */
.card-label {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-variant: small-caps;
    letter-spacing: 0.03em;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: #8B6F4E;
    margin-bottom: 0.25rem;
    display: block;
}

/* Card Title */
.card-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    letter-spacing: 0.08em;
    line-height: 1.0;
    color: #1E1E14;
    text-shadow: 2px 2px 0px rgba(212, 162, 78, 0.3);
    margin-bottom: 0.75rem;
}

/* Card Body */
.card-body {
    color: #3D2E1A;
    flex: 1;
    margin-bottom: 1rem;
}

/* Card Link */
.card-link {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: #D4A24E;
    text-decoration: none;
    background-image: linear-gradient(#D4A24E, #D4A24E);
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: background-size 0.4s ease;
    padding-bottom: 2px;
    display: inline-block;
}

.card-link:hover {
    background-size: 100% 2px;
}

/* Gem Sparkle Placeholder */
.gem-sparkle {
    width: 48px;
    height: 48px;
    position: absolute;
    bottom: 16px;
    right: 16px;
}

.gem-sparkle--orangery {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
    bottom: auto;
    right: auto;
}

/* --- VINE DIVIDERS --- */
.vine-divider {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 1rem 0;
    overflow: hidden;
}

.vine-svg {
    width: 100%;
    height: 80px;
    display: block;
}

.vine-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2.5s ease;
}

.vine-divider.is-animating .vine-path {
    stroke-dashoffset: 0;
}

.vine-leaf {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.vine-divider.is-animating .vine-leaf {
    opacity: 1;
    transition-delay: 1.5s;
}

.vine-flower {
    opacity: 0;
    transform-origin: center;
    transition: opacity 0.4s ease, r 0.4s ease;
}

.vine-divider.is-animating .vine-flower {
    opacity: 1;
    transition-delay: 2s;
}

.vine-flower-petals ellipse {
    transition: opacity 0.3s ease;
}

.vine-divider.is-animating .vine-flower-petals ellipse {
    opacity: 0.7;
    transition-delay: 2.2s;
}

/* --- CONSERVATORY --- */
.chamber--conservatory {
    background-color: #F5EDDA;
    padding-bottom: clamp(4rem, 10vh, 8rem);
}

.chamber-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    letter-spacing: 0.08em;
    line-height: 1.0;
    color: #1E1E14;
    text-shadow: 2px 2px 0px rgba(212, 162, 78, 0.3);
    text-align: center;
    margin-bottom: clamp(2rem, 5vw, 4rem);
}

/* --- ORANGERY --- */
.chamber--orangery {
    background-color: #3D2E1A;
    color: #FFF8EB;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.orangery-content {
    position: relative;
    z-index: 3;
    max-width: 700px;
}

.orangery-leaf {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

.orangery-leaf--left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.orangery-leaf--right {
    right: 0;
    top: 50%;
    transform: translateY(-50%) scaleX(-1);
}

.orangery-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    letter-spacing: 0.08em;
    line-height: 1.0;
    color: #FFF8EB;
    text-shadow: 2px 2px 0px rgba(212, 162, 78, 0.4);
    margin-bottom: 2rem;
}

.orangery-message {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.35rem);
    letter-spacing: 0.03em;
    line-height: 2;
    color: #E8D5B0;
    margin-bottom: 2.5rem;
}

.orangery-sigil {
    margin-bottom: 2rem;
    display: inline-block;
    animation: sigilPulse 4s ease-in-out infinite;
}

@keyframes sigilPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.orangery-domain {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.15em;
    color: #D4A24E;
}

/* --- COMPASS ROSE NAVIGATION --- */
.compass-rose {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 998;
    width: 56px;
    height: 56px;
}

.compass-center {
    width: 56px;
    height: 56px;
    background: #D4A24E;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(212, 162, 78, 0.4);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    position: relative;
    z-index: 2;
}

.compass-center:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(212, 162, 78, 0.5);
}

.compass-menu {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 56px;
    height: 56px;
    pointer-events: none;
}

.compass-item {
    position: absolute;
    width: 36px;
    height: 36px;
    background: #8B6F4E;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    bottom: 10px;
    right: 10px;
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.compass-item:hover {
    background: #D4A24E;
}

.compass-rose.is-open .compass-item {
    transform: rotate(var(--angle)) translateX(-70px) rotate(calc(-1 * var(--angle))) scale(1);
    pointer-events: auto;
}

/* --- GEM SPARKLE CSS ANIMATION --- */
@keyframes gemRotateHighlight {
    0% {
        background: conic-gradient(from 0deg, transparent 0deg, rgba(212, 162, 78, 0.6) 30deg, transparent 60deg, transparent 360deg);
    }
    100% {
        background: conic-gradient(from 360deg, transparent 0deg, rgba(212, 162, 78, 0.6) 30deg, transparent 60deg, transparent 360deg);
    }
}

.gem-sparkle-inner {
    width: 48px;
    height: 48px;
    position: relative;
}

.gem-sparkle-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(20% 0%, 80% 0%, 100% 35%, 50% 100%, 0% 35%);
    border: 1.5px solid #D4A24E;
    animation: gemRotateHighlight 3s linear infinite;
    border-radius: 2px;
}

.gem-sparkle-inner::after {
    content: '';
    position: absolute;
    inset: 4px;
    clip-path: polygon(20% 0%, 80% 0%, 100% 35%, 50% 100%, 0% 35%);
    border: 1px solid rgba(212, 162, 78, 0.3);
}

/* --- LEAF DRIFT ANIMATION --- */
@keyframes leafFloat {
    0% {
        transform: translateY(-10vh) rotate(0deg) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(110vh) rotate(360deg) translateX(50px);
        opacity: 0;
    }
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .greenhouse-frame {
        inset: 4px;
        border-width: 1px;
    }

    .corner-leaf {
        width: 40px;
        height: 40px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .card--featured {
        grid-row: span 1;
    }

    .compass-rose {
        bottom: 16px;
        right: 16px;
    }

    .orangery-leaf {
        width: 100px;
        height: 200px;
    }

    .bg-leaf {
        display: none;
    }
}

@media (max-width: 480px) {
    .chamber {
        padding-inline: clamp(1rem, 4vw, 2rem);
    }

    .atrium-title {
        font-size: clamp(3rem, 14vw, 5rem);
    }

    .compass-rose.is-open .compass-item {
        transform: rotate(var(--angle)) translateX(-55px) rotate(calc(-1 * var(--angle))) scale(1);
    }
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #FFF8EB;
}

::-webkit-scrollbar-thumb {
    background: #B8926A;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #D4A24E;
}

/* --- Selection Color --- */
::selection {
    background: rgba(212, 162, 78, 0.3);
    color: #1E1E14;
}
