/* ============================================================
   murasaki.quest — Street Botanical CSS
   Colors: #0D0021, #1A0033, #6A0DAD, #9B59B6, #C8A2C8,
           #E8D5F5, #F0E6FF, #2D1B4E, #7B2D8B
   Fonts: Anybody (variable), Space Grotesk, Martian Mono
   ============================================================ */

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

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

body {
    background: #0D0021;
    color: #E8D5F5;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    line-height: 1.65;
    overflow-x: hidden;
}

/* ─── CSS Custom Properties ─── */
:root {
    --murasaki: #6A0DAD;
    --shadow:   #0D0021;
    --void:     #1A0033;
    --mid:      #9B59B6;
    --lilac:    #C8A2C8;
    --mist:     #E8D5F5;
    --ghost:    #F0E6FF;
    --plum:     #2D1B4E;
    --bloom:    #7B2D8B;

    --blur-amount: 0px;
    --saturation: 1;
    --font-width: 85;
    --font-weight: 700;
}

/* ─── Typography ─── */
.anybody-font {
    font-family: 'Anybody', sans-serif;
    font-variation-settings: 'wdth' var(--font-width, 85), 'wght' var(--font-weight, 700);
}

/* ─── Sections ─── */
.section {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    scroll-snap-align: start;
}

/* ─── Grid Overlay (visible structural grid) ─── */
.grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(155, 89, 182, 0.12) 0px, transparent 1px, transparent 79px, rgba(155, 89, 182, 0.12) 80px),
        repeating-linear-gradient(90deg, rgba(155, 89, 182, 0.12) 0px, transparent 1px, transparent 119px, rgba(155, 89, 182, 0.12) 120px);
}

.grid-overlay--diagonal {
    background-image:
        repeating-linear-gradient(45deg, rgba(155, 89, 182, 0.06) 0px, transparent 1px, transparent 60px, rgba(155, 89, 182, 0.06) 61px),
        repeating-linear-gradient(-45deg, rgba(155, 89, 182, 0.06) 0px, transparent 1px, transparent 60px, rgba(155, 89, 182, 0.06) 61px);
}

/* ─── Vertical Progress Nav ─── */
.progress-nav {
    position: fixed;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(155, 89, 182, 0.35);
    border: 1px solid rgba(155, 89, 182, 0.5);
    cursor: pointer;
    transition: background 300ms ease, box-shadow 300ms ease, transform 300ms ease;
}

.progress-dot.active {
    background: #6A0DAD;
    box-shadow: 0 0 12px #6A0DAD, 0 0 24px rgba(106, 13, 173, 0.5);
    transform: scale(1.35);
}

.progress-dot:hover {
    background: #9B59B6;
    transform: scale(1.2);
}

/* ─── Z-Trace SVG Lines ─── */
.z-trace {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.z-line {
    transition: stroke-dashoffset 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ─── SECTION 1: Entry Gate ─── */
.section--entry {
    background: linear-gradient(135deg, #0D0021 0%, #1A0033 40%, #6A0DAD 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    padding: 8vh 6vw;
}

/* Top-left: Wordmark */
.entry-wordmark {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding-top: 4vh;
    z-index: 2;
    position: relative;
}

.wordmark-murasaki {
    display: block;
    font-family: 'Anybody', sans-serif;
    font-variation-settings: 'wdth' 85, 'wght' 700;
    font-size: clamp(52px, 6.5vw, 96px);
    letter-spacing: -0.02em;
    line-height: 1.0;
    color: #E8D5F5;
    transition: font-variation-settings 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.wordmark-dot {
    display: block;
    font-family: 'Anybody', sans-serif;
    font-variation-settings: 'wdth' 85, 'wght' 300;
    font-size: clamp(32px, 4vw, 60px);
    letter-spacing: -0.01em;
    color: #9B59B6;
    margin-top: -0.1em;
}

/* Top-right: Botanical Illustration */
.entry-botanical {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding-top: 2vh;
    z-index: 2;
    position: relative;

    --blur-amount: 14px;
    --saturation: 0.4;
    filter: blur(var(--blur-amount)) saturate(var(--saturation));
    transition: filter 2400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.entry-botanical.focused {
    --blur-amount: 0px;
    --saturation: 1;
}

.leaf-svg {
    width: clamp(200px, 30vw, 420px);
    height: auto;
}

/* Bottom-left: Pull quote */
.entry-pullquote {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    align-items: flex-end;
    padding-bottom: 6vh;
    z-index: 2;
    position: relative;
}

.pullquote-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(16px, 2vw, 24px);
    color: #C8A2C8;
    max-width: 380px;
    line-height: 1.4;
    border-left: 2px solid #6A0DAD;
    padding-left: 20px;
}

/* Bottom-right: Scroll indicator */
.scroll-indicator {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    padding-bottom: 6vh;
    z-index: 2;
    position: relative;
}

.scroll-label {
    font-family: 'Martian Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #9B59B6;
    margin-bottom: 8px;
}

.scroll-chevron {
    width: 28px;
    height: 28px;
    animation: chevronBounce 1.6s ease-in-out infinite;
}

.scroll-chevron svg {
    width: 100%;
    height: 100%;
}

@keyframes chevronBounce {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(6px); opacity: 1; }
}

/* ─── SECTION 2: Method Section ─── */
.section--method {
    background: #1A0033;
    display: flex;
    align-items: stretch;
}

.method-layout {
    display: grid;
    grid-template-columns: 55fr 45fr;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

/* Code column */
.method-code-col {
    padding: 8vh 5vw 6vh 6vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    position: relative;
}

.method-section-label {
    font-family: 'Martian Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(155, 89, 182, 0.5);
    position: absolute;
    bottom: 6vh;
    left: 6vw;
}

.code-block {
    background: rgba(13, 0, 33, 0.85);
    border: 1px solid rgba(155, 89, 182, 0.2);
    border-radius: 4px;
    box-shadow: 0 0 40px rgba(106, 13, 173, 0.2);
    overflow: hidden;
    position: relative;
}

.code-header {
    background: rgba(106, 13, 173, 0.12);
    padding: 10px 16px;
    border-bottom: 1px solid rgba(155, 89, 182, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.code-content {
    padding: 20px 20px 24px;
    overflow-x: auto;
    font-family: 'Martian Mono', monospace;
    font-size: 13px;
    line-height: 1.8;
    color: #E8D5F5;
    white-space: pre;
}

.code-selector { color: #C8A2C8; }
.code-prop { color: #9B59B6; }
.code-val { color: #E8D5F5; }
.code-var { color: #6A0DAD; }
.code-str { color: #C8A2C8; }
.code-brace { color: rgba(155, 89, 182, 0.7); }
.code-semi { color: rgba(155, 89, 182, 0.5); }
.code-comma { color: rgba(155, 89, 182, 0.5); }

/* Illustration column */
.method-illustration-col {
    padding: 8vh 5vw 6vh 4vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    position: relative;
    border-left: 1px solid rgba(155, 89, 182, 0.12);

    --blur-amount: 12px;
    --saturation: 0.5;
}

.method-illustration-col.focused {
    --blur-amount: 0px;
    --saturation: 1;
}

.method-col-label {
    font-family: 'Martian Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(155, 89, 182, 0.6);
    align-self: flex-start;
}

.petal-diagram-wrap {
    width: 100%;
    max-width: 340px;
    filter: blur(var(--blur-amount)) saturate(var(--saturation));
    transition: filter 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.petal-svg {
    width: 100%;
    height: auto;
}

.annotation-label {
    font-family: 'Martian Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    fill: #C8A2C8;
}

/* ─── Sticker Badges ─── */
.sticker-badge {
    display: inline-block;
    border: 2px solid #6A0DAD;
    background: #0D0021;
    padding: 4px 10px;
    font-family: 'Martian Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
    color: #9B59B6;
    line-height: 1.4;
}

.sticker-badge--inline {
    border-width: 1px;
    font-size: 10px;
    padding: 2px 8px;
}

.sticker-badge--bottom {
    align-self: flex-start;
    font-size: 10px;
    color: rgba(155, 89, 182, 0.7);
    border-color: rgba(106, 13, 173, 0.4);
}

/* ─── SECTION 3: Deep Dive Grid ─── */
.section--deepdive {
    background: linear-gradient(135deg, #1A0033 0%, #6A0DAD 55%, #C8A2C8 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 8vh 6vw;
    gap: 4vh;
    position: relative;
}

.deepdive-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 2;
}

.section-heading {
    font-family: 'Anybody', sans-serif;
    font-variation-settings: 'wdth' 85, 'wght' 700;
    font-size: clamp(48px, 7vw, 100px);
    letter-spacing: -0.02em;
    line-height: 1.0;
    color: #E8D5F5;
    transition: font-variation-settings 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section-heading.var-active {
    font-variation-settings: 'wdth' 110, 'wght' 900;
}

.deepdive-grid {
    display: flex;
    flex-direction: row;
    gap: 2vw;
    width: 100%;
    align-items: flex-start;
    position: relative;
    z-index: 2;
}

/* Diagonal Z arrangement: card 0 top, card 1 mid, card 2 bottom */
.deepdive-card {
    flex: 1;
    position: relative;
    cursor: pointer;
    transition: transform 300ms ease;
}

.deepdive-card:nth-child(1) { margin-top: 0; }
.deepdive-card:nth-child(2) { margin-top: 3vh; }
.deepdive-card:nth-child(3) { margin-top: 6vh; }

.card-inner {
    background: rgba(13, 0, 33, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(155, 89, 182, 0.25);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: border-color 300ms ease, box-shadow 300ms ease;
}

.deepdive-card:hover .card-inner {
    border-color: rgba(106, 13, 173, 0.7);
    box-shadow: 0 0 30px rgba(106, 13, 173, 0.3);
}

.card-title {
    font-family: 'Anybody', sans-serif;
    font-variation-settings: 'wdth' 110, 'wght' 900;
    font-size: clamp(22px, 2.5vw, 36px);
    letter-spacing: -0.02em;
    color: #E8D5F5;
    line-height: 1.1;
}

.card-summary {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #C8A2C8;
    line-height: 1.55;
}

.card-grid-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6A0DAD, transparent);
    transition: width 400ms ease;
}

.deepdive-card:hover .card-grid-line {
    width: 100%;
}

/* Blur-focus effect for non-hovered cards */
.deepdive-grid.hover-active .deepdive-card {
    filter: blur(3px) brightness(0.7);
    transition: filter 300ms ease, transform 300ms ease;
}

.deepdive-grid.hover-active .deepdive-card.card-focused {
    filter: blur(0px) brightness(1);
    transform: scale(1.02);
}

.deepdive-connectors {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ─── SECTION 4: Index / Footer ─── */
.section--index {
    background: #F0E6FF;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8vh 6vw 6vh;
    overflow: hidden;
}

.crosshatch-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(45, 27, 78, 0.07) 0px, transparent 1px, transparent 23px),
        repeating-linear-gradient(90deg, rgba(45, 27, 78, 0.07) 0px, transparent 1px, transparent 23px);
}

.root-network-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 44%;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
}

.root-svg {
    width: 100%;
    height: 100%;
}

.index-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 5vh;
    height: 100%;
}

.index-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.index-heading {
    font-family: 'Anybody', sans-serif;
    font-variation-settings: 'wdth' 85, 'wght' 700;
    font-size: clamp(40px, 6vw, 88px);
    letter-spacing: -0.02em;
    line-height: 1.0;
    color: #6A0DAD;
    transition: font-variation-settings 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.index-heading.var-active {
    font-variation-settings: 'wdth' 125, 'wght' 900;
}

.index-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #9B59B6;
    letter-spacing: 0.02em;
}

/* Topic grid: 3 columns × 4 rows */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2vh 3vw;
    flex: 1;
    align-content: start;
}

.topic-entry {
    display: flex;
    align-items: baseline;
    gap: 0;
    cursor: default;
    transition: transform 200ms ease;
}

.topic-entry:hover {
    transform: translateX(4px);
}

.topic-initial {
    font-family: 'Anybody', sans-serif;
    font-variation-settings: 'wdth' 125, 'wght' 900;
    font-size: clamp(44px, 5vw, 72px);
    line-height: 0.9;
    color: #6A0DAD;
    letter-spacing: -0.02em;
    margin-right: 2px;
}

.topic-rest {
    font-family: 'Martian Mono', monospace;
    font-size: clamp(11px, 1.1vw, 16px);
    color: #2D1B4E;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-variant: small-caps;
    padding-bottom: 0.1em;
}

.index-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 2vh;
    border-top: 1px solid rgba(106, 13, 173, 0.2);
}

.footer-domain {
    font-family: 'Anybody', sans-serif;
    font-variation-settings: 'wdth' 85, 'wght' 700;
    font-size: 18px;
    color: #6A0DAD;
    letter-spacing: -0.01em;
}

.footer-tagline {
    font-family: 'Martian Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9B59B6;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .section--entry {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        padding: 6vh 6vw;
    }

    .entry-botanical {
        grid-column: 1;
        grid-row: 2;
        justify-content: flex-start;
    }

    .entry-pullquote {
        grid-row: 3;
    }

    .scroll-indicator {
        grid-column: 1;
        grid-row: 4;
        align-items: flex-start;
    }

    .method-layout {
        grid-template-columns: 1fr;
    }

    .method-illustration-col {
        display: none;
    }

    .deepdive-grid {
        flex-direction: column;
    }

    .deepdive-card:nth-child(1),
    .deepdive-card:nth-child(2),
    .deepdive-card:nth-child(3) {
        margin-top: 0;
    }

    .topic-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .progress-nav {
        right: 12px;
    }
}

/* ─── Scroll-reveal transitions ─── */
.section-heading,
.index-heading {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 600ms ease,
        transform 600ms ease,
        font-variation-settings 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section-heading.revealed,
.index-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

.deepdive-card {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 500ms ease,
        transform 500ms ease,
        filter 300ms ease;
}

.deepdive-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.deepdive-card:nth-child(2) {
    transition-delay: 100ms;
}
.deepdive-card:nth-child(3) {
    transition-delay: 200ms;
}

/* Reset delay for hover interactions */
.deepdive-grid.hover-active .deepdive-card,
.deepdive-grid.hover-active .deepdive-card.card-focused {
    transition-delay: 0ms;
}

.topic-entry {
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.topic-entry.revealed {
    opacity: 1;
    transform: translateX(0);
}
