/* Bleed projects (6 Oct): the Projects group in the sidebar, the project home, the project
   tag and chip, the move menu. Tokens only (app.css §0), so both themes are a token swap;
   the buttons, cards and confirm rows are jbot.css's own. */

/* ---------- the sidebar group ---------- */
.pj-side { flex: none; display: flex; flex-direction: column; max-height: 42%; overflow-y: auto; padding: 0 var(--b-2); scrollbar-color: var(--rule2) transparent; scrollbar-width: thin; }
.pj-side[hidden], .pj-home[hidden], .pj-chip[hidden] { display: none !important; }
.pj-side-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--b-2); padding-right: var(--b-1); background: var(--paper); }
.pj-side .pj-label { position: static; flex: 1; }
.pj-side-head .pj-add { margin-bottom: 2px; }
.pj-add .icon { width: var(--b-icon-s); height: var(--b-icon-s); }
.pj-rows { display: flex; flex-direction: column; }
/* a project row is a chat row: the same height, radius, type and three states */
.pj-row { position: relative; display: flex; align-items: center; justify-content: flex-start; gap: var(--b-2); width: 100%; height: var(--b-row); margin-top: 1px; padding: 0 var(--b-3); border: 0; border-radius: var(--b-r-row); background: none; color: var(--ink2); font: var(--b-ui); text-align: left; transition: background var(--b-fast), color var(--b-fast); }
.pj-row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); opacity: 0; }
.pj-row:focus-visible { outline-offset: -2px; }
.pj-row:hover { background: var(--b-hover); color: var(--ink); }
.pj-row.on { background: var(--b-selected); color: var(--ink); font-weight: 550; }
.pj-row.on::before { opacity: 1; }
.pj-row > .icon { width: var(--b-icon-s); height: var(--b-icon-s); flex: none; color: var(--muted); }
.pj-row.on > .icon, .pj-here > .icon { color: var(--gold); }
.pj-row.archived > .icon { color: var(--muted); }
.pj-row-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-row-count { flex: none; min-width: 20px; font: var(--b-meta); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.pj-back { display: inline-flex; align-items: center; justify-content: flex-start; gap: var(--b-2); align-self: flex-start; height: var(--b-ctl); margin: var(--b-3) 0 var(--b-1); padding: 0 var(--b-3); border: 0; border-radius: var(--b-r-row); background: none; color: var(--soft); font: 500 12.5px var(--text); transition: background var(--b-fast), color var(--b-fast); }
.pj-back:hover { background: var(--b-hover); color: var(--ink); }
.pj-back .icon { width: var(--b-icon-s); height: var(--b-icon-s); }
.pj-quiet { margin: 2px var(--b-3) var(--b-2); font: var(--b-small); color: var(--muted); }
.pj-first { align-self: flex-start; margin: 0 var(--b-3) var(--b-2); }
.pj-link { display: inline; padding: 0; border: 0; background: none; color: var(--accent3); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--gold-line); cursor: pointer; }
.pj-link:hover { background: none; color: var(--accent); text-decoration-color: currentColor; }
.pj-arch-toggle { align-self: flex-start; margin: var(--b-1) var(--b-3); font-size: 12px; }
.pj-create { display: grid; gap: var(--b-2); margin: 0 var(--b-1) var(--b-2); padding: var(--b-3); border: 1px solid var(--rule); border-radius: var(--r); background: var(--bg); }
.pj-create-actions { display: flex; gap: 6px; }
.pj-input { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--rule2); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); font: 13.5px/1.5 var(--text); }
.pj-input:focus { outline: none; border-color: var(--gold-line); box-shadow: 0 0 0 3px var(--gold-soft); }
.pj-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pj-err { margin: 0; font: 500 12.5px/1.5 var(--text); color: var(--stop); overflow-wrap: anywhere; }

/* the project tag on a chat row (All chats), and four actions on a row */
/* the project a chat belongs to: a folder glyph in the row (its name is the tooltip and the spoken text) */
.pj-tag { flex: none; display: inline-flex; align-items: center; color: var(--muted); }
.pj-tag .icon { width: var(--b-glyph); height: var(--b-glyph); }
.pj-tag span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the chip in a project chat's header */
.pj-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 200px; height: 28px; padding: 0 var(--b-3); border: 1px solid var(--rule2); border-radius: 999px; background: transparent; color: var(--soft); font: 500 12px var(--text); transition: background var(--b-fast), border-color var(--b-fast), color var(--b-fast); }
.pj-chip:hover { background: var(--b-hover); border-color: var(--muted); color: var(--ink); }
.pj-chip .icon { width: var(--b-glyph); height: var(--b-glyph); flex: none; }
.pj-chip span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- the menu (project settings, move to project) ---------- */
.pj-menu { position: fixed; z-index: 30; display: flex; flex-direction: column; gap: 2px; width: max-content; min-width: 208px; max-width: min(300px, calc(100vw - 16px)); max-height: min(360px, calc(100vh - 16px)); overflow-y: auto; padding: 6px; border: 1px solid var(--rule2); border-radius: var(--r); background: var(--paper); box-shadow: var(--shadow-2); animation: pj-pop var(--b-fast) ease-out both; }
@keyframes pj-pop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.pj-menu-note { margin: 6px 10px; max-width: 260px; font: var(--b-label); line-height: 1.5; letter-spacing: var(--b-track); text-transform: uppercase; color: var(--muted); }
.pj-menu-item { display: flex; align-items: center; justify-content: flex-start; gap: var(--b-3); width: 100%; height: var(--b-ctl); padding: 0 var(--b-3) 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: var(--b-ui); text-align: left; transition: background var(--b-fast); }
.pj-menu-item:hover, .pj-menu-item:focus-visible { background: var(--b-hover); color: var(--ink); }
.pj-menu-item:focus-visible { outline-offset: -2px; }
.pj-menu-item > .icon { width: var(--b-icon); height: var(--b-icon); flex: none; color: var(--muted); }
.pj-menu-item span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-menu-item.on { font-weight: 600; }
.pj-menu-item .pj-tick { color: var(--accent3); }
.pj-menu-item.danger, .pj-menu-item.danger > .icon { color: var(--stop); }

/* ---------- the project home ---------- */
.jp-main.pj-on { grid-template-rows: auto minmax(0, 1fr); }
.jp-main.pj-on > .jp-scroll, .jp-main.pj-on > .jp-hero { display: none !important; }
.pj-home { min-height: 0; min-width: 0; overflow-y: auto; scrollbar-color: var(--rule2) transparent; }
.pj-home-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 32px; align-items: start; width: min(1180px, 100%); margin: 0 auto; padding: 32px clamp(16px, 2.5vw, 32px) 48px; }
.pj-home.bare .pj-home-in { grid-template-columns: minmax(0, 1fr); }
.pj-main { display: grid; gap: 24px; min-width: 0; }
.pj-col { display: grid; gap: 16px; min-width: 0; }
.pj-head { display: grid; gap: 8px; min-width: 0; }
.pj-eyebrow { display: flex; align-items: center; gap: var(--b-2); margin: 0; font: var(--b-label); letter-spacing: var(--b-track); text-transform: uppercase; color: var(--muted); }
.pj-eyebrow .icon { width: 13px; height: 13px; color: var(--gold); }
.pj-pill { padding: 2px 8px; border: 1px solid var(--rule2); border-radius: 999px; letter-spacing: .08em; color: var(--soft); }
.pj-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pj-name { flex: 0 1 auto; min-width: 0; margin: 0 6px 0 0; font: 500 clamp(28px, 3vw, 40px)/1.1 var(--display); letter-spacing: -.01em; color: var(--ink); overflow-wrap: anywhere; }
.pj-name:focus-visible { outline-offset: 4px; }
.pj-desc { display: inline-flex; align-items: baseline; justify-content: flex-start; gap: 8px; justify-self: start; max-width: 100%; padding: 4px 8px; margin-left: -8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--soft); font: 14.5px/1.55 var(--text); text-align: left; }
.pj-desc span { min-width: 0; overflow-wrap: anywhere; }
.pj-desc.empty { color: var(--muted); }
.pj-desc:hover { background: var(--bg2); color: var(--ink); }
.pj-desc .icon { width: 12px; height: 12px; flex: none; color: var(--muted); opacity: 0; transition: opacity .15s; }
.pj-desc:hover .icon, .pj-desc:focus-visible .icon, .pj-desc.empty .icon { opacity: 1; }
.pj-inline { display: grid; gap: 8px; }
.pj-inline .pj-edit-name { font: 500 26px/1.2 var(--display); }
.pj-note { margin: 0; font: 13px/1.5 var(--text); color: var(--soft); }
.pj-delete { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--stop) 35%, var(--rule2)); border-radius: var(--r-lg); background: color-mix(in srgb, var(--stop) 6%, var(--paper)); }
.pj-delete strong { font: 600 14px var(--text); color: var(--ink); overflow-wrap: anywhere; }
.pj-delete p { margin: 0; font: 13px/1.55 var(--text); color: var(--ink2); }
.pj-slot .jp-composer-wrap { width: 100%; margin: 0; padding: 0; animation: none; }
.pj-slot .jp-composer-wrap::before { display: none; }
.pj-slot .jp-foot { text-align: left; }
.pj-sec { display: grid; gap: 10px; min-width: 0; }
.pj-col .pj-sec { padding: 16px; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper); }
.pj-sec h2 { display: flex; align-items: baseline; gap: 8px; margin: 0; font: 600 14px/1.3 var(--text); color: var(--ink); }
.pj-chats h2 { font: var(--b-label); letter-spacing: var(--b-track); text-transform: uppercase; color: var(--muted); }
.pj-count { font: 500 11.5px var(--text); letter-spacing: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.pj-about { margin: -4px 0 0; font: 12.5px/1.5 var(--text); color: var(--soft); }
.pj-sec .pj-quiet { margin: 0; }
.pj-sec-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12.5px; }
.pj-instr { min-height: 120px; resize: vertical; }
.pj-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; min-width: 0; }
.pj-list li { display: flex; align-items: center; gap: 2px; min-width: 0; }
.pj-chats .pj-list { border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper); padding: 4px; }
.pj-item { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: var(--b-3); height: var(--b-row); padding: 0 var(--b-3); border: 0; border-radius: var(--b-r-row); background: none; color: var(--ink2); font: var(--b-ui); text-align: left; transition: background var(--b-fast); }
.pj-col .pj-item { padding-left: 6px; }
.pj-item:hover { background: var(--b-hover); color: var(--ink); }
.pj-item > .icon { width: var(--b-icon-s); height: var(--b-icon-s); flex: none; color: var(--muted); }
.pj-item-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-item-meta { flex: none; max-width: 55%; font: 11.5px/1.3 var(--text); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-k { display: grid; gap: 10px; justify-items: start; }
.pj-k .pj-list { width: 100%; }
.pj-k-confirm { gap: 6px !important; padding: 6px 8px 6px 10px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--stop) 8%, var(--paper)); }
.pj-k-confirm .jp-confirm-text { overflow-wrap: anywhere; }
.pj-k-form { display: grid; gap: 6px; }
.pj-k-form label { font: 600 12px var(--text); color: var(--soft); }
.pj-k-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 4px; }
.pj-k-text { min-height: 140px; resize: vertical; }
.pj-k-form .jp-set-actions { margin-top: 4px; }
.pj-state { align-content: center; min-height: 60%; }
.pj-state .jp-set-actions { justify-content: center; margin-top: 8px; }

@media (max-width: 1100px) {
  .pj-home-in { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 24px; }
}
@media (max-width: 860px) {
  .pj-home-in { padding: 20px 12px 32px; }
  .pj-row, .pj-item, .pj-menu-item { height: 44px; }
  .pj-side { max-height: 46%; }
}
@media (max-width: 560px) {
  .pj-chip { width: 32px; height: 32px; padding: 0; justify-content: center; }
  .pj-chip span { display: none; }
  .pj-name { font-size: 28px; }
  .pj-item-meta { max-width: 40%; }
  .pj-delete .jp-set-action { width: 100%; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .pj-menu { animation: none; } .pj-row, .pj-chip, .pj-desc .icon { transition: none; } }
.pj-item-meta.over { color: var(--stop); font-weight: 600; }
.pj-left { margin-left: auto; max-width: none; }

@media (hover: none) { .pj-desc .icon { opacity: 1; } }
/* inside a project the day labels of the list below already head its chats */
.pj-here ~ .pj-label { display: none; }
.pj-here { margin-bottom: var(--b-1); }
