/* ============================================================================
   AFK · Web UI (Phase 11) — self-hosted fonts + supplemental styles.

   The prototype pulled Bricolage Grotesque + JetBrains Mono from Google's CDN.
   The control plane is egress-locked (nothing leaves your infra), so the fonts
   are vendored under /static/fonts and declared here instead. Also adds the two
   status variants the real task vocabulary needs beyond the prototype's six
   (a PR closed unmerged, and a cancelled task) — see src/web/status.ts.
   ========================================================================== */

/* ----- Self-hosted fonts ------------------------------------------------- */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/fonts/bricolage-grotesque-var.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-600.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-700.woff2") format("woff2");
}

/* ----- Status variants beyond the prototype's six ------------------------ */
/* closed = PR closed without merging: distinct from failed (muted, not vermillion). */
.status.is-closed    { --fg: var(--ink-3); --bd: var(--line-bright); --bg: rgba(255,255,255,0.03); }
/* cancelled = you stopped it. */
.status.is-cancelled { --fg: var(--ink-3); --bd: var(--line-bright); --bg: transparent; }

/* ----- htmx: fade swapped fragments so the ~3s polling doesn't flicker ---- */
.htmx-swapping { opacity: 0; transition: opacity 0.12s ease-out; }
.htmx-settling { opacity: 1; transition: opacity 0.12s ease-in; }
@media (prefers-reduced-motion: reduce) {
  .htmx-swapping, .htmx-settling { transition: none; }
}

/* A subtle indicator that a live region is refreshing. */
.htmx-request .poll-dot { opacity: 1; }
.poll-dot { opacity: 0; transition: opacity 0.2s; }

/* ----- New-request modal: entrance ---------------------------------------- */
/* The modal is hx-swapped into #modal-root already carrying `.show` (so it's visible
   immediately, no JS to toggle a class). A CSS animation plays on insertion for a clean
   fade + rise — the prototype used a transition, which needs a prior state we don't have. */
#modal-root .scrim.show { animation: modal-scrim-in 0.2s ease-out; }
#modal-root .scrim.show .modal { animation: modal-rise-in 0.24s var(--ease); }
@keyframes modal-scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise-in {
  from { opacity: 0.4; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1;   transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #modal-root .scrim.show,
  #modal-root .scrim.show .modal { animation: none; }
}

/* ----- Requests filter: chip glyph + per-chip count ----------------------- */
/* The shared <Glyph> renders a bare <svg><use/></svg> and leans on an ancestor rule
   for its size (styles.css only sizes `.status .glyph svg`). Inside a filter chip it
   would otherwise fall back to the SVG default height (~150px) and spill below the row,
   so size it here — mirroring the `.status .glyph svg` rule. */
.fbtn .glyph { display: grid; place-items: center; flex: none; }
.fbtn .glyph svg { width: 12px; height: 12px; }
.fbtn .n { color: var(--ink-4); font-variant-numeric: tabular-nums; }
.fbtn.active .n { color: var(--signal-2); }

/* ----- History table: make the whole row a click target ------------------- */
/* The row already advertises itself as clickable (dashboard.css sets cursor:pointer +
   a hover highlight on `table.hist tr`), but only the task-title <a class="ttl"> was
   actually a link — so a click anywhere else in the row did nothing, which read as
   "sometimes it won't open". Stretch the title link over the whole row. Safe here: the
   row has no other links (the PR cell is plain text), so nothing interactive is covered.
   NB: keep `.ttl` itself unpositioned — the ::after must resolve against the <tr>. */
table.hist tbody tr { position: relative; }
table.hist .ttl::after { content: ""; position: absolute; inset: 0; }

/* ----- Topbar: clamp the sub-heading to one line -------------------------- */
/* The task-detail view feeds the whole (arbitrarily long) task request into the topbar
   sub (`sub={task.request}` in app.tsx). Without this it wraps to several lines and
   crowds the right-side controls. `min-width:0` lets the flex item shrink past its
   content; the sub then ellipsizes. Harmless on other pages — short subs never overflow. */
.topbar .head-txt { min-width: 0; }
.topbar .head-txt p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The live-chip and account are pills — never let them shrink/wrap under flex pressure.
   (A long task-detail sub used to squeeze "N active" onto two lines in production.) */
.topbar .live-chip,
.topbar .acct { white-space: nowrap; flex: none; }

/* ----- Onboard: live readiness checklist ---------------------------------- */
/* Reuses the vendored `.steps-rail`/`.orow` step styling; adds the fail state, the
   icon sizing inside the numbered node, and the "ready" banner. `.orow.done` (green) is
   already defined in dashboard.css. */
.orow .rail .num svg { width: 15px; height: 15px; }
.orow.fail .rail .num { background: rgba(255, 90, 60, 0.12); border-color: var(--vermillion); color: var(--vermillion); }
.orow:not(.done):not(.fail) .body { opacity: 0.55; }        /* pending gates read as upcoming */
.ready-banner {
  display: flex; align-items: center; gap: 9px; margin-top: 2px;
  border: 1px solid var(--signal-dim); background: var(--signal-tint); color: var(--signal-2);
  border-radius: var(--r); padding: 11px 14px; font-size: 13px;
}
.ready-banner svg { width: 16px; height: 16px; flex: none; }

/* ----- Onboard: config.yml reference -------------------------------------- */
/* The reference sits full-width below the form/checklist, so its .gen-card must not
   inherit the sticky positioning the checklist card uses. */
.cfg-ref .gen-card { position: static; }
.prop-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.prop-table th {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line);
  color: var(--ink-4); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600;
}
.prop-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prop-table tr:last-child td { border-bottom: 0; }
.prop-table .key { color: var(--ink); }
.prop-table .def { white-space: nowrap; }
.prop-table .desc { color: var(--ink-2); line-height: 1.5; }
.tag {
  display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--line-bright); white-space: nowrap;
}
.tag.req { color: var(--signal-2); border-color: var(--signal-dim); background: var(--signal-tint); }
.tag.opt { color: var(--ink-4); }
/* Copy-config button — pinned to the right of the sample card header. */
.gen-card .gh .copy-btn { margin-left: auto; gap: 6px; padding: 4px 10px; }

/* Collapsible "advanced blocks" (preview:/screenshot:) section of the config reference. */
.cfg-advanced { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.cfg-advanced > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 600; color: var(--ink); user-select: none;
}
.cfg-advanced > summary::-webkit-details-marker { display: none; }
.cfg-advanced > summary:hover { color: var(--signal-2); }
.cfg-advanced > summary .chev { color: var(--ink-4); transition: transform 0.18s; flex: none; }
.cfg-advanced[open] > summary .chev { transform: rotate(90deg); }
