/* ============================================
   supplychain.watch — Styles
   Scandinavian editorial magazine layout
   ============================================ */

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

:root {
    --navy-deep: #0b1628;
    --navy-mid: #162540;
    --navy-panel: #2a3a4e;
    --blue-accent: #3d8bc9;
    --gold-accent: #c8a97e;
    --red-alert: #d44a3c;
    --pale-steel: #e8edf2;
    --cloud: #f4f7fa;
    --muted: #8a9bae;
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    scroll-behavior: smooth;
}

body {
    background: var(--navy-deep);
    color: var(--pale-steel);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

/* --- Progress Indicator --- */
.progress-track {
    position: fixed;
    top: 0;
    right: 24px;
    width: 2px;
    height: 100vh;
    background: rgba(138, 155, 174, 0.15);
    z-index: 100;
}

.progress-fill {
    width: 100%;
    height: 0%;
    background: var(--blue-accent);
    transition: height 0.4s ease;
}

/* --- Spreads --- */
.spread {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
}

.spread-content {
    width: 100%;
    height: 100%;
    padding: clamp(2rem, 5vw, 6rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

/* --- Typography --- */
.display-title {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--pale-steel);
}

.title-xl {
    font-size: clamp(3rem, 8vw, 7rem);
}

.title-lg {
    font-size: clamp(2.5rem, 6vw, 5rem);
}

.title-md {
    font-size: clamp(2rem, 5vw, 4rem);
}

.spread-hero .display-title {
    font-size: clamp(4rem, 10vw, 9rem);
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    color: var(--muted);
    max-width: 480px;
    margin-top: 1.5rem;
}

.mono-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.mono-value {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 400;
    color: var(--blue-accent);
}

.spread-number {
    display: block;
    margin-bottom: 1.5rem;
    color: var(--gold-accent);
}

/* --- Split Layout --- */
.spread-split {
    flex-direction: row;
}

.spread-left, .spread-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

/* --- Hero Spread --- */
.spread-hero {
    background: var(--navy-deep);
}

.spread-hero .spread-text {
    position: relative;
    z-index: 2;
}

.spread-hero .hero-subtitle {
    margin-top: 2rem;
}

.container-counter {
    position: absolute;
    bottom: clamp(2rem, 5vw, 4rem);
    right: clamp(2rem, 5vw, 6rem);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    z-index: 2;
}

/* --- Network Spread --- */
.spread-network {
    background: var(--cloud);
}

.spread-network .display-title,
.spread-network .spread-number {
    color: var(--navy-deep);
}

.spread-network .body-text {
    color: var(--navy-panel);
}

.spread-network .mono-label {
    color: var(--navy-panel);
}

.route-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 2rem;
}

.route-line {
    height: 2px;
    background: linear-gradient(90deg, var(--blue-accent), transparent);
    width: 0;
    transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 1px;
}

.spread-network.is-active .route-line {
    width: 100%;
}

/* --- Observations Spread --- */
.spread-observations {
    background: var(--navy-mid);
}

.spread-observations .spread-content {
    align-items: flex-start;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.5rem, 3vw, 3rem);
    width: 100%;
    margin-top: 3rem;
}

.data-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(138, 155, 174, 0.1);
    border-radius: 2px;
    padding: clamp(1.5rem, 2.5vw, 2.5rem);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-stat {
    font-size: clamp(2rem, 4vw, 3.5rem);
}

/* --- Rhythm Spread --- */
.spread-rhythm {
    background: var(--navy-deep);
}

/* --- Signal Spread (Final) --- */
.spread-signal {
    background: var(--navy-deep);
}

.spread-signal .spread-content {
    align-items: center;
    text-align: center;
}

.centered {
    position: relative;
    z-index: 2;
}

.centered .body-text {
    margin-left: auto;
    margin-right: auto;
}

/* =============================================
   Signal Flag Compositions (Abstract Geometry)
   ============================================= */
.signal-composition {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.signal-shape {
    position: absolute;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.6s ease;
    will-change: transform;
}

/* Hero shapes */
.shape-rect {
    width: clamp(120px, 20vw, 280px);
    height: clamp(60px, 8vw, 120px);
    background: var(--blue-accent);
    opacity: 0.12;
    top: 12%;
    right: 8%;
}

.shape-tri {
    width: 0;
    height: 0;
    border-left: clamp(40px, 6vw, 80px) solid transparent;
    border-right: clamp(40px, 6vw, 80px) solid transparent;
    border-bottom: clamp(70px, 10vw, 140px) solid var(--gold-accent);
    opacity: 0.15;
    top: 25%;
    right: 20%;
}

.shape-circle {
    width: clamp(80px, 12vw, 180px);
    height: clamp(80px, 12vw, 180px);
    border-radius: 50%;
    border: 2px solid var(--blue-accent);
    opacity: 0.1;
    bottom: 20%;
    right: 15%;
}

.shape-band {
    width: clamp(200px, 30vw, 400px);
    height: 3px;
    background: var(--gold-accent);
    opacity: 0.2;
    top: 55%;
    right: 5%;
    transform: rotate(-15deg);
}

.shape-rect-sm {
    width: clamp(40px, 5vw, 70px);
    height: clamp(40px, 5vw, 70px);
    background: var(--red-alert);
    opacity: 0.1;
    bottom: 30%;
    right: 35%;
}

/* Network shapes */
.shape-diamond {
    width: clamp(60px, 8vw, 120px);
    height: clamp(60px, 8vw, 120px);
    background: var(--blue-accent);
    opacity: 0.15;
    transform: rotate(45deg);
    top: 20%;
    left: 15%;
}

.shape-hline {
    width: 60%;
    height: 2px;
    background: var(--navy-panel);
    opacity: 0.1;
    top: 50%;
    left: 10%;
}

.shape-circle-lg {
    width: clamp(140px, 18vw, 260px);
    height: clamp(140px, 18vw, 260px);
    border-radius: 50%;
    border: 2px solid var(--gold-accent);
    opacity: 0.12;
    bottom: 15%;
    left: 20%;
}

.shape-tri-inv {
    width: 0;
    height: 0;
    border-left: clamp(30px, 4vw, 60px) solid transparent;
    border-right: clamp(30px, 4vw, 60px) solid transparent;
    border-top: clamp(50px, 7vw, 100px) solid var(--red-alert);
    opacity: 0.1;
    top: 35%;
    left: 40%;
}

/* Card shapes */
.shape-sq-accent {
    width: 40px;
    height: 40px;
    background: var(--gold-accent);
    opacity: 0.15;
    top: -10px;
    right: -10px;
}

.shape-circle-accent {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--blue-accent);
    opacity: 0.1;
    top: -15px;
    right: -15px;
}

.shape-tri-accent {
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-bottom: 40px solid var(--red-alert);
    opacity: 0.12;
    top: -8px;
    right: -8px;
}

/* Rhythm shapes - container silhouettes */
.shape-wave-1, .shape-wave-2, .shape-wave-3 {
    height: 2px;
    background: var(--blue-accent);
    opacity: 0.15;
    left: 5%;
}

.shape-wave-1 {
    width: 80%;
    top: 30%;
}

.shape-wave-2 {
    width: 65%;
    top: 50%;
    opacity: 0.1;
}

.shape-wave-3 {
    width: 45%;
    top: 70%;
    opacity: 0.08;
}

.shape-container-1, .shape-container-2, .shape-container-3 {
    width: clamp(60px, 8vw, 100px);
    height: clamp(30px, 4vw, 50px);
    border: 2px solid var(--gold-accent);
    opacity: 0.12;
}

.shape-container-1 {
    top: 25%;
    right: 15%;
}

.shape-container-2 {
    top: 45%;
    right: 25%;
}

.shape-container-3 {
    top: 65%;
    right: 10%;
}

/* Final spread signal flags */
.shape-flag-1 {
    width: clamp(50px, 7vw, 100px);
    height: clamp(50px, 7vw, 100px);
    background: var(--blue-accent);
    opacity: 0.08;
    top: 10%;
    left: 10%;
}

.shape-flag-2 {
    width: clamp(80px, 10vw, 150px);
    height: clamp(40px, 5vw, 70px);
    background: var(--gold-accent);
    opacity: 0.1;
    top: 15%;
    right: 12%;
}

.shape-flag-3 {
    width: 0;
    height: 0;
    border-left: clamp(40px, 5vw, 70px) solid transparent;
    border-right: clamp(40px, 5vw, 70px) solid transparent;
    border-bottom: clamp(60px, 8vw, 120px) solid var(--red-alert);
    opacity: 0.08;
    bottom: 20%;
    left: 15%;
}

.shape-flag-4 {
    width: clamp(100px, 14vw, 200px);
    height: clamp(100px, 14vw, 200px);
    border-radius: 50%;
    border: 2px solid var(--blue-accent);
    opacity: 0.06;
    bottom: 25%;
    right: 20%;
}

.shape-flag-5 {
    width: clamp(30px, 4vw, 60px);
    height: clamp(30px, 4vw, 60px);
    background: var(--red-alert);
    opacity: 0.06;
    top: 40%;
    left: 5%;
    transform: rotate(45deg);
}

.shape-flag-6 {
    width: 40%;
    height: 2px;
    background: var(--gold-accent);
    opacity: 0.1;
    top: 60%;
    right: 0;
    transform: rotate(-8deg);
}

.shape-flag-7 {
    width: clamp(50px, 6vw, 90px);
    height: clamp(70px, 9vw, 130px);
    background: var(--blue-accent);
    opacity: 0.06;
    bottom: 10%;
    left: 40%;
}

/* --- Spread entry animations --- */
.spread .display-title,
.spread .body-text,
.spread .mono-label,
.spread .mono-value,
.spread .data-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.spread.is-active .display-title {
    opacity: 1;
    transform: translateY(0);
}

.spread.is-active .body-text {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}

.spread.is-active .mono-label {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
}

.spread.is-active .mono-value {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.spread.is-active .data-card {
    opacity: 1;
    transform: translateY(0);
}

.spread.is-active .data-card:nth-child(1) { transition-delay: 0.2s; }
.spread.is-active .data-card:nth-child(2) { transition-delay: 0.35s; }
.spread.is-active .data-card:nth-child(3) { transition-delay: 0.5s; }

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

    .spread-left, .spread-right {
        flex: none;
        padding: 1rem;
    }

    .data-grid {
        grid-template-columns: 1fr;
    }

    .container-counter {
        position: relative;
        bottom: auto;
        right: auto;
        align-items: flex-start;
        margin-top: 2rem;
    }
}
