/* ============================================
   freedom.compare — Memphis-Monochrome Design
   ============================================ */

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

:root {
    --black: #000000;
    --near-black: #1a1a1a;
    --dark-gray: #3d3d3d;
    --mid-gray: #7a7a7a;
    --light-gray: #c8c8c8;
    --pale-gray: #e8e8e8;
    --off-white: #f0f0f0;
    --white: #ffffff;
    --accent: #e63946;
    --font-display: 'Libre Baskerville', Georgia, serif;
    --font-body: 'Work Sans', Helvetica, sans-serif;
    --font-mono: 'Space Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
    background: var(--black);
    color: var(--white);
    font-family: var(--font-body);
    overflow-x: hidden;
}

/* --- Grid Confetti Background Texture --- */
.scene-light {
    background-color: var(--white);
    background-image:
        radial-gradient(circle, var(--light-gray) 1px, transparent 1px),
        linear-gradient(var(--light-gray) 1px, transparent 1px),
        linear-gradient(90deg, var(--light-gray) 1px, transparent 1px);
    background-size: 40px 40px, 40px 40px, 40px 40px;
    background-position: 20px 20px, 0 0, 0 0;
    background-blend-mode: normal;
}
.scene-light {
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='1.5' fill='%23c8c8c8' opacity='0.08'/%3E%3Cline x1='8' y1='6' x2='12' y2='6' stroke='%23c8c8c8' stroke-width='1' opacity='0.08'/%3E%3Cline x1='10' y1='4' x2='10' y2='8' stroke='%23c8c8c8' stroke-width='1' opacity='0.08'/%3E%3C/svg%3E");
    background-color: var(--white);
}

/* --- Fixed Side Nav --- */
#side-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 56px;
    height: 100vh;
    background: var(--black);
    border-right: 2px dotted var(--mid-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 1000;
}

.nav-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--white);
    background: transparent;
    transition: background 0.3s ease;
    cursor: pointer;
}

.nav-indicator.active {
    background: var(--white);
}

/* --- Scenes --- */
.scene {
    position: relative;
    min-height: 100vh;
    padding-left: 56px;
}

.scene-dark {
    background: var(--black);
    color: var(--white);
}

/* ============================================
   Scene 1: The Declaration
   ============================================ */
#scene-declaration {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}

.declaration-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

#freedom-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 10vw, 10rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--white);
}

#freedom-title .letter {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.12s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#freedom-title .letter.visible {
    opacity: 1;
}

#freedom-title .letter.shattered {
    opacity: 0.15;
}

.declaration-subtitle {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    color: var(--light-gray);
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
    letter-spacing: 0.01em;
    line-height: 1.65;
}

.declaration-subtitle.visible {
    opacity: 1;
}

.sparkline-container {
    margin-top: 3rem;
    width: 80vw;
    max-width: 1000px;
}

.sparkline-ribbon {
    width: 100%;
    height: 40px;
    margin-bottom: 8px;
}

.sparkline {
    fill: none;
    stroke: var(--mid-gray);
    stroke-width: 2.5;
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    transition: stroke-dashoffset 2s ease;
}

.sparkline.drawn {
    stroke-dashoffset: 0;
}

.spark-accent {
    fill: var(--accent);
    opacity: 0;
    transition: opacity 0.4s ease 2s;
}

.sparkline.drawn ~ .spark-accent {
    opacity: 1;
}

/* Memphis background decorations for scene 1 */
.memphis-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 1;
}

.memphis-bg.visible {
    opacity: 0.2;
}

/* --- Memphis Triangles (CSS border trick) --- */
.memphis-triangle {
    position: absolute;
    width: 0;
    height: 0;
}

.mt-1 {
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-bottom: 30px solid var(--white);
    top: 15%;
    left: 12%;
    transform: rotate(15deg);
    animation: bob 4s ease-in-out infinite;
}

.mt-2 {
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 20px solid var(--light-gray);
    top: 25%;
    right: 18%;
    transform: rotate(45deg);
    animation: bob 4s ease-in-out infinite 1s;
}

.mt-3 {
    border-left: 24px solid transparent;
    border-right: 24px solid transparent;
    border-bottom: 40px solid var(--dark-gray);
    bottom: 30%;
    right: 10%;
    transform: rotate(75deg);
    animation: slowRotate 60s linear infinite;
}

.mt-4 {
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 26px solid var(--light-gray);
    top: 60%;
    left: 8%;
    transform: rotate(45deg);
    animation: bob 4s ease-in-out infinite 0.5s;
}

.mt-5 {
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 18px solid var(--white);
    bottom: 15%;
    right: 25%;
    transform: rotate(15deg);
    animation: bob 4s ease-in-out infinite 2s;
}

/* --- Memphis Circles --- */
.memphis-circle {
    position: absolute;
    border-radius: 50%;
    border: 3px dotted var(--dark-gray);
    animation: slowRotate 60s linear infinite;
}

.mc-1 {
    width: 120px;
    height: 120px;
    top: 10%;
    right: 5%;
}

.mc-2 {
    width: 80px;
    height: 80px;
    bottom: 20%;
    left: 5%;
}

.mc-3 {
    width: 160px;
    height: 160px;
    top: 40%;
    right: 15%;
    border-color: var(--mid-gray);
}

/* ============================================
   Scene 2: The Measurement
   ============================================ */
#scene-measurement {
    min-height: 100vh;
    padding-top: 10vh;
    padding-bottom: 10vh;
    display: flex;
    align-items: center;
}

.measurement-grid {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

.comparison-row {
    display: grid;
    grid-template-columns: 180px 1fr 120px;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.comparison-row.in-view {
    opacity: 1;
    transform: translateY(0);
}

.comp-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: var(--black);
    letter-spacing: -0.03em;
}

.bar-container {
    display: flex;
    align-items: center;
    height: 32px;
    position: relative;
}

.bar-axis {
    width: 2px;
    height: 40px;
    border-left: 2px dotted var(--mid-gray);
    position: absolute;
    left: 50%;
    top: -4px;
}

.bar {
    height: 28px;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 0;
}

.bar-left {
    background: var(--black);
    position: absolute;
    right: 50%;
    margin-right: 1px;
}

.bar-right {
    background: var(--dark-gray);
    position: absolute;
    left: 50%;
    margin-left: 1px;
}

.bar-left.animated { width: var(--target-width); max-width: 50%; }
.bar-right.animated { width: var(--target-width); max-width: 50%; }

.accent-bar.animated {
    background: var(--accent);
}

.comp-values {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    letter-spacing: 0.08em;
    color: var(--near-black);
}

.value-accent {
    color: var(--accent);
}

/* Zigzag divider */
.zigzag-divider {
    height: 48px;
    width: 100%;
    background: linear-gradient(135deg, var(--black) 25%, transparent 25%) -24px 0,
                linear-gradient(225deg, var(--black) 25%, transparent 25%) -24px 0,
                linear-gradient(315deg, var(--black) 25%, transparent 25%),
                linear-gradient(45deg, var(--black) 25%, transparent 25%);
    background-size: 48px 48px;
    background-color: var(--white);
    opacity: 0.08;
    transition: transform 0.3s ease;
}

.zigzag-divider.pulse {
    animation: zigzagPulse 0.3s ease;
}

/* Memphis gutter */
.memphis-gutter {
    position: absolute;
    right: 0;
    top: 0;
    width: 20%;
    height: 100%;
    pointer-events: none;
}

.mg-1 {
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 36px solid var(--black);
    top: 15%;
    right: 10%;
    transform: rotate(15deg);
    animation: bob 4s ease-in-out infinite;
}

.mg-2 {
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-bottom: 24px solid var(--light-gray);
    top: 50%;
    right: 20%;
    transform: rotate(75deg);
    animation: bob 4s ease-in-out infinite 1.5s;
}

.mg-3 {
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-bottom: 30px solid var(--off-white);
    top: 80%;
    right: 5%;
    transform: rotate(45deg);
    animation: slowRotate 60s linear infinite;
}

.dotted-circle {
    position: absolute;
    border-radius: 50%;
    border: 3px dotted var(--dark-gray);
}

.dc-1 {
    width: 100px;
    height: 100px;
    top: 30%;
    right: -20px;
    animation: slowRotate 60s linear infinite;
}

.dc-2 {
    width: 140px;
    height: 140px;
    top: 65%;
    right: 15%;
    border-color: var(--mid-gray);
    animation: slowRotate 60s linear infinite reverse;
}

/* ============================================
   Scene 3: The Matrix
   ============================================ */
#scene-matrix {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 5vh;
    padding-bottom: 5vh;
}

.matrix-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

.dot-matrix {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 6px;
    width: min(400px, 80vw);
    height: min(400px, 80vw);
    margin-bottom: 4rem;
}

.dot-matrix .dot {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--dark-gray);
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.dot-matrix .dot.filled {
    background: var(--white);
}

.dot-matrix .dot.appear {
    opacity: 1;
}

.matrix-frame {
    position: absolute;
    inset: -60px;
    pointer-events: none;
}

.frame-dc-1 {
    width: 120px;
    height: 120px;
    top: -40px;
    left: -40px;
    border-color: var(--mid-gray);
}

.frame-dc-2 {
    width: 100px;
    height: 100px;
    bottom: 60px;
    right: -30px;
    border-color: var(--dark-gray);
}

.frame-dc-3 {
    width: 80px;
    height: 80px;
    top: 30%;
    right: -50px;
    border-color: var(--light-gray);
}

.frame-mt-1 {
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-bottom: 28px solid var(--light-gray);
    top: -20px;
    right: 20%;
    transform: rotate(45deg);
}

.frame-mt-2 {
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 20px solid var(--dark-gray);
    bottom: 80px;
    left: -20px;
    transform: rotate(15deg);
}

.frame-mt-3 {
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 34px solid var(--mid-gray);
    top: 50%;
    left: -50px;
    transform: rotate(75deg);
}

.frame-mt-4 {
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 18px solid var(--white);
    bottom: 20%;
    right: -20px;
    transform: rotate(15deg);
}

.frame-mt-5 {
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-bottom: 24px solid var(--light-gray);
    top: 10%;
    left: 20%;
    transform: rotate(45deg);
}

.matrix-columns {
    display: flex;
    gap: 4rem;
    width: min(600px, 80vw);
}

.matrix-col-left {
    flex: 1;
}

.matrix-col-right {
    flex: 1;
    text-align: right;
}

.matrix-item {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 1.6vw, 1.3rem);
    color: var(--white);
    padding: 1rem 0;
    border-bottom: 1px solid var(--dark-gray);
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.matrix-item.in-view {
    opacity: 1;
    transform: translateX(0);
}

.matrix-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(1.3rem, 2.2vw, 1.8rem);
    color: var(--mid-gray);
    letter-spacing: 0.08em;
    padding: 1rem 0;
    border-bottom: 1px solid var(--dark-gray);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.matrix-value.in-view {
    opacity: 1;
    transform: translateX(0);
}

.accent-value {
    color: var(--accent);
}

/* ============================================
   Scene 4: The Reckoning
   ============================================ */
#scene-reckoning {
    min-height: 100vh;
    overflow: hidden;
}

.reckoning-layout {
    display: flex;
    min-height: 100vh;
}

.reckoning-left {
    width: 70%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    padding: 5vh 3rem;
}

.radial-wheel {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: rotate(-360deg);
    transition: opacity 0.6s ease, transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.radial-wheel.in-view {
    opacity: 1;
    transform: rotate(0deg);
}

.wheel-label {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--near-black);
    text-align: center;
    position: absolute;
    bottom: -28px;
    width: 160px;
    letter-spacing: 0.01em;
}

.reckoning-right {
    width: 30%;
    background: var(--off-white);
    overflow: hidden;
    position: relative;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--mid-gray);
    letter-spacing: 0.08em;
    line-height: 2.2;
    padding: 2rem 1rem;
}

.waterfall-num {
    display: block;
    opacity: 0.6;
}

.waterfall-num.highlight {
    color: var(--accent);
    opacity: 1;
}

/* ============================================
   Scene 5: The Verdict
   ============================================ */
#scene-verdict {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.verdict-content {
    text-align: center;
    z-index: 2;
    position: relative;
    width: 100%;
}

.verdict-word {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 15vw, 15rem);
    color: var(--black);
    letter-spacing: -0.03em;
    line-height: 1.05;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.verdict-word.in-view {
    opacity: 1;
    transform: scale(1);
}

.verdict-sparkline {
    width: 90%;
    height: 60px;
    margin: 2rem auto 0;
    display: block;
}

.verdict-line {
    fill: none;
    stroke: var(--black);
    stroke-width: 2.5;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease;
}

.verdict-line.drawn {
    stroke-dashoffset: 0;
}

.bounce-dot {
    fill: var(--black);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bounce-dot.visible {
    opacity: 1;
    animation: bounceDot 1.5s ease-in-out infinite;
}

.bd-1 { animation-delay: 0s; }
.bd-2 { animation-delay: 0.2s; }
.bd-3 { animation-delay: 0.4s; }
.bd-4 { animation-delay: 0.6s; }
.bd-5 { animation-delay: 0.8s; }

.verdict-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    animation: confettiFall linear infinite;
}

.confetti-triangle {
    width: 0;
    height: 0;
}

.confetti-circle {
    border-radius: 50%;
}

/* ============================================
   Animations
   ============================================ */
@keyframes bob {
    0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
    50% { transform: translateY(-4px) rotate(var(--r, 0deg)); }
}

@keyframes slowRotate {
    to { transform: rotate(360deg); }
}

@keyframes zigzagPulse {
    0% { transform: scaleX(1); }
    50% { transform: scaleX(1.02); }
    100% { transform: scaleX(1); }
}

@keyframes bounceDot {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes confettiFall {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 0.3; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0.05; }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    #side-nav { width: 40px; }
    .scene { padding-left: 40px; }

    .comparison-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .comp-values {
        justify-content: flex-start;
        gap: 2rem;
    }

    .reckoning-layout {
        flex-direction: column;
    }

    .reckoning-left {
        width: 100%;
    }

    .reckoning-right {
        width: 100%;
        height: 40vh;
    }

    .matrix-columns {
        flex-direction: column;
        gap: 1rem;
    }

    .memphis-gutter { display: none; }
}
