/* ==========================================================================
   AI Discovery — the situation tree
   Page-scoped styles for the collapsible category → territory → scenario
   tree rendered by /assets/js/ai-discovery.js. Uses the design-system tokens
   from onsite.css; load this after it.
   ========================================================================== */

/* The collapse is pure CSS grid (0fr -> 1fr) — no JS height maths.
   Do not replace with max-height; the renderer relies on this. */
.collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s var(--ease); }
.collapse.open { grid-template-rows: 1fr; }
.collapse > .collapse-inner { overflow: hidden; min-height: 0; }
@media (prefers-reduced-motion: reduce) { .collapse { transition: none; } }

/* ---- the principle callout ---- */
.principle-box {
  background: var(--white);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--red);
  padding: 30px 34px;
  max-width: 860px;
}
.principle-box h2 {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: 22px; line-height: 1.15; letter-spacing: -0.01em;
  margin: 0 0 14px; color: var(--ink);
  display: flex; align-items: baseline; gap: 12px;
}
.principle-box h2 .mark { color: var(--red); font-size: 20px; line-height: 1; }
.principle-box p { color: var(--text-muted); font-size: 16px; line-height: 1.7; margin: 0; }
.principle-box p + p { margin-top: 14px; font-size: 15px; }

/* ---- tree shell ---- */
.tree-intro { max-width: 780px; margin-bottom: 44px; }
.tree { border-top: 1px solid var(--rule); }

/* ---- level 1: category ---- */
.tree-entry { border-bottom: 1px solid var(--rule); background: var(--white); }
.tree-entry:hover { background: var(--grey-50); }

.tree-head {
  display: flex; align-items: center; gap: 16px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  font-family: inherit; color: inherit;
  padding: 24px 4px;
}
.tree-entry-head .tree-entry-title {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: 21px; line-height: 1.1; letter-spacing: -0.005em; color: var(--ink);
}
.tree-entry-head .tree-count,
.tree-territory-head .tree-count {
  margin-left: auto; font-family: var(--mono); font-size: 12px;
  color: var(--grey-500); font-weight: 500; white-space: nowrap;
}
.tree-caret {
  flex: none; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--red); font-size: 13px;
  transition: transform .28s var(--ease);
}
.tree-head[aria-expanded="true"] > .tree-caret { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .tree-caret { transition: none; } }

.tree-entry-intro {
  color: var(--text-muted); font-size: 16px; line-height: 1.65;
  margin: 0 0 18px; padding-left: 38px; max-width: 780px;
}

/* ---- level 2: territory ---- */
.tree-territories { padding: 0 0 18px 38px; }
.tree-territory { border-top: 1px solid var(--rule); }
.tree-territory:first-child { border-top: none; }
.tree-territory-head { padding: 15px 4px; gap: 12px; }
.tree-territory-head .tree-territory-title {
  font-size: 16px; font-weight: 600; color: var(--ink);
}

/* ---- level 3: the scenario ---- */
.tree-leaves { padding: 4px 0 18px 34px; display: grid; gap: 2px; }
/* White on the grey slab so each scenario reads as its own card. */
.leaf {
  background: var(--white);
  border-left: 3px solid var(--red);
  padding: 20px 24px;
}
.leaf-situation {
  font-size: 16px; font-weight: 600; line-height: 1.5;
  margin: 0 0 10px; color: var(--ink);
}
.leaf-situation::before { content: "\201C"; color: var(--red); }
.leaf-situation::after  { content: "\201D"; color: var(--red); }
.leaf-outcome, .leaf-how {
  font-size: 15px; line-height: 1.65; color: var(--text-muted); margin: 0 0 8px;
}
.leaf-how { font-size: 14.5px; }
.leaf-want {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 12px; padding: 6px 0; min-height: 30px;
  background: none; border: none; cursor: pointer;
  color: var(--red); font-family: inherit; font-size: 14px; font-weight: 600;
  transition: gap .2s var(--ease);
}
.leaf-want:hover { gap: 12px; }
.leaf-want:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---- framing note ---- */
.framing-note {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14px; line-height: 1.6; color: var(--grey-500);
  margin: 14px 0 0; padding-left: 38px; max-width: 780px;
}
.framing-note .note-mark { color: var(--red); font-weight: 700; flex: none; }

@media (max-width: 860px) {
  .tree-head { padding: 19px 2px; gap: 12px; }
  .tree-entry-head .tree-entry-title { font-size: 18px; }
  .tree-entry-intro, .framing-note { padding-left: 0; }
  .tree-territories { padding-left: 14px; }
  .tree-leaves { padding-left: 10px; }
  .leaf { padding: 17px 18px; }
  .principle-box { padding: 22px; }
}
