/* ────────────────────────────────────────────────────────────────────
   utility_graph/demos/shared.css
   Shared stylesheet for all C4C Labs demos.

   CHANGELOG
   v0.1  2026-04-19  Initial extraction from flagstaff + great_salt_lake
                     demos. Covers all scaffolding: palette, layout,
                     header, stats strip, graph section, evidence panel,
                     insights, matchmaking callout, footer, mobile.
   v0.2  2026-04-29  Added paragraph-spacing rules for multi-paragraph
                     .match-item sections (used in santa_barbara demo's
                     Entry Point 3). Backwards compatible: single-paragraph
                     match-items unaffected because of :last-child rule.
   ──────────────────────────────────────────────────────────────────── */

/* ─── Design tokens ─────────────────────────────────────────────── */
:root {
    --indigo: #2825BE;
    --indigo-dark: #1a1884;
    --amber: #EB9001;
    --teal: #0C7A7A;
    --terra: #CF4C38;
    --gray-bg: #F6F5F2;
    --gray-border: #D9D6CC;
    --gray-text: #5C5A55;
    --black: #1C1B18;
}

/* ─── Reset + base ──────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    color: var(--black);
    background: #FFFEFC;
    line-height: 1.55;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 72px 32px 80px;
}

/* ─── Header ────────────────────────────────────────────────────── */
.header {
    margin-bottom: 48px;
}

.eyebrow {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--amber);
    margin-bottom: 12px;
}

h1 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 2.6rem;
    line-height: 1.1;
    color: var(--indigo);
    letter-spacing: -0.01em;
    margin-bottom: 20px;
}

.lead {
    font-size: 1.15rem;
    color: var(--gray-text);
    max-width: 640px;
    line-height: 1.55;
    margin-bottom: 14px;
}

.lead:last-of-type { margin-bottom: 0; }

/* ─── Headline stats strip ──────────────────────────────────────── */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin: 40px 0 8px;
    padding: 24px 28px;
    background: var(--gray-bg);
    border-left: 4px solid var(--indigo);
    border-radius: 0 4px 4px 0;
}

.stat-value {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--indigo);
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-value .unit {
    font-size: 1rem;
    color: var(--gray-text);
    font-weight: 500;
    margin-left: 2px;
}

.stat-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gray-text);
}

/* ─── Graph section ─────────────────────────────────────────────── */
.graph-section {
    margin: 56px 0 48px;
}

.graph-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gray-text);
    margin-bottom: 16px;
}

#cy {
    width: 100%;
    height: 680px;
    background: var(--gray-bg);
    border: 1px solid var(--gray-border);
    border-radius: 4px;
}

.graph-instruction {
    font-size: 0.9rem;
    color: var(--gray-text);
    margin-top: 14px;
    line-height: 1.5;
    transition: color 0.3s ease;
}

.graph-instruction strong {
    color: var(--indigo);
    font-weight: 600;
}

.graph-instruction.focused strong {
    color: var(--terra);
}

/* ─── Legend ────────────────────────────────────────────────────── */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 18px;
    padding: 12px 0;
    font-size: 0.85rem;
    color: var(--gray-text);
    border-top: 1px solid var(--gray-border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* ─── Evidence panel ────────────────────────────────────────────── */
.evidence-panel {
    position: fixed;
    right: 24px;
    top: 24px;
    width: 340px;
    max-height: 60vh;
    background: white;
    border: 1px solid var(--gray-border);
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    display: none;
    overflow-y: auto;
    z-index: 1000;
}

.evidence-panel.visible { display: block; }

.evidence-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--gray-text);
}

.evidence-panel h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--indigo);
    margin-bottom: 6px;
    padding-right: 24px;
}

.evidence-panel .type-badge {
    display: inline-block;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 2px;
    margin-bottom: 12px;
}

.evidence-panel .source-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gray-text);
    margin: 12px 0 4px;
}

.evidence-panel .source-text {
    font-size: 0.9rem;
    color: var(--black);
    padding: 10px 12px;
    background: var(--gray-bg);
    border-left: 3px solid var(--amber);
    margin-bottom: 8px;
}

.evidence-panel .meta {
    font-size: 0.8rem;
    color: var(--gray-text);
}

/* ─── Insights ──────────────────────────────────────────────────── */
.insights {
    margin: 48px 0;
}

.insights h2 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--indigo);
    margin-bottom: 12px;
}

.insights-hint {
    font-size: 0.9rem;
    color: var(--gray-text);
    font-style: italic;
    margin-bottom: 24px;
}

.insight {
    margin-bottom: 16px;
    padding: 16px 20px;
    border-left: 3px solid var(--teal);
    border-radius: 0 4px 4px 0;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, padding 0.2s ease;
    position: relative;
}

.insight:hover {
    background: rgba(12, 122, 122, 0.04);
}

.insight.active {
    background: rgba(207, 76, 56, 0.06);
    border-left-color: var(--terra);
    border-left-width: 4px;
    padding-left: 19px;
}

.insight h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--black);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insight .arrow {
    display: inline-block;
    color: var(--teal);
    font-weight: 700;
    font-size: 1rem;
    transition: transform 0.25s ease, color 0.25s ease;
}

.insight.active .arrow {
    transform: rotate(90deg);
    color: var(--terra);
}

.insight p {
    font-size: 0.98rem;
    color: var(--black);
    margin-bottom: 6px;
}

.insight .why {
    font-size: 0.9rem;
    color: var(--gray-text);
    font-style: italic;
}

.insight .node-ref {
    font-weight: 600;
    color: var(--indigo-dark);
}

/* ─── Matchmaking / thesis callout ──────────────────────────────── */
.matchmaking {
    margin: 56px 0;
    background: var(--gray-bg);
    border-left: 4px solid var(--terra);
    padding: 32px 36px;
    border-radius: 0 4px 4px 0;
}

.matchmaking .eyebrow {
    color: var(--terra);
}

.matchmaking h2 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--indigo);
    margin-bottom: 20px;
}

.match-item {
    margin-bottom: 14px;
    font-size: 0.96rem;
}

/* Multi-paragraph match-items: spacing between paragraphs.
   Single-paragraph match-items unaffected because the only <p>
   is also the last <p>, which gets margin-bottom: 0. */
.match-item p {
    margin-bottom: 10px;
}

.match-item p:last-child {
    margin-bottom: 0;
}

.match-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gray-text);
    display: block;
    margin-bottom: 4px;
}

.match-narrative {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-border);
    font-size: 0.96rem;
    color: var(--black);
    line-height: 1.65;
}

.match-narrative .closing-line {
    margin-top: 14px;
    font-style: italic;
    color: var(--gray-text);
}

.caveat {
    margin-top: 16px;
    padding: 12px 14px;
    background: rgba(235, 144, 1, 0.08);
    border-left: 3px solid var(--amber);
    font-size: 0.88rem;
    color: var(--gray-text);
    line-height: 1.5;
}

/* ─── Footer / CTA ──────────────────────────────────────────────── */
.footer {
    margin-top: 72px;
    padding-top: 32px;
    border-top: 1px solid var(--gray-border);
}

.cta-lead {
    font-size: 1.05rem;
    color: var(--black);
    margin-bottom: 20px;
    max-width: 620px;
}

.cta-email {
    display: inline-block;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--indigo);
    text-decoration: none;
    padding: 10px 18px;
    border: 2px solid var(--indigo);
    border-radius: 2px;
    transition: background 0.15s, color 0.15s;
}

.cta-email:hover {
    background: var(--indigo);
    color: white;
}

.footnote {
    margin-top: 32px;
    font-size: 0.85rem;
    color: var(--gray-text);
    line-height: 1.5;
}

.footnote a {
    color: var(--teal);
    text-decoration: underline;
}

/* ─── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .container { padding: 48px 20px 60px; }
    h1 { font-size: 2rem; }
    #cy { height: 520px; }
    .stats-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .evidence-panel {
        right: 12px;
        top: 12px;
        width: calc(100% - 24px);
        max-width: 380px;
    }
}
