/* ============================================================
   mysterious.day - Surreal Botanical Noir
   Palette: warm / Aesthetic: surreal / Layout: z-pattern
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Palette */
    --midnight-moss: #0D1A12;
    --warm-umber: #2A1F1A;
    --frosted-bone: #E8DFD4;
    --pale-parchment: #D4C9BB;
    --bone-smoke: #E8DFD4;
    --amber-glow: #C4935A;
    --dried-rose: #8B4A5E;
    --faded-sage: #7A9B6D;
    --warm-haze: #D4A054;
    --deep-moss: #1A2318;

    /* Typography */
    --font-display: 'Barlow Condensed', sans-serif;
    --font-body: 'Libre Baskerville', serif;
    --font-accent: 'IBM Plex Mono', monospace;

    /* Glassmorphic surface */
    --glass-bg: rgba(232, 223, 212, 0.14);
    --glass-blur: blur(18px) saturate(1.2);
    --glass-border: 1px solid rgba(232, 223, 212, 0.12);
    --glass-radius: 12px;

    /* Parallax offset (updated by JS) */
    --mouse-x: 0;
    --mouse-y: 0;
    --scroll-progress: 0;
}

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

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

body {
    background-color: var(--midnight-moss);
    color: var(--pale-parchment);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    animation: ambient-shift 60s ease-in-out infinite alternate;
}

/* Ambient background color shift */
@keyframes ambient-shift {
    0% { background-color: #0D1A12; }
    100% { background-color: #121A18; }
}

/* --- Grain Overlay --- */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    mix-blend-mode: soft-light;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

.grain-overlay.visible {
    opacity: 0.025;
    transition: opacity 400ms ease;
}

/* --- Selection --- */
::selection {
    background: rgba(196, 147, 90, 0.3);
    color: var(--frosted-bone);
}

/* --- Z-Path Anchor Dots --- */
.z-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--amber-glow);
    animation: pulse 3s ease-in-out infinite;
    z-index: 10;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

.z-dot-tl { top: 8%; left: 6%; }
.z-dot-tr { top: 8%; right: 6%; }
.z-dot-bl { bottom: 12%; left: 6%; }
.z-dot-br { bottom: 12%; right: 6%; }

/* --- Glassmorphic Panels --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    border: var(--glass-border);
    border-radius: var(--glass-radius);
    position: relative;
    overflow: hidden;
}

.glass-panel.materialized {
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    background: var(--glass-bg);
}

/* Top edge inner glow */
.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(196, 147, 90, 0.06), transparent);
    pointer-events: none;
    border-radius: var(--glass-radius) var(--glass-radius) 0 0;
}

/* ============================================================
   FIRST Z: HERO VIEWPORT
   ============================================================ */
.hero-viewport {
    position: relative;
    width: 100%;
    height: 100vh;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(12, 1fr);
    gap: clamp(2rem, 4vw, 5rem);
    padding: clamp(2rem, 4vw, 5rem);
    overflow: hidden;
}

/* Night-Blooming Cereus */
.cereus-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40vw;
    height: 40vw;
    max-width: 600px;
    max-height: 600px;
    z-index: 2;
    pointer-events: none;
}

.cereus-svg {
    width: 100%;
    height: 100%;
    transform: rotate(calc(var(--scroll-progress) * 3deg));
    transition: transform 100ms linear;
}

.cereus-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    opacity: 0;
}

.cereus-path.animating {
    opacity: 1;
    animation: draw-cereus 2000ms cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes draw-cereus {
    to { stroke-dashoffset: 0; }
}

/* Hero Title Panel */
.hero-title-panel {
    grid-column: 1 / 4;
    grid-row: 2 / 5;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.8rem, 3vw, 3rem);
    opacity: 0;
    transform: translateY(15px);
    clip-path: inset(0 100% 100% 0);
    box-shadow: 0 8px 32px rgba(13, 26, 18, 0.4), 0 0 48px rgba(212, 160, 84, 0.06);
}

.hero-title-panel.revealed {
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0 0 0 0);
    transition: opacity 800ms ease, transform 800ms ease, clip-path 600ms ease 200ms;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.06em;
    line-height: 1.05;
    text-transform: uppercase;
    color: var(--bone-smoke);
}

/* Hero Pull-Quote */
.hero-quote {
    grid-column: 1 / 4;
    grid-row: 9 / 11;
    z-index: 5;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(10px);
}

.hero-quote.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 800ms ease, transform 800ms ease;
}

.pull-quote {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    line-height: 1.72;
    color: var(--pale-parchment);
    opacity: 0.85;
}

/* Petal Navigation */
.petal-nav {
    grid-column: 5 / 7;
    grid-row: 9 / 12;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 1.2rem;
    opacity: 0;
}

.petal-nav.revealed {
    opacity: 1;
    transition: opacity 600ms ease;
}

.petal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    border-radius: 50% 50% 50% 0;
    background: rgba(232, 223, 212, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(196, 147, 90, 0.4);
    text-decoration: none;
    transition: transform 200ms ease-out, border-color 200ms ease, background 200ms ease;
    position: relative;
}

.petal-btn:hover {
    transform: translateY(-3px) rotate(45deg);
    border-color: rgba(196, 147, 90, 0.8);
    background: rgba(232, 223, 212, 0.12);
}

.petal-label {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--amber-glow);
    pointer-events: none;
    transition: transform 200ms ease-out;
}

.petal-btn:hover .petal-label {
    transform: rotate(-45deg);
}

/* ============================================================
   SECOND Z: CONTENT VIEWPORT
   ============================================================ */
.content-viewport {
    position: relative;
    width: 100%;
    min-height: 120vh;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: auto;
    gap: clamp(2rem, 4vw, 5rem);
    padding: clamp(4rem, 6vw, 8rem) clamp(2rem, 4vw, 5rem);
}

.vine-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.vine-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1200ms ease-out;
}

.vine-path.growing {
    stroke-dashoffset: 0;
}

/* --- Glass Cards --- */
.glass-card {
    position: relative;
    padding: clamp(1.8rem, 3vw, 3rem);
    border-radius: var(--glass-radius);
    z-index: 5;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms ease, transform 600ms ease;
    animation: card-breathe 4s ease-in-out infinite;
}

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

/* Hover-lift for cards */
.glass-card:hover {
    transform: translateY(-6px);
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 300ms ease;
}

@keyframes card-breathe {
    0%, 100% { box-shadow: 0 8px 32px rgba(13, 26, 18, 0.4), 0 0 48px rgba(212, 160, 84, 0.06); }
    50% { box-shadow: 0 8px 32px rgba(13, 26, 18, 0.4), 0 0 48px rgba(212, 160, 84, 0.10); }
}

/* Near depth */
.glass-card-near {
    background: rgba(232, 223, 212, 0.16);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    border: 1px solid rgba(232, 223, 212, 0.12);
    box-shadow: 0 8px 32px rgba(13, 26, 18, 0.4), 0 0 48px rgba(212, 160, 84, 0.06);
}

.glass-card-near:hover {
    border-color: rgba(232, 223, 212, 0.22);
    box-shadow: 0 16px 48px rgba(13, 26, 18, 0.5), 0 0 48px rgba(212, 160, 84, 0.10);
}

/* Mid depth */
.glass-card-mid {
    background: rgba(232, 223, 212, 0.12);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border: 1px solid rgba(232, 223, 212, 0.10);
    box-shadow: 0 6px 24px rgba(13, 26, 18, 0.35), 0 0 36px rgba(212, 160, 84, 0.05);
}

.glass-card-mid:hover {
    border-color: rgba(232, 223, 212, 0.18);
    box-shadow: 0 14px 40px rgba(13, 26, 18, 0.45), 0 0 40px rgba(212, 160, 84, 0.08);
}

/* Far depth */
.glass-card-far {
    background: rgba(232, 223, 212, 0.08);
    backdrop-filter: blur(10px) saturate(1.1);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
    border: 1px solid rgba(232, 223, 212, 0.08);
    box-shadow: 0 4px 18px rgba(13, 26, 18, 0.3), 0 0 24px rgba(212, 160, 84, 0.04);
}

/* Inner glow on cards */
.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, rgba(196, 147, 90, 0.06), transparent);
    pointer-events: none;
    border-radius: var(--glass-radius) var(--glass-radius) 0 0;
}

/* Card positioning in Z-pattern */
.card-1 {
    grid-column: 1 / 4;
    grid-row: 1;
}

.card-2 {
    grid-column: 3 / 5;
    grid-row: 2;
    margin-top: 2rem;
}

.card-3 {
    grid-column: 3 / 7;
    grid-row: 3;
}

/* Card typography */
.card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    letter-spacing: 0.03em;
    line-height: 1.05;
    color: var(--bone-smoke);
    margin-bottom: 1.2rem;
}

.card-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: var(--pale-parchment);
    margin-bottom: 1rem;
}

.card-body:last-of-type {
    margin-bottom: 0;
}

.card-meta {
    display: block;
    margin-top: 1.5rem;
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--amber-glow);
}

/* Card corner flourishes */
.card-flourish {
    position: absolute;
    width: 4rem;
    height: 4rem;
    pointer-events: none;
}

.flourish-tl {
    top: 0.5rem;
    left: 0.5rem;
}

.flourish-br {
    bottom: 0.5rem;
    right: 0.5rem;
}

/* --- Pressed-Flower Silhouettes --- */
.pressed-flower {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    animation: drift 8s ease-in-out infinite alternate;
}

.pressed-flower svg {
    width: 100%;
    height: 100%;
}

@keyframes drift {
    0% { transform: translateY(0) translate(calc(var(--mouse-x) * 1px), calc(var(--mouse-y) * 1px)); }
    100% { transform: translateY(-2px) translate(calc(var(--mouse-x) * 1px), calc(var(--mouse-y) * 1px)); }
}

/* Position pressed flowers */
.flower-1 {
    width: 12vw;
    top: 15%;
    right: 5%;
}

.flower-2 {
    width: 10vw;
    bottom: 25%;
    left: 3%;
}

.flower-3 {
    width: 8vw;
    top: 55%;
    right: 20%;
}

/* ============================================================
   THIRD Z: CLOSING VIEWPORT
   ============================================================ */
.closing-viewport {
    position: relative;
    width: 100%;
    height: 100vh;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(12, 1fr);
    gap: clamp(2rem, 4vw, 5rem);
    padding: clamp(2rem, 4vw, 5rem);
    overflow: hidden;
}

.root-network {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
}

.closing-botanical {
    grid-column: 1 / 3;
    grid-row: 2 / 7;
    z-index: 2;
    pointer-events: none;
}

.closing-flora {
    width: 100%;
    height: auto;
}

/* Closing pressed flowers */
.closing-flower-1 {
    width: 8vw;
    top: 20%;
    right: 15%;
}

.closing-flower-2 {
    width: 10vw;
    top: 40%;
    left: 40%;
}

.closing-flower-3 {
    width: 9vw;
    bottom: 30%;
    right: 30%;
}

/* Call-to-reflection bar */
.closing-bar {
    grid-column: 2 / 7;
    grid-row: 8 / 11;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    padding: clamp(1.8rem, 3vw, 3rem) clamp(2.5rem, 4vw, 4rem);
    box-shadow: 0 8px 32px rgba(13, 26, 18, 0.4), 0 0 48px rgba(212, 160, 84, 0.06);
    opacity: 0;
    transform: translateY(20px);
}

.closing-bar.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 800ms ease, transform 800ms ease;
}

.closing-text {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    letter-spacing: 0.03em;
    line-height: 1.2;
    color: var(--bone-smoke);
    text-align: right;
    margin-bottom: 1rem;
}

.closing-meta {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--amber-glow);
}

/* --- Deep Moss text for light glassmorphic surfaces --- */
.glass-panel-light .card-title,
.glass-panel-light .card-body {
    color: var(--deep-moss);
}

/* --- Link Styles --- */
a {
    color: var(--amber-glow);
    text-decoration: none;
    background-image: linear-gradient(var(--dried-rose), var(--dried-rose));
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size 300ms ease;
}

a:hover {
    background-size: 100% 1px;
}

/* --- Botanical SVG Hover --- */
.cereus-svg path:hover,
.closing-flora path:hover {
    stroke-width: 1.6;
    stroke: var(--amber-glow);
    transition: stroke-width 300ms ease, stroke 300ms ease;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .hero-viewport {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(12, 1fr);
    }

    .hero-title-panel {
        grid-column: 1 / 5;
        grid-row: 2 / 4;
    }

    .hero-quote {
        grid-column: 1 / 4;
        grid-row: 8 / 10;
    }

    .petal-nav {
        grid-column: 3 / 5;
        grid-row: 10 / 12;
        flex-direction: row;
        gap: 0.8rem;
    }

    .petal-btn {
        width: 55px;
        height: 55px;
    }

    .content-viewport {
        grid-template-columns: repeat(4, 1fr);
    }

    .card-1 {
        grid-column: 1 / 5;
    }

    .card-2 {
        grid-column: 1 / 4;
        margin-top: 0;
    }

    .card-3 {
        grid-column: 1 / 5;
    }

    .closing-viewport {
        grid-template-columns: repeat(4, 1fr);
    }

    .closing-botanical {
        grid-column: 1 / 3;
        grid-row: 1 / 5;
    }

    .closing-bar {
        grid-column: 1 / 5;
        grid-row: 7 / 11;
        align-items: center;
    }

    .closing-text {
        text-align: center;
    }

    .cereus-container {
        width: 60vw;
        height: 60vw;
    }

    .z-dot {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2rem, 12vw, 3.5rem);
    }

    .petal-btn {
        width: 48px;
        height: 48px;
    }

    .petal-label {
        font-size: 0.6rem;
    }
}
