/*
 * /power-law-outcomes/ dashboard layout (MAR-869): filter rail on the left
 * (css/vc-dashboard-rail.css), charts in the middle, new names on the right.
 * Every rule is scoped to html.vc-rail; chart-only embeds and
 * ?layout=classic leave that class off and see the plain page.
 * Markup and behaviour: js/power-law-outcomes-rail.js.
 */

/* Outside the dashboard layout the baked names list has no place. */
.plo-names { display: none; }

/* ── Three columns ────────────────────────────────────────────────────── */
html.vc-rail .vcr-layout.plo-layout {
    grid-template-columns: 216px minmax(0, 1fr) 272px;
    gap: 2rem;
    max-width: 1640px;
}
html.vc-rail .plo-layout .vcr-grid { gap: 1.5rem; }
/* The chart cards fill the middle column; their own page-level widths and
   outer margins came from the old one-column page. */
html.vc-rail .plo-layout .vcr-grid > *,
html.vc-rail .plo-layout .vcr-grid .section-inner > * { margin-top: 0; margin-bottom: 0; min-width: 0; max-width: none; }
html.vc-rail .plo-layout .vcr-grid .median-subsection + .median-subsection { margin-top: 0; }

/* ── Per-chart filters now in the rail ────────────────────────────────── */
html.vc-rail .matrix-filters .filter-row[data-group="matrix-region"],
html.vc-rail .matrix-filters .filter-row[data-group="matrix-ownership"],
html.vc-rail .matrix-filters .filter-row[data-group="matrix-vc"],
html.vc-rail #market-map .filter-row[data-group="tier"],
html.vc-rail #market-map .filter-row[data-group="status"],
html.vc-rail #market-map .filter-row[data-group="region"],
html.vc-rail #market-map .filter-row[data-group="vc"],
html.vc-rail #powerLawGeoMap [data-pl-seg-type],
html.vc-rail #utTiers,
html.vc-rail .filter-label:has(+ #utTiers),
html.vc-rail #ocTiers { display: none !important; }
/* The timeline's row now starts with Mode. */
html.vc-rail .filter-label.ut-label-2 { margin-left: 0; }

/* A chart that cannot take a rail filter says so just above the card. */
html.vc-rail .plo-note {
    margin: 0 0 -0.9rem;
    color: var(--text-faint); font: 400 0.8rem/1.4 var(--font-sans);
}
html.vc-rail .plo-note[hidden] { display: none; }

/* ── Names rail ───────────────────────────────────────────────────────── */
html.vc-rail .plo-names {
    display: block;
    position: sticky; top: 132px;   /* clears the nav and the family strip */
    max-height: calc(100vh - 152px); overflow-y: auto;
    scrollbar-width: none;
}
html.vc-rail .plo-names::-webkit-scrollbar { width: 0; }
html.vc-rail .plo-names:hover { scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; }
html.vc-rail .plo-names:hover::-webkit-scrollbar { width: 6px; }
html.vc-rail .plo-names:hover::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 999px; }
html.vc-rail .plo-list { padding-bottom: 1.25rem; }
html.vc-rail .plo-list + .plo-list { padding-top: 1rem; border-top: 1px solid var(--border-light); }
html.vc-rail .plo-list[hidden] { display: none; }
/* Cards on the canvas, like the VC investment dashboard (MAR-891, MAR-899).
   A section that already holds its own chart card stays on the canvas, so no
   card sits inside another; only a bare section becomes the card. */
html.vc-rail .plo-layout .vcr-grid > .section:not(:has(.map-card, .city-scatter-card, .matrix-table-wrap, .evbc, .pl-geo-card)) { padding: 24px 28px; background: var(--surface-card); border: 1px solid var(--border-light); border-radius: 14px; }
html.vc-rail .plo-layout .vcr-grid > .egate-clip:not(:has(.map-card, .city-scatter-card, .matrix-table-wrap, .evbc, .pl-geo-card)) { border-bottom: 0; border-radius: 14px 14px 0 0; }
html.vc-rail .plo-layout .vcr-grid > .egate-clip:not(:has(.map-card, .city-scatter-card, .matrix-table-wrap, .evbc, .pl-geo-card)) + .egate-veil { margin-top: -1.5rem; border: 1px solid var(--border-light); border-top: 0; border-radius: 0 0 14px 14px; background-color: var(--surface-card); }
/* The sector matrix table sits inside its chart card: no second border (MAR-899). */
html.vc-rail .plo-layout .map-card .matrix-table-wrap { border: 0; box-shadow: none; }
html.vc-rail .plo-names { display: flex; flex-direction: column; gap: 12px; }
html.vc-rail .plo-list { padding: 16px 18px; background: var(--surface-card); border: 1px solid var(--border-light); border-radius: 14px; }
html.vc-rail .plo-list + .plo-list { padding-top: 16px; border-top: 1px solid var(--border-light); }
html.vc-rail .plo-list-title {
    margin: 0;
    color: var(--white); font: 700 0.95rem/1.3 var(--font-sans);
}
html.vc-rail .plo-list-sub {
    margin: 0.15rem 0 0.6rem;
    color: var(--text-faint); font: 400 0.78rem/1.4 var(--font-sans);
}
html.vc-rail .plo-count { font-weight: 600; color: var(--text-light); }
html.vc-rail .plo-items { list-style: none; margin: 0; padding: 0; }
html.vc-rail .plo-item[hidden] { display: none; }
html.vc-rail .plo-row {
    display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 0.6rem; align-items: center;
    padding: 0.32rem 0.25rem; margin: 0 -0.25rem;
    border-radius: 6px;
    color: inherit; text-decoration: none;
}
html.vc-rail a.plo-row:hover { background: var(--chart-canvas); }
html.vc-rail a.plo-row:hover .plo-name { color: var(--blue); }
html.vc-rail .plo-logo {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; overflow: hidden;
    border: 1px solid var(--logo-tile-border); border-radius: 6px;
    background: var(--logo-tile-bg);
}
html.vc-rail .plo-logo img { width: 100%; height: 100%; object-fit: contain; }
html.vc-rail .plo-logo-letter { color: var(--text-faint); font: 700 0.8rem var(--font-sans); }
html.vc-rail .plo-text { display: grid; min-width: 0; }
html.vc-rail .plo-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--white); font: 600 0.84rem/1.25 var(--font-sans);
}
html.vc-rail .plo-meta {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--text-faint); font: 400 0.72rem/1.3 var(--font-sans);
}
html.vc-rail .plo-val { color: var(--text-light); font: 600 0.78rem var(--font-sans); white-space: nowrap; }
html.vc-rail .plo-empty { margin: 0.2rem 0 0; color: var(--text-faint); font: 400 0.8rem var(--font-sans); }
html.vc-rail .plo-empty[hidden] { display: none; }
html.vc-rail .plo-list-foot { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; padding-top: 0.4rem; }
html.vc-rail .plo-more,
html.vc-rail .plo-all {
    padding: 0; border: 0; background: none; cursor: pointer;
    color: var(--blue); font: 600 0.8rem var(--font-sans); text-decoration: none;
}
html.vc-rail .plo-more[hidden] { display: none; }
html.vc-rail .plo-more:hover,
html.vc-rail .plo-all:hover { text-decoration: underline; }

/* ── Narrower screens ─────────────────────────────────────────────────── */
/* Below 1240px the names move under the charts, two lists side by side. */
@media (max-width: 1239.98px) {
    html.vc-rail .vcr-layout.plo-layout { grid-template-columns: 216px minmax(0, 1fr); }
    html.vc-rail .plo-names {
        grid-column: 2; position: static; max-height: none; overflow: visible;
        display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 2rem;
        padding-top: 1.5rem; border-top: 1px solid var(--border-light);
    }
    html.vc-rail .plo-list + .plo-list { padding-top: 0; border-top: 0; }
}
@media (max-width: 899.98px) {
    html.vc-rail .plo-names { margin-top: 2rem; grid-template-columns: minmax(0, 1fr); }
    html.vc-rail .plo-list + .plo-list { padding-top: 1rem; border-top: 1px solid var(--border-light); }
}

/* The hero holds only the breadcrumbs and the title here. */
html.vc-rail .hero:has(+ .vcr-layout.plo-layout),
html.vc-rail .hero:has(~ .vcr-layout.plo-layout) { min-height: 0; }
html.vc-rail .hero:has(~ .vcr-layout.plo-layout) .hero-inner { max-width: 1640px; padding-bottom: 0.5rem; }

/* The sector table's own filters all live in the rail now (exit status
   follows the rail's Status). */
html.vc-rail .matrix-filters { display: none !important; }

/* The map builds its own chapter-sized heading; here it reads as a card
   title like the others. */
html.vc-rail #powerLawGeoMap .pl-geo-eyebrow { display: none; }
html.vc-rail #powerLawGeoMap .pl-geo-title {
    font: 700 1.15rem/1.3 var(--font-sans); letter-spacing: 0; margin: 0 0 0.25rem;
}
html.vc-rail #powerLawGeoMap .pl-geo-sub { font-size: 0.92rem; margin-bottom: 0.8rem; }
