/* ============================================
   double-standard.org
   A visual argument in asymmetric formatting
   ============================================ */

/* --- Custom Properties --- */
:root {
    /* Backgrounds */
    --bg-favored: #f7f5f2;
    --bg-diminished: #e8e4de;

    /* Fault line */
    --fault-line-color: #3d3d3d;

    /* Text */
    --text-favored: #1a1a1a;
    --text-diminished: #4a4a4a;

    /* Accents */
    --accent-favored: #8b1a1a;
    --accent-diminished: #a07858;
    --reveal-accent: #2c4a6b;

    /* Counter / Label */
    --counter-color: #6b6b6b;
    --muted: #b0b0b0;

    /* Spacing (asymmetric) */
    --pad-favored: clamp(60px, 8vw, 120px);
    --pad-diminished: clamp(16px, 2vw, 32px);

    /* Line heights */
    --lh-favored: 1.8;
    --lh-diminished: 1.35;

    /* Opacity */
    --opacity-favored: 1;
    --opacity-diminished: 0.72;

    /* Split ratio */
    --split-favored: 58%;
    --split-diminished: 42%;

    /* Fonts */
    --font-display-favored: 'DM Serif Display', serif;
    --font-display-diminished: 'DM Sans', sans-serif;
    --font-body: 'IBM Plex Mono', monospace;
}

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

html {
    scroll-snap-type: y proximity;
    overflow-x: hidden;
    scroll-behavior: auto;
}

body {
    font-family: var(--font-body);
    background: var(--bg-favored);
    color: var(--text-favored);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- The Fault Line --- */
#fault-line {
    position: fixed;
    top: 0;
    left: var(--split-favored);
    width: 1px;
    height: 100vh;
    background: var(--fault-line-color);
    z-index: 100;
    box-shadow: -0.5px 0 0 0 rgba(247, 245, 242, 0.15);
    transition: opacity 1.5s ease, border-style 0.5s ease;
}

#fault-line.dissolving-1 {
    background: transparent;
    border-right: 1px dashed var(--fault-line-color);
}

#fault-line.dissolving-2 {
    background: transparent;
    border-right: 1px dotted var(--fault-line-color);
}

#fault-line.dissolved {
    opacity: 0;
    border: none;
    background: transparent;
}

/* --- Exhibit Counter --- */
#exhibit-counter {
    position: fixed;
    bottom: 24px;
    right: 28px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--counter-color);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#exhibit-counter.visible {
    opacity: 1;
}

/* --- Exhibits Container --- */
#exhibits {
    width: 100%;
}

/* --- Exhibit (each section) --- */
.exhibit {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--split-favored) var(--split-diminished);
    scroll-snap-align: start;
    overflow: hidden;
}

/* --- Background Exhibit Numbers --- */
.exhibit-bg-number {
    position: absolute;
    font-family: var(--font-display-favored);
    font-size: 20vw;
    font-weight: 400;
    line-height: 1;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
    user-select: none;
}

.exhibit-bg-number.favored-bg {
    left: 5%;
    color: var(--text-favored);
    opacity: 0.03;
}

.exhibit-bg-number.diminished-bg {
    right: 2%;
    color: var(--text-diminished);
    opacity: 0.015;
    text-align: right;
}

/* --- Column Base Styles --- */
.col-favored {
    background: var(--bg-favored);
    padding: clamp(80px, 12vh, 160px) var(--pad-favored) clamp(80px, 12vh, 160px) var(--pad-favored);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 1;
    margin-bottom: 0;
}

.col-diminished {
    background: var(--bg-diminished);
    padding: clamp(40px, 6vh, 80px) var(--pad-diminished) clamp(40px, 6vh, 80px) var(--pad-diminished);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 1;
    opacity: var(--opacity-diminished);
}

/* --- Exhibit A: Opening --- */
#exhibit-a .col-favored {
    padding-left: var(--pad-favored);
}

.display-favored {
    font-family: var(--font-display-favored);
    font-size: clamp(2.5rem, 5vw, 5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text-favored);
    line-height: 1.1;
    position: relative;
}

.display-diminished {
    font-family: var(--font-display-diminished);
    font-size: clamp(1.25rem, 2.5vw, 2.5rem);
    font-weight: 400;
    letter-spacing: 0.01em;
    color: var(--text-diminished);
    line-height: 1.2;
}

/* --- Exhibit B-F: Headers --- */
.header-favored {
    font-family: var(--font-display-favored);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text-favored);
    line-height: 1.15;
    margin-bottom: 40px;
    position: relative;
    margin-right: -40px;
}

.header-diminished {
    font-family: var(--font-display-diminished);
    font-size: clamp(1.2rem, 2.2vw, 2rem);
    font-weight: 400;
    letter-spacing: 0.01em;
    color: var(--text-diminished);
    line-height: 1.25;
    margin-bottom: 16px;
}

/* --- Exhibit B-F: Body Text --- */
.body-favored {
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 1.8vw, 1.4rem);
    font-weight: 400;
    line-height: var(--lh-favored);
    color: var(--text-favored);
    max-width: 580px;
}

.body-diminished {
    font-family: var(--font-body);
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    font-weight: 400;
    line-height: var(--lh-diminished);
    color: var(--text-diminished);
    max-width: 400px;
}

/* --- Red Margin Annotations (favored side only) --- */
.annotation {
    position: relative;
    display: inline;
}

.annotation::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--accent-favored);
    border-radius: 0;
    /* Slightly irregular hand-ruled quality */
    clip-path: polygon(0% 40%, 3% 0%, 8% 60%, 15% 20%, 22% 80%, 30% 10%, 38% 70%, 45% 30%, 52% 90%, 60% 15%, 68% 75%, 75% 25%, 82% 85%, 90% 5%, 95% 60%, 100% 35%);
}

/* --- Stagger Text Animation --- */
.stagger-text .word {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.stagger-text.revealed .word {
    opacity: 1;
}

/* Diminished side: text is always fully visible (no ceremony) */
.body-diminished {
    opacity: 1;
}

/* --- Exhibit G: Final --- */
.exhibit-final {
    position: relative;
}

.exhibit-final .col-final-favored {
    background: var(--bg-favored);
    transition: all 3s ease;
}

.exhibit-final .col-final-diminished {
    background: var(--bg-diminished);
    transition: all 3s ease;
}

.exhibit-final.unified {
    grid-template-columns: 50% 50%;
}

.exhibit-final.unified .col-final-favored,
.exhibit-final.unified .col-final-diminished {
    background: var(--bg-favored);
    opacity: 1;
}

.final-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.final-message p {
    position: absolute;
    font-family: var(--font-body);
    font-size: clamp(1.1rem, 2.2vw, 1.8rem);
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--reveal-accent);
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s ease;
    max-width: 80%;
}

#final-text-1.visible {
    opacity: 1;
}

#final-text-2.visible {
    opacity: 1;
}

/* --- Spacing Between Exhibits --- */
.exhibit + .exhibit .col-favored {
    border-top: none;
}

.exhibit + .exhibit .col-diminished {
    border-top: none;
}

/* Favored side gets 120px gap (via padding top), diminished gets 40px */
.exhibit:not(:first-child) .col-favored {
    padding-top: clamp(120px, 15vh, 200px);
}

.exhibit:not(:first-child) .col-diminished {
    padding-top: clamp(40px, 5vh, 80px);
}

/* --- Mobile Adaptation (< 768px) --- */
@media (max-width: 768px) {
    .exhibit {
        grid-template-columns: 1fr;
        grid-template-rows: 58% 42%;
    }

    #fault-line {
        left: 0;
        top: 58%;
        width: 100%;
        height: 1px;
    }

    #fault-line.dissolving-1 {
        border-right: none;
        border-bottom: 1px dashed var(--fault-line-color);
    }

    #fault-line.dissolving-2 {
        border-right: none;
        border-bottom: 1px dotted var(--fault-line-color);
    }

    .exhibit-bg-number {
        font-size: 30vw;
    }

    .exhibit-bg-number.diminished-bg {
        right: auto;
        left: 5%;
    }

    #exhibit-counter {
        bottom: 16px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .header-favored {
        margin-right: 0;
    }

    .col-favored {
        padding: clamp(40px, 8vh, 80px) clamp(24px, 5vw, 48px);
    }

    .col-diminished {
        padding: clamp(16px, 3vh, 32px) clamp(12px, 3vw, 24px);
    }

    .exhibit-final.unified {
        grid-template-columns: 1fr;
        grid-template-rows: 50% 50%;
    }

    .body-favored {
        max-width: 100%;
    }

    .body-diminished {
        max-width: 100%;
    }
}

/* --- Exhibit transition (grid-template-columns) --- */
.exhibit-final {
    transition: grid-template-columns 3s ease;
}
