/* p9r.xyz - Frutiger Aero atrium with cultural ornamentation */

:root {
    --c-obsidian: #1A1118;
    --c-terracotta: #E07A5F;
    --c-teal: #3D8B8B;
    --c-coral: #F2A07B;
    --c-cyan: #5EC4C4;
    --c-parchment: #F0E6D3;
    --c-brass: #8B7355;
    --c-orchid: #6B3A6B;
    --c-sky: #7EB8C9;
    --c-umber: #2C1810;

    --cursor-x: 50vw;
    --cursor-y: 50vh;

    --progress: 0%;
    --progress-color: var(--c-terracotta);

    --font-display: 'Caveat', 'Brush Script MT', cursive;
    --font-emphasis: 'Satisfy', 'Caveat', cursive;
    --font-body: 'Nunito', 'Inter', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    color: var(--c-umber);
    background: var(--c-obsidian);
    line-height: 1.65;
    overscroll-behavior: none;
}

/* ----- PARALLAX CONTAINER ----- */
.parallax-container {
    perspective: 1px;
    perspective-origin: 0 0;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    transform-style: preserve-3d;
    scroll-behavior: smooth;
}

.chamber {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    overflow: hidden;
}

.layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.layer-bg {
    transform: translateZ(-2px) scale(3);
    z-index: 0;
}

.layer-mid {
    transform: translateZ(-1px) scale(2);
    z-index: 1;
    mix-blend-mode: soft-light;
    opacity: 0.85;
}

.layer-fg {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6vh 6vw;
    pointer-events: auto;
}

.layer-mid svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ----- BACKGROUND GRADIENT MESHES ----- */

@keyframes breathe-1 {
    0%, 100% { background-position: 0% 0%, 100% 100%, 50% 50%, 30% 70%, 70% 30%; background-size: 140% 140%, 130% 130%, 110% 110%, 90% 90%, 100% 100%; }
    50% { background-position: 10% 5%, 95% 90%, 55% 45%, 25% 65%, 75% 25%; background-size: 150% 150%, 140% 140%, 120% 120%, 100% 100%, 110% 110%; }
}

@keyframes breathe-2 {
    0%, 100% { background-position: 0% 0%, 100% 100%, 50% 50%, 20% 80%; }
    50% { background-position: 5% 10%, 95% 95%, 60% 40%, 25% 75%; }
}

@keyframes breathe-3 {
    0%, 100% { background-position: 20% 20%, 80% 80%, 50% 60%, 30% 70%; }
    50% { background-position: 25% 15%, 75% 85%, 55% 65%, 35% 65%; }
}

@keyframes breathe-4 {
    0%, 100% { background-position: 50% 50%, 0% 0%, 100% 100%; transform: translateZ(-2px) scale(3) rotate(0deg); }
    50% { background-position: 50% 50%, 5% 5%, 95% 95%; transform: translateZ(-2px) scale(3) rotate(0.5deg); }
}

@keyframes breathe-5 {
    0% { background-position: 10% 20%, 80% 30%, 30% 80%, 70% 70%, 50% 50%; }
    33% { background-position: 80% 30%, 30% 80%, 70% 70%, 50% 50%, 10% 20%; }
    66% { background-position: 30% 80%, 70% 70%, 50% 50%, 10% 20%, 80% 30%; }
    100% { background-position: 10% 20%, 80% 30%, 30% 80%, 70% 70%, 50% 50%; }
}

@keyframes horizon-cycle {
    0%   { background: radial-gradient(ellipse at 30% 40%, #E07A5F 0%, transparent 60%), radial-gradient(ellipse at 70% 60%, #7EB8C9 0%, transparent 60%), #1A1118; }
    16%  { background: radial-gradient(ellipse at 30% 40%, #F2A07B 0%, transparent 60%), radial-gradient(ellipse at 70% 60%, #5EC4C4 0%, transparent 60%), #1A1118; }
    33%  { background: radial-gradient(ellipse at 30% 40%, #5EC4C4 0%, transparent 60%), radial-gradient(ellipse at 70% 60%, #3D8B8B 0%, transparent 60%), #1A1118; }
    50%  { background: radial-gradient(ellipse at 30% 40%, #3D8B8B 0%, transparent 60%), radial-gradient(ellipse at 70% 60%, #6B3A6B 0%, transparent 60%), #1A1118; }
    66%  { background: radial-gradient(ellipse at 30% 40%, #6B3A6B 0%, transparent 60%), radial-gradient(ellipse at 70% 60%, #E07A5F 0%, transparent 60%), #1A1118; }
    83%  { background: radial-gradient(ellipse at 30% 40%, #7EB8C9 0%, transparent 60%), radial-gradient(ellipse at 70% 60%, #F2A07B 0%, transparent 60%), #1A1118; }
    100% { background: radial-gradient(ellipse at 30% 40%, #E07A5F 0%, transparent 60%), radial-gradient(ellipse at 70% 60%, #7EB8C9 0%, transparent 60%), #1A1118; }
}

.bg-chamber-1 {
    background:
        radial-gradient(ellipse 80% 60% at 15% 20%, rgba(242,160,123,0.95) 0%, transparent 55%),
        radial-gradient(ellipse 70% 70% at 85% 80%, rgba(224,122,95,0.85) 0%, transparent 60%),
        radial-gradient(circle 50% at 50% 50%, rgba(240,230,211,0.6) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 30% 70%, rgba(126,184,201,0.7) 0%, transparent 55%),
        radial-gradient(ellipse 70% 60% at 70% 30%, rgba(94,196,196,0.55) 0%, transparent 60%),
        linear-gradient(135deg, #F2A07B 0%, #7EB8C9 50%, #E07A5F 100%);
    background-blend-mode: soft-light, overlay, screen, soft-light, soft-light, normal;
    background-size: 140% 140%, 130% 130%, 110% 110%, 90% 90%, 100% 100%, 100% 100%;
    animation: breathe-1 50s ease-in-out infinite;
}

.bg-chamber-2 {
    background:
        radial-gradient(ellipse 70% 60% at 50% 0%, rgba(224,122,95,0.92) 0%, transparent 60%),
        radial-gradient(ellipse 70% 70% at 0% 100%, rgba(94,196,196,0.85) 0%, transparent 60%),
        radial-gradient(ellipse 70% 70% at 100% 100%, rgba(126,184,201,0.85) 0%, transparent 60%),
        radial-gradient(circle 40% at 50% 50%, rgba(240,230,211,0.35) 0%, transparent 60%),
        linear-gradient(180deg, #E07A5F 0%, #5EC4C4 70%, #7EB8C9 100%);
    background-blend-mode: soft-light, soft-light, overlay, screen, normal;
    background-size: 130% 130%, 120% 120%, 120% 120%, 100% 100%, 100% 100%;
    animation: breathe-2 55s ease-in-out infinite;
}

.bg-chamber-3 {
    background:
        radial-gradient(ellipse 80% 70% at 15% 15%, rgba(107,58,107,0.95) 0%, transparent 60%),
        radial-gradient(ellipse 70% 60% at 50% 50%, rgba(61,139,139,0.85) 0%, transparent 65%),
        radial-gradient(ellipse 80% 60% at 50% 100%, rgba(26,17,24,1) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 30%, rgba(94,196,196,0.4) 0%, transparent 60%),
        linear-gradient(160deg, #6B3A6B 0%, #3D8B8B 55%, #1A1118 100%);
    background-blend-mode: soft-light, overlay, normal, soft-light, normal;
    background-size: 140% 140%, 130% 130%, 130% 130%, 110% 110%;
    animation: breathe-3 60s ease-in-out infinite;
}

.bg-chamber-4 {
    background:
        radial-gradient(circle 30% at 50% 50%, rgba(242,160,123,1) 0%, rgba(240,230,211,0.6) 35%, transparent 60%),
        radial-gradient(ellipse 90% 90% at 50% 50%, transparent 30%, rgba(126,184,201,0.85) 55%),
        radial-gradient(ellipse 100% 100% at 0% 100%, rgba(94,196,196,0.5) 0%, transparent 70%),
        linear-gradient(45deg, #7EB8C9 0%, #5EC4C4 100%);
    background-blend-mode: screen, soft-light, overlay, normal;
    background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    animation: breathe-4 45s ease-in-out infinite;
}

.portal-aura {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle 22% at 50% 50%,
        rgba(255,255,255,0.4) 0%,
        rgba(242,160,123,0.5) 30%,
        rgba(224,122,95,0.3) 50%,
        transparent 70%);
    animation: portal-pulse 8s ease-in-out infinite;
    mix-blend-mode: screen;
}

@keyframes portal-pulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.08); opacity: 1; }
}

.bg-chamber-5 {
    background:
        radial-gradient(ellipse 60% 50% at 10% 20%, rgba(224,122,95,0.85) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 30%, rgba(94,196,196,0.85) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 30% 80%, rgba(107,58,107,0.85) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 70% 70%, rgba(242,160,123,0.85) 0%, transparent 60%),
        radial-gradient(circle 30% at 50% 50%, rgba(240,230,211,0.45) 0%, transparent 60%),
        linear-gradient(135deg, #6B3A6B 0%, #3D8B8B 50%, #E07A5F 100%);
    background-blend-mode: soft-light, soft-light, soft-light, overlay, screen, normal;
    background-size: 130% 130%, 130% 130%, 130% 130%, 130% 130%, 100% 100%;
    animation: breathe-5 70s linear infinite;
}

.bg-chamber-6 {
    background: radial-gradient(ellipse at 30% 40%, #E07A5F 0%, transparent 60%),
                radial-gradient(ellipse at 70% 60%, #7EB8C9 0%, transparent 60%),
                #1A1118;
    animation: horizon-cycle 30s ease-in-out infinite;
}

/* ----- MIDGROUND PATTERN LAYERS ----- */
.mid-chamber-1 { display: none; }

.mid-chamber-2 { opacity: 0.55; }
.mid-chamber-3 { opacity: 0.55; }
.mid-chamber-4 { opacity: 0.6; }
.mid-chamber-5 { opacity: 0.65; }

/* ----- ADINKRA OVERLAY ----- */
.adinkra-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    opacity: 0.18;
    mix-blend-mode: overlay;
}

.adinkra-overlay svg {
    width: 100%;
    height: 100%;
}

/* ----- GLASS PANELS ----- */
.glass-panel {
    position: relative;
    background: rgba(240, 230, 211, 0.12);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(240, 230, 211, 0.22);
    border-radius: 24px;
    padding: 56px 64px;
    box-shadow:
        0 8px 32px rgba(26, 17, 24, 0.18),
        inset 0 1px 0 rgba(240, 230, 211, 0.32),
        inset 0 -1px 0 rgba(26, 17, 24, 0.06);
    color: var(--c-parchment);
    overflow: hidden;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 800ms cubic-bezier(.2,.65,.25,1),
                transform 800ms cubic-bezier(.2,.65,.25,1),
                backdrop-filter 1200ms ease;
    will-change: transform, opacity;
}

.glass-panel.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* prismatic edge cursor light on panels */
.glass-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle 200px at var(--panel-x, 50%) var(--panel-y, 50%),
            rgba(240, 230, 211, 0.16) 0%,
            rgba(240, 230, 211, 0) 60%),
        radial-gradient(circle 220px at calc(var(--panel-x, 50%) + 4px) calc(var(--panel-y, 50%) - 2px),
            rgba(255, 100, 100, 0.05) 0%, transparent 55%),
        radial-gradient(circle 230px at calc(var(--panel-x, 50%) - 2px) calc(var(--panel-y, 50%) + 4px),
            rgba(100, 200, 255, 0.05) 0%, transparent 55%),
        radial-gradient(circle 240px at calc(var(--panel-x, 50%) + 6px) calc(var(--panel-y, 50%) + 6px),
            rgba(180, 100, 220, 0.04) 0%, transparent 55%);
    transition: opacity 0.3s ease;
    border-radius: inherit;
    z-index: 0;
}

.glass-panel > * {
    position: relative;
    z-index: 1;
}

.glass-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg,
        rgba(255,255,255,0.10) 0%,
        rgba(255,255,255,0) 25%,
        rgba(255,255,255,0) 75%,
        rgba(255,255,255,0.04) 100%);
    pointer-events: none;
}

/* ----- TYPOGRAPHY ----- */
.caveat {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--c-parchment);
}

.satisfy {
    font-family: var(--font-emphasis);
    color: var(--c-terracotta);
    font-size: clamp(22px, 2.4vw, 36px);
    line-height: 1.4;
}

.satisfy.emphasis { color: var(--c-terracotta); margin: 18px 0; }

.body {
    font-family: var(--font-body);
    font-size: clamp(15px, 1.1vw, 19px);
    font-weight: 400;
    line-height: 1.7;
    color: var(--c-parchment);
    margin-top: 14px;
}

.body.small {
    font-size: clamp(14px, 1vw, 17px);
    margin-top: 10px;
    color: rgba(240, 230, 211, 0.88);
}

.ornament-label {
    display: block;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 0.18em;
    color: var(--c-brass);
    text-transform: uppercase;
    margin-bottom: 16px;
}

.ornament-attribution {
    display: block;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--c-brass);
    text-transform: lowercase;
    margin-top: 24px;
    font-style: italic;
}

/* Handwritten reveal: clip-path stroke */
.handwritten-reveal {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1500ms cubic-bezier(.22,.7,.2,1);
}

.handwritten-reveal.is-revealed {
    clip-path: inset(0 0 0 0);
}

/* ----- CHAMBER 1 - THRESHOLD ----- */
.panel-threshold {
    width: min(620px, 86vw);
    text-align: center;
    padding: 72px 72px 64px;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(.2,.65,.25,1);
}

.panel-threshold h1 {
    font-size: clamp(72px, 9vw, 128px);
    margin: 12px 0 22px;
    color: var(--c-parchment);
    text-shadow: 0 2px 30px rgba(26,17,24,0.25);
}

.panel-threshold .evocative {
    font-size: clamp(22px, 2.2vw, 34px);
    color: var(--c-terracotta);
    margin-bottom: 8px;
}

/* ----- CHAMBER 2 - GARDEN ----- */
.garden-pair {
    position: relative;
    width: min(1200px, 92vw);
    height: min(560px, 70vh);
    margin: auto;
}

.panel-garden-a {
    position: absolute;
    left: 0;
    top: 4%;
    width: 60%;
    max-width: 720px;
}

.panel-garden-b {
    position: absolute;
    right: 0;
    top: 38%;
    width: 38%;
    max-width: 460px;
    padding: 44px 48px;
}

.panel-garden-a h2 {
    font-size: clamp(36px, 4.5vw, 64px);
    margin-bottom: 8px;
}

/* ----- CHAMBER 3 - ARCHIVE ----- */
.archive-stack {
    position: relative;
    width: min(1200px, 92vw);
    height: min(580px, 75vh);
    margin: auto;
}

.panel-archive {
    position: absolute;
    width: 42%;
    max-width: 520px;
    padding: 40px 48px;
}

.panel-archive h3 {
    font-size: clamp(28px, 3vw, 44px);
    margin-bottom: 10px;
}

.panel-archive-a { left: 0; top: 0; }
.panel-archive-b { left: 30%; top: 32%; width: 38%; }
.panel-archive-c { right: 0; bottom: 0; }

/* ----- CHAMBER 4 - LENS ----- */
.panel-lens {
    width: min(1100px, 80vw);
    padding: 56px 72px;
    text-align: center;
}

.panel-lens h2 {
    font-size: clamp(40px, 5vw, 72px);
    margin-bottom: 16px;
}

/* ----- CHAMBER 5 - CONFLUENCE ----- */
.confluence-diamond {
    position: relative;
    width: min(900px, 90vw);
    height: min(560px, 75vh);
    margin: auto;
}

.panel-conf {
    position: absolute;
    width: 42%;
    max-width: 320px;
    padding: 32px 36px;
    text-align: center;
}

.panel-conf h4 {
    font-family: var(--font-display);
    font-size: clamp(28px, 3vw, 44px);
    color: var(--c-parchment);
    margin: 8px 0 4px;
    letter-spacing: -0.02em;
}

.conf-n { left: 50%; top: 0; transform: translate(-50%, 0); }
.conf-e { right: 0; top: 50%; transform: translate(0, -50%); }
.conf-s { left: 50%; bottom: 0; transform: translate(-50%, 0); }
.conf-w { left: 0; top: 50%; transform: translate(0, -50%); }

.conf-n.is-revealed { transform: translate(-50%, 0); }
.conf-e.is-revealed { transform: translate(0, -50%); }
.conf-s.is-revealed { transform: translate(-50%, 0); }
.conf-w.is-revealed { transform: translate(0, -50%); }

.panel-conf {
    opacity: 0;
    transition: opacity 800ms cubic-bezier(.2,.65,.25,1) var(--delay, 0ms);
}
.panel-conf.is-revealed { opacity: 1; }

/* per-panel tint */
.conf-n { background: rgba(94,196,196,0.16); border-color: rgba(94,196,196,0.28); }
.conf-e { background: rgba(242,160,123,0.16); border-color: rgba(242,160,123,0.28); }
.conf-s { background: rgba(224,122,95,0.16); border-color: rgba(224,122,95,0.28); }
.conf-w { background: rgba(107,58,107,0.18); border-color: rgba(107,58,107,0.30); }

.confluence-attribution {
    position: absolute;
    bottom: -42px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--c-parchment);
    opacity: 0.7;
    text-align: center;
    width: 100%;
}

/* ----- CHAMBER 6 - HORIZON ----- */
.panel-horizon {
    width: min(820px, 88vw);
    padding: 64px 72px;
    text-align: center;
    background: rgba(240, 230, 211, 0.08);
    border-color: rgba(240, 230, 211, 0.16);
}

.horizon-line {
    font-size: clamp(32px, 4vw, 56px);
    color: var(--c-parchment);
    line-height: 1.3;
}

/* ----- CURSOR-FOLLOW LIGHT ----- */
.cursor-light {
    position: fixed;
    pointer-events: none;
    width: 200px;
    height: 200px;
    left: var(--cursor-x);
    top: var(--cursor-y);
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
        rgba(240, 230, 211, 0.18) 0%,
        rgba(240, 230, 211, 0.08) 30%,
        transparent 70%);
    transition: left 0.15s ease, top 0.15s ease;
    z-index: 5;
    mix-blend-mode: screen;
    will-change: left, top;
}

@keyframes ambient-pulse {
    0%, 100% { opacity: 0.04; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.10; transform: translate(-50%, -50%) scale(1.15); }
}

.cursor-light.touch-mode {
    left: 50vw;
    top: 50vh;
    animation: ambient-pulse 2s ease-in-out infinite;
    transition: none;
}

/* ----- PROGRESS BAR ----- */
.progress-track {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(26, 17, 24, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10;
}

.progress-fill {
    height: 100%;
    width: var(--progress);
    background: var(--progress-color);
    transition: width 0.1s linear, background-color 0.4s ease;
    box-shadow: 0 0 12px var(--progress-color);
}

/* ----- RESPONSIVE ----- */
@media (max-width: 768px) {
    .layer-fg { padding: 4vh 4vw; }

    .panel-threshold { padding: 48px 36px 44px; }
    .panel-threshold h1 { font-size: 64px; }

    .garden-pair, .archive-stack, .confluence-diamond {
        height: auto;
        min-height: 80vh;
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

    .panel-garden-a, .panel-garden-b,
    .panel-archive,
    .panel-conf {
        position: relative;
        width: 100%;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        transform: none;
        max-width: 100%;
        padding: 32px 28px;
    }

    .conf-n, .conf-e, .conf-s, .conf-w {
        transform: none;
    }
    .conf-n.is-revealed, .conf-e.is-revealed,
    .conf-s.is-revealed, .conf-w.is-revealed { transform: none; }

    .panel-lens { padding: 40px 32px; }
    .panel-horizon { padding: 44px 32px; }

    .confluence-attribution { position: relative; bottom: auto; margin-top: 16px; }

    .glass-panel { padding: 36px 32px; border-radius: 20px; }
}
