/* The landing page's stylesheet.
 *
 * Plan 138 Stage 3c lifted this out of a <style> block in ops/templates/info.html
 * so the public page can run under a same-origin CSP with no 'unsafe-inline'.
 * The rules are unchanged apart from three that used to be inline style
 * attributes on the markup -- .stats-row + .stats-row, .stat-card .num-timestamp
 * and .service-logo-pair -- which had to become classes for the same reason.
 *
 * This file is authored code and lives on the image side of Stage 7's mount
 * seam, so a change to it ships with an image build and not with `git pull`.
 * The template references it through asset_url(), which appends a content hash
 * so it can be cached for a year and still change on deploy.
 */

body { padding: 2rem 0; }

.top-bar {
    max-width: 900px;
    margin: 0 auto 1.5rem auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-bar a { text-decoration: none; }
.prose { max-width: 900px; margin: 0 auto; }

h2 { border-bottom: 1px solid var(--pico-muted-border-color); padding-bottom: 0.3rem; margin-bottom: 1rem; }

/* ── Hero ── */
.hero { margin-bottom: 2.5rem; }
.hero h1 {
    border-bottom: 2px solid var(--pico-muted-border-color);
    padding-bottom: 0.4rem;
    margin-bottom: 1rem;
}
.hero p { font-size: 1.1rem; color: var(--pico-secondary); margin-bottom: 1.25rem; }
.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.hero-cta a[role="button"] { margin: 0; }

/* ── Live stats ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}
.stats-row + .stats-row { margin-top: 0.75rem; }
.stat-card {
    border: 1px solid var(--pico-muted-border-color);
    border-top: 3px solid var(--pico-primary);
    border-radius: 8px;
    padding: 1.1rem 1.2rem 1rem;
    text-align: center;
    background: var(--pico-card-background-color);
}
.stat-card .num { font-size: 2.2rem; font-weight: 700; line-height: 1.1; color: var(--pico-primary); }
.stat-card .num-timestamp { font-size: 1.1rem; padding-top: 0.55rem; }
.stat-card .label { font-size: 0.8rem; color: var(--pico-muted-color); margin-top: 0.3rem; }

/* ── Services grid ── */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}
.service-card {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
}
.service-card:hover { border-color: var(--pico-primary-hover); }
.service-card.active {
    border-color: var(--pico-primary);
    box-shadow: 0 0 0 1px var(--pico-primary);
}
.service-logo {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    margin-top: 0.05rem;
    object-fit: contain;
}
.service-logo-pair { display: flex; gap: 0.35rem; flex-shrink: 0; }
.service-logo-placeholder {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 6px;
    background: var(--pico-secondary-background);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--pico-secondary);
    text-align: center;
    line-height: 1.1;
}

/* ── Service card content ── */
.service-info { width: 100%; min-width: 0; }
.service-info .title-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.15rem;
}
.service-info strong { font-size: 0.95rem; }
.service-info p {
    font-size: 0.82rem;
    color: var(--pico-muted-color);
    margin: 0;
}
.service-badge {
    font-size: 0.72rem;
    font-weight: 600;
    background: #374151;
    color: #ffffff;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    white-space: nowrap;
}
.why-cta {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--pico-primary);
    font-weight: 600;
    flex-shrink: 0;
}
.service-card:not(.active) .why-cta::after { content: " ▸"; }
.service-card.active .why-cta::after { content: " ▾"; }

/* ── Service detail panel ── */
.service-detail-panel {
    grid-column: 1 / -1;
    border: 1px solid var(--pico-primary);
    border-radius: 8px;
    padding: 1.1rem 1.4rem;
    background: var(--pico-card-background-color);
}
.service-detail-panel ul {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}
.service-detail-panel li { margin-bottom: 0.35rem; }

/* ── Technical highlights ── */
.highlights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}
.highlight-card {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
    padding: 1rem 1.2rem;
}
.highlight-card h3 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.highlight-card p { font-size: 0.85rem; color: var(--pico-muted-color); margin: 0; }
.highlight-detail-panel {
    grid-column: 1 / -1;
    border: 1px solid var(--pico-primary);
    border-radius: 8px;
    padding: 1.1rem 1.4rem;
    background: var(--pico-card-background-color);
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    line-height: 1.6;
}
.highlight-detail-panel h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pico-color);
    margin: 1rem 0 0.3rem;
}
.highlight-detail-panel h4:first-child { margin-top: 0; }
.highlight-detail-panel p { margin: 0 0 0.6rem; }
.highlight-detail-panel p:last-child { margin-bottom: 0; }

/* ── Expandable highlight card ── */
.highlight-card.expandable { cursor: pointer; user-select: none; transition: border-color 0.15s, box-shadow 0.15s; }
.highlight-card.expandable:hover { border-color: var(--pico-primary-hover); }
.highlight-card.expandable.active { border-color: var(--pico-primary); box-shadow: 0 0 0 1px var(--pico-primary); }
.highlight-read-more {
    display: inline-block;
    margin-top: 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--pico-primary);
}
.highlight-card:not(.active) .highlight-read-more::after { content: " Read more ▸"; }
.highlight-card.active .highlight-read-more::after { content: " Collapse ▴"; }

/* ── Highlight detail panel (full-width, below grid) ── */
.highlight-detail-panel {
    border: 1px solid var(--pico-primary);
    border-radius: 8px;
    padding: 1.4rem 1.6rem;
    background: var(--pico-card-background-color);
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    line-height: 1.6;
}
.highlight-detail-panel h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pico-color);
    margin: 1rem 0 0.3rem;
}
.highlight-detail-panel h4:first-child { margin-top: 0; }
.highlight-detail-panel p { margin: 0 0 0.6rem; }
.highlight-detail-panel p:last-child { margin-bottom: 0; }

/* ── Architecture diagram ── */
.diagram-wrap {
    overflow-x: auto;
    margin-bottom: 0.5rem;
}
.flow-diagram {
    display: block;
    width: 100%;
    min-width: 680px;
    height: auto;
}
/* Layer identity is carried by the badge text inside each node, never by
   colour alone -- the stroke is reinforcement, not the signal. */
.flow-diagram .node rect {
    fill: var(--pico-card-background-color);
    stroke: var(--pico-muted-border-color);
    stroke-width: 1;
}
.flow-diagram .node[data-layer] rect {
    stroke: var(--layer-color, var(--pico-muted-border-color));
    stroke-width: 1.5;
}
.flow-diagram .node[data-layer="fetch"]       { --layer-color: #2563EB; }
.flow-diagram .node[data-layer="parse"]       { --layer-color: #475569; }
/* The scrape queue reads the ops tables, so it carries their colour. */
.flow-diagram .node[data-layer="decides"]     { --layer-color: #0F766E; }
.flow-diagram .node[data-layer="bronze"]      { --layer-color: #B45309; }
.flow-diagram .node[data-layer="operational"] { --layer-color: #0F766E; }
.flow-diagram .node[data-layer="staging"]     { --layer-color: #0369A1; }
.flow-diagram .node[data-layer="silver"]      { --layer-color: #64748B; }
.flow-diagram .node[data-layer="mart"]        { --layer-color: #7C3AED; }
.flow-diagram .node[data-layer="serving"]     { --layer-color: #059669; }
.flow-diagram .node.external rect {
    fill: none;
    stroke-dasharray: 4 3;
}
.flow-diagram .badge {
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    fill: var(--layer-color, var(--pico-muted-color));
}
.flow-diagram .title {
    font-size: 12px;
    font-weight: 700;
    fill: var(--pico-color);
}
.flow-diagram .sub {
    font-size: 10px;
    fill: var(--pico-muted-color);
}
.flow-diagram .edge {
    fill: none;
    stroke: var(--pico-muted-color);
    stroke-width: 1.4;
}
/* The control loop is dashed as well as labelled, so the two paths stay
   distinguishable without relying on colour. */
.flow-diagram .edge.loop { stroke-dasharray: 5 4; }
.flow-diagram .edge-label {
    font-size: 9.5px;
    font-style: italic;
    fill: var(--pico-muted-color);
}
.flow-diagram .arrow-head { fill: var(--pico-muted-color); }
.diagram-caption {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    margin: 0 0 1.25rem;
}

/* ── Layer / grain table ── */
.layer-table-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}
.layer-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 0;
}
.layer-table th,
.layer-table td {
    text-align: left;
    vertical-align: top;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}
.layer-table th {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--pico-muted-color);
    border-bottom-width: 2px;
}
.layer-table td { color: var(--pico-muted-color); }
.layer-table tbody tr:last-child td { border-bottom: none; }
.layer-table .layer-name {
    white-space: nowrap;
    font-weight: 700;
    color: var(--pico-color);
    border-left: 3px solid var(--layer-color, var(--pico-muted-border-color));
}
.layer-table tr[data-layer="bronze"]      { --layer-color: #B45309; }
.layer-table tr[data-layer="operational"] { --layer-color: #0F766E; }
.layer-table tr[data-layer="staging"]     { --layer-color: #0369A1; }
.layer-table tr[data-layer="silver"]      { --layer-color: #64748B; }
.layer-table tr[data-layer="mart"]        { --layer-color: #7C3AED; }

.subhead {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 1.25rem 0 0.6rem;
}

/* ── Shared section copy ── */
.section-lede {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    margin-bottom: 0.85rem;
}
.stats-freshness {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    margin: 0.75rem 0 0;
}
.flow-note {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    margin: 0 0 2.5rem;
}
.footer-legal {
    font-size: 0.75rem;
    color: var(--pico-muted-color);
    line-height: 1.6;
    margin: 1rem 0 0;
}

/* ── Platform evolution callout ── */
.evolution {
    border: 1px solid var(--pico-muted-border-color);
    border-left: 3px solid #7C3AED;
    border-radius: 8px;
    padding: 1.1rem 1.4rem;
    margin-bottom: 2.5rem;
    background: var(--pico-card-background-color);
}
.evolution .track-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #7C3AED;
    border: 1px solid #7C3AED;
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
    margin-bottom: 0.6rem;
}
.evolution p { font-size: 0.85rem; color: var(--pico-muted-color); margin: 0 0 0.6rem; }
.evolution ul {
    margin: 0 0 0.6rem;
    padding-left: 1.2rem;
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}
.evolution li { margin-bottom: 0.25rem; }
.evolution p:last-child { margin-bottom: 0; }

/* ── Recent work ── */
.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.work-column {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
    padding: 1rem 1.2rem;
}
.work-column h3 {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--pico-muted-color);
    margin: 0 0 0.75rem;
}
.work-list { list-style: none; margin: 0; padding: 0; }
.work-list li {
    font-size: 0.85rem;
    padding-bottom: 0.7rem;
    margin-bottom: 0.7rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}
.work-list li:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}
.work-list .work-title { font-weight: 600; display: block; margin-bottom: 0.15rem; }
.work-list .work-summary { color: var(--pico-muted-color); font-size: 0.82rem; }
.work-list .work-meta {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.72rem;
    color: var(--pico-muted-color);
}
.work-empty { font-size: 0.85rem; color: var(--pico-muted-color); margin: 0; }
.work-footnote { font-size: 0.8rem; color: var(--pico-muted-color); margin: 0 0 2.5rem; }

/* ── Testing and evidence ── */
.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.evidence-card {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
}
.evidence-card h3 { margin: 0 0 0.3rem; font-size: 0.88rem; }
.evidence-card p { font-size: 0.82rem; color: var(--pico-muted-color); margin: 0; }
.evidence-note { font-size: 0.85rem; color: var(--pico-muted-color); margin: 0 0 2.5rem; }

/* ── Footer CTA ── */
.footer-cta {
    border-top: 1px solid var(--pico-muted-border-color);
    padding-top: 1.5rem;
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}
.footer-cta a[role="button"] { margin: 0; }
.footer-cta .footer-note {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--pico-muted-color);
}
