/* ---------------------------------------------------------------------------
   log.css — the raw timeline docked at the bottom.
   ---------------------------------------------------------------------------
   Every other pane is an interpretation. This one is the receipts, which is why
   it is always on screen rather than behind a "show details" link, and why it
   is monospaced with a fixed-width timestamp column: scanning down a column of
   times is how anyone actually reads a log.
--------------------------------------------------------------------------- */

.log__resize {
  height: 6px;
  flex: none;
  cursor: ns-resize;
  border-radius: var(--r-pill) var(--r-pill) 0 0;
  background: transparent;
  transition: background var(--m-fast) var(--m-ease);
}
.log__resize:hover,
.log__resize:focus-visible { background: var(--c-primary-soft); }
.log__resize::after {
  content: '';
  display: block;
  width: 36px;
  height: 2px;
  margin: 2px auto 0;
  border-radius: var(--r-pill);
  background: var(--c-border-strong);
}
body.is-resizing-log { user-select: none; cursor: ns-resize; }

/* The dock is only a dock on desktop. On a phone the log is an ordinary block
   in the document and dragging it does nothing useful. */
@media (max-width: 1023px) {
  .log__resize { display: none; }
}

.log__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--c-border);
  flex: none;
}
.log__title {
  font-size: var(--t-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-fg-muted);
}
.log__levels { display: flex; gap: var(--s-1); }
.filter-chip--lvl { font-family: var(--f-mono); }
.filter-chip--lvl[data-level="warn"].is-on {
  background: var(--c-warn-soft); border-color: var(--c-warn); color: var(--c-warn-ink);
}
.filter-chip--lvl[data-level="error"].is-on {
  background: var(--c-danger-soft); border-color: var(--c-danger); color: var(--c-danger-ink);
}

.log__search {
  flex: 1 1 160px;
  min-width: 120px;
  max-width: 260px;
  min-height: 28px;
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  font-size: var(--t-sm);
}
.log__search:focus { border-color: var(--c-primary); }
.log__search::placeholder { color: var(--c-fg-faint); }

.log__follow { margin-left: auto; }
.log__count { font-size: var(--t-xs); flex: none; }

.log__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-2) 0;
  background: var(--c-surface);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.log__line {
  display: grid;
  /* 12ch, not 11ch: the timestamp is HH:MM:SS.mmm which is exactly 12
     characters. An 11ch column let it spill into the level column and the two
     rendered on top of each other. */
  grid-template-columns: 12ch 6ch 12ch minmax(0, 1fr);
  gap: var(--s-2);
  padding: 1px var(--s-3);
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  line-height: 1.6;
  color: var(--c-fg-muted);
}
.log__line:hover { background: var(--c-surface-2); }

.log__t { color: var(--c-fg-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log__lvl { text-transform: uppercase; color: var(--c-fg-faint); }
.log__stage { color: var(--c-primary); }
.log__stage[hidden] { display: none; }
.log__msg { color: var(--c-fg-muted); min-width: 0; }

.log__line[data-level="warn"] { background: var(--c-warn-soft); }
.log__line[data-level="warn"] .log__lvl,
.log__line[data-level="warn"] .log__msg { color: var(--c-warn-ink); }

.log__line[data-level="error"] { background: var(--c-danger-soft); }
.log__line[data-level="error"] .log__lvl,
.log__line[data-level="error"] .log__msg { color: var(--c-danger-ink); font-weight: var(--fw-medium); }

.log__line[data-level="debug"] { color: var(--c-fg-faint); }
.log__line[data-level="debug"] .log__msg { color: var(--c-fg-faint); }

@media (max-width: 900px) {
  /* The stage column is the first thing to go: it is repeated in the message
     often enough that losing it costs almost nothing on a narrow screen. */
  /* The stage column goes first: it is repeated in the message often enough
     that losing it costs almost nothing. The timestamp keeps its full 12ch,
     because a clipped timestamp is worse than a missing stage. */
  .log__line { grid-template-columns: 12ch 5ch minmax(0, 1fr); }
  .log__stage { display: none; }
  .log__search { max-width: none; }
}
@media (max-width: 600px) {
  /* The level word STAYS. It is the only non-colour signal of severity, and
     dropping it would leave a red row as the sole indication that something
     failed. The timestamp gives up its column width instead. */
  .log__line { grid-template-columns: 12ch 5ch minmax(0, 1fr); gap: var(--s-1); }
  .log__head { gap: var(--s-1); }
  .log__title { width: 100%; }
}
