/* Network Packet Visualizer (/network-packet-visualizer): the network canvas with its legend, the message in segments
   and the playback buttons; the list of packets; and the selected packet's layers, fields and bytes. Tiles, panels,
   tables, tags and buttons come from the app kit (css/app-kit, docs/app-kit.md). Loaded only on this app's page. */

.np-landing-app .np-net-panel { display: flex; flex-direction: column; gap: var(--ak-space-3, 1rem); }
.np-landing-app .np-net { display: block; width: 100%; height: 150px; cursor: pointer; touch-action: manipulation; }
.np-landing-app .np-legend { justify-content: center; }

/* The message in segments: one chip per segment, coloured by what happened to it. */
.np-landing-app .np-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.np-landing-app .np-seg {
    --np-state: var(--ak-border);
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.2rem 0.5rem;
    border: 2px dashed var(--np-state);
    border-radius: var(--ak-radius-sm, 8px);
    background: color-mix(in srgb, var(--np-state) 10%, transparent);
    color: var(--ak-muted);
}
.np-landing-app .np-seg-no { font-size: var(--ak-fs-xs, 0.75rem); font-weight: 700; color: var(--ak-muted); }
.np-landing-app .np-seg-text { font-family: var(--ak-font-mono, ui-monospace, Menlo, Consolas, monospace); font-size: var(--ak-fs-sm, 0.875rem); white-space: pre; }
.np-landing-app .np-seg::after { font-size: var(--ak-fs-xs, 0.75rem); font-weight: 700; color: var(--np-state); }
.np-landing-app .np-seg[data-state="flying"] { --np-state: var(--ak-series-1); border-style: solid; color: var(--ak-text); }
.np-landing-app .np-seg[data-state="lost"] { --np-state: var(--ak-danger); border-style: solid; color: var(--ak-text); }
.np-landing-app .np-seg[data-state="lost"]::after { content: "✕"; }
.np-landing-app .np-seg[data-state="delivered"] { --np-state: var(--ak-success); border-style: solid; color: var(--ak-text); }
.np-landing-app .np-seg[data-state="acked"] { --np-state: var(--ak-success); border-style: solid; background: color-mix(in srgb, var(--np-state) 24%, transparent); color: var(--ak-text); }
.np-landing-app .np-seg[data-state="acked"]::after { content: "✓"; }

.np-landing-app .np-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ak-space-2, 0.5rem); }
.np-landing-app .np-actions .ak-btn { justify-content: center; min-width: 0; }
@media (max-width: 640px) { .np-landing-app .np-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The list of packets: a stripe in the packet's colour, the row of the selected packet, lost packets struck out. */
.np-landing-app .np-list-wrap { max-height: 15.5rem; }
.np-landing-app .np-list tbody tr { cursor: pointer; }
.np-landing-app .np-list tbody td:first-child { box-shadow: inset 4px 0 0 var(--np-kind, var(--ak-border)); }
.np-landing-app .np-list tbody tr[aria-selected="true"] { background: color-mix(in srgb, var(--ak-accent) 16%, transparent); }
.np-landing-app .np-list tbody tr:focus-visible { outline: 2px solid var(--ak-accent); outline-offset: -2px; }
.np-landing-app .np-list tbody tr.is-lost .ak-mono { text-decoration: line-through; text-decoration-color: var(--ak-danger); }
.np-landing-app .np-info { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.4rem; }
.np-landing-app .np-info .ak-mono { font-size: var(--ak-fs-xs, 0.75rem); }

/* The selected packet. */
.np-landing-app .np-detail { display: flex; flex-direction: column; gap: var(--ak-space-3, 1rem); }
.np-landing-app .np-detail[hidden] { display: none; }
.np-landing-app .np-detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.np-landing-app .np-title { margin: 0; font-weight: 700; color: var(--ak-text); }
.np-landing-app .np-link-pick { display: inline-flex; align-items: center; gap: 0.5rem; }
.np-landing-app .np-link-label { color: var(--ak-muted); font-size: var(--ak-fs-sm, 0.875rem); font-weight: 600; }
.np-landing-app .np-link-pick .ak-seg-btn:disabled { opacity: 0.4; cursor: default; }

/* The layers side by side, as wide as their share of the frame. */
.np-landing-app .np-bar { display: flex; gap: 3px; min-width: 0; }
.np-landing-app .np-layer {
    --np-layer: var(--ak-accent);
    display: flex;
    flex-direction: column;
    flex-basis: 4.6rem;
    min-width: 0;
    padding: 0.3rem 0.5rem;
    border-radius: var(--ak-radius-sm, 8px);
    border: 1px solid var(--np-layer);
    background: color-mix(in srgb, var(--np-layer) 20%, transparent);
    color: var(--ak-text);
    font-size: var(--ak-fs-xs, 0.75rem);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
}
.np-landing-app .np-layer > b { font-size: var(--ak-fs-sm, 0.875rem); }
.np-landing-app .np-layer > span { color: var(--ak-muted); }

.np-landing-app .np-detail-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--ak-space-3, 1rem); align-items: start; }
@media (max-width: 1100px) { .np-landing-app .np-detail-body { grid-template-columns: minmax(0, 1fr); } }
.np-landing-app .np-fields-wrap { max-height: none; }
.np-landing-app .np-fields tbody tr > :first-child { box-shadow: inset 4px 0 0 var(--np-layer, var(--ak-border)); }
.np-landing-app .np-fields th, .np-landing-app .np-fields td { padding-block: 0.22rem; }
.np-landing-app .np-fields td { white-space: normal; overflow-wrap: anywhere; }
.np-landing-app .np-fields tbody tr { cursor: default; }
.np-landing-app .np-fields tbody tr.is-marked { background: color-mix(in srgb, var(--ak-warning) 22%, transparent); }
.np-landing-app .np-fields tbody tr:focus-visible { outline: 2px solid var(--ak-accent); outline-offset: -2px; }
.np-landing-app .np-fields tbody + tbody tr:first-child > * { border-top: 2px solid var(--ak-border); }

/* The bytes: offset, sixteen bytes in hexadecimal, and their characters; each byte has its layer's colour. */
.np-landing-app .np-hex {
    max-width: 100%;
    overflow-x: auto;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--ak-border);
    border-radius: 0.5rem;
    background: var(--ak-bg);
    font-family: var(--ak-font-mono, ui-monospace, Menlo, Consolas, monospace);
    font-size: var(--ak-fs-xs, 0.75rem);
    line-height: 1.7;
    color: var(--ak-text);
}
.np-landing-app .np-hex-row { display: flex; gap: 0.9rem; white-space: nowrap; }
.np-landing-app .np-hex-off { color: var(--ak-muted); }
.np-landing-app .np-hex-bytes { display: inline-grid; grid-template-columns: repeat(16, 1.55em); }
.np-landing-app .np-hex-chars { display: inline-grid; grid-template-columns: repeat(16, 0.62em); }
.np-landing-app .np-hex [data-i] { text-align: center; border-bottom: 2px solid var(--np-layer, transparent); }
.np-landing-app .np-hex-chars [data-i] { border-bottom-color: transparent; }
.np-landing-app .np-hex [data-layer="eth"] { --np-layer: var(--ak-series-8); }
.np-landing-app .np-hex [data-layer="ip"] { --np-layer: var(--ak-series-4); }
.np-landing-app .np-hex [data-layer="tcp"], .np-landing-app .np-hex [data-layer="udp"] { --np-layer: var(--ak-series-1); }
.np-landing-app .np-hex [data-layer="data"] { --np-layer: var(--ak-series-3); }
.np-landing-app .np-hex [data-i].is-marked { background: color-mix(in srgb, var(--ak-warning) 45%, transparent); }
