/* ==========================================================================
   Repolex Ecosystem Wheel
   Clean, architectural, white-background pencil-line aesthetic.

   Two fixed zones under the site nav: the wheel, which takes about four
   fifths of the width and always fits its area, and a side panel holding
   every control and the selected repository (goodlux, 2026-09-24).
   ========================================================================== */

:root {
    --wheel-bg: #ffffff;
    --wheel-surface: #fafafb;
    --wheel-rule: #e4e4e7;
    --wheel-rule-soft: #f1f1f4;
    --wheel-ink: #18181b;
    --wheel-ink-soft: #52525b;
    --wheel-ink-faint: #a1a1aa;
    --wheel-complete: #16a34a;
    --wheel-progress: #d97706;
    --wheel-failed: #dc2626;
    --wheel-discovered: #94a3b8;
    --wheel-inbound: #2563eb;
    --wheel-outbound: #d97706;
    --wheel-font-mono: 'Courier New', 'American Typewriter', Menlo, monospace;
    --side-width: clamp(300px, 20vw, 400px);
    /* The site nav is fixed and measures 51px (0.75rem padding round
       0.85rem text, plus its rule). The shell starts below it. */
    --nav-h: 51px;
}

body.viz-body {
    margin: 0;
    padding: 0;
    padding-top: var(--nav-h);
    height: 100vh;
    overflow: hidden;
    background: var(--wheel-bg);
    color: var(--wheel-ink);
    font-family: var(--wheel-font-mono);
    user-select: none;
}

.viz-shell {
    display: grid;
    grid-template-columns: 1fr var(--side-width);
    width: 100vw;
    height: calc(100vh - var(--nav-h));
    overflow: hidden;
    background: var(--wheel-bg);
}

/* --- the wheel ----------------------------------------------------------- */

/* style.css gives every <main> an 800px column with padding; the wheel's
   area is not an article column. */
main.canvas-container {
    max-width: none;
    margin: 0;
    padding: 0;
}
.canvas-container {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

#wheel-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.all-languages {
    position: absolute;
    top: 14px;
    left: 14px;
    height: 28px;
    padding: 0 0.7rem;
    border: 1px solid var(--wheel-ink);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    color: var(--wheel-ink);
    cursor: pointer;
}
.all-languages:hover { background: var(--wheel-ink); color: #ffffff; }
.all-languages.hidden { display: none; }

.wheel-tooltip {
    position: absolute;
    z-index: 120;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--wheel-ink);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    padding: 0.45rem 0.75rem;
    max-width: 320px;
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 11px;
    transform: translate(14px, 14px);
}
.wheel-tooltip.flip-x { transform: translate(calc(-100% - 14px), 14px); }
.wheel-tooltip.flip-y { transform: translate(14px, calc(-100% - 14px)); }
.wheel-tooltip.flip-x.flip-y { transform: translate(calc(-100% - 14px), calc(-100% - 14px)); }
.wheel-tooltip strong { font-size: 12.5px; font-weight: 600; color: var(--wheel-ink); }
.wheel-tooltip .meta-line { color: var(--wheel-ink-soft); display: flex; gap: 0.4rem; }

/* --- the side panel ------------------------------------------------------ */

.side-panel {
    border-left: 1px solid var(--wheel-rule);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    font-size: 11.5px;
    color: var(--wheel-ink-soft);
}

.side-panel section { margin: 0; }   /* style.css spaces article sections */

.side-block {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--wheel-rule);
    flex: none;
}

.side-title {
    font-size: 10px;
    font-weight: normal;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wheel-ink-faint);
    margin: 0 0 0.5rem;   /* style.css gives h2 article margins */
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.side-title .hint { letter-spacing: 0; text-transform: none; font-size: 10px; }

.viz-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 0.8rem;
}
.viz-stats .figure b { color: var(--wheel-ink); font-variant-numeric: tabular-nums; }
.viz-stats .asof { grid-column: 1 / -1; color: var(--wheel-ink-faint); font-size: 10.5px; }

.viz-search-wrap { position: relative; }
.viz-search {
    width: 100%;
    box-sizing: border-box;
    height: 28px;
    padding: 0 1.6rem 0 0.6rem;
    border: 1px solid var(--wheel-rule);
    border-radius: 4px;
    font-family: inherit;
    font-size: 11.5px;
    color: var(--wheel-ink);
    background: #fafafa;
    outline: none;
}
.viz-search:focus { border-color: var(--wheel-ink); background: #ffffff; }
.viz-search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--wheel-ink-faint);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    display: none;
}
.viz-search-clear.visible { display: block; }

.lang-list { display: flex; flex-direction: column; gap: 0.15rem; }
.lang-pill {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0.45rem;
    border: 1px solid transparent;
    border-radius: 3px;
    background: none;
    font-family: inherit;
    font-size: 11px;
    color: var(--wheel-ink-soft);
    text-align: left;
    cursor: pointer;
}
.lang-pill b { font-weight: normal; font-variant-numeric: tabular-nums; color: var(--wheel-ink-faint); }
.lang-pill:hover { border-color: var(--wheel-rule); color: var(--wheel-ink); }
.lang-pill.on { background: var(--wheel-ink); color: #ffffff; }
.lang-pill.on b { color: rgba(255, 255, 255, 0.7); }

.viz-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}
.filter-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.45rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    background: #ffffff;
    border: 1px solid var(--wheel-rule);
    color: var(--wheel-ink-faint);
    cursor: pointer;
}
.filter-pill b { margin-left: auto; font-weight: normal; font-variant-numeric: tabular-nums; }
.filter-pill:hover { border-color: var(--wheel-ink-soft); }
.filter-pill.active { border-color: var(--wheel-ink); color: var(--wheel-ink); }
.filter-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.filter-dot.complete { background: var(--wheel-complete); }
.filter-dot.progress { background: var(--wheel-progress); }
.filter-dot.failed { background: var(--wheel-failed); }
.filter-dot.discovered { background: var(--wheel-discovered); }

.viz-btn {
    width: 100%;
    height: 28px;
    border: 1px solid var(--wheel-rule);
    background: #ffffff;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    color: var(--wheel-ink);
    cursor: pointer;
}
.viz-btn:hover { border-color: var(--wheel-ink); background: #fafafa; }

/* --- the selected repository --------------------------------------------- */

.inspector-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.inspector-empty { display: none; margin: 0; padding: 0.9rem 1rem; color: var(--wheel-ink-faint); }
.inspector-panel.empty .inspector-empty { display: block; }
.inspector-panel.empty .inspector-header,
.inspector-panel.empty .inspector-body { display: none; }

.inspector-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--wheel-rule);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    background: var(--wheel-surface);
}
.inspector-title-wrap { display: flex; flex-direction: column; gap: 0.25rem; overflow: hidden; }
.inspector-repo-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--wheel-ink);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.inspector-status-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    width: fit-content;
}
.inspector-status-badge.complete { background: #dcfce7; color: #166534; }
.inspector-status-badge.in_progress { background: #fef3c7; color: #92400e; }
.inspector-status-badge.failed { background: #fee2e2; color: #991b1b; }
.inspector-status-badge.discovered { background: #f1f5f9; color: #475569; }
.inspector-close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: var(--wheel-ink-faint);
    cursor: pointer;
    padding: 0;
}
.inspector-close:hover { color: var(--wheel-ink); }

.inspector-body {
    padding: 0.75rem 1rem;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.inspector-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.8rem;
    font-size: 11px;
}
.inspector-label { color: var(--wheel-ink-faint); }
.inspector-val { color: var(--wheel-ink); text-align: right; word-break: break-all; }
.inspector-val a { color: #2563eb; text-decoration: none; }
.inspector-val a:hover { text-decoration: underline; }

.inspector-section-title {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--wheel-ink-soft);
    margin-bottom: 0.35rem;
    display: flex;
    justify-content: space-between;
}
.inspector-section-title span { display: flex; align-items: center; gap: 0.4rem; }
.legend-line { display: inline-block; width: 16px; height: 2px; }
.legend-line.inbound { background: var(--wheel-inbound); }
.legend-line.outbound { background: var(--wheel-outbound); }

.inspector-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.inspector-list-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.2rem 0.3rem;
    border-radius: 3px;
    font-size: 11px;
    color: var(--wheel-ink);
    cursor: pointer;
}
.inspector-list-item span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inspector-list-item .pkg { color: var(--wheel-ink-faint); flex: none; }
.inspector-list-item:hover { background: #f4f4f5; color: #2563eb; }
.inspector-list-empty { color: var(--wheel-ink-faint); font-style: italic; padding: 0.2rem 0.3rem; font-size: 11px; }

/* --- pull it locally ------------------------------------------------------ */

.pull-copy {
    border: 1px solid var(--wheel-rule);
    background: #ffffff;
    border-radius: 3px;
    font-family: inherit;
    font-size: 10px;
    padding: 0 0.4rem;
    cursor: pointer;
    color: var(--wheel-ink-soft);
    text-transform: none;
    letter-spacing: 0;
}
.pull-copy:hover { border-color: var(--wheel-ink); color: var(--wheel-ink); }
.pull-deps { display: flex; align-items: center; gap: 0.35rem; font-size: 11px; margin-bottom: 0.35rem; cursor: pointer; }
.pull-deps b { font-weight: normal; color: var(--wheel-ink-faint); }
.pull-cmd {
    margin: 0;
    padding: 0.5rem 0.6rem;
    background: #18181b;
    color: #e4e4e7;
    border-radius: 4px;
    font-family: var(--wheel-font-mono);
    font-size: 10.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 12rem;
    overflow-y: auto;
    user-select: text;
}

/* Narrow windows: the panel goes under the wheel rather than squeezing it. */
@media (max-width: 760px) {
    body.viz-body { overflow: auto; height: auto; }
    .viz-shell { grid-template-columns: 1fr; grid-template-rows: 100vw auto; height: auto; }
    .side-panel { border-left: none; border-top: 1px solid var(--wheel-rule); }
}
