/* ============================================================
   supplychain.wiki — Industrial Knowledge Monument
   Aesthetic: neubrutalism · Layout: stacked-sections
   Typography: serif-classic · Palette: dark-neon
   Imagery: marble-texture · Motifs: sharp-angles · Tone: energetic
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #0D0D0D;
    color: #C8C8C8;
    font-family: "Source Serif 4", Georgia, serif;
    font-weight: 400;
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Global noise grain overlay */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    opacity: 0.04;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)' fill='white'/></svg>");
}

/* --- ANCHOR RAIL --- */
.anchor-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: 48px;
    height: 100vh;
    background: #0D0D0D;
    border-right: 2px solid #00FFD1;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 0;
    transform: translateX(-48px);
    animation: railSlideIn 600ms 200ms forwards cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes railSlideIn {
    to { transform: translateX(0); }
}

.rail-mark {
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
    letter-spacing: 0.18em;
    color: #00FFD1;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin-bottom: 24px;
    text-transform: uppercase;
}

.rail-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 22px;
    flex: 1;
    align-items: center;
    margin-top: 10px;
}

.rail-item {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #6A6A7A;
    cursor: pointer;
    transition: color 200ms ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.rail-item:hover {
    color: #FF00AA;
}

.rail-item.active {
    color: #00FFD1;
}

.rail-tick {
    width: 1px;
    height: 12px;
    background: currentColor;
    display: block;
    transform: rotate(180deg);
}

.rail-label {
    display: block;
}

.rail-pulse {
    width: 6px;
    height: 6px;
    background: #00FFD1;
    border-radius: 50%;
    margin-top: auto;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(0, 255, 209, 0.7);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

/* --- HERO --- */
.hero {
    position: relative;
    min-height: 100vh;
    padding: 80px 6vw 80px calc(48px + 6vw);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #0D0D0D;
    border-bottom: 6px solid #00FFD1;
    overflow: hidden;
}

.hero-meta {
    font-family: "IBM Plex Mono", monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6A6A7A;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 36px;
    opacity: 0;
    animation: fadeUp 600ms 600ms forwards;
}

.meta-key {
    color: #6A6A7A;
}

.meta-val {
    color: #00FFD1;
    margin-left: 4px;
}

.meta-val.pulse-live {
    color: #CCFF00;
    position: relative;
    padding-left: 14px;
}

.meta-val.pulse-live::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    background: #CCFF00;
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 8px rgba(204, 255, 0, 0.8);
    animation: pulse 1.4s ease-in-out infinite;
}

.meta-sep {
    color: #4A4A5A;
}

.hero-title {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 900;
    font-size: clamp(2.8rem, 9vw, 7.5rem);
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    line-height: 0.95;
    text-shadow: 1px 1px 0 #00FFD1, 0 0 20px rgba(0, 255, 209, 0.18);
    margin-bottom: 24px;
}

.hero-title .ch {
    display: inline-block;
    transform: translateY(8px);
    opacity: 0;
    animation: charDrop 500ms forwards cubic-bezier(0.2, 0.8, 0.2, 1.05);
}

.hero-title .ch.space {
    width: 0.35em;
}

@keyframes charDrop {
    to { transform: translateY(0); opacity: 1; }
}

.hero-rule {
    height: 6px;
    background: #00FFD1;
    width: 0;
    margin-bottom: 24px;
    animation: ruleExtend 600ms 1200ms forwards cubic-bezier(0.5, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(0, 255, 209, 0.4);
}

@keyframes ruleExtend {
    to { width: 100%; }
}

.hero-sub {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    color: #E0E0E0;
    line-height: 1.4;
    max-width: 60ch;
    margin-bottom: 56px;
    opacity: 0;
    animation: fadeUp 700ms 1700ms forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0;
    border-top: 2px solid #2A2A35;
    border-bottom: 2px solid #2A2A35;
    opacity: 0;
    animation: fadeUp 700ms 2000ms forwards;
}

.stat-cell {
    padding: 20px 24px;
    border-right: 2px solid #2A2A35;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-cell:last-child {
    border-right: none;
}

.stat-num {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: #FFFFFF;
    line-height: 1;
    text-shadow: 0 0 10px rgba(0, 255, 209, 0.2);
}

.stat-lbl {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #00FFD1;
}

/* --- SECTIONS --- */
.section {
    position: relative;
    padding: 0 6vw 80px calc(48px + 6vw);
    background: #0D0D0D;
    border-bottom: 6px solid #00FFD1;
    min-height: 80vh;
    overflow: hidden;
}

.section.alt {
    background: #1A1A1A;
}

.section-header {
    position: relative;
    height: auto;
    min-height: 90px;
    margin: 0 -6vw 56px calc(-48px - 6vw);
    padding: 18px 6vw 18px calc(48px + 6vw);
    display: flex;
    align-items: center;
    gap: 24px;
    overflow: hidden;
}

.section-title {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 3.6rem);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: #FFFFFF;
    text-shadow: 1px 1px 0 #00FFD1;
    line-height: 1;
    flex-shrink: 0;
}

.section-id {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #00FFD1;
    align-self: flex-end;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.rule-thin {
    flex: 1;
    height: 1px;
    background: #00FFD1;
    box-shadow: 0 0 6px rgba(0, 255, 209, 0.5);
    min-width: 30px;
}

/* --- MARBLE TEXTURE --- */
.marble {
    background-color: #2A2A35;
    /* Marble vein colors: #4A4A5A (light), #1E1E2A (dark indigo), #00FFD1 @ 5% */
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(74, 74, 90, 0.55) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 70%, rgba(30, 30, 42, 0.65) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(0, 255, 209, 0.05) 0%, transparent 40%),
        linear-gradient(135deg, rgba(74, 74, 90, 0.25) 0%, transparent 30%, rgba(30, 30, 42, 0.4) 70%, transparent 100%),
        linear-gradient(45deg, #1E1E2A 0%, transparent 50%);
    background-size: 200% 200%, 220% 220%, 180% 180%, 300% 300%, 250% 250%;
    background-position: 0% 0%, 100% 100%, 50% 50%, 0% 100%, 100% 0%;
    animation: marbleShift 60s ease-in-out infinite alternate;
}

@keyframes marbleShift {
    0% {
        background-position: 0% 0%, 100% 100%, 50% 50%, 0% 100%, 100% 0%;
    }
    100% {
        background-position: 30% 20%, 70% 80%, 60% 40%, 20% 80%, 80% 20%;
    }
}

/* --- GRID 12 --- */
.section-body.grid12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px 16px;
}

.span-1-4  { grid-column: 1 / span 4; }
.span-5-8  { grid-column: 5 / span 4; }
.span-9-12 { grid-column: 9 / span 4; }
.span-1-6  { grid-column: 1 / span 6; }
.span-7-12 { grid-column: 7 / span 6; }
.span-1-7  { grid-column: 1 / span 7; }
.span-8-12 { grid-column: 8 / span 5; }
.span-1-8  { grid-column: 1 / span 8; }
.span-5-12 { grid-column: 5 / span 8; }
.span-1-12 { grid-column: 1 / span 12; }

/* --- BLOCKS --- */
.block {
    position: relative;
}

.block.callout {
    padding: 24px 28px;
    border: 2px solid #00FFD1;
    position: relative;
}

.block.callout::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 16px;
    background: #0D0D0D;
    clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.block.callout.alt {
    border-color: #FF00AA;
}

.callout-tag {
    display: inline-block;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #00FFD1;
    border: 1px solid #00FFD1;
    padding: 3px 8px;
    margin-bottom: 14px;
}

.block.callout.alt .callout-tag {
    color: #FF00AA;
    border-color: #FF00AA;
}

.block.callout p {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 600;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    color: #FFFFFF;
    line-height: 1.5;
}

.lede {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.8;
    color: #C8C8C8;
}

.lede::first-letter {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 900;
    font-size: 3em;
    float: left;
    line-height: 0.9;
    margin: 6px 10px 0 0;
    color: #00FFD1;
}

/* --- CARDS --- */
.card {
    position: relative;
    background: #1A1A1A;
    border: 4px solid #1A1A1A;
    padding: 28px 24px 24px;
    transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
                border-color 280ms ease,
                box-shadow 280ms ease;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
    cursor: pointer;
}

.section.alt .card {
    background: #0D0D0D;
    border-color: #0D0D0D;
}

.card:hover {
    transform: translateY(-3px);
    border-color: #00FFD1;
    box-shadow: 0 6px 20px rgba(0, 255, 209, 0.18);
}

.card.active-pink {
    border-color: #FF00AA;
    box-shadow: 0 6px 20px rgba(255, 0, 170, 0.25);
}

.card-corner {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #00FFD1;
    clip-path: polygon(100% 0, 0 0, 100% 100%);
    opacity: 0.6;
    transition: opacity 200ms ease;
}

.card:hover .card-corner {
    opacity: 1;
}

.pulse-dot {
    position: absolute;
    top: 28px;
    left: -3px;
    width: 6px;
    height: 6px;
    background: #00FFD1;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(0, 255, 209, 0.7);
}

.card-title {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 1.8vw, 1.6rem);
    color: #E0E0E0;
    margin-bottom: 12px;
    line-height: 1.2;
    transition: text-shadow 280ms ease, color 280ms ease;
}

.card:hover .card-title {
    color: #FFFFFF;
    text-shadow: 0 0 12px rgba(0, 255, 209, 0.6);
}

.card p {
    font-size: clamp(0.92rem, 1.1vw, 1rem);
    line-height: 1.7;
    margin-bottom: 16px;
    color: #C8C8C8;
}

.card-meta {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6A6A7A;
    border-top: 1px solid #2A2A35;
    padding-top: 12px;
}

.card.mode .mode-glyph {
    display: block;
    margin-bottom: 16px;
    opacity: 0.85;
}

.card.mode .mode-glyph svg {
    width: 60px;
    height: 40px;
}

/* --- DATA TABLES --- */
.data-table {
    grid-column: 1 / span 12;
    width: 100%;
    border-collapse: collapse;
    background: #0D0D0D;
    border: 2px solid #2A2A35;
    margin-top: 8px;
}

.data-table thead tr {
    background-color: #2A2A35;
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(74, 74, 90, 0.55) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 70%, rgba(30, 30, 42, 0.65) 0%, transparent 50%),
        linear-gradient(135deg, rgba(74, 74, 90, 0.25) 0%, transparent 30%, rgba(30, 30, 42, 0.4) 70%, transparent 100%);
    background-size: 200% 200%, 220% 220%, 300% 300%;
}

.data-table th {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #00FFD1;
    text-align: left;
    padding: 14px 18px;
    border-bottom: 2px solid #00FFD1;
    font-weight: 500;
}

.data-table td {
    padding: 14px 18px;
    border: 1px solid #2A2A35;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: #E0E0E0;
    transition: background 200ms ease;
}

.data-table td.num {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.85rem;
    color: #00FFD1;
    letter-spacing: 0.06em;
}

.data-table td.num.pink {
    color: #FF00AA;
}

.data-table tbody tr {
    transition: background 200ms ease, border-left 200ms ease;
    border-left: 0px solid transparent;
}

.data-table tbody tr:hover {
    background: rgba(0, 255, 209, 0.05);
    border-left: 3px solid #FF00AA;
}

/* --- ARCHIVE LIST --- */
.archive-list {
    grid-column: 1 / span 12;
    list-style: none;
    border-top: 1px solid #2A2A35;
}

.archive-item {
    display: grid;
    grid-template-columns: 200px 1fr 140px;
    gap: 24px;
    align-items: center;
    padding: 18px 8px;
    border-bottom: 1px solid #2A2A35;
    transition: background 200ms ease, padding-left 200ms ease;
    position: relative;
}

.archive-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 60%;
    background: #00FFD1;
    transition: width 200ms ease;
}

.archive-item:hover {
    background: rgba(0, 255, 209, 0.04);
    padding-left: 18px;
}

.archive-item:hover::before {
    width: 3px;
}

.ar-time {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6A6A7A;
}

.ar-title {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    color: #E0E0E0;
    font-weight: 500;
}

.archive-item:hover .ar-title {
    color: #FFFFFF;
}

.ar-tag {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #00FFD1;
    border: 1px solid #00FFD1;
    padding: 4px 10px;
    text-align: center;
    justify-self: end;
}

/* --- DIAGONAL CUTS --- */
.diagonal-cut {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 60px;
    pointer-events: none;
}

/* --- COLOPHON --- */
.colophon {
    background: #0D0D0D;
    padding: 40px 6vw 60px calc(48px + 6vw);
    border-top: 2px solid #2A2A35;
}

.colophon-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 28px;
}

.colo-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.colo-key {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6A6A7A;
}

.colo-val {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: #00FFD1;
}

.swatch-list {
    display: flex;
    gap: 4px;
}

.sw {
    width: 24px;
    height: 24px;
    display: inline-block;
    border: 1px solid #2A2A35;
}

/* --- SECTION SCROLL ANIMATIONS --- */
.section-body > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.section-body.in-view > *:nth-child(1)  { transition-delay: 0ms;   }
.section-body.in-view > *:nth-child(2)  { transition-delay: 60ms;  }
.section-body.in-view > *:nth-child(3)  { transition-delay: 120ms; }
.section-body.in-view > *:nth-child(4)  { transition-delay: 180ms; }
.section-body.in-view > *:nth-child(5)  { transition-delay: 240ms; }
.section-body.in-view > *:nth-child(6)  { transition-delay: 300ms; }
.section-body.in-view > *:nth-child(7)  { transition-delay: 360ms; }
.section-body.in-view > *:nth-child(8)  { transition-delay: 420ms; }
.section-body.in-view > * {
    opacity: 1;
    transform: translateY(0);
}

/* Border pulse when section enters viewport */
.section.pulsing {
    animation: borderPulse 300ms ease;
}

@keyframes borderPulse {
    0% { border-bottom-color: rgba(0, 255, 209, 0.4); }
    50% { border-bottom-color: rgba(0, 255, 209, 1); box-shadow: 0 6px 24px rgba(0, 255, 209, 0.4); }
    100% { border-bottom-color: rgba(0, 255, 209, 0.7); }
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .anchor-rail {
        width: 36px;
    }
    .anchor-rail .rail-list {
        gap: 14px;
    }
    .rail-label {
        font-size: 9px;
    }
    .hero, .section, .colophon {
        padding-left: calc(36px + 4vw);
        padding-right: 4vw;
    }
    .section-header {
        margin-left: calc(-36px - 4vw);
        margin-right: -4vw;
        padding-left: calc(36px + 4vw);
        padding-right: 4vw;
        flex-wrap: wrap;
        gap: 12px;
    }
    .span-1-4, .span-5-8, .span-9-12,
    .span-1-6, .span-7-12,
    .span-1-7, .span-8-12,
    .span-1-8, .span-5-12 {
        grid-column: 1 / span 12;
    }
    .archive-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .ar-tag {
        justify-self: start;
    }
    .data-table {
        font-size: 0.85rem;
    }
    .data-table th, .data-table td {
        padding: 10px 12px;
    }
}

@media (max-width: 600px) {
    .hero-stats {
        grid-template-columns: 1fr 1fr;
    }
    .stat-cell {
        border-right: 2px solid #2A2A35;
        border-bottom: 2px solid #2A2A35;
    }
    .stat-cell:nth-child(2n) {
        border-right: none;
    }
    .lede::first-letter {
        font-size: 2.4em;
    }
}
