/* Plain Quantum Toolkit: Cryptographic Dependency Explorer (S1; from the Gate 2 prototype d57a1fd).
   Uses the site's tokens (site.css) and toolkit.css. Status colours are text colours with light and dark
   values at least 4.5:1 on --surface; every status also has its own words, so colour is never the only cue. */
:root { --dx-vuln: #B42318; --dx-ok: #047857; --dx-warn: #B45309; --dx-hl: #6D28D9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --dx-vuln: #FDA29B; --dx-ok: #34D399; --dx-warn: #FBBF24; --dx-hl: #67E8F9; } }
:root[data-theme="dark"] { --dx-vuln: #FDA29B; --dx-ok: #34D399; --dx-warn: #FBBF24; --dx-hl: #67E8F9; }

.dx { padding-bottom: 48px; }
.dx-proto { font-family: var(--f-display); font-size: 0.9rem; border: 1.5px dashed var(--muted); border-radius: 10px; padding: 8px 14px; margin: 18px 0 0; color: var(--fg); }
.dx-lead { max-width: var(--read); }
.dx h2 { margin-top: 44px; }
.dx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 960px) { .dx-grid { grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr); } .dx-detail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; } }

/* journey map */
.dx-legend { font-family: var(--f-display); font-size: 0.88rem; color: var(--muted); margin: 0 0 12px; }
.dx-spine, .dx-branches { list-style: none; margin: 0; padding: 0; }
.dx-step { margin: 0; }
.dx-node { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; font: inherit;
  font-family: var(--f-display); background: var(--surface); color: var(--fg); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 14px; min-height: 44px; cursor: pointer; }
.dx-node:hover { border-color: var(--link); }
.dx-node:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.dx-node[aria-pressed="true"] { border: 2.5px solid var(--dx-hl); padding: 9px 13px; }
.dx-node .dx-name { font-weight: 600; font-size: 1rem; line-height: 1.3; }
.dx-node .dx-zone { font-size: 0.8rem; color: var(--muted); }
.dx-node .dx-counts { font-size: 0.82rem; color: var(--fg); }
.dx-node .dx-flag { display: none; font-size: 0.8rem; font-weight: 600; color: var(--dx-hl); }
.dx-node.dx-affected { box-shadow: inset 6px 0 0 var(--dx-hl); }
.dx-node.dx-affected .dx-flag { display: inline; }
.dx-link { font-family: var(--f-display); font-size: 0.84rem; color: var(--muted); margin: 0 0 0 22px; padding: 6px 0 6px 16px; border-left: 2px solid var(--line); }
.dx-link .dx-arrow { color: var(--fg); }
.dx-boundary { display: block; margin-top: 4px; color: var(--fg); border-top: 2px dashed var(--muted); padding-top: 4px; }
.dx-branches { margin: 6px 0 4px 22px; padding-left: 14px; border-left: 2px solid var(--line); }
.dx-branches .dx-node { padding: 8px 12px; }
.dx-services { margin-top: 22px; }
.dx-services h3 { font-size: 1rem; margin: 0 0 6px; }
.dx-services ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }

/* detail panel */
.dx-detail { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.dx-detail:focus { outline: none; }
.dx-detail:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.dx-detail h3 { margin: 0 0 4px; font-size: 1.25rem; }
.dx-detail h4 { font-size: 1rem; margin: 22px 0 8px; }
.dx-meta { font-family: var(--f-display); font-size: 0.9rem; margin: 6px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.dx-meta dt { color: var(--muted); }
.dx-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .dx-meta { grid-template-columns: minmax(0, 1fr); gap: 0; } .dx-meta dt { margin-top: 8px; } }
.dx-grid > *, .dx-mechs, .dx-mech, .dx-mbody { min-width: 0; }
.dx-mech > summary, .dx-node, .dx-reason { overflow-wrap: anywhere; }
.dx-mechs { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.dx-mech { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.dx-mech > summary { cursor: pointer; padding: 10px 14px; font-family: var(--f-display); font-size: 0.92rem; min-height: 44px; list-style-position: outside; }
.dx-mech > summary .dx-mtitle { font-weight: 600; display: block; }
.dx-mech > summary .dx-mline { color: var(--fg); }
.dx-mech[open] > summary { border-bottom: 1px solid var(--line); }
.dx-mbody { padding: 10px 14px 14px; font-size: 0.95rem; }
.dx-mbody .dx-meta { margin-bottom: 8px; }
.dx-mbody ul { margin: 4px 0 8px; padding-left: 20px; }
.dx-example { border-left: 4px solid var(--mark-cyan); background: var(--soft); border-radius: 0 10px 10px 0; padding: 8px 12px; margin: 0 0 10px; font-family: var(--f-display); font-size: 0.9rem; }
.dx-plain { color: var(--muted); font-family: var(--f-display); font-size: 0.88rem; }
.dx-st { font-weight: 600; }
.dx-st.vulnerable { color: var(--dx-vuln); }
.dx-st.not-affected { color: var(--dx-ok); }
.dx-st.check-key-size { color: var(--dx-warn); }
.dx-st.unknown { color: var(--muted); }
.dx-ev { display: inline-block; font-family: var(--f-display); font-size: 0.8rem; font-weight: 500; padding: 1px 8px; border-radius: 999px; border: 1.5px solid var(--fg); color: var(--fg); }
.dx-ev.inferred { border-style: dashed; }
.dx-ev.unknown { border-style: dotted; color: var(--muted); border-color: var(--muted); }
.dx-inline { font: inherit; text-align: left; background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; min-height: 24px; }
.dx-inline:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.dx-back { margin-top: 16px; }
.dx-nav { display: grid; gap: 4px; margin: 0; padding-left: 20px; font-family: var(--f-display); font-size: 0.92rem; }

/* what-if */
.dx-scen { border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; background: var(--surface); margin: 12px 0; }
.dx-scen legend { font-family: var(--f-display); font-weight: 500; padding: 0 4px; }
.dx-scen label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; cursor: pointer; min-height: 44px; font-family: var(--f-display); font-size: 0.95rem; }
.dx-scen label:hover { background: var(--soft); }
.dx-scen input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--mark-violet); }
.dx-impact { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; }
.dx-impact[hidden] { display: none; }
.dx-impact h3 { margin: 0 0 6px; font-size: 1.1rem; }
.dx-impact ol { padding-left: 20px; }
.dx-impact li { margin: 8px 0; }
.dx-reason { font-family: var(--f-display); font-size: 0.88rem; color: var(--fg); }

/* table */
/* Inventory of every use (S1 visual correction): one panel holding the filters, the count and the records.
   Words are never broken inside a label; status and evidence keep their text (never colour alone). */
.dx-inv { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin: 12px 0 0; }
.dx-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 13rem)); gap: 12px 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); font-family: var(--f-display); font-size: 0.85rem; color: var(--muted); }
.dx-filters label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dx-filters select { font: inherit; font-size: 0.92rem; color: var(--fg); padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); min-height: 44px; width: 100%; }
.dx-table { width: 100%; border-collapse: collapse; font-family: var(--f-display); font-size: 0.875rem; line-height: 1.45; }
.dx-table caption { text-align: left; padding: 12px 18px 8px; font-weight: 600; color: var(--fg); font-size: 0.85rem; }
.dx-table th, .dx-table td { text-align: left; vertical-align: top; padding: 11px 12px; border-top: 1px solid var(--line); overflow-wrap: normal; word-break: normal; hyphens: manual; }
.dx-table thead th { font-weight: 600; font-size: 0.78rem; color: var(--muted); padding-top: 8px; padding-bottom: 8px; vertical-align: bottom; border-top: 1px solid var(--line); }
.dx-table th:first-child, .dx-table td:first-child { padding-left: 18px; }
.dx-table th:last-child, .dx-table td:last-child { padding-right: 18px; }
.dx-table tbody th { font-weight: 500; }
.dx-table tbody tr:hover { background: var(--soft); }
.dx-table .dx-inline { font-weight: 500; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.dx-table .dx-c-where, .dx-table .dx-c-what { color: var(--muted); }
.dx-table .dx-c-st, .dx-table .dx-c-ev, .dx-table .dx-c-what { white-space: nowrap; }
.dx-table .dx-st, .dx-table .dx-ev { white-space: nowrap; }
.dx-table .dx-ev { font-size: 0.78rem; padding: 0 8px; line-height: 1.6; }
.dx-col-use { width: 24%; } .dx-col-where { width: 24%; } .dx-col-what { width: 13%; } .dx-col-alg { width: 23%; } .dx-col-st { width: 8%; } .dx-col-ev { width: 8%; }
/* Below 960 px: each use becomes a stacked record (same fields, same order, labels shown);
   explicit table roles in the markup keep the table semantics for assistive technology. */
@media (max-width: 959px) {
  .dx-filters { grid-template-columns: repeat(auto-fill, minmax(8.25rem, 1fr)); gap: 10px 12px; padding: 14px 16px; }
  .dx-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dx-table, .dx-table tbody { display: block; width: 100%; }
  .dx-table colgroup { display: none; }
  .dx-table caption { display: block; padding: 12px 16px 4px; }
  .dx-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; padding: 14px 16px; border-top: 1px solid var(--line); }
  .dx-table tbody tr:hover { background: none; }
  .dx-table th, .dx-table td { display: block; border: 0; padding: 0; }
  .dx-table th:first-child, .dx-table td:first-child, .dx-table th:last-child, .dx-table td:last-child { padding-left: 0; padding-right: 0; }
  .dx-table .dx-c-use { grid-column: 1 / -1; margin-bottom: 6px; font-size: 0.95rem; line-height: 1.35; }
  .dx-table .dx-c-where, .dx-table .dx-c-what, .dx-table .dx-c-alg { grid-column: 1 / -1; margin-bottom: 5px; color: var(--fg); line-height: 1.4; }
  .dx-table td::before { content: attr(data-label); content: attr(data-label) / ""; display: block; font-size: 0.72rem; line-height: 1.3; color: var(--muted); }
  .dx-table .dx-c-st, .dx-table .dx-c-ev { margin-top: 1px; }
  .dx-table td > .dx-st, .dx-table td > .dx-ev { justify-self: start; }
}
@media (min-width: 560px) and (max-width: 959px) {
  .dx-table td { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); column-gap: 12px; align-items: baseline; margin-bottom: 3px; }
  .dx-table td::before { margin: 0; font-size: 0.8rem; }
  .dx-table .dx-c-st, .dx-table .dx-c-ev { grid-column: 1 / -1; }
  .dx-table .dx-c-st { margin-bottom: 3px; }
}
.dx-copy textarea { width: 100%; font-family: var(--f-mono); font-size: 0.8rem; }
@media (prefers-reduced-motion: reduce) { .dx * { scroll-behavior: auto !important; } }

/* narrow screens (O1): compact steps; the details panel opens directly under the chosen step */
@media (max-width: 959px) {
  .dx-node { flex-direction: row; flex-wrap: wrap; column-gap: 8px; row-gap: 0; padding: 8px 12px; }
  .dx-node[aria-pressed="true"] { padding: 7px 11px; }
  .dx-node .dx-name { flex: 1 0 100%; }
  .dx-node .dx-zone::after { content: " ·"; }
  .dx-step > .dx-detail, .dx-services li > .dx-detail { margin: 8px 0 10px; }
  .dx-link { padding: 3px 0 3px 12px; font-size: 0.8rem; margin-left: 16px; }
  .dx-boundary { margin-top: 2px; padding-top: 2px; }
  .dx-branches { margin: 4px 0 2px 16px; padding-left: 10px; }
  .dx-jump { display: flex; flex-direction: column; gap: 4px; font-family: var(--f-display); font-size: 0.9rem; margin: 0 0 16px; }
  .dx-jump select { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); min-height: 44px; }
}
@media (min-width: 960px) { .dx-jump, .dx-back { display: none; } }
/* S1-02: select plus an explicit "Show step" button */
.dx-jump-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; } /* clear of the 3 px + 2 px focus ring */
.dx-jump-row select { flex: 1 1 100%; min-width: 0; }
.dx-jump-row .btn { min-height: 44px; }
.dx-detail[hidden] { display: none; }
.dx-labels dt { font-family: var(--f-display); font-weight: 600; margin-top: 14px; }
.dx-labels dd { margin: 4px 0 0; }
.dx-labels :target { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 6px; }
/* the explorer uses a full-width layout, so it mirrors the article rules it needs (site.css is unchanged) */
.dx { padding-block: 20px 72px; }
.dx h1 { font-size: clamp(2rem, 4.6vw, 3rem); margin: 12px 0 16px; }
.dx .byline { font-family: var(--f-display); font-size: 0.9rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.dx h2 { font-size: 1.5rem; }
.dx h2[id], .dx-labels dt[id] { scroll-margin-top: 80px; }
.dx-lead p + p, .dx-lead p + .pqnote, .dx-lead .pqnote + p { margin-top: 18px; }
.dx-labels h3 { font-size: 1.1rem; margin: 26px 0 4px; }
.dx-labels > p { margin: 0 0 8px; }
.dx-renewal { margin-top: 8px; padding: 8px 12px; border-left: 4px solid var(--mark-cyan); background: var(--soft); border-radius: 0 10px 10px 0; font-family: var(--f-display); font-size: 0.92rem; }
