/* ==========================================================================
   relative.quest — Pop-Art Relativity
   Colors: #2DD4BF #8B5CF6 #34D399 #F0ECE8 #FFE066 #1A1A2E #E87040 #C8B8A8
   Fonts: Zilla Slab 700, Nunito Sans 400/600, Fira Code 400
   ========================================================================== */

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

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

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.75;
    color: #1A1A2E;
    background-color: #1A1A2E;
    overflow-x: hidden;
}

/* ---- Retro Pattern Border Frame ---- */
#retro-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.retro-border {
    position: absolute;
    background: repeating-linear-gradient(
        90deg,
        #E87040 0px,
        #E87040 8px,
        transparent 8px,
        transparent 16px,
        #FFE066 16px,
        #FFE066 24px,
        transparent 24px,
        transparent 32px
    );
}

.retro-border-top {
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    transform: scaleX(0);
    transform-origin: left;
    animation: borderDrawH 1.2s ease-out 0.3s forwards;
}

.retro-border-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    transform: scaleX(0);
    transform-origin: right;
    animation: borderDrawH 1.2s ease-out 0.5s forwards;
}

.retro-border-left {
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: repeating-linear-gradient(
        180deg,
        #E87040 0px,
        #E87040 8px,
        transparent 8px,
        transparent 16px,
        #FFE066 16px,
        #FFE066 24px,
        transparent 24px,
        transparent 32px
    );
    transform: scaleY(0);
    transform-origin: top;
    animation: borderDrawV 1.2s ease-out 0.4s forwards;
}

.retro-border-right {
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    background: repeating-linear-gradient(
        180deg,
        #E87040 0px,
        #E87040 8px,
        transparent 8px,
        transparent 16px,
        #FFE066 16px,
        #FFE066 24px,
        transparent 24px,
        transparent 32px
    );
    transform: scaleY(0);
    transform-origin: bottom;
    animation: borderDrawV 1.2s ease-out 0.6s forwards;
}

@keyframes borderDrawH {
    to { transform: scaleX(1); }
}
@keyframes borderDrawV {
    to { transform: scaleY(1); }
}

/* ---- Hero / Spacetime Opening ---- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#aurora-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        #2DD4BF 0%,
        #8B5CF6 35%,
        #34D399 65%,
        #2DD4BF 100%
    );
    background-size: 300% 300%;
    animation: auroraShift 12s ease-in-out infinite;
    z-index: 0;
}

@keyframes auroraShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---- Marble Mass Objects ---- */
.marble-mass {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #F0ECE8, #C8B8A8);
    box-shadow:
        inset -20px -20px 40px rgba(26, 26, 46, 0.15),
        inset 10px 10px 30px rgba(240, 236, 232, 0.5),
        0 0 60px rgba(200, 184, 168, 0.3);
    z-index: 2;
    opacity: 0;
    animation: marbleFadeIn 1.5s ease-out forwards;
}

/* Noise overlay for marble texture */
.marble-mass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E");
    background-size: cover;
    mix-blend-mode: overlay;
    opacity: 0.4;
}

/* Marble veins */
.marble-mass::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(200, 184, 168, 0.6) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 20%, rgba(240, 236, 232, 0.4) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(200, 184, 168, 0.3) 0%, transparent 60%);
    mix-blend-mode: multiply;
}

.marble-mass-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    left: -5%;
    animation-delay: 0.5s;
}

.marble-mass-2 {
    width: 200px;
    height: 200px;
    top: 55%;
    right: 5%;
    animation-delay: 0.8s;
}

.marble-mass-3 {
    width: 150px;
    height: 150px;
    bottom: 10%;
    left: 30%;
    animation-delay: 1.1s;
}

@keyframes marbleFadeIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 0.85;
        transform: scale(1);
    }
}

/* ---- Hero Content ---- */
#hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    transform: scale(0.95);
    opacity: 0;
    animation: wordmarkEnter 1.2s ease-out 0.8s forwards;
}

#wordmark {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(48px, 8vw, 96px);
    color: #F0ECE8;
    text-shadow:
        3px 3px 0px #E87040,
        6px 6px 0px rgba(26, 26, 46, 0.3);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hero-tagline {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(14px, 2vw, 22px);
    color: #FFE066;
    margin-top: 16px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

@keyframes wordmarkEnter {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ---- Content Path (Organic S-Curve) ---- */
#content-path {
    position: relative;
    padding: 80px 0 120px;
    background: #F0ECE8;
}

/* Subtle curved background decoration */
#content-path::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 10% 20%, rgba(45, 212, 191, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 50%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 80%, rgba(52, 211, 153, 0.07) 0%, transparent 50%);
    pointer-events: none;
}

/* ---- Concept Sections ---- */
.concept-section {
    position: relative;
    margin-bottom: 100px;
    display: flex;
    align-items: flex-start;
    gap: 40px;
}

.concept-section:last-child {
    margin-bottom: 0;
}

.section-left {
    margin-left: 10vw;
    max-width: 60vw;
    flex-direction: row;
}

.section-right {
    margin-left: 20vw;
    max-width: 60vw;
    flex-direction: row-reverse;
}

.section-inner {
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    padding: 48px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    border: 2px solid rgba(26, 26, 46, 0.06);
    flex: 1;
    transition: transform 0.5s ease;
}

/* Warping effect near marble objects */
.concept-section.warped .section-inner {
    transform: skew(0.5deg, 0);
}

/* ---- Inline Marble Masses ---- */
.marble-mass-inline {
    position: relative;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.marble-mass-inline.visible {
    opacity: 0.75;
}

.marble-mass-4 {
    width: 180px;
    height: 180px;
    align-self: center;
}

.marble-mass-5 {
    width: 220px;
    height: 220px;
    align-self: flex-start;
    margin-top: 40px;
}

.marble-mass-6 {
    width: 160px;
    height: 160px;
    align-self: flex-end;
}

.marble-mass-7 {
    width: 250px;
    height: 250px;
    align-self: center;
}

.marble-mass-8 {
    width: 200px;
    height: 200px;
    align-self: flex-start;
    margin-top: 20px;
}

/* ---- Retro Accents ---- */
.retro-accent {
    width: 80px;
    height: 8px;
    margin-bottom: 24px;
}

.retro-zigzag {
    background: repeating-linear-gradient(
        90deg,
        #E87040 0px,
        #E87040 6px,
        transparent 6px,
        transparent 12px
    );
    clip-path: polygon(
        0% 50%, 5% 0%, 10% 50%, 15% 100%, 20% 50%,
        25% 0%, 30% 50%, 35% 100%, 40% 50%, 45% 0%,
        50% 50%, 55% 100%, 60% 50%, 65% 0%, 70% 50%,
        75% 100%, 80% 50%, 85% 0%, 90% 50%, 95% 100%, 100% 50%
    );
    height: 12px;
    background: #E87040;
}

.retro-diamonds {
    background: repeating-linear-gradient(
        45deg,
        #FFE066 0px,
        #FFE066 4px,
        transparent 4px,
        transparent 8px,
        #E87040 8px,
        #E87040 12px,
        transparent 12px,
        transparent 16px
    );
}

.retro-waves {
    background: #E87040;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.retro-waves::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 8px,
        #FFE066 8px,
        #FFE066 12px
    );
    animation: waveSlide 3s linear infinite;
}

@keyframes waveSlide {
    to { transform: translateX(-50%); }
}

/* ---- Section Typography ---- */
.section-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(32px, 5vw, 64px);
    color: #1A1A2E;
    line-height: 1.2;
    margin-bottom: 20px;
}

.section-body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.75;
    color: #1A1A2E;
    margin-bottom: 28px;
}

/* ---- Equations ---- */
.equation-block {
    background: #1A1A2E;
    padding: 20px 28px;
    border-radius: 8px;
    display: inline-block;
    border-left: 4px solid #E87040;
}

.equation {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 14px;
    color: #2DD4BF;
    display: block;
    margin-bottom: 6px;
}

.equation sup, .equation sub {
    font-size: 0.75em;
}

.equation-label {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #C8B8A8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ---- Gravitational Lensing Visual ---- */
.lensing-visual {
    position: relative;
    width: 100%;
    height: 200px;
    margin-top: 28px;
    overflow: hidden;
    background: #1A1A2E;
    border-radius: 8px;
}

.lens-mass {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #F0ECE8, #C8B8A8);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    box-shadow: 0 0 40px rgba(45, 212, 191, 0.4);
}

.light-ray {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, #FFE066, transparent);
    left: 0;
    transform-origin: left center;
    z-index: 1;
}

.light-ray-1 {
    top: 40%;
    width: 100%;
    animation: rayBend1 4s ease-in-out infinite;
}

.light-ray-2 {
    top: 50%;
    width: 100%;
    animation: rayBend2 4s ease-in-out infinite;
}

.light-ray-3 {
    top: 60%;
    width: 100%;
    animation: rayBend3 4s ease-in-out infinite;
}

.light-source {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #FFE066;
    top: 50%;
    left: 5%;
    transform: translateY(-50%);
    box-shadow: 0 0 20px #FFE066;
    z-index: 3;
}

@keyframes rayBend1 {
    0%, 100% { clip-path: polygon(0% 0%, 45% 0%, 50% 100%, 55% 0%, 100% 30%, 100% 40%, 55% 20%, 50% 100%, 45% 20%, 0% 100%); }
    50% { clip-path: polygon(0% 0%, 43% 0%, 50% 100%, 57% 0%, 100% 25%, 100% 35%, 57% 15%, 50% 100%, 43% 15%, 0% 100%); }
}

@keyframes rayBend2 {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.5); }
}

@keyframes rayBend3 {
    0%, 100% { clip-path: polygon(0% 0%, 45% 100%, 50% 0%, 55% 100%, 100% 60%, 100% 70%, 55% 80%, 50% 0%, 45% 80%, 0% 100%); }
    50% { clip-path: polygon(0% 0%, 43% 100%, 50% 0%, 57% 100%, 100% 65%, 100% 75%, 57% 85%, 50% 0%, 43% 85%, 0% 100%); }
}

/* ---- Spacetime Grid ---- */
.spacetime-grid {
    margin-top: 28px;
    border-radius: 8px;
    overflow: hidden;
    background: #1A1A2E;
}

#grid-canvas {
    display: block;
    width: 100%;
    height: 300px;
}

/* ---- Gravitational Wave Visual ---- */
.wave-visual {
    margin-top: 28px;
    background: #1A1A2E;
    border-radius: 8px;
    padding: 20px;
    overflow: hidden;
}

#wave-svg {
    width: 100%;
    height: 120px;
}

/* ---- Cosmic Footer ---- */
#cosmic-footer {
    position: relative;
    padding: 80px 0 60px;
    background: linear-gradient(
        135deg,
        #2DD4BF 0%,
        #8B5CF6 50%,
        #34D399 100%
    );
    text-align: center;
    overflow: hidden;
}

.retro-border-footer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: repeating-linear-gradient(
        90deg,
        #E87040 0px,
        #E87040 10px,
        #FFE066 10px,
        #FFE066 20px,
        #1A1A2E 20px,
        #1A1A2E 30px
    );
}

.footer-content {
    position: relative;
    z-index: 2;
}

.footer-text {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(24px, 4vw, 48px);
    color: #F0ECE8;
    text-shadow: 2px 2px 0px rgba(26, 26, 46, 0.3);
    margin-bottom: 12px;
}

.footer-sub {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1.5vw, 18px);
    color: rgba(240, 236, 232, 0.8);
    letter-spacing: 0.1em;
}

/* ---- Scroll-triggered animations ---- */
.concept-section {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.concept-section.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .concept-section {
        flex-direction: column !important;
        margin-left: 5vw !important;
        max-width: 90vw !important;
    }

    .marble-mass-inline {
        width: 100px !important;
        height: 100px !important;
        align-self: center !important;
        margin: 20px auto !important;
    }

    .section-inner {
        padding: 28px;
    }

    .marble-mass-1 {
        width: 180px;
        height: 180px;
    }

    .marble-mass-2 {
        width: 120px;
        height: 120px;
    }

    .marble-mass-3 {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 600px) {
    #wordmark {
        font-size: clamp(36px, 10vw, 60px);
    }

    .section-inner {
        padding: 20px;
    }

    .equation-block {
        padding: 16px 20px;
    }

    .lensing-visual {
        height: 150px;
    }
}
