/* ===========================================================================
   NMOS public site — shared components
   Markup: includes/components/crawl-log.php
     .nmos-dot        status dot + optional word
     .nmos-log-line   the signature: one monospace log line with a dot
     .nmos-log-lines  a short stack of log lines on one inset surface
     .nmos-log        the product preview window (crawl visits table)
   Rules: ink neutrals only. Green appears on the verified dot, red on the
   unverified verdict and on 4xx/5xx status codes, nowhere else. No shadow,
   gradient, glow or blur. Every token has a literal fallback so the component
   renders the same whether or not the foundation defines it.
   =========================================================================== */

/* ---------- 1. Status dot ------------------------------------------------ */
body.sentinel-body .nmos-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  font: inherit;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: baseline;
}
body.sentinel-body .nmos-dot .nmos-dot-mark {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--outline, #7a8296);
}
body.sentinel-body .nmos-dot.nmos-dot--ok .nmos-dot-mark { background-color: var(--ok, #4cc38a); }
body.sentinel-body .nmos-dot.nmos-dot--risk .nmos-dot-mark { background-color: var(--risk, #e5484d); }
body.sentinel-body .nmos-dot.nmos-dot--warn .nmos-dot-mark { background-color: var(--warn, #d9a23b); }
body.sentinel-body .nmos-dot.nmos-dot--risk .nmos-dot-label { color: var(--risk, #e5484d); }

/* ---------- 2. Log line (signature) -------------------------------------- */
body.sentinel-body .nmos-log-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: var(--on-surface-variant, #a3a9b8);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: normal;
  text-align: left;
}
/* The dot sits on the first text line, also when the line wraps. */
body.sentinel-body .nmos-log-line > .nmos-dot { flex: none; height: 20px; }
body.sentinel-body .nmos-log-line .nmos-log-line-text { min-width: 0; overflow-wrap: anywhere; }
body.sentinel-body .nmos-log-line .nmos-log-line-seg { white-space: nowrap; }
body.sentinel-body .nmos-log-line .nmos-log-line-method,
body.sentinel-body .nmos-log-line .nmos-log-line-sep,
body.sentinel-body .nmos-log-line .nmos-log-line-when { color: var(--outline, #7a8296); }
body.sentinel-body .nmos-log-line .nmos-log-line-path { color: var(--on-surface, #eef0f5); }
body.sentinel-body .nmos-log-line.is-error .nmos-log-line-status,
body.sentinel-body .nmos-log-line.is-unverified .nmos-log-line-verdict { color: var(--risk, #e5484d); }

/* One line on its own inside a card. */
body.sentinel-body .nmos-log-line.nmos-log-line--boxed {
  padding: 8px 12px;
  background-color: var(--surface-inset, #07080d);
  border: 1px solid var(--border-subtle, rgba(238, 240, 245, 0.08));
  border-radius: 8px;
}

/* A short excerpt: several lines on one inset surface. */
body.sentinel-body .nmos-log-lines {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 12px 16px;
  background-color: var(--surface-inset, #07080d);
  border: 1px solid var(--border-subtle, rgba(238, 240, 245, 0.08));
  border-radius: 8px;
}

/* ---------- 3. Crawl log window ------------------------------------------ */
body.sentinel-body .nmos-log {
  --nmos-log-pad: 20px;
  --nmos-log-gap: 24px;
  --nmos-log-row-pad: 10px;
  container: nmos-log / inline-size;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  background-color: var(--surface-container-lowest, #11141c);
  border: 1px solid var(--border-subtle, rgba(238, 240, 245, 0.08));
  border-radius: 16px;
  color: var(--on-surface, #eef0f5);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

body.sentinel-body .nmos-log .nmos-log-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--nmos-log-pad);
  border-bottom: 1px solid var(--border-subtle, rgba(238, 240, 245, 0.08));
}
body.sentinel-body .nmos-log .nmos-log-title {
  min-width: 0;
  color: var(--on-surface, #eef0f5);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}
body.sentinel-body .nmos-log .nmos-log-meta {
  flex: none;
  color: var(--outline, #7a8296);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 16px;
  font-feature-settings: normal;
  white-space: nowrap;
}

body.sentinel-body .nmos-log .nmos-log-table {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: auto;
  background: none;
}
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-th,
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td {
  box-sizing: border-box;
  padding: var(--nmos-log-row-pad) 0 var(--nmos-log-row-pad) var(--nmos-log-gap);
  border: 0;
  background: none;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  letter-spacing: 0;
  text-transform: none;
}
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-th:first-child,
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td:first-child { padding-left: var(--nmos-log-pad); }
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-th:last-child,
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td:last-child { padding-right: var(--nmos-log-pad); }

/* Column heads: quiet, sentence case. */
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-th {
  padding-top: 8px;
  padding-bottom: 8px;
  color: var(--outline, #7a8296);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
}

/* Rows. */
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td {
  border-top: 1px solid var(--border-subtle, rgba(238, 240, 245, 0.08));
  color: var(--on-surface-variant, #a3a9b8);
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
}
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-bot {
  color: var(--on-surface, #eef0f5);
  font-size: 14px;
  font-weight: 500;
}
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-when,
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-path,
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-status {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-feature-settings: normal;
}
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-when {
  color: var(--outline, #7a8296);
  font-size: 12px;
}
/* The path takes the spare width and truncates before the table can overflow. */
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-path {
  width: 100%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--on-surface, #eef0f5);
}

/* The moment: an unverified visit, and error status codes. */
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-row.is-unverified .nmos-log-td {
  background-color: var(--surface-container, #1a1e28);
}
body.sentinel-body .nmos-log .nmos-log-table .nmos-log-row.is-error .nmos-log-td.nmos-log-col-status {
  color: var(--risk, #e5484d);
}

body.sentinel-body .nmos-log .nmos-log-note {
  padding: 12px var(--nmos-log-pad);
  border-top: 1px solid var(--border-subtle, rgba(238, 240, 245, 0.08));
  color: var(--outline, #7a8296);
  font-size: 12px;
  line-height: 16px;
}

/* ---------- 4. Compact variant (cards, narrow tiles) ---------------------- */
body.sentinel-body .nmos-log.nmos-log--compact {
  --nmos-log-pad: 16px;
  --nmos-log-gap: 16px;
  --nmos-log-row-pad: 8px;
  border-radius: 12px;
}
body.sentinel-body .nmos-log.nmos-log--compact .nmos-log-head { padding-top: 12px; padding-bottom: 12px; }
body.sentinel-body .nmos-log.nmos-log--compact .nmos-log-table .nmos-log-col-when { display: none; }
body.sentinel-body .nmos-log.nmos-log--compact .nmos-log-table .nmos-log-col-bot { padding-left: var(--nmos-log-pad); }
body.sentinel-body .nmos-log.nmos-log--compact .nmos-log-table .nmos-log-td.nmos-log-col-bot { font-size: 13px; }
body.sentinel-body .nmos-log.nmos-log--compact .nmos-log-table .nmos-log-td.nmos-log-col-path,
body.sentinel-body .nmos-log.nmos-log--compact .nmos-log-table .nmos-log-td.nmos-log-col-status { font-size: 12px; }

/* ---------- 5. Narrow: fewer columns and rows, same type size ------------- */
/* Decided by the width of the window itself, so it also works inside a column. */
@container nmos-log (max-width: 519px) {
  body.sentinel-body .nmos-log .nmos-log-table .nmos-log-col-when { display: none; }
  body.sentinel-body .nmos-log .nmos-log-table .nmos-log-col-bot { padding-left: var(--nmos-log-pad); }
}
@container nmos-log (max-width: 399px) {
  body.sentinel-body .nmos-log .nmos-log-head,
  body.sentinel-body .nmos-log .nmos-log-table,
  body.sentinel-body .nmos-log .nmos-log-note {
    --nmos-log-pad: 16px;
    --nmos-log-gap: 12px;
  }
  body.sentinel-body .nmos-log .nmos-log-head { padding-top: 12px; padding-bottom: 12px; }
  body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-bot { font-size: 13px; }
  body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-path,
  body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-status { font-size: 12px; }
  body.sentinel-body .nmos-log .nmos-log-table .nmos-log-row.nmos-log-row--extra { display: none; }
}

@container nmos-log (max-width: 359px) {
  /* Verification becomes the dot alone. The words stay in the markup for screen readers. */
  body.sentinel-body .nmos-log .nmos-log-table .nmos-log-col-verified .nmos-log-th-label,
  body.sentinel-body .nmos-log .nmos-log-table .nmos-log-col-verified .nmos-dot-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* Browsers without container queries: decide by viewport instead. */
@supports not (container-type: inline-size) {
  @media (max-width: 600px) {
    body.sentinel-body .nmos-log {
      --nmos-log-pad: 16px;
      --nmos-log-gap: 12px;
    }
    body.sentinel-body .nmos-log .nmos-log-table .nmos-log-col-when { display: none; }
    body.sentinel-body .nmos-log .nmos-log-table .nmos-log-col-bot { padding-left: var(--nmos-log-pad); }
    body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-path,
    body.sentinel-body .nmos-log .nmos-log-table .nmos-log-td.nmos-log-col-status { font-size: 12px; }
    body.sentinel-body .nmos-log .nmos-log-table .nmos-log-row.nmos-log-row--extra { display: none; }
  }
  @media (max-width: 400px) {
    /* Verification becomes the dot alone. The words stay in the markup for screen readers. */
    body.sentinel-body .nmos-log .nmos-log-table .nmos-log-col-verified .nmos-log-th-label,
    body.sentinel-body .nmos-log .nmos-log-table .nmos-log-col-verified .nmos-dot-label {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
  }
}

/* Log lines on phones: one step smaller, still 12px. */
@media (max-width: 480px) {
  body.sentinel-body .nmos-log-line { gap: 8px; font-size: 12px; }
  body.sentinel-body .nmos-log-lines { padding: 12px; }
}
