/* ============================================
   doublestandard.xyz
   Two typographic measurement systems on one surface
   ============================================ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    background-color: #f0eff4;
}

body {
    background-color: #f0eff4;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Content Column: The Uneven Ledger --- */
.content-column {
    width: 68vw;
    margin-left: 22vw;
    margin-right: 10vw;
    padding-top: 12vw;
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* --- Marginalia Column --- */
.marginalia-column {
    position: fixed;
    top: 0;
    left: 0;
    width: 20vw;
    height: 100vh;
    padding: 12vw 2vw 4vw 2vw;
    overflow: hidden;
    pointer-events: none;
    z-index: 10;
    background-color: transparent;
}

.margin-note {
    position: absolute;
    left: 2vw;
    width: 14vw;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.margin-note.visible {
    opacity: 1;
}

.margin-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(107, 107, 126, 0.7);
    line-height: 1.4;
    display: block;
    background-color: rgba(232, 231, 237, 0.5);
    padding: 0.4em 0.6em;
}

.collision-label {
    color: rgba(194, 24, 91, 0.7);
}

/* --- System A: The Generous Standard --- */
.system-a .heading-a {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: clamp(3.6rem, 9.6vw, 9.6rem);
    letter-spacing: -0.03em;
    color: #1a1a2e;
    line-height: 1.1;
    margin-top: 12vw;
    margin-bottom: 3.2vw;
    max-width: 100%;
    position: relative;
}

.system-a .heading-a:first-child {
    margin-top: 0;
}

/* Debossed effect for System A headings */
.heading-a.debossed {
    text-shadow: 2px 2px 0 #e8e7ed;
}

.system-a p {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(1.1rem, 3.2vw, 3.2rem);
    line-height: 1.618;
    color: #2d2d3f;
    max-width: 72ch;
    margin-bottom: 1.6em;
}

.system-a p:last-child {
    margin-bottom: 0;
}

.section.system-a {
    padding-bottom: 6vw;
}

/* --- System B: The Punitive Standard --- */
.system-b .heading-b {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.4vw, 2.4rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b6b7e;
    line-height: 1.2;
    margin-top: 2vw;
    margin-bottom: 1vw;
}

.system-b p {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.15;
    color: #8a8a9c;
    max-width: 48ch;
    margin-bottom: 0.6em;
}

.system-b p:last-child {
    margin-bottom: 0;
}

.section.system-b {
    padding-bottom: 1.2vw;
}

/* --- Transition Rules --- */
.transition-rule {
    border: none;
    height: 1px;
    background-color: #3a3a4a;
    width: 100%;
    margin: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease-in;
}

.transition-rule.drawn {
    transform: scaleX(1);
}

/* Collision rules use accent color */
.collision-rule-top,
.collision-rule-bottom {
    height: 2px;
    background-color: #c2185b;
}

/* --- Reveal Animation --- */
.reveal {
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.reveal.visible {
    opacity: 1;
}

/* First section special entrance */
.section[data-index="0"] {
    opacity: 0;
}

.section[data-index="0"].entrance-complete {
    opacity: 1;
    transition: opacity 1.2s ease-out;
}

/* --- Collision Paragraph --- */
.collision-section {
    padding-top: 2vw;
    padding-bottom: 2vw;
}

.collision-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2vw;
}

.collision-left.system-a p {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(1.1rem, 3.2vw, 3.2rem);
    line-height: 1.618;
    color: #2d2d3f;
    max-width: none;
}

.collision-right.system-b p {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.15;
    color: #8a8a9c;
    max-width: none;
}

.collision-left {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.collision-right {
    opacity: 0;
    transition: opacity 0.3s ease-out 0.3s;
}

.collision-section.visible .collision-left,
.collision-section.visible .collision-right {
    opacity: 1;
}

/* --- Endmark --- */
.endmark {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.6rem;
    margin-top: 8vw;
    margin-bottom: 1.6rem;
}

.endmark-a {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: 2.4rem;
    color: #1a1a2e;
}

.endmark-divider {
    display: inline-block;
    width: 1px;
    height: 2.4rem;
    background-color: #c2185b;
}

.endmark-b {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b6b7e;
}

.endmark-line {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: #3a3a4a;
    text-align: center;
    margin-bottom: 0;
}

/* Terminal empty space */
.terminal-space {
    height: 20vh;
}

/* --- Accent color: annotation numbers --- */
.margin-label::first-letter {
    color: rgba(194, 24, 91, 0.85);
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .content-column {
        width: 90vw;
        margin-left: 5vw;
        margin-right: 5vw;
        padding-top: 8vw;
    }

    .marginalia-column {
        display: none;
    }

    /* Inline annotations on mobile */
    .section::before {
        font-family: 'IBM Plex Mono', monospace;
        font-weight: 300;
        font-size: 0.65rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(107, 107, 126, 0.7);
        display: block;
        margin-bottom: 1rem;
        padding: 0.3em 0.5em;
        background-color: rgba(232, 231, 237, 0.5);
    }

    .section.system-a[data-index="0"]::before { content: "Standard A, clause 1"; }
    .section.system-b[data-index="1"]::before { content: "Standard B, provision B-001"; }
    .section.system-a[data-index="2"]::before { content: "Standard A, clause 2"; }
    .section.system-a[data-index="3"]::before { content: "Standard A, clause 3"; }
    .section.system-b[data-index="4"]::before { content: "Standard B, provision B-002"; }
    .section.system-a[data-index="5"]::before { content: "Standard A, clause 4"; }
    .section.system-b[data-index="6"]::before { content: "Standard B, provision B-003"; }
    .section.system-b[data-index="7"]::before { content: "Standard B, provision B-004"; }
    .section.system-a[data-index="8"]::before { content: "Standard A, clause 5"; }
    .collision-section[data-index="9"]::before { content: "Collision zone"; color: rgba(194, 24, 91, 0.7); }
    .section.system-b[data-index="10"]::before { content: "Standard B, provision B-005"; }
    .section.system-a[data-index="11"]::before { content: "Standard A, clause 6"; }

    .system-b p {
        font-size: 0.95rem;
    }

    .system-a .heading-a {
        margin-top: 6vw;
    }

    .collision-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}
