/* ============================================
   gabs.ai — Styles
   Gold-black luxury, organic-flow, ma-negative-space
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #080706;
    --bg-secondary: #0f0d0a;
    --bg-tertiary: #1a1714;
    --accent-primary: #c9a84c;
    --accent-secondary: #8b7332;
    --text-primary: #d4cfc6;
    --text-secondary: #8a8478;
    --text-tertiary: #6b6560;
    --highlight: #e8d48b;
    --border-divider: #2a2520;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Lora', 'Times New Roman', serif;
    --font-utility: 'DM Sans', 'Helvetica Neue', sans-serif;

    --bg-current: var(--bg-primary);
}

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

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

body {
    background-color: var(--bg-current);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle noise texture on body */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Scroll Progress Indicator --- */
.scroll-progress {
    position: fixed;
    top: 0;
    right: 20px;
    width: 1px;
    height: 0%;
    background-color: var(--accent-primary);
    z-index: 1000;
    transition: height 0.1s linear;
}

/* --- Stage Base --- */
.stage {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    scroll-snap-align: start;
    overflow: hidden;
}

/* --- Stage Numerals (Assay Numerals) --- */
.stage-numeral {
    position: absolute;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 200px;
    color: var(--accent-primary);
    opacity: 0.07;
    letter-spacing: 0.02em;
    user-select: none;
    pointer-events: none;
    z-index: 1;
    will-change: transform;
}

/* --- Stage 1: Surface --- */
.stage-surface {
    justify-content: flex-start;
    align-items: center;
}

.stage-surface .stage-numeral {
    top: 10%;
    left: 5%;
}

.surface-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: 10vw;
    width: 100%;
    position: relative;
    z-index: 2;
}

.hero-wordmark {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(5rem, 15vw, 12rem);
    letter-spacing: 0.06em;
    color: var(--accent-primary);
    line-height: 1;
    margin-bottom: 1.5rem;
}

.balance-beam {
    height: 1px;
    background-color: var(--accent-primary);
    width: calc(90vw - 10vw);
    align-self: flex-start;
    animation: pulse-beam 4s ease-in-out infinite;
    transform-origin: left center;
}

@keyframes pulse-beam {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* --- Stage 2: Weigh --- */
.stage-weigh {
    justify-content: flex-end;
}

.stage-weigh .stage-numeral {
    top: 15%;
    left: 6%;
}

.weigh-content {
    width: 40%;
    margin-right: 8vw;
    margin-left: auto;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.weigh-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.weigh-statement {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 28px;
    line-height: 1.85;
    color: var(--text-primary);
}

/* --- Stage 3: Test --- */
.stage-test {
    align-items: center;
}

.stage-test .stage-numeral {
    top: 12%;
    right: 6%;
    left: auto;
}

.test-content {
    display: flex;
    width: 100%;
    padding: 0 8vw;
    position: relative;
    z-index: 2;
    gap: 4vw;
    align-items: center;
}

.test-paragraphs {
    flex: 1;
    max-width: 33%;
}

.test-para {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.85;
    color: var(--text-primary);
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.test-para.visible {
    opacity: 1;
    transform: translateY(0);
}

.test-para-1 {
    margin-left: 0;
}

.test-para-2 {
    margin-left: 40px;
    transition-delay: 0.15s;
}

.test-para-3 {
    margin-left: 80px;
    transition-delay: 0.3s;
}

.test-waveform {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#waveform-canvas {
    width: 100%;
    max-width: 50vw;
    height: 300px;
}

/* --- Stage 4: Refine --- */
.stage-refine {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.stage-refine .stage-numeral {
    top: 10%;
    left: 5%;
}

.refine-content {
    max-width: 65%;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.refine-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.refine-statement {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.03em;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Gold underline draw animation */
.gold-underline {
    position: relative;
    display: inline;
}

.gold-underline::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 2px;
    background-color: var(--accent-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gold-underline.drawn::after {
    transform: scaleX(1);
}

/* --- Stage 5: Declare --- */
.stage-declare {
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: var(--bg-tertiary);
}

.stage-declare .stage-numeral {
    top: 10%;
    left: 5%;
}

/* Border frame animation */
.border-frame {
    position: absolute;
    top: 40px;
    right: 40px;
    bottom: 40px;
    left: 40px;
    pointer-events: none;
    z-index: 3;
}

.border-line {
    position: absolute;
    background-color: var(--accent-primary);
}

.border-top {
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.border-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 1200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.border-left {
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 1200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.border-right {
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 1200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.border-frame.animate .border-top,
.border-frame.animate .border-bottom {
    transform: scaleX(1);
}

.border-frame.animate .border-left,
.border-frame.animate .border-right {
    transform: scaleY(1);
}

.declare-content {
    position: relative;
    z-index: 4;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease-out 0.6s, transform 1s ease-out 0.6s;
}

.declare-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.declare-statement {
    font-family: var(--font-utility);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 2rem;
}

.declare-contact {
    font-family: var(--font-utility);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* --- Balance beam dividers between sections --- */
.stage-weigh::before,
.stage-test::before,
.stage-refine::before,
.stage-declare::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    width: 70%;
    height: 1px;
    background-color: var(--accent-primary);
    opacity: 0.2;
    animation: pulse-beam 4s ease-in-out infinite;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero-wordmark {
        font-size: clamp(3rem, 12vw, 6rem);
    }

    .surface-content {
        padding-left: 6vw;
    }

    .balance-beam {
        width: 80vw;
    }

    .weigh-content {
        width: 75%;
        margin-right: 6vw;
    }

    .weigh-statement {
        font-size: 22px;
    }

    .test-content {
        flex-direction: column;
        padding: 0 6vw;
    }

    .test-paragraphs {
        max-width: 100%;
    }

    .test-para-1,
    .test-para-2,
    .test-para-3 {
        margin-left: 0;
    }

    .test-para-2 {
        margin-left: 20px;
    }

    .test-para-3 {
        margin-left: 40px;
    }

    .test-waveform {
        width: 100%;
    }

    #waveform-canvas {
        max-width: 100%;
        height: 200px;
    }

    .refine-content {
        max-width: 85%;
    }

    .refine-statement {
        font-size: clamp(1.5rem, 4vw, 2.5rem);
    }

    .stage-numeral {
        font-size: 120px;
    }

    .border-frame {
        top: 20px;
        right: 20px;
        bottom: 20px;
        left: 20px;
    }
}
