/* How a query was obtained, the loop it runs in, how sure its path is.
   Templates: _site_macros.html. Views: web/siteviews.py. Reference: DESIGN.md, "Provenance of a query". */

/* The method mark: a word in a thin box. Neutral ink: how a query was obtained is not a state.
   Solid border: read for certain. Dashed border and a "?": the translator was not sure. */
.src {
  display: inline-flex; align-items: center; gap: 1px; flex: none;
  height: 16px; padding: 0 var(--sp-2); margin-right: var(--sp-3);
  border: 1px solid var(--line-strong); border-radius: var(--r-1);
  font: 500 var(--fs-1)/1 var(--font-sans); color: var(--ink-2); background: var(--surface);
  white-space: nowrap; vertical-align: 1px;
}
.src.is-runtime, .src.is-unsure { border-style: dashed; }
.src.is-code { color: var(--ink-3); }
.src > i { font-style: normal; color: var(--ink-3); }
.src-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); min-width: 0; }
.src-line > .src { margin-right: 0; }
.src-line .clip, .lp .clip, .xl .clip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-line .clip { max-width: 28rem; }
/* In a list cell the mark sits before the SQL preview, which keeps its ellipsis. */
.l1.has-src { display: flex; align-items: center; min-width: 0; }
.l1.has-src > .sql-preview { flex: 1 1 auto; min-width: 0; }
.lp-chip > .icon { color: var(--ink-3); }

/* The call beside the SQL built from it. Two panes from 900px, stacked below. */
.xl { display: grid; grid-template-columns: minmax(0, 2fr) auto minmax(0, 3fr); gap: var(--sp-4); align-items: stretch; }
.xl-side { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.xl-side > pre.sql { flex: 1 1 auto; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.xl.is-unsure .xl-side:last-of-type > pre.sql { border-style: dashed; }
.xl-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); min-height: var(--ctl-sm); }
.xl-head > .label { margin: 0; }
.xl-arrow { display: flex; align-items: center; color: var(--ink-3); padding-top: var(--ctl-sm); }
.xl-notes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.xl-notes > .label { margin: 0; }
@media (max-width: 900px) {
  .xl { grid-template-columns: minmax(0, 1fr); }
  .xl-arrow { padding: 0; justify-content: center; transform: rotate(90deg); }
}

/* The loop as nested boxes: entry point, driver query, the loop, the query inside it. */
.lp { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.lp-entry { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); min-width: 0; }
.lp-entry > .mono { max-width: 100%; }
.lp-box { border: 1px solid var(--line-strong); border-radius: var(--r-3); background: var(--surface); min-width: 0; }
.lp-box.is-acc { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
/* A retry, poll or fixed loop: dashed and quiet. It repeats the work; it does not multiply it by the data. */
.lp-box.is-quiet { border-style: dashed; }
.lp-box.is-quiet .lp-turn > .icon { color: var(--ink-3); }
.lp-box.is-plain { border-color: var(--line); }
.lp-inner { margin: 0 var(--sp-5) var(--sp-5) var(--sp-7); background: var(--surface-2); }
.lp-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-5); padding: var(--sp-3) var(--sp-5); min-width: 0; }
.lp-head > .mono { max-width: 24rem; }
.lp-turn { display: inline-flex; align-items: center; gap: var(--sp-3); font-weight: 600; white-space: nowrap; }
.lp-turn > .icon { color: var(--accent); }
.lp-x { margin-left: auto; display: inline-flex; align-items: center; gap: var(--sp-4); color: var(--ink-3); font-size: var(--fs-2); white-space: nowrap; }
.lp-facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); padding: 0 var(--sp-5) var(--sp-3); }
.lp-facts:empty { display: none; }
.lp-row { display: flex; align-items: center; gap: var(--sp-2) var(--sp-5); padding: var(--sp-3) var(--sp-5); font-size: var(--fs-2); min-width: 0; }
.lp-row > .label { margin: 0; flex: none; width: 5.5rem; }
.lp-row > .mono { flex: 1 1 12rem; }
.lp-row > .path { flex: 0 1 auto; }
.lp-box > .lp-row { border-top: 1px solid var(--line); }
.lp-box > .lp-row:first-child { border-top: 0; }
.lp-row.is-driver { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface-2); }
.lp-row.is-this > .mono { color: var(--ink); }
@media (max-width: 700px) { .lp-row { flex-wrap: wrap; } .lp-x { margin-left: 0; } }

/* Inside the expanded Queries row the boxes sit on the table's inset. */
.site-detail .lp, .site-detail .xl { max-width: 72rem; }

/* Lists: a guessed path is plain text on the second line, dotted like every fact that is not asserted. */
.guess { border-bottom: 1px dashed var(--line-strong); }
.list-note { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-5); border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: var(--fs-2); }
.list-note > .src { margin-right: 0; }
