/* The project pages (projects.js), ported from the ForQ app's layout onto studio.css's tokens. */

.panel:is(#tab-memory, #tab-projects, #tab-project, #tab-timeline, #tab-diff, #tab-share, #tab-connect, #tab-sharedlist) { display: flex; flex-direction: column; gap: 16px; }

/* A page's head: a way back, the title with its actions, a line under it. */
.mem-body { display: flex; flex-direction: column; gap: 14px; }
.pj-head { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 0; }
.pj-head:empty { display: none; }
.pj-back { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; color: rgb(var(--muted)); font-size: 13px; text-decoration: none; }
.pj-back:hover { color: rgb(var(--ink)); }
.pj-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pj-title h1 { flex: 1; min-width: 0; font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1.15; letter-spacing: -0.03em; color: rgb(var(--ink)); overflow-wrap: anywhere; }
.pj-title .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pj-title .acts a { text-decoration: none; }
.pj-sub { color: rgb(var(--muted)); }
.pj-facts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pj-note { color: rgb(var(--faint)); font-size: 13px; padding: 4px 6px; }
.pj-group { margin-top: 8px; font-size: 18px; }

/* Accordions: projects on Projects, sections on a project. */
.pj-list { display: flex; flex-direction: column; border-radius: 28px; background: rgb(var(--raised)); padding: 6px 10px; }
.pj-list:empty { display: none; }
.pj-list > .empty, .pj-list > .pj-note, .pj-list > .pj-new { padding: 12px 10px; }
.pj-item { border-top: 1px solid var(--line); }
.pj-item:first-child, .pj-new + .pj-item { border-top: 0; }
.pj-item > summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 6px; cursor: pointer; list-style: none; border-radius: 14px; }
.pj-item > summary::-webkit-details-marker { display: none; }
.pj-item > summary:hover { background: rgb(var(--ink) / 0.03); }
.pj-item .chev { display: inline-flex; color: rgb(var(--faint)); transition: transform 0.15s; }
.pj-item[open] > summary .chev { transform: rotate(90deg); }
.pj-name { flex: 1; min-width: 0; font-weight: 600; color: rgb(var(--ink)); }
.pj-name-link { color: inherit; text-decoration: none; }
.pj-name-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.pj-meta { display: inline-flex; align-items: center; gap: 8px; color: rgb(var(--faint)); font-size: 12.5px; }
.pj-body { display: flex; flex-direction: column; gap: 10px; padding: 0 8px 14px 32px; }
.pj-body > .btn { align-self: flex-start; }
.pj-counts, .pj-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.pj-links { display: flex; gap: 16px; flex-wrap: wrap; }
.pj-link { display: inline-flex; align-items: center; gap: 2px; color: rgb(var(--accent)); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.pj-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.pj-new { display: flex; gap: 6px; flex-wrap: wrap; }
.pj-new input { flex: 1; min-width: 160px; }

.pj-topics { display: flex; gap: 6px; flex-wrap: wrap; }
.pj-topics:empty { display: none; }
.pj-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; background: rgb(var(--chip)); padding: 4px 11px; font-size: 13px; color: rgb(var(--body)); }

/* What changed. */
.pj-dates { display: inline-flex; align-items: center; gap: 6px; color: rgb(var(--muted)); font-size: 13px; }
.pj-diff { display: flex; flex-direction: column; gap: 16px; }
.pj-diff .card .bar { margin-bottom: 4px; }
.pj-change .text { display: flex; flex-direction: column; gap: 3px; }
.pj-arrow { display: inline-flex; color: rgb(var(--faint)); }
.pj-why { font-size: 13px; color: rgb(var(--muted)); }

/* Share: the steps, and who reads it. */
.pj-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; counter-reset: step; }
.pj-steps > li { counter-increment: step; display: flex; flex-direction: column; gap: 10px; }
.pj-steps > li > h2::before, .pj-steps > li > .bar > h2::before { content: counter(step) ". "; color: rgb(var(--faint)); }
.pj-vis { display: flex; flex-direction: column; gap: 6px; }
.pj-choice { display: flex; align-items: flex-start; gap: 10px; width: 100%; border: 2px solid var(--line); border-radius: 16px; background: none; padding: 11px 12px; text-align: left; color: rgb(var(--body)); }
.pj-choice:hover { border-color: var(--line-strong); }
.pj-choice.on { border-color: rgb(var(--accent) / 0.6); background: rgb(var(--accent) / 0.05); }
.pj-choice .dot { flex-shrink: 0; width: 14px; height: 14px; margin-top: 3px; border-radius: 999px; border: 2px solid rgb(var(--faint)); }
.pj-choice.on .dot { border-color: rgb(var(--accent)); background: rgb(var(--accent)); box-shadow: inset 0 0 0 2px rgb(var(--raised)); }
.pj-choice > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.pj-url { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Connect: the catalog and its sheet. */
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pj-conn { display: flex; flex-direction: column; align-items: stretch; gap: 10px; border: 0; text-align: left; color: rgb(var(--body)); border-radius: 22px; padding: 16px 18px; }
.pj-conn:hover { background: rgb(var(--block)); }
.pj-conn-head { display: flex; align-items: center; gap: 12px; }
.pj-conn-head > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pj-conn-head strong { color: rgb(var(--ink)); }
.pj-logo { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; }
.pj-logo.mono { display: inline-block; background: rgb(var(--ink)); -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
.pj-logo.mono.chatgpt { -webkit-mask-image: url("/assets/connectors/chatgpt.svg"); mask-image: url("/assets/connectors/chatgpt.svg"); }

.pj-sheet { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); border: 1px solid var(--line-strong); border-radius: 24px; background: rgb(var(--card)); color: rgb(var(--body)); padding: 20px; }
.pj-sheet[open] { display: flex; flex-direction: column; gap: 12px; }
.pj-sheet::backdrop { background: rgb(var(--page) / 0.7); }
.pj-sheet .seg { align-self: flex-start; background: rgb(var(--block)); }
.pj-sheet-body { display: flex; flex-direction: column; gap: 8px; }
.pj-sheet .acts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pj-code { position: relative; display: flex; align-items: flex-start; gap: 8px; border-radius: 14px; background: rgb(var(--block)); padding: 10px 12px; }
.pj-code pre { flex: 1; min-width: 0; margin: 0; overflow-x: auto; font-size: 12.5px; line-height: 1.5; }
.pj-code code { user-select: all; }

@media (max-width: 640px) {
  .pj-title h1 { font-size: 24px; }
  .pj-body { padding-left: 12px; }
  .pj-item > summary .pj-meta { width: 100%; padding-left: 24px; }
  .pj-grid { grid-template-columns: 1fr; }
  .pj-sheet { padding: 16px; }
  #inv-share .row { flex-wrap: wrap; }
  #inv-share .row .text { flex-basis: calc(100% - 80px); }
  #inv-share .row select { width: 100%; }
}
