/* PDF Inspector — a hero uploader (after="hide") over a form of findings
   sections (styles/components/form.css + uploader.css). The cards, rows,
   stat grid, captions and section footers are the layer's; only the chips,
   the confidence tags, the finding rows' icon column, the evidence area and
   the image gallery are the page's own. */

/* ── Flag chips — one anchor per fired finding panel ─────────────────────── */
.insp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.insp-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  border: 1px solid transparent;
}
.insp-chip--high {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}
.insp-chip--advisory {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 28%, transparent);
  color: var(--warning);
}
.insp-chip:hover { filter: brightness(0.97); }

/* The chips jump to a section: leave room above its header. */
.insp-panel { scroll-margin-top: var(--space-4); }

/* The file the report is about: one line, truncated, full name on hover. */
.insp-file {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

/* Six overview tiles side by side on a wide card, one per line on a phone. */
.insp-stats { --grid-switch: 560px; }

/* ── Finding rows: an icon column, then the sentence and its evidence ───── */
.insp-finding {
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
}
.insp-finding__icon { flex-shrink: 0; margin-top: 1px; }
.insp-finding--high .insp-finding__icon { color: var(--danger); }
.insp-finding--advisory .insp-finding__icon { color: var(--warning); }
/* "Nothing found" is good news: a green check, calm text. */
.insp-finding--clear { color: var(--text-dim); }
.insp-finding--clear .insp-finding__icon { color: var(--success); }
.insp-finding__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.insp-finding__body strong { font-weight: 600; }
.insp-finding__evidence { color: var(--text-muted); font-weight: 600; }
.insp-finding__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Key / value rows: values are the document's own text, in the body face. */
.insp-value { font-family: var(--sans); color: var(--text); }
.insp-value a { color: var(--accent); }

/* Outline entries keep their nesting as an indent. */
.insp-outline {
  display: block;
  padding-inline-start: calc(var(--depth, 0) * var(--space-4));
  overflow-wrap: anywhere;
}

.insp-note { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ── Read-only evidence area (JS source, recoverable text) ───────────────── */
.insp-evidence {
  width: 100%;
  min-height: 80px;
  max-height: 320px;
  resize: vertical;
  padding: 12px 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}
.insp-evidence:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Embedded-image gallery ──────────────────────────────────────────────── */
.insp-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
}

.insp-cell {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--bg-elev-2);
  border-radius: var(--radius-md);
  padding: 8px;
}

.insp-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  /* Checkerboard so transparency is obvious. */
  background-color: var(--bg);
  background-image:
    linear-gradient(45deg, var(--border) 25%, transparent 25%),
    linear-gradient(-45deg, var(--border) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--border) 75%),
    linear-gradient(-45deg, transparent 75%, var(--border) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
.insp-thumb img { width: 100%; height: 100%; object-fit: contain; }

.insp-thumb__label {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  color: var(--text-dim);
  backdrop-filter: blur(4px);
}
.insp-thumb__label--warn { color: var(--warning); }

.insp-thumb__badge {
  position: absolute;
  right: 4px;
  top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: color-mix(in srgb, var(--danger) 88%, transparent);
  color: #fff;
}

.insp-cell__meta { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.insp-cell .btn { width: 100%; }
