/* ==========================================================================
   supplychain.observer — minimalist surveillance dashboard
   Palette: warm-earthy · Layout: masonry · Typography: condensed
   ========================================================================== */

:root {
    /* Warm-earthy palette */
    --raw-earth: #8B6F47;
    --deep-soil: #3D2B1F;
    --sage-moss: #6B7F5E;
    --terracotta: #B85C38;
    --sand-light: #E8DCC8;
    --concrete-grey: #9A9590;
    --bone-white: #F4EDE2;

    /* Category coding */
    --cat-logistics: #8B6F47;
    --cat-materials: #6B7F5E;
    --cat-labor: #B85C38;
    --cat-environment: #9A9590;

    /* Fonts */
    --font-display: "Barlow Condensed", "Oswald", "Arial Narrow", sans-serif;
    --font-body: "IBM Plex Sans", "Inter", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", "Menlo", monospace;
}

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

html, body {
    background: var(--sand-light);
    color: var(--deep-soil);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body {
    position: relative;
    padding: 24px clamp(16px, 3vw, 40px) 0;
    min-height: 100vh;
}

/* ==========================================================================
   Flowing curves background
   ========================================================================== */

.flow-curves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
}

.flow-curves path {
    fill: none;
    stroke: var(--sage-moss);
    stroke-opacity: 0.09;
    stroke-linecap: round;
}

.flow-curves path:nth-child(1) { stroke-width: 60; }
.flow-curves path:nth-child(2) { stroke-width: 80; }
.flow-curves path:nth-child(3) { stroke-width: 50; }
.flow-curves path:nth-child(4) { stroke-width: 40; stroke-opacity: 0.06; }

/* ==========================================================================
   Observation header
   ========================================================================== */

.observation-header {
    position: relative;
    z-index: 2;
    min-height: 58vh;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 0 32px;
    border-bottom: 1px solid var(--concrete-grey);
}

.header-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px 32px;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--deep-soil);
}

.header-row--top {
    padding-bottom: 20px;
    border-bottom: 1px dashed rgba(61, 43, 31, 0.25);
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
}

.meta-divider {
    color: var(--concrete-grey);
}

.header-system {
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
}

.status-label,
.ts-label {
    color: var(--concrete-grey);
}

.status-value {
    color: var(--sage-moss);
    font-weight: 500;
}

.ts-value {
    color: var(--deep-soil);
    padding-left: 4px;
    border-left: 1px solid var(--concrete-grey);
    margin-left: 2px;
    padding-left: 12px;
}

/* Header identity block */

.header-identity {
    padding: 20px 0 16px;
    max-width: 1100px;
}

.domain-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.0;
    color: var(--deep-soil);
    margin-bottom: 14px;
}

.descriptor {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    color: var(--deep-soil);
    max-width: 62ch;
    line-height: 1.55;
}

/* Header bottom: category legend + counter */

.header-row--bottom {
    padding-top: 18px;
    border-top: 1px dashed rgba(61, 43, 31, 0.25);
}

.category-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.legend-title {
    color: var(--concrete-grey);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--deep-soil);
}

.swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 0;
}

.header-counter {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--concrete-grey);
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.counter-value {
    color: var(--deep-soil);
    font-size: 1.1rem;
    font-weight: 500;
}

/* ==========================================================================
   Pulsing status indicator
   ========================================================================== */

.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sage-moss);
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

.pulse-dot::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--sage-moss);
    opacity: 0.5;
    animation: pulse-ring 2s ease-in-out infinite;
}

.pulse-dot--small {
    width: 6px;
    height: 6px;
}

@keyframes pulse {
    0%   { transform: scale(1);   opacity: 1;   }
    50%  { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1);   opacity: 1;   }
}

@keyframes pulse-ring {
    0%   { transform: scale(1);   opacity: 0.5; }
    50%  { transform: scale(1.6); opacity: 0;   }
    100% { transform: scale(1);   opacity: 0;   }
}

/* ==========================================================================
   Intelligence wall (masonry)
   ========================================================================== */

.intelligence-wall {
    position: relative;
    z-index: 2;
    column-count: 3;
    column-gap: 16px;
    padding: 28px 0 48px;
}

@media (max-width: 980px) {
    .intelligence-wall {
        column-count: 2;
    }
}

@media (max-width: 640px) {
    .intelligence-wall {
        column-count: 1;
    }
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    display: inline-block;
    width: 100%;
    background: var(--bone-white);
    margin-bottom: 16px;
    padding: 22px 22px 20px;
    border: 1px solid rgba(154, 149, 144, 0.35);
    border-top: 2px solid var(--raw-earth);
    break-inside: avoid;
    page-break-inside: avoid;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s ease,
                box-shadow 0.25s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px -12px rgba(61, 43, 31, 0.25);
}

.card[data-cat="logistics"]   { border-top-color: var(--cat-logistics); }
.card[data-cat="materials"]   { border-top-color: var(--cat-materials); }
.card[data-cat="labor"]       { border-top-color: var(--cat-labor); }
.card[data-cat="environment"] { border-top-color: var(--cat-environment); }

/* Card internals */

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--concrete-grey);
}

.card-idx {
    color: var(--deep-soil);
    font-weight: 500;
}

.card-cat {
    text-align: right;
}

.card[data-cat="logistics"]   .card-cat { color: var(--cat-logistics); }
.card[data-cat="materials"]   .card-cat { color: var(--cat-materials); }
.card[data-cat="labor"]       .card-cat { color: var(--cat-labor); }
.card[data-cat="environment"] .card-cat { color: var(--cat-environment); }

.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.05rem, 1.4vw, 1.3rem);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.15;
    color: var(--deep-soil);
    margin-bottom: 12px;
}

.card-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 0.95vw, 0.95rem);
    line-height: 1.65;
    color: var(--deep-soil);
    margin-bottom: 14px;
}

.card-caption {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.55;
    letter-spacing: 0.02em;
    color: var(--concrete-grey);
    margin-top: 10px;
}

.card-quote {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 500;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--raw-earth);
    padding: 10px 0 10px 14px;
    border-left: 2px solid var(--raw-earth);
    margin: 14px 0;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(154, 149, 144, 0.5);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--concrete-grey);
}

/* Data list */

.data-list {
    list-style: none;
    margin: 12px 0 8px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--deep-soil);
}

.data-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: 1px dotted rgba(154, 149, 144, 0.5);
    gap: 12px;
}

.data-list li:last-child {
    border-bottom: none;
}

.data-list li span:first-child {
    color: var(--concrete-grey);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.68rem;
}

.data-list li span:last-child {
    color: var(--deep-soil);
    font-weight: 500;
    text-align: right;
}

/* Wide editorial cards */

.card--wide .card-body {
    font-size: clamp(0.9rem, 1vw, 1rem);
}

/* Visual cards */

.card--visual .blob-svg {
    display: block;
    width: 100%;
    height: auto;
    margin: 6px 0 4px;
    background: transparent;
}

.blob-svg .draw-path {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Initial hidden state for path-draw reveal (set by JS) */
.blob-svg .draw-path.pre-draw {
    opacity: 0;
}

.blob-svg .draw-path.drawing {
    opacity: 1;
    transition: stroke-dashoffset 2.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.observer-foot {
    position: relative;
    z-index: 2;
    border-top: 1px solid var(--concrete-grey);
    padding: 24px 0 36px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.foot-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--concrete-grey);
}

.foot-row:nth-child(2) {
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font-body);
    color: var(--deep-soil);
    font-size: 0.9rem;
    max-width: 78ch;
}

.foot-tag {
    color: var(--terracotta);
    font-weight: 500;
}

.foot-value {
    color: var(--deep-soil);
}

.foot-row--bottom {
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px dashed rgba(154, 149, 144, 0.5);
    margin-top: 4px;
}

.foot-mono {
    color: var(--concrete-grey);
}

/* ==========================================================================
   Small screens tweaks
   ========================================================================== */

@media (max-width: 720px) {
    body {
        padding: 16px 14px 0;
    }

    .observation-header {
        min-height: auto;
        max-height: none;
        padding-bottom: 24px;
    }

    .header-row,
    .header-row--top,
    .header-row--bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-system {
        flex-wrap: wrap;
    }

    .foot-row--bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}
