/* xsnapshot rendered record (viewer.js, inventory.js, share-summary.js):
   the page heading of /view.html and /s/<id>, the numbered sidenav and
   blocks, the summary spec grid, spec rows, folds, the disk tree, the
   redaction scan, Docker sections, inventory tables, the delete panel and
   the server-rendered summary. Used by the viewer, the shared page and the
   landing's import stage. */

/* ---------- viewer page heading ---------- */
.viewer-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 46ch);
  gap: 24px 64px;
  align-items: end;
  padding: 56px 0 40px;
}
.viewer-heading h1 {
  font-size: clamp(36px, 4.4vw, 56px);
}
.viewer-heading > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.viewer {
  padding-bottom: 56px;
}
/* the no-JS shared page: an empty record shell takes no room */
.viewer:empty {
  display: none;
}
.viewer > .banner:only-child {
  margin-block: 0 56px;
  padding: 20px 24px;
}

/* ---------- the record: numbered sidenav + blocks ---------- */
.render {
  min-width: 0;
}
.layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  padding-bottom: 40px;
}
.sections {
  min-width: 0;
  counter-reset: block;
}
.sidenav {
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
  display: grid;
  max-height: calc(100dvh - var(--topbar-h) - 48px);
  overflow-y: auto;
  border-left: 1px solid var(--line);
  counter-reset: nav;
  font-size: 13px;
  line-height: 20px;
  scrollbar-width: thin;
}
.sidenav a {
  display: flex;
  gap: 10px;
  margin-left: -1px;
  padding: 4px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}
.sidenav a::before {
  counter-increment: nav;
  content: counter(nav, decimal-leading-zero);
  content: counter(nav, decimal-leading-zero) / "";
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.sidenav a:hover {
  color: var(--text);
}
/* the section in view (set by viewer.js) */
.sidenav a[aria-current] {
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 700;
}
.sidenav a[aria-current]::before {
  color: var(--accent);
}
.block {
  padding: 24px 0 36px;
  border-top: 1px solid var(--line);
  counter-increment: block;
}
.block > h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 22px;
  line-height: 26px;
  letter-spacing: -0.02em;
  word-spacing: normal;
}
.block > h2::before {
  content: counter(block, decimal-leading-zero);
  content: counter(block, decimal-leading-zero) / "";
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
}
.block h3 {
  margin: 24px 0 8px;
}
.block > p,
.block > div > p {
  max-width: 72ch;
  font-size: 13px;
  line-height: 20px;
}
.block ul:not([class]),
.block ol:not([class]) {
  margin: 8px 0 12px;
  padding-left: 20px;
  font-size: 13px;
  line-height: 20px;
}
.block ul:not([class]) {
  list-style: "+  ";
}
.block li::marker {
  color: var(--muted);
}

/* the record: one vocabulary for the viewer Summary and the landing hero
   (path bar, host, meta line, spec rows, three counts) */
.record {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg);
  overflow: hidden;
}
.record-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 17px;
}
.record-path {
  min-width: 0;
  color: var(--muted-raised);
  overflow-wrap: anywhere;
}
.record-body {
  padding: 20px 20px 24px;
}
.record-host {
  margin: 0;
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.record-host + .meta {
  margin: 4px 0 0;
}
.record-specs {
  margin: 16px 0 0;
  border-top: 1px solid var(--line);
}
.record-specs > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 20px;
}
.record-specs dt,
.record-counts dt {
  color: var(--muted);
  font-size: 11px;
  line-height: 20px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.record-specs dd,
.record-counts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.record-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.record-counts > div {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  padding: 12px 0 12px 16px;
  border-left: 1px solid var(--line);
}
.record-counts > div:first-child {
  padding-left: 0;
  border-left: 0;
}
.record-counts dd {
  font-size: 26px;
  line-height: 29px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.specs {
  display: grid;
  grid-template-columns: minmax(8rem, 14rem) minmax(0, 1fr);
  margin: 4px 0 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 20px;
}
.specs dt,
.specs dd {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
/* one label style on the page: the Label type used by the Summary */
.specs dt {
  padding-right: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.specs dd {
  font-variant-numeric: tabular-nums;
}
.fold {
  border-bottom: 1px solid var(--line);
}
.fold summary .muted {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 400;
}
.fold pre {
  margin-top: 0;
}

/* block devices: each level of children steps 16px in, on a hairline rail */
.tree {
  margin-bottom: 12px;
}
.disk {
  padding: 4px 0;
  font-size: 13px;
  line-height: 20px;
  overflow-wrap: anywhere;
}
.disk-children {
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--line-control);
}

/* the redaction scan */
.scan {
  margin: 12px 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  font-size: 13px;
  line-height: 20px;
}
.scan.ok {
  border-color: var(--ok);
}
.scan.ok > p:first-child::before {
  content: "✓ " / "";
  color: var(--ok);
  font-weight: 700;
}
.scan.warn {
  border-color: var(--danger);
}
.scan.warn > p:first-child::before {
  content: "× " / "";
  color: var(--danger);
  font-weight: 700;
}
.scan p:last-child {
  margin-bottom: 0;
}
.hits {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.hits li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.path {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 17px;
  overflow-wrap: anywhere;
}

/* Docker inventory */
.docker-status strong {
  display: block;
  margin-bottom: 8px;
}
.docker-status p:last-child {
  margin-bottom: 0;
}
.docker-section {
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--line);
}

/* inventory: one semantic table, labelled records below 600px */
.inventory {
  min-width: 0;
  margin: 16px 0 24px;
}
.inventory-filter-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
}
.inventory-count {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.inventory-caption {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  text-align: left;
}
.inventory-table {
  table-layout: fixed;
}
.inventory-table thead th {
  overflow-wrap: normal;
}
/* short numeric columns stay narrow so hashes and paths get the width */
.inventory-table .inventory-num {
  width: 16ch; /* fits "REDACTIONS" in the Label style plus cell padding */
}
.inventory-table tbody th {
  color: var(--text);
  font-weight: 500;
}
.inventory-cell-label {
  display: none;
}
.inventory-cell-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.inventory-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
.inventory-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.inventory-pages button {
  padding-inline: 12px;
  font-size: 13px;
  white-space: nowrap;
}

/* the shared page's delete panel */
.delete {
  margin: 24px 0;
  padding: 30px;
  border: 1px solid var(--danger);
  border-radius: var(--r-card);
}
.delete h2 {
  margin-bottom: 12px;
  font-size: 22px;
  line-height: 26px;
  letter-spacing: -0.02em;
  word-spacing: normal;
}
.delete > p {
  max-width: 72ch;
  font-size: 13px;
  line-height: 20px;
}
.delete-label {
  display: block;
  font-size: 13px;
  line-height: 20px;
  font-weight: 700;
}
.delete button {
  margin-bottom: 4px;
}
.delete .status + p {
  margin-top: 16px;
}

/* server-rendered summary (share-summary.js), readable without JS */
.snapshot-access {
  margin-bottom: 56px;
  padding: 4px 24px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.snapshot-access > p {
  max-width: 72ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.snapshot-access dl {
  margin: 4px 0 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 20px;
}
.snapshot-access dl > div {
  display: grid;
  grid-template-columns: minmax(6rem, 10rem) minmax(0, 1fr);
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.snapshot-access dt {
  color: var(--muted);
  font-size: 11px;
  line-height: 20px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.snapshot-access dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  /* the sidenav becomes a scrolling strip above the blocks */
  .sidenav {
    position: static;
    display: flex;
    max-height: none;
    overflow-x: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidenav a {
    flex: none;
    align-items: center;
    min-height: 44px;
    margin: 0 0 -1px;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }
  .sidenav a[aria-current] {
    border-bottom-color: var(--accent);
  }
}
@media (max-width: 900px) {
  .viewer-heading {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 720px) {
  .viewer-heading {
    padding: 40px 0 30px;
  }
  .specs {
    grid-template-columns: minmax(6rem, 0.75fr) minmax(0, 1fr);
  }
  .scan,
  .delete {
    padding: 20px 16px;
  }
  .snapshot-access {
    padding-inline: 16px;
  }
  .snapshot-access dl > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}
@media (max-width: 600px) {
  .inventory-wrap {
    border: 0;
    overflow: visible;
  }
  .inventory-table,
  .inventory-table tbody {
    display: block;
    width: 100%;
  }
  .inventory-caption {
    display: block;
    padding: 0 0 12px;
    border: 0;
  }
  .inventory-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .inventory-table .inventory-row {
    display: block;
    margin-bottom: 12px;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-field);
  }
  .inventory-table .inventory-row th,
  .inventory-table .inventory-row td {
    display: block;
    width: 100%;
    padding: 6px 0;
    border: 0;
  }
  .inventory-cell-label {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 11px;
    line-height: 18px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .inventory-cell-value {
    display: block;
    min-width: 0;
    font-size: 13px;
  }
  .inventory-table .inventory-row th .inventory-cell-value {
    font-weight: 700;
  }
  .inventory-empty {
    display: block;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-field);
  }
  .inventory-pages {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 480px) {
  .record-bar,
  .record-body,
  .record figcaption {
    padding-inline: 16px;
  }
  .record-specs > div {
    grid-template-columns: 76px minmax(0, 1fr);
  }
  .record-counts > div {
    padding-left: 8px;
  }
  /* "REDACTIONS" must fit a third of 254px: tighter tracking and gutter */
  .record-counts dt {
    letter-spacing: 0.02em;
  }
  .record-counts dd {
    font-size: 22px;
    line-height: 26px;
  }
}
@media (forced-colors: active) {
  .scan,
  .delete,
  .snapshot-access,
  .record,
  .inventory-table .inventory-row {
    border-color: CanvasText;
  }
  .sidenav a[aria-current] {
    border-color: Highlight;
  }
  .inventory-row:focus-visible {
    outline-color: Highlight;
  }
}
