/* ============================================
   supplychain.watch - Editorial Magazine Design
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0e0e12;
    --bg-secondary: #f5f0e8;
    --surface: #1c1c24;
    --neon-magenta: #ff00ff;
    --neon-cyan: #00ffcc;
    --neon-coral: #ff3366;
    --text-cream: #f5f0e8;
    --text-graphite: #1a1a1e;
    --grain-warm: #c8b89a;
    --marble-alabaster: #e8e0d0;
    --marble-base: #d4ccc0;
    --marble-mid: #c8c0b4;
    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Source Serif 4', 'Georgia', serif;
    --font-mono: 'Space Mono', monospace;
    --spring-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background: var(--bg-primary);
    color: var(--text-cream);
    font-family: var(--font-body);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Film Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.05;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="4" stitchTiles="stitch"/></filter><rect width="200" height="200" filter="url(%23n)" opacity="1"/></svg>');
    background-size: 200px 200px;
    animation: grainShift 0.5s steps(4) infinite;
}

@keyframes grainShift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 1px); }
    50% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, 2px); }
    100% { transform: translate(2px, -2px); }
}

/* --- Glitch Line --- */
#glitch-line {
    position: fixed;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--neon-magenta);
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 0 10px var(--neon-magenta), 0 0 30px var(--neon-magenta);
    transition: none;
}

#glitch-line.flash {
    opacity: 0.6;
}

/* --- Scan Lines --- */
.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    z-index: 2;
}

/* --- Navigation --- */
#magazine-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.4s var(--spring-ease);
    background: linear-gradient(to top, rgba(14, 14, 18, 0.95), rgba(14, 14, 18, 0));
    padding: 2rem clamp(2rem, 5vw, 6rem) 1.5rem;
}

#magazine-nav.visible {
    transform: translateY(0);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(200, 184, 154, 0.2);
    padding-top: 1rem;
}

.nav-folio,
.nav-issue {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--grain-warm);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-cream);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.nav-links a::before {
    content: attr(data-index) ' ';
    color: var(--neon-cyan);
    opacity: 0.5;
}

.nav-links a:hover {
    opacity: 1;
    color: var(--neon-cyan);
}

/* --- Spreads (Sections) --- */
.spread {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 6rem);
}

.spread-dark {
    background: var(--bg-primary);
    color: var(--text-cream);
}

.spread-light {
    background: var(--bg-secondary);
    color: var(--text-graphite);
}

.spread-marble {
    background: var(--marble-base);
    color: var(--text-graphite);
}

.spread-content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Section Numbers --- */
.section-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--neon-magenta);
    opacity: 0.5;
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
}

.section-number.neon-cyan {
    color: var(--neon-cyan);
    text-shadow: 0 0 20px rgba(0, 255, 204, 0.4);
}

.section-number.neon-magenta {
    color: var(--neon-magenta);
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
}

.section-number.graphite {
    color: var(--text-graphite);
    text-shadow: none;
    opacity: 0.3;
}

/* --- SPREAD 1: Hero --- */
.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem 0;
}

.hero-title-container {
    margin-bottom: 1rem;
}

.hero-title-row {
    display: flex;
    justify-content: center;
    gap: clamp(0.2rem, 1vw, 1rem);
}

.hero-letter {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 10vw, 12rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--neon-magenta);
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
    line-height: 1;
    display: inline-block;
    position: relative;
    animation: neonFlicker 3s ease-in-out infinite;
}

.hero-letter::before,
.hero-letter::after {
    content: attr(data-letter);
    position: absolute;
    top: 0;
    left: 0;
}

@keyframes neonFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.92; }
    75% { opacity: 0.97; }
}

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

.hero-watch {
    font-family: var(--font-display);
    font-size: clamp(0.8rem, 2vw, 1.4rem);
    letter-spacing: 0.5em;
    text-transform: uppercase;
    color: var(--text-cream);
    opacity: 0.7;
}

.hero-tagline {
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 1.5vw, 1.125rem);
    color: var(--text-cream);
    opacity: 0.5;
    max-width: 30em;
    line-height: 1.75;
    margin-bottom: 4rem;
}

.hero-scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-text {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--neon-cyan);
    opacity: 0.5;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--neon-cyan), transparent);
    opacity: 0.4;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* RGB Channel Split for Hero */
.hero-title-container {
    position: relative;
}

/* --- SPREAD 2: What --- */
.what-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 5vw, 6rem);
    align-items: center;
    min-height: 80vh;
}

.what-left {
    padding-right: 2rem;
}

.pull-quote {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-style: italic;
    line-height: 1.4;
    color: var(--text-graphite);
    position: relative;
}

.pq-mark {
    font-family: var(--font-display);
    font-size: 1.5em;
    color: var(--neon-coral);
    vertical-align: -0.1em;
    line-height: 0;
}

.what-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-graphite);
    margin-bottom: 2rem;
    line-height: 1.1;
}

.what-body {
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text-graphite);
    max-width: 38em;
    margin-bottom: 1.5rem;
    opacity: 0.85;
}

.what-annotation {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(26, 26, 30, 0.15);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.annotation-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-graphite);
    opacity: 0.5;
}

.annotation-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--neon-coral);
    letter-spacing: -0.02em;
}

.marble-veining-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.08;
    background:
        radial-gradient(ellipse at 20% 50%, var(--grain-warm) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, var(--marble-mid) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 80%, var(--marble-alabaster) 0%, transparent 45%);
}

/* --- SPREAD 3: Network --- */
.network-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 80vh;
    justify-content: center;
}

.network-header {
    display: flex;
    align-items: baseline;
    gap: 2rem;
}

.network-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-cream);
}

.network-map {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.map-svg {
    width: 100%;
    height: auto;
}

.continent {
    fill: var(--marble-base);
    opacity: 0.15;
}

.route-line {
    stroke-dasharray: 8 4;
    animation: routePulse 3s linear infinite;
}

.route-1 { animation-delay: 0s; }
.route-2 { animation-delay: 0.5s; }
.route-3 { animation-delay: 1s; }
.route-4 { animation-delay: 1.5s; }
.route-5 { animation-delay: 2s; }
.route-6 { animation-delay: 2.5s; }

@keyframes routePulse {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -24; }
}

.port-node {
    animation: portGlow 2s ease-in-out infinite;
}

@keyframes portGlow {
    0%, 100% { r: 4; opacity: 1; }
    50% { r: 6; opacity: 0.7; }
}

.map-annotations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.map-anno {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.anno-1 { top: 15%; left: 30%; }
.anno-2 { top: 18%; right: 30%; }
.anno-3 { bottom: 40%; left: 35%; }

.anno-code {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--neon-cyan);
    letter-spacing: -0.02em;
}

.anno-desc {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-cream);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- SPREAD 4: Live Pulse --- */
.pulse-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 80vh;
    justify-content: center;
}

.pulse-header {
    display: flex;
    align-items: baseline;
    gap: 2rem;
    flex-wrap: wrap;
}

.pulse-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-cream);
}

.pulse-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-cyan);
    animation: dotBlink 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px var(--neon-cyan);
}

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

.status-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--neon-cyan);
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.3);
}

.pulse-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: auto auto;
    gap: 2rem;
}

.pulse-counter {
    background: var(--surface);
    border: 1px solid rgba(200, 184, 154, 0.1);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.counter-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-cream);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.counter-value {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    color: var(--neon-magenta);
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
    animation: neonFlicker 3s ease-in-out infinite;
}

.counter-unit {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--neon-cyan);
    letter-spacing: -0.02em;
    opacity: 0.7;
}

.pulse-ticker {
    background: var(--surface);
    border: 1px solid rgba(200, 184, 154, 0.1);
    padding: 1.5rem 2rem;
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 1 / 3;
}

.ticker-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-cream);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(200, 184, 154, 0.1);
}

.ticker-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

.ticker-line {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(200, 184, 154, 0.05);
    transition: opacity 0.3s ease;
}

.ticker-id {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--neon-cyan);
    letter-spacing: -0.02em;
    min-width: 10em;
}

.ticker-route {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-cream);
    opacity: 0.7;
    flex: 1;
}

.ticker-status {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
}

.status-transit {
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 255, 204, 0.3);
}

.status-arrived {
    color: var(--neon-magenta);
    border: 1px solid rgba(255, 0, 255, 0.3);
}

.status-delay {
    color: var(--neon-coral);
    border: 1px solid rgba(255, 51, 102, 0.3);
}

.pulse-metrics {
    display: flex;
    gap: 1.5rem;
}

.metric {
    background: var(--surface);
    border: 1px solid rgba(200, 184, 154, 0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.metric-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-cream);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metric-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-cream);
}

/* --- SPREAD 5: Philosophy (Marble) --- */
.marble-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background:
        radial-gradient(ellipse at 30% 20%, var(--marble-alabaster) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, var(--marble-mid) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 90%, var(--marble-alabaster) 0%, transparent 50%),
        linear-gradient(135deg, var(--marble-base) 0%, var(--marble-mid) 50%, var(--marble-base) 100%);
}

.philosophy-content {
    position: relative;
    z-index: 3;
}

.philosophy-layout {
    max-width: 700px;
    margin: 0 auto;
    padding: 4rem 0;
}

.philosophy-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-graphite);
    margin-bottom: 3rem;
    line-height: 1.1;
}

.philosophy-text p {
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text-graphite);
    opacity: 0.85;
    max-width: 38em;
    margin-bottom: 1.5rem;
}

.philosophy-quote {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-style: italic;
    line-height: 1.4;
    color: var(--text-graphite);
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(26, 26, 30, 0.15);
}

.graphite-mark {
    color: var(--text-graphite);
    opacity: 0.3;
}

/* --- SPREAD 6: Closing --- */
.spread-final {
    display: flex;
    flex-direction: column;
}

.closing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    gap: 4rem;
}

.closing-statement {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.closing-text {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 7vw, 8rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-cream);
    line-height: 1.1;
}

.closing-accent {
    color: var(--neon-magenta);
    text-shadow: 0 0 30px rgba(255, 0, 255, 0.4);
    animation: neonFlicker 3s ease-in-out infinite;
}

.closing-footer {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    opacity: 0.4;
}

.closing-domain {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-cream);
}

.closing-divider {
    color: var(--neon-cyan);
}

.closing-issue {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-cream);
}

/* --- Scroll Entry Animations --- */
.animate-in {
    opacity: 0;
    transform: translateY(40px);
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.8s var(--spring-ease);
}

/* Stagger children */
.animate-in.visible:nth-child(1) { transition-delay: 0ms; }
.animate-in.visible:nth-child(2) { transition-delay: 80ms; }
.animate-in.visible:nth-child(3) { transition-delay: 160ms; }
.animate-in.visible:nth-child(4) { transition-delay: 240ms; }
.animate-in.visible:nth-child(5) { transition-delay: 320ms; }
.animate-in.visible:nth-child(6) { transition-delay: 400ms; }

/* --- Glitch Page Shift --- */
body.glitch-shift {
    transform: translateX(2px);
}

/* --- RGB Split Effect for Hero --- */
.hero-letter {
    position: relative;
}

.rgb-split .hero-letter::before {
    content: '';
    position: absolute;
    top: 0;
    left: -3px;
    width: 100%;
    height: 100%;
    background: inherit;
    mix-blend-mode: screen;
    opacity: 0;
}

/* --- Neon Dividers --- */
.neon-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, var(--neon-cyan), var(--marble-alabaster));
    opacity: 0.3;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .what-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .what-left {
        padding-right: 0;
    }

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

    .pulse-ticker {
        grid-column: 1;
        grid-row: auto;
    }

    .pulse-metrics {
        flex-direction: column;
    }

    .nav-links {
        display: none;
    }

    .ticker-line {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .ticker-id {
        min-width: auto;
    }

    .hero-letter {
        font-size: clamp(2.5rem, 12vw, 6rem);
    }
}

@media (max-width: 600px) {
    .spread {
        padding: 1.5rem;
    }

    .hero-title-row {
        gap: 0.1rem;
    }

    .closing-text {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .network-map {
        overflow-x: auto;
    }
}
