/* ============================================
   doublestandard.xyz - Styles
   Judicial Noir / Split-Screen Duality
   ============================================ */

/* --- Custom Properties --- */
:root {
    /* Colors */
    --left-bg: #1C1410;
    --right-bg: #0D1520;
    --left-text: #F5ECD7;
    --right-text: #B8D4E8;
    --divider-gold: #C8A45A;
    --left-highlight: #8B4513;
    --right-highlight: #2C5F8A;
    --warning-red: #A63D40;
    --merge-bg: #3D3A2E;
    --black: #121212;

    /* Timing */
    --transition-warm: 600ms ease-in-out;
    --transition-cold: 400ms linear;
    --breathing-duration: 4s;
}

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

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

body {
    background: var(--black);
    overflow-x: hidden;
    font-size: 18px;
    line-height: 1.65;
}

/* --- Opening Overlay --- */
#opening-overlay {
    position: fixed;
    inset: 0;
    background: var(--black);
    z-index: 1000;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.6s ease-out;
}

#opening-overlay.fade-out {
    opacity: 0;
}

/* --- Central Dividing Line --- */
#central-line-container {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100vh;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#central-line-container.visible {
    opacity: 1;
}

#central-line-container.shattered {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#central-line-svg {
    width: 100%;
    height: 100%;
}

#central-line {
    stroke-dashoffset: 300;
    animation: drawLine 1.2s ease-out forwards;
    animation-play-state: paused;
}

#central-line-container.visible #central-line {
    animation-play-state: running;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes breathe {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

#central-line-container.breathing #central-line {
    animation: drawLine 1.2s ease-out forwards, breathe var(--breathing-duration) ease-in-out infinite;
    animation-delay: 0s, 1.2s;
}

/* --- Shattered Fragments --- */
#shattered-fragments {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 51;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#shattered-fragments.active {
    opacity: 1;
}

.shard {
    position: absolute;
    left: 50%;
    background: var(--divider-gold);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s ease;
}

.shard.scattered {
    opacity: 0;
}

/* --- Scales Motif --- */
#scales-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 180px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

#scales-container.visible {
    opacity: 1;
}

#scales-svg .scales-beam {
    transform-origin: 100px 50px;
    transition: transform 1.5s ease-in-out;
}

#scales-svg.tilt-left .scales-beam {
    transform: rotate(-8deg);
}

#scales-svg.tilt-right .scales-beam {
    transform: rotate(8deg);
}

#scales-svg .scales-line,
#scales-svg .scales-pan-left,
#scales-svg .scales-pan-right {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease;
}

#scales-container.visible .scales-line,
#scales-container.visible .scales-pan-left,
#scales-container.visible .scales-pan-right {
    stroke-dashoffset: 0;
}

/* --- Panels --- */
.panel {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

.panel-left,
.panel-right {
    position: relative;
    width: 50%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.panel-left {
    background: var(--left-bg);
}

.panel-right {
    background: var(--right-bg);
}

/* --- Crosshatch Backgrounds --- */
.crosshatch-left {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 16px,
        rgba(200, 164, 90, 0.08) 16px,
        rgba(200, 164, 90, 0.08) 16.5px
    );
    pointer-events: none;
}

.crosshatch-right {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 16px,
        rgba(44, 95, 138, 0.08) 16px,
        rgba(44, 95, 138, 0.08) 16.5px
    );
    pointer-events: none;
}

/* --- Panel Content --- */
.panel-content {
    position: relative;
    z-index: 5;
    padding: 40px;
    max-width: 480px;
}

.left-content {
    text-align: right;
    margin-left: auto;
    margin-right: 40px;
}

.right-content {
    text-align: left;
    margin-right: auto;
    margin-left: 40px;
}

/* --- Typography: Left Side (Standard A) --- */
.left-type {
    font-family: 'Playfair Display', serif;
    color: var(--left-text);
}

h1.left-type {
    font-weight: 700;
    font-size: clamp(48px, 8vw, 80px);
    line-height: 1.1;
}

h2.left-type {
    font-weight: 700;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.2;
    margin-bottom: 24px;
}

.left-body {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    color: var(--left-text);
    margin-bottom: 16px;
}

.left-body em {
    color: var(--divider-gold);
    font-style: italic;
}

/* --- Typography: Right Side (Standard B) --- */
.right-type {
    font-family: 'Archivo', sans-serif;
    color: var(--right-text);
}

h1.right-type {
    font-weight: 600;
    font-size: clamp(48px, 8vw, 80px);
    line-height: 1.1;
}

h2.right-type {
    font-weight: 600;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.2;
    margin-bottom: 24px;
}

.right-body {
    font-family: 'Archivo', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    color: var(--right-text);
    margin-bottom: 16px;
}

.right-body em {
    color: var(--divider-gold);
    font-style: italic;
}

/* --- Typography: Accent --- */
.accent-type {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 14px;
    color: var(--divider-gold);
    letter-spacing: 0.08em;
}

/* --- Hero Word (Panel 1) --- */
.hero-word {
    opacity: 0;
    transition: opacity var(--transition-warm);
}

.hero-word.visible {
    opacity: 1;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    animation: pulseChevron 2s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.scroll-indicator.visible {
    opacity: 1;
}

@keyframes pulseChevron {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.5; }
    50% { transform: translateX(-50%) translateY(6px); opacity: 1; }
}

/* --- Reveal Blocks --- */
.reveal-block {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.left-reveal {
    transform: translateX(-40px) rotate(2deg);
}

.right-reveal {
    transform: translateX(40px) rotate(-2deg);
}

.left-reveal.revealed {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
    transition-duration: 600ms;
    transition-timing-function: ease-in-out;
}

.right-reveal.revealed {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
    transition-duration: 400ms;
    transition-timing-function: linear;
    transition-delay: 200ms;
}

/* --- Statement Block (Panel 3) --- */
.statement-block {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.statement {
    font-size: clamp(24px, 4vw, 40px);
    line-height: 1.3;
    font-weight: 700;
}

.strikethrough {
    text-decoration: line-through;
    text-decoration-color: var(--warning-red);
    text-decoration-thickness: 3px;
}

.bold-emphasis {
    font-weight: 700;
    color: var(--divider-gold);
}

/* --- Redaction Bars --- */
.redaction-target {
    position: relative;
    display: inline-block;
}

.redaction-target::after {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    width: calc(100% + 8px);
    height: 100%;
    background: var(--warning-red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s ease;
}

.redaction-target.redacted::after {
    transform: scaleX(1);
}

.redaction-target.unredacted::after {
    transform: scaleX(0);
    transform-origin: right;
}

/* --- Panel 4: The Break --- */
.panel-break {
    position: relative;
    justify-content: center;
    align-items: center;
}

.panel-break .panel-left,
.panel-break .panel-right {
    transition: background 1.2s ease;
}

.panel-break.merging .panel-left {
    background: color-mix(in srgb, var(--left-bg) 50%, var(--right-bg) 50%);
}

.panel-break.merging .panel-right {
    background: color-mix(in srgb, var(--right-bg) 50%, var(--left-bg) 50%);
}

.panel-center-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 55;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.panel-center-content.visible {
    opacity: 1;
}

#break-text {
    font-size: clamp(48px, 8vw, 96px);
    color: var(--warning-red);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.04em;
}

/* Fingerprint SVG */
#fingerprint-svg {
    width: 160px;
    height: 200px;
    opacity: 0.6;
}

.fp-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2.5s ease;
}

.panel-center-content.visible .fp-path {
    stroke-dashoffset: 0;
}

/* --- Panel 5: The Merge --- */
.panel-merge {
    background: var(--merge-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 100vh;
}

.panel-merge::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 16px,
            rgba(200, 164, 90, 0.05) 16px,
            rgba(200, 164, 90, 0.05) 16.5px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 16px,
            rgba(44, 95, 138, 0.05) 16px,
            rgba(44, 95, 138, 0.05) 16.5px
        );
    pointer-events: none;
}

.merge-content {
    position: relative;
    z-index: 5;
    max-width: 640px;
    padding: 60px 24px;
    text-align: left;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

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

#scales-balanced {
    display: block;
    width: 120px;
    height: auto;
    margin: 0 auto 40px;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.merge-content.visible #scales-balanced {
    opacity: 1;
}

.merge-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 22px;
    line-height: 1.65;
    color: var(--left-text);
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .panel {
        flex-direction: column;
    }

    .panel-left,
    .panel-right {
        width: 100%;
        min-height: 50vh;
    }

    .left-content,
    .right-content {
        text-align: center;
        margin: 0 auto;
        padding: 40px 24px;
    }

    #central-line-container {
        display: none;
    }

    .panel-left {
        border-bottom: 2px solid var(--divider-gold);
    }

    .left-reveal {
        transform: translateY(-30px) rotate(0deg);
    }

    .right-reveal {
        transform: translateY(30px) rotate(0deg);
    }

    .left-reveal.revealed,
    .right-reveal.revealed {
        transform: translateY(0) rotate(0deg);
    }

    .panel-center-content {
        position: relative;
        transform: none;
        top: auto;
        left: auto;
        padding: 60px 24px;
    }

    .panel-break {
        flex-direction: column;
    }

    .panel-break .panel-left,
    .panel-break .panel-right {
        min-height: 25vh;
    }

    h1.left-type,
    h1.right-type {
        font-size: clamp(36px, 10vw, 60px);
    }

    .merge-content {
        padding: 40px 20px;
    }
}
