/* relative.quest — CSS 3D Perspective Scroll Experience */

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
    --bg-deep:        #1a1625;
    --bg-twilight:    #2d2640;
    --text-phantom:   #f5f0ff;
    --accent-purple:  #8b5cf6;
    --accent-pink:    #ec4899;
    --accent-indigo:  #6366f1;
    --shadow-plane:   #374151;
    --light-violet:   #c084fc;

    --font-display:   'Syne', sans-serif;
    --font-body:      'Libre Franklin', sans-serif;
    --font-accent:    'Spectral', serif;

    --perspective:    1200px;
    --transition-panel: transform 0.8s cubic-bezier(0.33, 1, 0.68, 1),
                        opacity 0.8s cubic-bezier(0.33, 1, 0.68, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-deep);
    color: var(--text-phantom);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ─── Typography ────────────────────────────────────────────── */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    line-height: 1.1;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    line-height: 1.2;
}

h3 {
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 700;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.spectral-label {
    font-family: var(--font-accent);
    font-size: 1rem;
    font-weight: 400;
    font-style: normal;
    color: var(--light-violet);
    opacity: 0.75;
}

.italic-label {
    font-style: italic;
}

/* ─── Hero Section ──────────────────────────────────────────── */
.hero {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-deep);
    perspective: var(--perspective);
}

/* Perspective Grid Floor */
.hero-grid-floor {
    position: absolute;
    bottom: -10%;
    left: -50%;
    width: 200%;
    height: 65vh;
    background:
        linear-gradient(var(--accent-purple) 1px, transparent 1px),
        linear-gradient(90deg, var(--accent-purple) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: perspective(500px) rotateX(60deg);
    transform-origin: bottom center;
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
}

/* Rotating Frame Motif */
.rotating-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 140px;
    margin-top: -70px;
    margin-left: -100px;
    border: 1px solid var(--accent-purple);
    perspective: 800px;
    transform-style: preserve-3d;
    animation: frame-spin 20s linear infinite;
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
}

@keyframes frame-spin {
    from { transform: rotateY(0deg); }
    to   { transform: rotateY(360deg); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 900px;
    padding: 2rem;
}

/* Dual Text Wrapper — positions the echo absolutely behind */
.dual-text-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.echo-shadow {
    position: absolute;
    top: -8px;
    left: 10px;
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--accent-purple);
    opacity: 0.28;
    pointer-events: none;
    white-space: nowrap;
    user-select: none;
}

.hero-title {
    color: var(--text-phantom);
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: var(--text-phantom);
    opacity: 0.7;
    margin-bottom: 2.5rem;
    position: relative;
}

/* Subtitle echo via JS-injected sibling */
.hero-subtitle .echo {
    position: absolute;
    top: -6px;
    left: 8px;
    color: var(--accent-pink);
    opacity: 0.2;
    pointer-events: none;
    user-select: none;
    font-family: var(--font-body);
    font-size: clamp(1rem, 2.5vw, 1.4rem);
}

.cta-link {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-phantom);
    text-decoration: none;
    border: 1px solid var(--accent-purple);
    padding: 0.8rem 2rem;
    position: relative;
    transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.cta-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-purple);
    transform: translateX(-101%);
    transition: transform 0.35s cubic-bezier(0.33, 1, 0.68, 1);
    z-index: -1;
}

.cta-link:hover {
    color: var(--bg-deep);
    border-color: var(--light-violet);
}

.cta-link:hover::before {
    transform: translateX(0);
}

/* Hero z-label */
.hero .z-label {
    position: absolute;
    bottom: 1.5rem;
    right: 2rem;
}

/* ─── Z-Depth Labels ────────────────────────────────────────── */
.z-label {
    font-family: var(--font-accent);
    font-size: 0.75rem;
    font-style: italic;
    color: var(--accent-indigo);
    opacity: 0.5;
    letter-spacing: 0.05em;
    user-select: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
}

/* ─── Panels Container ──────────────────────────────────────── */
.panels-container {
    position: relative;
    perspective: var(--perspective);
    perspective-origin: 50% 50%;
    padding: 6rem 0 4rem;
    overflow: hidden;
}

/* ─── Depth Panels ──────────────────────────────────────────── */
.depth-panel {
    position: relative;
    width: 90%;
    max-width: 860px;
    margin: 0 auto 5rem;
    background: var(--bg-twilight);
    padding: 3rem;
    transform-style: preserve-3d;
    transform: translateZ(-120px) rotateY(0deg);
    opacity: 0;
    transition: var(--transition-panel);
    will-change: transform, opacity;
}

.depth-panel.visible {
    opacity: 1;
    transform: translateZ(0px) rotateY(0deg);
}

/* Each panel gets a unique initial rotate via inline data or class variants */
.panel-a { border-left: 3px solid var(--accent-purple); }
.panel-b { border-left: 3px solid var(--accent-pink); border-right: 3px solid var(--accent-indigo); }
.panel-c { border-left: 3px solid var(--accent-indigo); }
.panel-d { border-left: 3px solid var(--accent-pink); }
.panel-e { border-left: 3px solid var(--light-violet); border-top: 1px solid var(--accent-purple); }

/* Panel alternating alignment */
.panel-a,
.panel-c,
.panel-e {
    margin-left: 5%;
    margin-right: auto;
}

.panel-b,
.panel-d {
    margin-right: 5%;
    margin-left: auto;
}

.panel-inner {
    position: relative;
}

.panel-number {
    display: block;
    font-size: 3.5rem;
    font-weight: 600;
    color: var(--accent-purple);
    opacity: 0.12;
    position: absolute;
    top: -1rem;
    right: 0;
    font-family: var(--font-display);
    letter-spacing: -0.05em;
    user-select: none;
}

.panel-heading {
    margin-bottom: 1.2rem;
    color: var(--text-phantom);
    position: relative;
}

/* Panel heading echo */
.panel-heading .echo {
    position: absolute;
    top: -6px;
    left: 8px;
    color: var(--accent-purple);
    opacity: 0.22;
    pointer-events: none;
    user-select: none;
    font-family: var(--font-display);
    font-size: inherit;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.panel-body {
    font-size: 1rem;
    color: var(--text-phantom);
    opacity: 0.85;
    max-width: 640px;
    margin-bottom: 1.5rem;
}

/* ─── Pull Quote ─────────────────────────────────────────────── */
.pull-quote {
    border-left: 2px solid var(--accent-pink);
    padding-left: 1.2rem;
    margin-top: 1.5rem;
    font-family: var(--font-accent);
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-phantom);
    opacity: 0.8;
}

/* ─── Escher Motif ──────────────────────────────────────────── */
.escher-motif {
    width: 180px;
    height: 120px;
    border: 1px solid var(--accent-indigo);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    position: relative;
    perspective: 400px;
}

.escher-motif::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid var(--accent-purple);
    opacity: 0.6;
}

.escher-motif::after {
    content: '';
    position: absolute;
    inset: 20px;
    border: 1px solid var(--accent-pink);
    opacity: 0.35;
}

.escher-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0.5rem;
}

/* ─── Dual Reality Block ─────────────────────────────────────── */
.dual-reality {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-top: 1.5rem;
    border: 1px solid var(--shadow-plane);
}

.reality-left,
.reality-right {
    flex: 1;
    padding: 1.2rem 1.5rem;
}

.reality-left {
    background: rgba(99, 102, 241, 0.08);
    border-right: none;
}

.reality-right {
    background: rgba(236, 72, 153, 0.08);
    border-left: none;
}

.reality-divider {
    width: 1px;
    background: linear-gradient(to bottom, var(--accent-indigo), var(--accent-pink));
    flex-shrink: 0;
}

.reality-text {
    font-size: 1.2rem;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-phantom);
    margin-top: 0.4rem;
}

.panel-caption {
    display: block;
    margin-top: 0.8rem;
    font-size: 0.85rem;
}

/* ─── Perspective Coordinates Block ─────────────────────────── */
.perspective-coords {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.5rem;
    padding: 1.2rem;
    border: 1px solid var(--shadow-plane);
    background: rgba(45, 38, 64, 0.5);
}

.coord-item {
    display: flex;
    align-items: baseline;
    gap: 1.2rem;
}

.coord-label {
    min-width: 60px;
    font-size: 0.85rem;
}

.coord-value {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-phantom);
    opacity: 0.8;
}

/* ─── Manifesto Grid ─────────────────────────────────────────── */
.manifesto-heading {
    color: var(--light-violet);
    margin-bottom: 2rem;
}

.manifesto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.manifesto-item {
    padding: 1.2rem;
    border-top: 2px solid var(--accent-purple);
    background: rgba(139, 92, 246, 0.06);
}

.manifesto-item-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--light-violet);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.manifesto-item p {
    font-size: 0.9rem;
    color: var(--text-phantom);
    opacity: 0.75;
    line-height: 1.65;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.site-footer {
    position: relative;
    background: var(--bg-deep);
    padding: 5rem 2rem 3rem;
    overflow: hidden;
    border-top: 1px solid var(--shadow-plane);
}

.footer-grid-floor {
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 120%;
    background:
        linear-gradient(var(--accent-indigo) 1px, transparent 1px),
        linear-gradient(90deg, var(--accent-indigo) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: perspective(400px) rotateX(-55deg);
    transform-origin: top center;
    opacity: 0.1;
    pointer-events: none;
}

.footer-content {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    text-align: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-domain {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-phantom);
    letter-spacing: -0.03em;
    position: relative;
}

/* Footer domain echo */
.footer-domain .echo {
    position: absolute;
    top: -5px;
    left: 8px;
    color: var(--accent-purple);
    opacity: 0.2;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

.footer-tagline {
    color: var(--accent-pink);
    opacity: 0.6;
}

.footer-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.footer-coords {
    color: var(--accent-indigo);
    opacity: 0.45;
    font-size: 0.85rem;
}

/* ─── Scroll progress line ──────────────────────────────────── */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
    z-index: 9999;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 700px) {
    .depth-panel {
        width: 92%;
        padding: 2rem 1.5rem;
        margin-left: auto;
        margin-right: auto;
    }

    .panel-a,
    .panel-b,
    .panel-c,
    .panel-d,
    .panel-e {
        margin-left: auto;
        margin-right: auto;
    }

    .dual-reality {
        flex-direction: column;
    }

    .reality-divider {
        width: 100%;
        height: 1px;
    }

    .rotating-frame {
        width: 140px;
        height: 100px;
        margin-top: -50px;
        margin-left: -70px;
    }
}
