/* =============================================
   a6c.quest — Japanese Minimal Aurora Design
   ============================================= */

/* Custom Properties */
:root {
    --deep-ground: #0e1117;
    --primary-surface: #1a1e2e;
    --aurora-green: #00d4aa;
    --aurora-violet: #7b5ea7;
    --aurora-teal: #3de8d4;
    --marble-white: #e8e4df;
    --warm-stone: #c9c0b6;
    --accent-rose: #d4728c;

    --aurora-sweep: linear-gradient(135deg, #00d4aa 0%, #3de8d4 30%, #7b5ea7 70%, #d4728c 100%);
    --marble-wash: radial-gradient(ellipse at 30% 40%, rgba(232,228,223,0.08) 0%, transparent 70%);
    --stone-fade: linear-gradient(to bottom, #0e1117 0%, #1a1e2e 100%);

    --font-headline: 'Space Grotesk', sans-serif;
    --font-body: 'IBM Plex Mono', monospace;
    --font-accent: 'Cormorant Garamond', serif;

    --gutter: clamp(2rem, 4vw, 5rem);
    --ease-settle: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    background-color: #000000;
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.875rem, 1.5vw, 1.0625rem);
    line-height: 1.85;
    color: var(--marble-white);
    background-color: var(--deep-ground);
    overflow-x: hidden;
    opacity: 0;
    animation: bodyFadeIn 300ms ease-out 100ms forwards;
}

@keyframes bodyFadeIn {
    from { opacity: 0; background-color: #000000; }
    to { opacity: 1; background-color: var(--deep-ground); }
}

/* Scroll Progress Indicator */
#scroll-progress {
    position: fixed;
    left: 0;
    top: 0;
    width: 40px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

#progress-svg {
    width: 100%;
    height: 100%;
}

#progress-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 3px rgba(0, 212, 170, 0.4));
}

@keyframes pulseGlow {
    0%, 100% { filter: drop-shadow(0 0 2px rgba(0, 212, 170, 0.3)); }
    50% { filter: drop-shadow(0 0 6px rgba(0, 212, 170, 0.6)); }
}

#progress-svg.active #progress-path {
    animation: pulseGlow 3s ease-in-out infinite;
}

/* Wordmark */
.wordmark {
    position: fixed;
    top: clamp(1.5rem, 3vh, 2.5rem);
    left: clamp(3rem, 6vw, 5rem);
    z-index: 90;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    color: var(--warm-stone);
    opacity: 0;
    animation: wordmarkAppear 200ms ease-out 400ms forwards;
}

@keyframes wordmarkAppear {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wordmark-cursor {
    animation: cursorBlink 1s step-end infinite;
    color: var(--aurora-green);
    font-weight: 300;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.wordmark-cursor.hidden {
    display: none;
}

/* Section Base */
.section {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
    background: var(--stone-fade);
    transition: background-position 1.5s var(--ease-settle);
}

/* Section Grid */
.section-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0 var(--gutter);
    max-width: 100vw;
    min-height: 100vh;
    padding: 0 var(--gutter);
    position: relative;
    z-index: 2;
}

/* Marble Overlay */
.marble-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.section-opening .marble-overlay {
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(201,192,182,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(232,228,223,0.04) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(123,94,167,0.03) 0%, transparent 60%);
}

.section-first-z .marble-overlay {
    background-image:
        radial-gradient(ellipse at 60% 20%, rgba(201,192,182,0.05) 0%, transparent 45%),
        radial-gradient(ellipse at 30% 70%, rgba(232,228,223,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(123,94,167,0.03) 0%, transparent 55%);
}

.section-second-z .marble-overlay {
    background-image:
        radial-gradient(ellipse at 40% 60%, rgba(201,192,182,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 25%, rgba(232,228,223,0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 15% 45%, rgba(123,94,167,0.04) 0%, transparent 55%);
}

.section-convergence .marble-overlay {
    background-image:
        radial-gradient(ellipse at 50% 50%, rgba(201,192,182,0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 25% 35%, rgba(232,228,223,0.05) 0%, transparent 45%),
        radial-gradient(ellipse at 70% 70%, rgba(123,94,167,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 20%, rgba(212,114,140,0.02) 0%, transparent 40%);
}

.marble-full {
    opacity: 0.6;
}

.section-closing .marble-overlay {
    background-image:
        radial-gradient(ellipse at 50% 50%, rgba(201,192,182,0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 80%, rgba(232,228,223,0.03) 0%, transparent 40%);
}

/* Lattice Intersecting Lines */
.section-first-z::before,
.section-convergence::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        repeating-linear-gradient(
            30deg,
            transparent,
            transparent 80px,
            rgba(0, 212, 170, 0.03) 80px,
            rgba(0, 212, 170, 0.03) 80.5px
        ),
        repeating-linear-gradient(
            150deg,
            transparent,
            transparent 80px,
            rgba(0, 212, 170, 0.03) 80px,
            rgba(0, 212, 170, 0.03) 80.5px
        );
    pointer-events: none;
}

/* Section Stamps (Hanko-style) */
.section-stamp {
    position: absolute;
    top: clamp(1.5rem, 3vh, 2.5rem);
    right: clamp(1.5rem, 3vw, 3rem);
    width: 40px;
    height: 40px;
    color: var(--warm-stone);
    opacity: 0.2;
    z-index: 5;
}

.section-stamp svg {
    width: 100%;
    height: 100%;
}

/* Typography */
h1 {
    font-family: var(--font-headline);
    font-weight: 500;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--marble-white);
}

h2 {
    font-family: var(--font-headline);
    font-weight: 300;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.04em;
    line-height: 1.3;
    color: var(--marble-white);
    margin-bottom: 1.5rem;
}

.body-text {
    color: var(--warm-stone);
    max-width: 48ch;
    margin-bottom: 1rem;
}

.accent-text {
    font-family: var(--font-accent);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    line-height: 1.6;
    color: var(--aurora-teal);
    margin-top: 1.5rem;
    max-width: 40ch;
}

.closing-text {
    font-family: var(--font-headline);
    font-weight: 300;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.02em;
    text-align: center;
    color: var(--marble-white);
}

/* Reveal Animation Classes */
.reveal-item {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 900ms var(--ease-settle), transform 900ms var(--ease-settle);
}

.reveal-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =====================
   SECTION 1: Opening Field
   ===================== */
.section-opening .section-grid {
    align-items: start;
}

.opening-content {
    grid-column: 1 / 6;
    grid-row: 1;
    align-self: start;
    padding-top: 38.2vh;
}

.opening-shape {
    grid-column: 5 / 8;
    grid-row: 1;
    align-self: end;
    justify-self: end;
    padding-bottom: calc(100vh * 0.15);
}

/* Geometric Concentric Circles */
.geo-concentric-circles {
    position: relative;
    width: clamp(120px, 18vw, 220px);
    height: clamp(120px, 18vw, 220px);
}

.geo-concentric-circles .circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid transparent;
    border-image: var(--aurora-sweep);
    border-image-slice: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    transition: transform 700ms var(--ease-settle);
}

/* Use box-shadow trick for gradient borders on circles since border-image doesnt work with border-radius */
.geo-concentric-circles .circle {
    border: none;
    background: transparent;
}

.circle-outer {
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 0 1px var(--aurora-green), 0 0 0 1px var(--aurora-green);
}

.circle-mid {
    width: 61.8%;
    height: 61.8%;
    box-shadow: inset 0 0 0 1px var(--aurora-teal), 0 0 0 1px var(--aurora-teal);
    transition-delay: 200ms;
}

.circle-inner {
    width: 38.2%;
    height: 38.2%;
    box-shadow: inset 0 0 0 1px var(--aurora-violet), 0 0 0 1px var(--aurora-violet);
    transition-delay: 400ms;
}

.circle.visible {
    transform: translate(-50%, -50%) scale(1);
}

/* =====================
   SECTION 2: First Z-Sweep
   ===================== */
.section-first-z .section-grid {
    align-items: start;
}

.z-content-left {
    grid-column: 1 / 5;
    grid-row: 1;
    align-self: start;
    padding-top: 20vh;
}

.z-visual-right {
    grid-column: 5 / 9;
    grid-row: 1;
    align-self: end;
    justify-self: end;
    padding-bottom: 15vh;
}

/* Z-Line diagonal connector */
.z-line {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}

.z-line-forward {
    top: 30%;
    left: 35%;
    width: 30%;
    height: 1px;
    background: var(--aurora-sweep);
    transform: rotate(25deg);
    transform-origin: left center;
    opacity: 0.4;
}

.z-line-reverse {
    top: 35%;
    right: 35%;
    width: 30%;
    height: 1px;
    background: var(--aurora-sweep);
    transform: rotate(-25deg);
    transform-origin: right center;
    opacity: 0.4;
}

/* Marble Slab */
.marble-slab {
    width: clamp(200px, 25vw, 350px);
    height: clamp(250px, 30vw, 400px);
    position: relative;
    clip-path: polygon(10% 0%, 100% 5%, 95% 100%, 0% 90%);
}

.slab-inner {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(232,228,223,0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(201,192,182,0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 45% 80%, rgba(123,94,167,0.06) 0%, transparent 50%),
        linear-gradient(135deg, rgba(26,30,46,0.9) 0%, rgba(14,17,23,0.95) 100%);
    border: 1px solid rgba(232,228,223,0.08);
}

/* =====================
   SECTION 3: Second Z-Sweep (Mirrored)
   ===================== */
.z-visual-left {
    grid-column: 1 / 5;
    grid-row: 1;
    align-self: start;
    justify-self: end;
    padding-top: 15vh;
}

.z-content-right {
    grid-column: 4 / 9;
    grid-row: 1;
    align-self: end;
    padding-bottom: 15vh;
}

/* Geometric Composition */
.geo-composition {
    position: relative;
    width: clamp(180px, 22vw, 300px);
    height: clamp(180px, 22vw, 300px);
}

.geo-triangle {
    position: absolute;
    width: 0;
    height: 0;
}

.tri-up {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    border-bottom: 104px solid var(--primary-surface);
    filter: drop-shadow(0 0 1px var(--aurora-green));
}

.tri-right {
    top: 30%;
    right: 0;
    border-top: 45px solid transparent;
    border-bottom: 45px solid transparent;
    border-left: 78px solid var(--primary-surface);
    filter: drop-shadow(0 0 1px var(--aurora-teal));
}

.tri-down {
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-top: 70px solid var(--primary-surface);
    filter: drop-shadow(0 0 1px var(--aurora-violet));
}

.geo-circle-overlay {
    position: absolute;
    bottom: 10%;
    left: 20%;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 170, 0.3);
    background: transparent;
}

.geo-triangle.reveal-item {
    opacity: 0;
    transform: translateY(40px) rotate(-15deg);
}

.geo-triangle.reveal-item.visible {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
    transition: opacity 700ms var(--ease-settle), transform 700ms var(--ease-settle);
}

/* =====================
   SECTION 4: Convergence
   ===================== */
.section-convergence .section-grid {
    align-items: center;
    justify-items: center;
}

.convergence-content {
    grid-column: 2 / 8;
    text-align: center;
}

.convergence-content .body-text {
    max-width: 60ch;
    margin: 0 auto 2rem;
}

.convergence-geo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    margin-top: 3rem;
}

.convergence-circles {
    width: 80px;
    height: 80px;
}

.convergence-tri {
    position: relative;
}

/* =====================
   SECTION 5: Closing Field
   ===================== */
.section-closing {
    background: var(--deep-ground);
}

.section-closing .section-grid {
    align-items: center;
    justify-items: center;
}

.closing-content {
    grid-column: 2 / 8;
    text-align: center;
    padding: 20vh 0;
}

.closing-mark {
    margin-top: 4rem;
    display: flex;
    justify-content: center;
}

.closing-circles {
    width: 60px;
    height: 60px;
}

/* =====================
   Link Styles
   ===================== */
a {
    color: var(--aurora-green);
    text-decoration: none;
    transition: color 300ms var(--ease-settle);
}

a:hover {
    color: var(--aurora-teal);
}

/* =====================
   Mobile Responsive
   ===================== */
@media (max-width: 768px) {
    .section-grid {
        grid-template-columns: 1fr;
        padding: 0 clamp(1.5rem, 5vw, 2.5rem);
    }

    .opening-content,
    .z-content-left,
    .z-content-right,
    .z-visual-left,
    .z-visual-right,
    .convergence-content,
    .closing-content {
        grid-column: 1 / -1;
    }

    .opening-content {
        padding-top: 30vh;
    }

    .opening-shape {
        grid-column: 1 / -1;
        justify-self: center;
        padding-bottom: 10vh;
    }

    .z-content-left,
    .z-content-right {
        padding-top: 15vh;
        padding-bottom: 2rem;
        align-self: start;
    }

    .z-visual-right,
    .z-visual-left {
        justify-self: center;
        align-self: center;
        padding-top: 0;
        padding-bottom: 10vh;
    }

    .z-line {
        display: none;
    }

    #scroll-progress {
        display: none;
    }

    .section-stamp {
        top: 1rem;
        right: 1rem;
        width: 30px;
        height: 30px;
    }

    .convergence-geo {
        flex-direction: column;
        gap: 2rem;
    }

    .marble-slab {
        width: 200px;
        height: 250px;
    }

    .geo-composition {
        width: 160px;
        height: 160px;
    }

    .closing-content {
        padding: 15vh 0;
    }
}

/* =====================
   Subtle Background Noise
   ===================== */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.015;
    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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Page load initial shape animation */
@keyframes shapeScaleIn {
    from { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.section-opening .geo-concentric-circles .circle {
    animation: shapeScaleIn 500ms var(--ease-settle) forwards;
    opacity: 0;
}

.section-opening .geo-concentric-circles .circle-outer {
    animation-delay: 900ms;
}

.section-opening .geo-concentric-circles .circle-mid {
    animation-delay: 1100ms;
}

.section-opening .geo-concentric-circles .circle-inner {
    animation-delay: 1300ms;
}
