/* View tuning for the whole app (loaded after the page styles).
   Denser tables, long tables paged, panels that fold, the Ecosystem parts in the sidebar.
   The behaviour lives in public/view.js. */

/* ── Page header: less space above the work ── */
.page { padding-top: clamp(16px, 2.2vw, 28px); }
.ph { margin-bottom: 16px; }
.ph h1 { font-size: clamp(22px, 2vw, 26px); }
.ph h1::after { margin-top: 8px; }
.seg { margin-bottom: 16px; }

/* ── Tables: tighter rows, short values kept on one line ── */
th, td { padding: 9px 14px; }
td { font-size: 13.5px; line-height: 1.4; }
td.code, td .code, td .pill, td time { white-space: nowrap; }
td .sub { font-size: 12px; margin-top: 1px; }
tbody tr:hover > td { background: var(--hover); }

/* Directory: one line per entry */
#ld-table td:nth-last-child(1), #ld-table td:nth-last-child(2), #ld-table td:nth-last-child(4) { white-space: nowrap; }
#ld-table td:nth-last-child(3) { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ld-table td:nth-last-child(6) { white-space: nowrap; }

/* Founders: the one-liner on one line, full text on hover */
table.fd-t td.co span { display: -webkit-box; max-width: 520px; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.fd-t td { vertical-align: middle; }

/* Long text in a cell: three lines until clicked (view.js) */
td.has-clip { min-width: 260px; }
.clip { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.clip.open { display: block; -webkit-line-clamp: unset; }

/* ── Long tables: pager under the table, header stays in view ── */
tr.pg-off { display: none; }
.tw.pg-stick { overflow: visible; }
.tw.pg-stick th { position: sticky; top: 0; z-index: 2; }
.pg-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); background: var(--surface); }
.pg-bar b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.pg-bar .pg-nav { display: inline-flex; align-items: center; gap: 4px; }
.pg-bar .pg-size { display: inline-flex; gap: 2px; margin-left: auto; padding: 2px; background: var(--soft); border-radius: 8px; }
.pg-bar button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 500; min-width: 30px; height: 28px; padding: 0 9px; border-radius: 7px; cursor: pointer; }
.pg-bar button:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.pg-bar button:disabled { opacity: .35; cursor: default; }
.pg-bar .pg-size button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ── Panels fold from their header; the choice is kept per page ── */
.panel-h { position: relative; }
.panel-h:has(> .pfold) { padding-right: 48px; }
.pfold { position: absolute; right: 12px; top: 13px; display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s, transform .2s; }
.panel-h:hover .pfold, .pfold:focus-visible, .panel.folded .pfold { opacity: 1; }
.pfold:hover { background: var(--hover); color: var(--ink); }
.pfold svg { width: 16px; height: 16px; }
.panel.folded .pfold { transform: rotate(-90deg); }
.panel.folded > :not(.panel-h) { display: none !important; }
.panel.folded > .panel-h { border-bottom: 0; }
@media (hover: none) { .pfold { opacity: 1; } }

/* ── Back to top on long pages ── */
.to-top { position: fixed; right: 22px; bottom: 22px; z-index: 30; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); display: grid; place-items: center; cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top svg { width: 18px; height: 18px; }

/* ── Sidebar: Ecosystem's parts sit under it ── */
/* The logo block never shrinks; when the list is taller than the window, the list scrolls instead */
.sb-brand, .sb-foot { flex-shrink: 0; }
.sb-nav { min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 -8px 0 -12px; padding: 0 4px 8px 12px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent; overscroll-behavior: contain; }
.sb-nav > *, .sb-subs > *, .sb-group { flex-shrink: 0; }
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 3px; }
.sb-nav::-webkit-scrollbar-track { background: transparent; }
/* Ecosystem folds: a click on it shows or hides its parts (kept per browser) */
.sb-chev { display: inline-grid; place-items: center; margin-left: auto; opacity: .6; transition: transform .2s var(--ease, ease); }
.sb-chev svg.i { width: 15px; height: 15px; }
.sb-group.shut .sb-chev { transform: rotate(-90deg); }
.sb-group.shut .sb-subs { display: none; }
.shell.mini .sb-chev { display: none; }
.shell.mini .sb-group .sb-subs { display: flex; }
.sb-group { display: flex; flex-direction: column; gap: 2px; }
.sb-subs { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 4px 22px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .14); }
.sb-subs .sb-i { height: 32px; font-size: 13px; gap: 9px; padding: 0 10px; }
.sb-subs .sb-i svg.i { width: 15px; height: 15px; }
.sb-subs .sb-i::before { left: -11px; }
.sb-i.sb-parent.open { color: var(--ink); }
.shell.mini .sb-subs { margin: 0; padding: 0; border: 0; }
.eco-parts { display: none; }
@media (max-width: 820px) {
  .eco-parts { display: inline-flex; }
  .to-top { bottom: calc(var(--hdr, 64px) + 14px); right: 14px; }
  .pg-bar .pg-size { margin-left: 0; }
  #ld-table td:nth-last-child(3) { max-width: 180px; }
}
#ld-table td:nth-last-child(7) { min-width: 200px; }
