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

:root {
    --parchment: #f0e6d3;
    --umber: #2c2219;
    --sienna: #a0522d;
    --brass: #b8953e;
    --slate: #7a7d7e;
    --terracotta: #c67a4a;
    --night: #1a1510;
    --dust-veil: rgba(240, 230, 211, 0.15);
    --scroll: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--parchment);
    color: var(--umber);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    font-weight: 400;
    line-height: 1.75;
    font-feature-settings: 'onum' 1, 'liga' 1;
    overflow-x: hidden;
}

/* === Progress Bar === */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: calc(var(--scroll) * 100%);
    background: linear-gradient(90deg, var(--sienna), var(--terracotta), var(--brass));
    z-index: 1000;
    transition: width 0.1s linear;
}

/* === Signal Line === */
.signal-line {
    position: fixed;
    top: 0;
    left: 12%;
    width: 10px;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

/* === Coordinate Markers === */
.coord {
    position: absolute;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 8px;
    color: var(--slate);
    opacity: 0.4;
    z-index: 5;
    pointer-events: none;
}
.coord-tl { top: 12px; left: 12px; }
.coord-tr { top: 12px; right: 12px; }
.coord-bl { bottom: 12px; left: 12px; }
.coord-br { bottom: 12px; right: 12px; }

/* === Dispatch Common === */
.dispatch {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.dispatch-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--sienna);
    display: block;
    margin-bottom: 1rem;
}

.dispatch-heading {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--umber);
    margin-bottom: 1.5rem;
}

/* === Animated Rules === */
.animated-rule {
    border: none;
    height: 1px;
    background-color: var(--terracotta);
    width: 0%;
    transition: width 2.5s cubic-bezier(0.22, 1, 0.36, 1);
    margin: 1.5rem 0;
}
.animated-rule.visible {
    width: 100%;
}

/* ===========================
   DISPATCH I — The Arrival
   =========================== */
.dispatch-1 {
    height: 100vh;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
}

.corridor-photo {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(175deg, rgba(176, 149, 110, 0.3) 0%, transparent 40%),
        linear-gradient(185deg, transparent 50%, rgba(44, 34, 25, 0.5) 100%),
        radial-gradient(ellipse at 50% 20%, rgba(184, 149, 62, 0.15) 0%, transparent 60%),
        linear-gradient(90deg, rgba(44, 34, 25, 0.15) 0%, transparent 15%, transparent 85%, rgba(44, 34, 25, 0.15) 100%),
        repeating-linear-gradient(90deg, transparent, transparent 120px, rgba(44, 34, 25, 0.03) 120px, rgba(44, 34, 25, 0.03) 121px),
        repeating-linear-gradient(180deg, transparent, transparent 80px, rgba(160, 82, 45, 0.02) 80px, rgba(160, 82, 45, 0.02) 81px),
        linear-gradient(180deg, #e8d9c2 0%, #f0e6d3 30%, #e5d4be 70%, #d4c4a8 100%);
    filter: sepia(0.25) saturate(0.7) brightness(0.95) contrast(1.05);
}

.dispatch-photo-overlay {
    position: absolute;
    inset: 0;
    background: var(--dust-veil);
    pointer-events: none;
}

.dispatch-lower-third {
    position: relative;
    z-index: 10;
    padding: 3rem 5vw 4rem;
}

.domain-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.15em;
    color: var(--brass);
    line-height: 1.1;
}

.title-underline {
    height: 2px;
    background: var(--terracotta);
    width: 0%;
    margin-top: 0.75rem;
    transition: width 3s cubic-bezier(0.22, 1, 0.36, 1);
}
.title-underline.visible {
    width: 100%;
}

/* ===========================
   DISPATCH II — The Briefing
   =========================== */
.dispatch-2 {
    min-height: 100vh;
    padding: 10vh 5vw;
}

.wireframe-globe {
    position: absolute;
    top: 15%;
    right: 10%;
    width: 300px;
    height: 300px;
    border: 1px solid var(--brass);
    border-radius: 50%;
    opacity: 0.08;
    transform: rotateX(60deg) rotateY(15deg);
}
.wireframe-globe::before {
    content: '';
    position: absolute;
    top: 25%;
    left: -5%;
    width: 110%;
    height: 50%;
    border: 1px solid var(--brass);
    border-radius: 50%;
}
.wireframe-globe::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 20%;
    width: 60%;
    height: 80%;
    border: 1px solid var(--brass);
    border-radius: 50%;
}

.briefing-layout {
    display: grid;
    grid-template-columns: 38% 1fr;
    gap: 5vw;
    position: relative;
    z-index: 2;
    max-width: 1200px;
}

.briefing-photo {
    position: relative;
    margin-top: -15vh;
    min-height: 60vh;
    overflow: hidden;
}

.document-texture {
    width: 100%;
    height: 100%;
    min-height: 60vh;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(160, 82, 45, 0.03) 3px, rgba(160, 82, 45, 0.03) 3.5px),
        repeating-linear-gradient(90deg, transparent, transparent 5px, rgba(44, 34, 25, 0.02) 5px, rgba(44, 34, 25, 0.02) 5.5px),
        radial-gradient(ellipse at 30% 40%, rgba(160, 82, 45, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(44, 34, 25, 0.06) 0%, transparent 40%),
        linear-gradient(180deg, #e2d1b8 0%, #ecdcc5 50%, #d8c7ad 100%);
    filter: sepia(0.25) saturate(0.7) brightness(0.95) contrast(1.05);
}

.briefing-text {
    padding-top: 5vh;
}

.prose {
    color: var(--umber);
    margin-bottom: 1.5rem;
}

/* ===========================
   DISPATCH III — The Negotiation
   =========================== */
.dispatch-3 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vh 10vw;
}

.negotiation-content {
    max-width: 700px;
    width: 100%;
    text-align: center;
}

.axiom {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 400;
    line-height: 2.8;
    color: var(--umber);
    opacity: 0;
    transition: opacity 1.2s ease;
}
.axiom.visible {
    opacity: 1;
}

.axiom-rule {
    margin: 0.5rem auto;
    max-width: 200px;
}

/* ===========================
   DISPATCH IV — The Archive
   =========================== */
.dispatch-4 {
    min-height: 120vh;
    position: relative;
    padding: 10vh 5vw;
}

.archive-grid-bg {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 79px, rgba(122, 125, 126, 0.04) 79px, rgba(122, 125, 126, 0.04) 80px),
        repeating-linear-gradient(90deg, transparent, transparent 79px, rgba(122, 125, 126, 0.04) 79px, rgba(122, 125, 126, 0.04) 80px);
    pointer-events: none;
}

.archive-container {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    min-height: 100vh;
}

.dispatch-number-archive {
    position: relative;
    z-index: 10;
}

.document-fragment {
    position: absolute;
    background: var(--parchment);
    padding: 2rem 2.5rem;
    box-shadow: 2px 4px 20px rgba(44, 34, 25, 0.12);
    border: 1px solid var(--terracotta);
    max-width: 340px;
    animation: borderPulse 4s ease-in-out infinite;
}

@keyframes borderPulse {
    0%, 100% { border-color: var(--terracotta); }
    50% { border-color: transparent; }
}

.frag-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--slate);
    margin-bottom: 0.75rem;
}

.frag-body {
    font-family: 'Source Serif 4', serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--umber);
}

.frag-body.serif-italic {
    font-style: italic;
}

.frag-body.mono-style {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
}

.frag-1 {
    top: 8%;
    left: 5%;
    transform: rotate(-2deg);
}
.frag-2 {
    top: 12%;
    right: 8%;
    transform: rotate(3deg);
}
.frag-3 {
    top: 42%;
    left: 25%;
    transform: rotate(-1deg);
}
.frag-4 {
    top: 55%;
    right: 5%;
    transform: rotate(4deg);
}
.frag-5 {
    top: 75%;
    left: 10%;
    transform: rotate(-3deg);
}

/* ===========================
   DISPATCH V — The Resolution
   =========================== */
.dispatch-5 {
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: linear-gradient(180deg, var(--umber), var(--night));
    position: relative;
}

.horizon-photo {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg,
            rgba(44, 34, 25, 0.6) 0%,
            rgba(26, 21, 16, 0.3) 40%,
            rgba(160, 82, 45, 0.15) 50%,
            rgba(184, 149, 62, 0.1) 52%,
            rgba(26, 21, 16, 0.5) 70%,
            rgba(26, 21, 16, 0.8) 100%
        );
    filter: sepia(0.25) saturate(0.7) brightness(0.95) contrast(1.05);
}

.resolution-photo-overlay {
    position: absolute;
    inset: 0;
    background: var(--dust-veil);
    pointer-events: none;
}

.resolution-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 0 10vw;
}

.resolution-text {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    font-weight: 400;
    color: var(--parchment);
    letter-spacing: var(--resolution-spacing, 0.02em);
    line-height: 1.4;
}

.colophon {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
}

.colophon-domain {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--brass);
    letter-spacing: 0.15em;
}

.colophon-border {
    height: 2px;
    background: var(--terracotta);
    margin-top: 0.5rem;
    width: 100%;
    animation: colophonPulse 3s ease-in-out infinite;
}

@keyframes colophonPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .briefing-layout {
        grid-template-columns: 1fr;
    }
    .briefing-photo {
        margin-top: 0;
        min-height: 40vh;
    }
    .document-fragment {
        position: relative;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        max-width: 100%;
        margin-bottom: 2rem;
    }
    .archive-container {
        min-height: auto;
    }
}
