/* 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;
}
@media screen {
  /* The footer stays below the fold in all record states, print excluded. */
  main.viewer {
    min-height: 100dvh;
    padding-bottom: 56px;
  }
}
@media (scripting: none) {
  /* The empty SSR shell reserves no viewport when its viewer will never mount. */
  main.viewer:empty {
    display: none;
  }
}

/* actionable empty and failure states */
.viewer-state {
  max-width: 72ch;
  margin: 0 0 56px;
  padding: 24px;
  border: 1px solid var(--line-control);
  border-radius: var(--r-card);
}
.viewer-state .kicker {
  margin: 0 0 16px;
}
.viewer-state h2 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 29px;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.viewer-state-message {
  max-width: 60ch;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
}
.viewer-state-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}
.section-jump {
  display: none;
}

/* ---------- 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;
}

/* Keyboard and assistive-tech destination: the section heading, not a control. */
.block > h2:focus {
  outline: none;
}
.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 > div > p {
  max-width: 72ch;
  font-size: 13px;
  line-height: 20px;
}
.block ul: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: block;
  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;
}
.specs > div {
  display: grid;
  grid-template-columns: minmax(8rem, 14rem) minmax(0, 1fr);
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.specs > div > dt,
.specs > div > dd {
  border-bottom: 0;
}
@media (max-width: 720px) {
  .specs > div {
    grid-template-columns: minmax(6rem, 0.75fr) minmax(0, 1fr);
  }
}
.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;
}

/* a username address (viewer.js addressNote): the address to share, then the fixed link */
.address-note {
  margin: 0 0 40px;
}
.address-note > .muted {
  max-width: 72ch;
  font-size: 13px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

/* 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 .snapshot-sheet {
  margin: 4px 0 16px;
  padding: 12px;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--line);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  /* A native disclosure exposes every section instead of an undiscoverable
     clipped strip. Its menu scrolls within the remaining viewport. */
  .sidenav {
    display: none;
  }
  .section-jump {
    position: sticky;
    top: calc(var(--topbar-h) + 8px);
    z-index: 2;
    display: block;
    margin-bottom: 16px;
    border: 1px solid var(--line-control);
    border-radius: var(--r-field);
    background: var(--bg);
  }
  /* marker and label stay together on the left; only the count sits right */
  .section-jump summary {
    padding: 0 16px;
  }
  .section-jump summary .muted {
    margin-left: auto;
    font-size: 12px;
    font-weight: 400;
    word-spacing: normal;
  }
  /* the open list overlays the record below its toggle, so opening it never
     shifts the page (and never moves the section in view) */
  .section-jump[open] {
    border-radius: var(--r-field) var(--r-field) 0 0;
  }
  .section-jump nav {
    position: absolute;
    top: 100%;
    left: -1px;
    right: -1px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: calc(100dvh - var(--topbar-h) - 128px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line-control);
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--r-field) var(--r-field);
    background: var(--bg);
    scrollbar-width: thin;
    counter-reset: jump;
  }
  .section-jump a {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 0;
    min-height: 44px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted-raised);
    font-size: 12px;
    line-height: 17px;
    text-decoration: none;
    overflow-wrap: normal;
  }
  .section-jump a:nth-child(odd) {
    border-right: 1px solid var(--line);
  }
  .section-jump a:hover {
    background: var(--fill-2);
    color: var(--text);
  }
  .section-jump a::before {
    counter-increment: jump;
    content: counter(jump, decimal-leading-zero);
    content: counter(jump, decimal-leading-zero) / "";
    color: var(--muted);
    flex: none;
    min-width: 2ch;
    font-size: 11px;
    line-height: 18px;
    font-variant-numeric: tabular-nums;
  }
  /* the section in view, as in the sidenav: ink, bold, lime counter */
  .section-jump a[aria-current] {
    color: var(--text);
    font-weight: 700;
  }
  .section-jump a[aria-current]::before {
    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;
  }
  .viewer-state {
    padding: 20px 16px;
  }
  .viewer-state h2 {
    font-size: 24px;
    line-height: 29px;
  }
  .viewer-state-actions {
    align-items: flex-start;
    flex-direction: column;
  }
  .viewer-state-actions .text-link {
    min-height: 24px;
  }
  .scan,
  .delete {
    padding: 20px 16px;
  }
  .snapshot-access {
    padding-inline: 16px;
  }
}
@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 (max-width: 480px) {
  /* JavaScript lengthens the eyebrow once the mode is known; two lines are
     reserved so that does not move the heading */
  .viewer-heading .eyebrow {
    min-height: 36px;
  }
  .specs > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 8px 0;
  }
  .specs > div > dt,
  .specs > div > dd {
    padding: 0;
  }
  .specs > div > dt {
    margin-bottom: 2px;
  }
}
@media (forced-colors: active) {
  .scan,
  .delete,
  .snapshot-access,
  .snapshot-access .snapshot-sheet,
  .record,
  .inventory-table .inventory-row {
    border-color: CanvasText;
  }
  .sidenav a[aria-current] {
    border-color: Highlight;
  }
  .inventory-row:focus-visible {
    outline-color: Highlight;
  }
}

/* A printed record is a paper spec sheet, not the interactive workspace. */
@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --text: #000;
    --text-strong: #000;
    --muted: #000;
    --muted-raised: #000;
    --accent: #000;
    --accent-ink: #fff;
    --line: #000;
    --line-control: #000;
    --fill: transparent;
    --fill-2: transparent;
    --fill-2-hover: transparent;
    --surface: #fff;
    --btn: #fff;
    --btn-ink: #000;
    --ok: #000;
    --warn: #000;
    --danger: #000;
  }
  @page {
    margin: 16mm;
  }
  html,
  body {
    min-height: 0;
    background: #fff;
    color: #000;
    print-color-adjust: economy;
  }
  .wrap {
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .button,
  .snapshot-access {
    display: none !important;
  }
  body:has([data-stage] .layout) > main.wrap > section:not(.import) {
    display: none !important;
  }
  #share:has([data-stage] .layout) {
    padding: 0;
    border: 0;
  }
  #share:has([data-stage] .layout)::before {
    content: "Local snapshot · read-only" / "";
    display: block;
    padding-bottom: 24px;
    font-size: 22px;
    font-weight: 700;
  }
  #share:has([data-stage] .layout) > .import-grid,
  #share:has([data-stage] .layout) > [data-import-progress] {
    display: none !important;
  }
  [data-stage] {
    margin: 0;
  }
  .topbar,
  .skip,
  .sidenav,
  .section-jump,
  .workbench,
  .publish,
  .delete,
  .viewer-state-actions,
  .inventory-filter-label,
  .inventory-pages,
  .site-footer nav,
  nav,
  button,
  input,
  select,
  textarea,
  form {
    display: none !important;
  }
  .viewer {
    display: block;
    min-height: 0;
    padding: 0;
  }
  .viewer-heading {
    display: block;
    padding: 0 0 24px;
  }
  .viewer-heading h1 {
    margin-bottom: 12px;
    font-size: 30px;
    line-height: 1.1;
  }
  .viewer-heading > p {
    max-width: 72ch;
    color: #000;
  }
  .layout {
    display: block;
    padding: 0;
  }
  .block {
    padding: 16px 0 24px;
    break-before: auto;
    break-inside: auto;
  }
  .block > h2 {
    margin-bottom: 12px;
    font-size: 22px;
  }
  .block > h2::before {
    color: #000;
  }
  h1,
  h2,
  h3,
  h4,
  h5,
  summary,
  caption {
    break-after: avoid-page;
    break-inside: avoid;
  }
  p,
  .specs > div,
  .specs dt,
  .specs dd,
  .record-specs > div,
  .record-counts > div,
  .hits li,
  .disk,
  .docker-section,
  .inventory-row,
  .fold-brief {
    break-inside: avoid-page;
  }
  p,
  li {
    orphans: 3;
    widows: 3;
  }
  .specs > div {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    padding: 0;
    border-bottom: 1px solid #000;
  }
  .specs dt,
  .specs dd {
    border-bottom: 0;
  }
  .specs dt {
    /* labels wrap between words, never inside one */
    overflow-wrap: normal;
    word-break: normal;
  }
  .specs dd {
    min-width: 0;
  }
  .record,
  .scan,
  .banner,
  .snapshot-access,
  .table-wrap,
  .inventory-table .inventory-row {
    background: #fff;
    color: #000;
    border-color: #000;
    box-shadow: none;
    break-inside: avoid-page;
  }
  .record-bar,
  .record-specs,
  .record-specs > div,
  .record-counts,
  .record-counts > div,
  .block,
  .specs,
  .specs dt,
  .specs dd,
  .fold,
  .hits li,
  .disk-children,
  .docker-section,
  .snapshot-access .snapshot-sheet,
  .inventory-caption,
  .inventory-table .inventory-num {
    border-color: #000;
  }
  .record,
  .inventory-cell-value,
  pre,
  code,
  .specs dd,
  .hits,
  .meta,
  .record-path {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .fold {
    break-inside: auto;
  }
  .fold summary {
    display: block;
    padding-block: 12px;
    border: 0;
    font-size: 13px;
  }
  .fold summary .muted {
    color: #000;
  }
  .fold summary::marker {
    content: "";
  }
  details.fold:not([open]) > pre,
  .fold > pre {
    display: block;
    max-width: 100%;
    overflow: visible;
  }
  .fold pre {
    /* Preserve column spacing while keeping printed text inside the page. */
    white-space: break-spaces;
    overflow-wrap: anywhere;
    word-break: normal;
    break-inside: auto;
  }
  .inventory-table {
    display: table;
    width: 100%;
    table-layout: fixed;
  }
  .inventory-table thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }
  .inventory-table tbody {
    display: table-row-group;
  }
  .inventory-table .inventory-row {
    display: table-row;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .inventory-table .inventory-row th,
  .inventory-table .inventory-row td {
    display: table-cell;
    width: auto;
    padding: 6px;
    break-inside: avoid-page;
  }
  .inventory-caption {
    display: table-caption;
    padding: 12px 0;
  }
  .inventory-cell-label {
    display: none;
  }
  .inventory-cell-value {
    display: block;
  }
  .inventory-wrap {
    overflow: visible;
  }
  .site-footer {
    margin-top: 24px;
    padding: 16px 0 0;
    color: #000;
  }
}
