/* supplychain.wiki - Bauhaus pedagogical rigor meets signal-interference noise */

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

:root {
    --pure-white: #ffffff;
    --near-black: #1a1a1a;
    --bauhaus-red: #d42a2a;
    --bauhaus-blue: #2856a4;
    --bauhaus-yellow: #e8c52e;
    --mid-gray: #6b6b6b;
    --glitch-static: #c8c8c8;
    --deep-ink: #0a0a14;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--pure-white);
    color: #2a2a2a;
    font-family: 'Work Sans', sans-serif;
    font-size: 17px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ---- Hero Section ---- */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--pure-white);
}

.geo-circle {
    position: absolute;
    width: 40vw;
    height: 40vw;
    border-radius: 50%;
    background: var(--bauhaus-red);
    top: -5vw;
    right: -5vw;
    opacity: 0;
    transform: translateX(100px);
    animation: slideIn 0.8s ease forwards 0.2s;
}

.geo-rectangle {
    position: absolute;
    width: 50vw;
    height: 30vh;
    background: var(--bauhaus-blue);
    top: 20vh;
    left: -10vw;
    opacity: 0;
    transform: translateX(-100px);
    animation: slideIn 0.8s ease forwards 0.4s;
}

.geo-triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 20vw solid transparent;
    border-right: 20vw solid transparent;
    border-bottom: 30vh solid var(--bauhaus-yellow);
    bottom: 0;
    left: 5vw;
    opacity: 0;
    transform: translateY(100px);
    animation: slideInUp 0.8s ease forwards 0.6s;
}

@keyframes slideIn {
    to { opacity: 0.85; transform: translateX(0); }
}

@keyframes slideInUp {
    to { opacity: 0.85; transform: translateY(0); }
}

.visible-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(26,26,26,0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(26,26,26,0.08) 1px, transparent 1px);
    background-size: calc(100% / 12) 80px;
    opacity: 0;
    animation: gridFade 0.5s ease forwards 0.5s;
    pointer-events: none;
}

@keyframes gridFade {
    to { opacity: 1; }
}

.hero-title-wrap {
    position: relative;
    z-index: 10;
    text-align: center;
}

.hero-title-wrap h1 {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--near-black);
    display: inline-block;
}

.hero-title-wrap h1 span {
    display: inline-block;
    opacity: 0;
    position: relative;
}

.hero-title-wrap h1 span::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--bauhaus-red);
    transform: scaleX(0);
    transform-origin: left;
}

.hero-title-wrap h1 span.revealed {
    opacity: 1;
}

.hero-title-wrap h1 span.revealed::after {
    animation: underlineDraw 0.15s ease forwards;
}

@keyframes underlineDraw {
    to { transform: scaleX(1); }
}

.hero-tagline {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--mid-gray);
    letter-spacing: 0.04em;
    margin-top: 16px;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards 2s;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* ---- Waveform Divider ---- */
.waveform-divider {
    width: 100%;
    height: 40px;
    overflow: hidden;
    background: var(--pure-white);
}

.waveform-divider svg {
    width: 200%;
    height: 100%;
    animation: waveScroll 20s linear infinite;
}

.waveform-line {
    fill: none;
    stroke: var(--bauhaus-blue);
    stroke-width: 1.5;
}

@keyframes waveScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ---- Knowledge Grid ---- */
.knowledge-section {
    padding: 60px 20px;
    background: var(--pure-white);
}

.knowledge-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 0;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    background-image:
        linear-gradient(to right, rgba(26,26,26,0.06) 1px, transparent 1px);
    background-size: calc(100% / 3) 100%;
}

.side-col {
    padding: 20px 16px;
}

.center-col {
    padding: 20px 32px;
    border-left: 1px solid rgba(26,26,26,0.08);
    border-right: 1px solid rgba(26,26,26,0.08);
}

/* ---- Section Markers ---- */
.section-marker {
    width: 20px;
    height: 20px;
    margin-bottom: 20px;
    transition: transform 0.6s ease;
}

.section-marker.spin {
    transform: rotate(360deg);
}

.marker-circle {
    border-radius: 50%;
    background: var(--bauhaus-red);
}

.marker-square {
    background: var(--bauhaus-blue);
    transform: rotate(45deg);
}

.marker-square.spin {
    transform: rotate(405deg);
}

/* ---- Content Blocks ---- */
.content-block {
    margin-bottom: 40px;
}

.content-block h2 {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--near-black);
    margin-bottom: 14px;
}

.content-block p {
    margin-bottom: 14px;
}

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Annotations ---- */
.annotation {
    margin-bottom: 24px;
}

.anno-code {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--mid-gray);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.annotation p {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--mid-gray);
    line-height: 1.5;
}

.fade-side-left {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.fade-side-right {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.fade-side-left.visible, .fade-side-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.dot-grid-bg {
    width: 100%;
    height: 120px;
    background-image: radial-gradient(circle, var(--glitch-static) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
}

/* ---- Wiki Links ---- */
.wiki-link {
    color: var(--bauhaus-blue);
    text-decoration: none;
    background-image: linear-gradient(var(--bauhaus-red), var(--bauhaus-red));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size 0.3s ease;
    padding-bottom: 2px;
}

.wiki-link:hover {
    background-size: 100% 2px;
}

/* ---- Glitch Bands ---- */
.glitch-band {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--glitch-static);
}

.glitch-band-1 {
    height: 40px;
}

.glitch-band-2 {
    height: 60px;
}

.glitch-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 20px;
    overflow: hidden;
}

.glitch-text {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 100;
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--near-black);
    white-space: nowrap;
    opacity: 0.5;
}

.glitch-band.active {
    animation: glitchFlicker 0.5s step-end;
}

.glitch-band-2.active {
    animation-duration: 0.8s;
}

.glitch-band.active .glitch-text {
    text-shadow: 3px 0 var(--bauhaus-red), -3px 0 var(--bauhaus-blue);
}

.glitch-band-2.active .glitch-text {
    text-shadow: 5px 0 var(--bauhaus-red), -5px 0 var(--bauhaus-blue);
}

@keyframes glitchFlicker {
    0%, 100% { background: var(--glitch-static); }
    20% { background: var(--pure-white); }
    40% { background: var(--glitch-static); }
    60% { background: var(--pure-white); }
    80% { background: var(--glitch-static); }
}

/* ---- Footer / Index Terminal ---- */
.footer-section {
    background: var(--deep-ink);
    color: var(--pure-white);
    padding: 80px 20px 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    max-width: 1100px;
    margin: 0 auto 60px;
}

.footer-col h3 {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pure-white);
    margin-bottom: 16px;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--mid-gray);
    margin-bottom: 8px;
}

.footer-col .wiki-link {
    color: var(--bauhaus-yellow);
}

.colophon-text {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--mid-gray);
    line-height: 1.6;
    margin-bottom: 8px;
}

.footer-ornaments {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.ornament {
    display: inline-block;
}

.ornament-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bauhaus-red);
}

.ornament-square {
    width: 14px;
    height: 14px;
    background: var(--bauhaus-blue);
    transform: rotate(45deg);
}

.ornament-triangle {
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 16px solid var(--bauhaus-yellow);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .knowledge-grid {
        grid-template-columns: 1fr;
    }

    .center-col {
        border-left: none;
        border-right: none;
        order: -1;
    }

    .side-left { order: 0; }
    .side-right { order: 1; }

    .geo-circle {
        width: 60vw;
        height: 60vw;
    }

    .geo-rectangle {
        width: 70vw;
    }

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