/* Knowledge — Stage 1 (8 oct 2026). The shell: name + the house segmented control
 * (`tb-seg`, catalog default) + one panel at a time. Reference: CollectUI 28281548
 * (@kvnkld, "AI Knowledge Base") — see knowledge.js. Tokens only; no palette imported.
 * Pillars keeps pillars.css; Instructions is the old BESC drawer body (`.besc-inst-*`,
 * removed from besc.css) re-laid as a card. */

.kn-page { padding-bottom: 48px; }

.kn-top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 0 0 20px;
}
.kn-top h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.015em; color: var(--bb-ink); }
.kn-seg { flex-wrap: wrap; }

/* index.html's inline `button {}` (navy, inline-flex) out-ranks a single class on hover —
   the same trap pillars.css documents (§44). Every button here re-declares what it needs. */
.kn-page .tb-seg button { display: inline-flex; align-items: center; background: transparent; color: var(--bb-ink-2, #5A564F); }
.kn-page .tb-seg button:hover { background: var(--bb-hover, #F4F2EC); color: var(--bb-ink, #1A1A1A); }
.kn-page .tb-seg button.is-on { background: var(--bb-surface, #fff); color: var(--bb-accent-ink, #11326D); }

.kn-panel[hidden] { display: none !important; }

/* Pillars renders its own `.pl-top` with an h1; inside Knowledge it is a section head. */
.kn-panel .pl-top h1 { font-size: 18px; }

/* ------------------------------------------------------------- instructions */

.kn-inst { display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.kn-inst-seg { align-self: flex-start; flex-wrap: wrap; }
.kn-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px; border-radius: var(--bb-r-card, 12px);
  background: var(--bb-surface, #fff);
  box-shadow: var(--bb-sh-card, 0 0 0 1px var(--bb-line, #E6E1D8));
}
.kn-inst-nums { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; }
@media (max-width: 520px) { .kn-inst-nums { grid-template-columns: 1fr; } }
.kn-inst-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.kn-inst-f span { font-size: 11px; font-weight: 600; color: var(--bb-ink-3); }
.kn-inst-f input {
  width: 100%; box-sizing: border-box; height: 36px; padding: 0 12px;
  border: 1px solid var(--bb-line); border-radius: var(--bb-r-control, 8px);
  background: var(--bb-surface); color: var(--bb-ink);
  font-family: var(--bb-mono); font-variant-numeric: tabular-nums; font-size: 13px;
}
.kn-inst-ta {
  min-height: 360px; width: 100%; resize: vertical; box-sizing: border-box;
  padding: 12px 14px; border: 1px solid var(--bb-line); border-radius: var(--bb-r-control, 8px);
  background: var(--bb-surface); color: var(--bb-ink);
  font: 13px/1.55 'Outfit', sans-serif;
}
.kn-inst-f input:focus, .kn-inst-ta:focus {
  outline: none; border-color: var(--bb-navy, #0D2A5E); box-shadow: 0 0 0 3px rgba(13, 42, 94, .12);
}
.kn-inst-pie { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kn-inst-n { font-family: var(--bb-mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--bb-ink-3); }
.kn-inst-pie .kn-primary { margin-left: auto; }
/* --bb-fill, not --bb-accent: white text on a solid fill (beautiful.css — in dark the accent
   turns a lit blue and white on it reads 2.3:1). */
.kn-page button.tb-btn.kn-primary { background: var(--bb-fill, #0D2A5E); color: #fff; box-shadow: none; }
.kn-page button.tb-btn.kn-primary:hover { background: var(--bb-fill-2, #1A3D7A); }
.kn-page button.tb-btn.kn-primary:disabled { opacity: .6; cursor: default; }
.kn-row { margin-top: 10px; }

/* ------------------------------------------------------------- programs (stage 2a)
   Master-detail. Reference: CollectUI fe9c51a2 (@UI_Farhan, data-table + file-tree) — a
   grouped tree that picks on the left, a pane that reads on the right. Tokens only. */

.kn-prog { display: flex; flex-direction: column; gap: 14px; }
.kn-prog-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kn-q {
  margin-left: auto; width: 240px; max-width: 100%; height: 34px; box-sizing: border-box;
  padding: 0 12px; border: 1px solid var(--bb-line); border-radius: var(--bb-r-control, 8px);
  background: var(--bb-surface); color: var(--bb-ink); font: 13px 'Outfit', sans-serif;
}
.kn-q:focus { outline: none; border-color: var(--bb-accent); box-shadow: 0 0 0 3px rgba(13, 42, 94, .12); }
.kn-pl-n { font-family: var(--bb-mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--bb-ink-3); }
.kn-seg .kn-pl-n { margin-left: 6px; }

.kn-prog-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .kn-prog-grid { grid-template-columns: 1fr; } .kn-q { margin-left: 0; width: 100%; } }

.kn-pl {
  gap: 0; padding: 6px; max-height: calc(100vh - 220px); overflow-y: auto;
  position: sticky; top: 76px;
}
@media (max-width: 860px) { .kn-pl { position: static; max-height: 360px; } }
.kn-pl-g {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--bb-ink-3);
}
/* `.kn-pl` is a flex COLUMN with a max-height: without `flex: none` every row shrinks to its
   32px min-height once the list overflows, and a two-line name spills over its neighbours. */
.kn-page button.kn-pl-row {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; flex: none;
  padding: 6px 10px; border: 0; border-radius: 6px; text-align: left;
  background: transparent; color: var(--bb-ink); font: 13px/1.3 'Outfit', sans-serif; box-shadow: none;
  cursor: pointer;
}
.kn-page button.kn-pl-row:hover { background: var(--bb-hover); color: var(--bb-ink); }
.kn-page button.kn-pl-row.is-on { background: var(--bb-accent-tint); color: var(--bb-accent-ink); font-weight: 600; }
.kn-pl-name { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.kn-pl-row .kn-pl-n { flex: none; }

.kn-tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px;
  background: var(--bb-canvas); color: var(--bb-ink-2); font-size: 10.5px; font-weight: 600;
  letter-spacing: .02em; white-space: nowrap; flex: none;
}
.kn-tag-red { background: var(--bb-red-tint); color: var(--bb-red); }

.kn-det { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* Program cards — "All programs". Reference: northbridge.edu's `.teaser-program-block`
   (gradient into navy, frosted badges, bold white title), with generated per-school art in place of the photo. */
.kn-pc-g {
  display: flex; justify-content: space-between; align-items: center; margin-top: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--bb-ink-3);
}
.kn-pc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.kn-page button.kn-pc {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch;
  min-height: 230px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; text-align: left;
  background: var(--bb-fill, #0D2A5E); color: #fff; font: inherit; cursor: pointer;
  box-shadow: 0 1px 2px rgba(13, 42, 94, .10), 0 6px 18px rgba(13, 42, 94, .10);
  transition: transform .18s ease, box-shadow .18s ease;
}
.kn-page button.kn-pc:hover {
  background: var(--bb-fill, #0D2A5E); color: #fff; transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(13, 42, 94, .12), 0 12px 28px rgba(13, 42, 94, .18);
}
.kn-page button.kn-pc:focus-visible { outline: 2px solid var(--bb-accent); outline-offset: 2px; }
.kn-pc-art {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.kn-page button.kn-pc:hover .kn-pc-art { transform: scale(1.05); }
.kn-pc-mot {
  position: absolute; top: 14px; right: 14px; width: min(46%, 130px); height: auto; aspect-ratio: 1;
  display: block; pointer-events: none; transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.kn-page button.kn-pc:hover .kn-pc-mot { transform: rotate(-4deg) scale(1.06); }
.kn-pc::after {
  content: ''; position: absolute; inset: 30% 0 0 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 20, 44, 0) 0%, rgba(8, 20, 44, .45) 50%, rgba(8, 20, 44, .82) 100%);
}
.kn-pc-body { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; padding: 16px; }
/* CCU: red + white (BRAND in knowledge.js) — the foot fades to wine, not navy. */
.kn-pc-ccu::after { background: linear-gradient(180deg, rgba(60, 6, 16, 0) 0%, rgba(60, 6, 16, .45) 50%, rgba(60, 6, 16, .85) 100%); }
.kn-page button.kn-pc.kn-pc-ccu, .kn-page button.kn-pc.kn-pc-ccu:hover { background: #5E0A17; }
.kn-pc-s { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.kn-pc-bs { display: flex; flex-wrap: wrap; gap: 5px; }
.kn-pc-b {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 6px;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .28);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 11px; font-weight: 600; white-space: nowrap; color: #fff;
}
.kn-pc-t { font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: -.005em; color: #fff; white-space: normal; overflow-wrap: break-word; }
.kn-det-h { display: flex; align-items: flex-start; gap: 12px; }
.kn-det-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.kn-det-t h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--bb-ink); }
.kn-det-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--bb-ink-2); }
.kn-det-camp { display: flex; flex-wrap: wrap; gap: 4px; }
/* Data Sheet — read-only label/value grid above the typed facts (stage 2a-bis). */
.kn-sheet h3 { margin: 0; font-size: 13px; font-weight: 700; color: var(--bb-ink); }
.kn-sheet-none { font-size: 12px; font-weight: 600; color: var(--bb-ink-3); }
.kn-sheet-kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 13px; color: var(--bb-ink); }
.kn-sheet-kv dt { font-size: 11px; font-weight: 600; color: var(--bb-ink-3); padding-top: 2px; }
.kn-sheet-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kn-sheet-kv ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 2px; }
.kn-sheet-a { color: var(--bb-accent-ink, var(--bb-ink)); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.kn-sheet-more summary { cursor: pointer; width: max-content; }
.kn-sheet-more[open] summary { margin-bottom: 4px; }
.kn-mono { font-family: var(--bb-mono); font-variant-numeric: tabular-nums; font-size: 12px; }
@media (max-width: 520px) { .kn-sheet-kv { grid-template-columns: 1fr; gap: 2px; } .kn-sheet-kv dd { margin-bottom: 8px; } }
.kn-det-list { display: flex; flex-direction: column; gap: 10px; }

.kn-entry { gap: 8px; }
.kn-entry-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kn-entry-h h3 { margin: 0; flex: 1 1 200px; min-width: 0; font-size: 14px; font-weight: 600; color: var(--bb-ink); }
.kn-entry-act { display: inline-flex; gap: 6px; margin-left: auto; }
.kn-entry-b { white-space: pre-wrap; font-size: 13px; line-height: 1.55; color: var(--bb-ink); overflow-wrap: anywhere; }
.kn-entry-f { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.kn-entry-src { font-size: 12px; color: var(--bb-ink-2); min-width: 0; overflow-wrap: anywhere; }
.kn-entry-src a { color: var(--bb-accent-ink); }
.kn-page button.tb-btn.kn-danger { color: var(--bb-red); }
.kn-page button.tb-btn.kn-danger:hover { background: var(--bb-red-tint); }

.kn-form-r { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px; }
.kn-form-r:has(.kn-f-date) { grid-template-columns: minmax(0, 1fr) 180px; }
@media (max-width: 520px) { .kn-form-r, .kn-form-r:has(.kn-f-date) { grid-template-columns: 1fr; } }
.kn-form select, .kn-form textarea {
  width: 100%; box-sizing: border-box; padding: 8px 12px;
  border: 1px solid var(--bb-line); border-radius: var(--bb-r-control, 8px);
  background: var(--bb-surface); color: var(--bb-ink); font: 13px/1.5 'Outfit', sans-serif;
}
.kn-form select { height: 36px; padding: 0 10px; }
.kn-form textarea { resize: vertical; min-height: 120px; }
.kn-form .kn-inst-f input { font-family: 'Outfit', sans-serif; }
.kn-form select:focus, .kn-form textarea:focus { outline: none; border-color: var(--bb-accent); box-shadow: 0 0 0 3px rgba(13, 42, 94, .12); }
