/* The packet decoder (Pages/Decode.cshtml, decode.js). Colours are site.css's tokens only, so
   the light and dark looks follow from there. */

.decode-form { margin-bottom: 18px; }
.decode-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.decode-form textarea {
    display: block; width: 100%; min-height: 64px; resize: vertical; padding: 9px 11px;
    border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel-solid); color: var(--text);
    font: 13.5px/1.5 var(--mono); overflow-wrap: anywhere;
}
.decode-form textarea:focus { outline: none; border-color: var(--accent); }
.decode-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.btn.decode-go { border-color: var(--accent); background: var(--accent); color: var(--panel-solid); font-weight: 600; padding: 6px 16px; }
.btn.decode-go:hover { filter: brightness(1.08); }
.decode-try { font-size: 13px; color: var(--muted); }

.decode-out { transition: opacity 0.15s; }
.decode-out.loading { opacity: 0.55; }
.decode-note { color: var(--muted); }
.decode-note.bad, .decode-summary .bad { color: var(--bad); }
.decode-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 8px; font-size: 15px; }
.decode-summary span { font-size: 13px; font-weight: 600; }
.decode-summary .ok { color: var(--ok); }
.decode-summary .warn { color: var(--warn); }

/* The line itself, kept in view while the fields scroll under it. */
.raw-box {
    position: sticky; top: 0; z-index: 2; margin: 0 0 16px; padding: 12px 14px 9px;
    background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(0, 0, 0, calc(0.18 * var(--shade)));
}
.raw-line { display: block; font: 15px/1.9 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.raw-line .seg { border-radius: 3px; cursor: default; }
.raw-line .seg[data-f] { cursor: pointer; }
.raw-line .seg[data-f]:hover, .raw-line .hl { background: rgba(var(--accent-rgb), 0.2); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.55); }
.raw-line .bad { text-decoration: underline wavy var(--bad); text-underline-offset: 4px; }
.raw-line .warn { text-decoration: underline wavy var(--warn); text-underline-offset: 4px; }
.raw-line .caret { display: inline-block; width: 2px; height: 1.25em; margin: 0 1px; vertical-align: -0.25em; background: var(--bad); border-radius: 1px; }
.raw-line .caret.warning { background: var(--warn); }
.raw-line .caret.hl { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.55); }
.raw-info { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--faint); min-height: 1.5em; overflow-wrap: anywhere; }
.raw-info.on { color: var(--text-soft); }

/* Spaces count in APRS (padding, ambiguity), so each shows as a faint dot; control bytes show as their symbols. */
.sp { background: radial-gradient(circle, var(--faint) 0 1px, transparent 1.5px) center / 100% 100% no-repeat; }
.ctl { color: var(--warn); }

/* The sections. */
.dsec { margin: 0 0 18px; }
.dsec h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 600; margin: 0 0 4px; }
.dsec.depth-1 { margin-left: 14px; padding-left: 12px; border-left: 2px solid rgba(var(--accent-rgb), 0.35); }
.fields, .problems { list-style: none; margin: 0; padding: 0; }
.fld {
    display: grid; grid-template-columns: minmax(9em, 13em) minmax(0, 1fr) minmax(4em, max-content); gap: 4px 14px; align-items: baseline;
    padding: 6px 8px; margin: 0 -8px; border-bottom: 1px solid var(--line); border-radius: 6px; font-size: 13.5px;
}
.fld:hover, .fld.hl { background: rgba(var(--accent-rgb), 0.09); }
.fld:focus-visible { outline-offset: -2px; }
.fld .lbl { color: var(--muted); }
.fld .val { min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.fld .val .sent { color: var(--muted); font-size: 12.5px; }
.fld .val .note { display: block; color: var(--faint); font-size: 12px; margin-top: 1px; }
.fld .val .sym { vertical-align: -4px; margin-right: 6px; }
.fld .val .call { font-family: var(--mono); }
.fld .slice { justify-self: end; max-width: 22ch; color: var(--text-soft); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; text-align: right; }

.problem { margin: 6px 0; padding: 7px 10px; border-left: 3px solid var(--bad); border-radius: 0 6px 6px 0; background: rgba(var(--tint), 0.03); font-size: 13.5px; color: var(--text); }
.problem.warning { border-left-color: var(--warn); }
.problem.hl, .problem:hover { background: rgba(var(--accent-rgb), 0.09); }
.problem .where { font-weight: 600; margin-right: 4px; color: var(--bad); }
.problem.warning .where { color: var(--warn); }
.problem .where code { font-weight: 400; color: var(--text-soft); background: rgba(var(--tint), 0.06); padding: 0 4px; border-radius: 4px; }
.problems { margin-bottom: 16px; }

@media (max-width: 720px) {
    .raw-line { font-size: 13.5px; }
    .fld { grid-template-columns: minmax(0, 1fr) auto; }
    .fld .lbl { grid-column: 1; }
    .fld .slice { grid-column: 2; grid-row: 1; }
    .fld .val { grid-column: 1 / -1; }
}
