/* Night mode for the SOP documents (stage 2, 14 Sept 2026).
   The document stylesheet (/data/css/sop-doc.css) ships with the content feed and is built from the print master, so
   it is not touched. This sheet loads after it and, in night mode only, swaps the document's colour variables and the
   handful of hard-coded whites and navy-on-white texts. Layout, sizes and the navy blocks (masthead, step numbers,
   contact cards, footer) stay as printed; the light sheets become dark cards and the text goes light. */

:root[data-theme="dark"] .sop-doc {
  --off-white:  #1c2b40;
  --text-dark:  #e6ebf2;
  --text-body:  #d5dde8;
  --text-muted: #a7b3c4;
  --bg-page:    #0f1a2b;
  --line:       rgba(255,255,255,0.14);
  --amber-dark: #f1a83a;
  --red:        #ff6b5b;
}

/* Sheets that are hard-coded white in the print master */
:root[data-theme="dark"] .sop-doc .section,
:root[data-theme="dark"] .sop-doc .rule-card,
:root[data-theme="dark"] .sop-doc details.qrc-collapse,
:root[data-theme="dark"] .sop-doc details.sec-collapse { background: #172538; }
:root[data-theme="dark"] .sop-doc .ref-table tr { background: #172538; }
:root[data-theme="dark"] .sop-doc .ref-table tr:nth-child(even) td { background: #1c2b40; }

/* Navy text on what used to be white: now light text */
:root[data-theme="dark"] .sop-doc .section-title,
:root[data-theme="dark"] .sop-doc .qrc-steps strong,
:root[data-theme="dark"] .sop-doc .rule-card-value,
:root[data-theme="dark"] .sop-doc .step-content strong,
:root[data-theme="dark"] .sop-doc .forms-jump .fj-q,
:root[data-theme="dark"] .sop-doc .ref-table .mono,
:root[data-theme="dark"] .sop-doc details.qrc-collapse > summary,
:root[data-theme="dark"] .sop-doc details.sec-collapse > summary { color: #e6ebf2; }
:root[data-theme="dark"] .sop-doc .rule-card-value.red { color: #ff6b5b; }
:root[data-theme="dark"] .sop-doc .rule-card-value.amber { color: #f1a83a; }
:root[data-theme="dark"] .sop-doc .qrc-label,
:root[data-theme="dark"] .sop-doc .form-table th { color: #9fb8d6; }
:root[data-theme="dark"] .sop-doc .jump a { color: #e6ebf2; }
:root[data-theme="dark"] .sop-doc .jump a b { color: #f5a623; }

/* Hairlines that were navy at low opacity */
:root[data-theme="dark"] .sop-doc .qrc-steps li,
:root[data-theme="dark"] .sop-doc .qrc-check li,
:root[data-theme="dark"] .sop-doc .uniform-item,
:root[data-theme="dark"] .sop-doc .step,
:root[data-theme="dark"] .sop-doc .alert + .step-list,
:root[data-theme="dark"] .sop-doc .figure-strip + .step-list { border-color: rgba(255,255,255,0.12); }

/* Amber and red tints read a little stronger on a dark card */
:root[data-theme="dark"] .sop-doc .alert,
:root[data-theme="dark"] .sop-doc .qrc-alert,
:root[data-theme="dark"] .sop-doc .forms-jump { background: rgba(245,166,35,0.14); }
:root[data-theme="dark"] .sop-doc .alert.red,
:root[data-theme="dark"] .sop-doc .qrc-alert.red { background: rgba(255,107,91,0.14); border-color: #ff6b5b; }

/* Photos: take the glare off at night, full colour on tap-and-hold is not needed */
:root[data-theme="dark"] .sop-doc .sop-figure img { filter: brightness(0.85); }
