/* Site-specific layer on top of Daylight UI.
 *
 * Only the pieces Daylight does not ship: the four answer panels, the retrieved-passage list,
 * and data tables. Everything here is written against Daylight's tokens — no hex outside its
 * :root, so recolouring daylight.css recolours this too.
 *
 * Light only, like the system it extends. There is deliberately no prefers-color-scheme block.
 *
 * Per Daylight's own gotcha: every child gets its own class. No descendant element selectors,
 * so nothing here can silently out-specify a class rule.
 */

/* ───────────────────────── headings outside a card ───────────────────────── */

.section-h {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 34px 0 2px;
}
.sub-h {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 22px 0 6px;
}

/* A select needs a little more room than Daylight's text fields assume. */
.field-select { padding-right: 32px; cursor: pointer; }
.ctl-wide { flex: 2 1 240px; max-width: 320px; }

/* The example questions are sentences, not one-word chips, so let them wrap. */
.chip-q {
  text-align: left;
  align-items: baseline;
  max-width: 100%;
  white-space: normal;
  line-height: 1.45;
}

/* ───────────────────────────── answer panels ───────────────────────────── */

.sysgrid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-top: 14px;
}
@media (min-width: 720px)  { .sysgrid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) { .sysgrid { grid-template-columns: repeat(4, 1fr); } }

.syscard {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.syscard::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--sys-accent, var(--indigo));
}
.sys-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 2px; }
.sys-letter {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  color: var(--sys-accent, var(--indigo));
}
.sys-what { font-size: 12.5px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.sys-mode {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 9px;
}
.sys-answer {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 11px;
  flex: 1;
}
.sys-answer-waiting { color: var(--ink-3); font-style: italic; }
.sys-answer-failed { color: var(--coral); font-family: var(--mono); font-size: 12.5px; }
.sys-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin: 0;
}
.sys-flag { color: var(--amber); font-weight: 600; }

/* ─────────────────────────── retrieved passages ─────────────────────────── */

.passage {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  margin-bottom: 9px;
}
.passage-sum { cursor: pointer; padding: 11px 14px; display: block; }
.psum { display: flex; flex-wrap: wrap; gap: 9px; align-items: baseline; }
.p-rank {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: #fff;
  background: var(--cyan);
  border-radius: 6px;
  padding: 2px 7px;
}
.p-score { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--mint); }
.p-cid { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.p-title { font-size: 12.5px; color: var(--ink-3); }
.p-url { padding: 0 14px 10px; font-size: 12px; overflow-wrap: anywhere; }
.p-src { color: var(--ink-3); font-family: var(--mono); font-size: 11px; margin-left: 8px; }
.p-text {
  margin: 0;
  padding: 0 14px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-2);
  max-height: 320px;
  overflow: auto;
}

/* ───────────────────────────────── tables ───────────────────────────────── */

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dtable {
  border-collapse: collapse;
  width: 100%;
  min-width: 470px;
  font-size: 13px;
}
.dtable-th {
  text-align: right;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.dtable-td {
  text-align: right;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dtable-th-first, .dtable-td-first {
  text-align: left;
  white-space: normal;
  min-width: 128px;
  max-width: 240px;
}
.dtable-num { font-family: var(--mono); font-size: 12.5px; }
.dtable-lab { color: var(--ink-3); font-size: 12px; }
.dtable-row-extra { background: var(--paper-2); }
.dtable-sys { font-weight: 700; }

.ok { color: var(--mint); font-weight: 600; }
.bad { color: var(--coral); font-weight: 600; }

/* The stored-verdict panel appears under the answers when an example chip was used. */
.stored-gold { font-size: 14px; margin: 0 0 6px; }
.stored-ev {
  font-size: 13px;
  color: var(--ink-2);
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin: 0 0 14px;
  white-space: pre-wrap;
}

/* ─────────────────────────── narrow screens ───────────────────────────
 * Daylight tightens its own components under 560px; these are the three places where this
 * site's content needs more than that. Overrides live here, never in daylight.css, so the
 * vendored system stays a clean copy of /Users/goutam/projects/daylight-ui.
 */
@media (max-width: 620px) {
  /* .card-head is a nowrap flex row: the status pill was squeezing the description into a
     ~180px column. Let the row wrap and send the pill to its own line underneath. */
  .card-head { flex-wrap: wrap; }
  /* flex-basis:100% is what forces the line break (capping its width with max-content would
     shrink the item back onto row one). A full-width capsule looks like a stretched button, so
     at this size the pill drops its chrome and reads as a plain mono caption instead. */
  .meta-pill {
    order: 3;
    flex: 0 0 100%;
    background: none;
    border: 0;
    padding: 4px 0 0;
    color: var(--ink-3);
  }

  /* One control per row beats two half-width selects with their labels cut off. */
  .ctl, .ctl-wide { flex: 1 1 100%; max-width: none; }
}

/* The question id inside an example chip is one token; it must not wrap to two lines. */
.chip-id { white-space: nowrap; }
