/* DT_UB_DK_DARK v1 (2026-09-24, U-build lane DK) - U01 full dark mode for the inner pages, ortho + obgyn.
   ONE switch: html[data-theme=dark] (set before first paint by the prefs head script, partials/dt_v4.php). Amber is
   data-theme=light + data-read=amber, so nothing here touches amber or light. Loaded last in <head> on shelled pages.
   Values = the dark tokens of v4-shell.css: ground #111b2b, surface #19263a, surface-2 #1c2a44, ink #edf1ff,
   text-2 #b4c1d9, line #35445e, accent #6f9dff (dark text #07132a on it). No pure black anywhere.
   1. page token families remapped (m1, look2, v4-skin, v4-x, the pages' own :root names)
   2. --dk?-HEX vars: look2*.css / v4-skin.css write their light literals as var(--dk?-HEX,#HEX) (same colour in light)
   3. shared pieces (hero, tints, buttons, porcelain art, forms)  4. page fixes */

/* ---------- 1. tokens ---------- */
html:is(.dt-v4,.dk-page)[data-theme=dark],html:is(.dt-v4,.dk-page)[data-theme=dark] body{
  --bg:#111b2b!important;--bg-2:#152036!important;--card:#19263a!important;--panel:#19263a!important;--surface:#19263a!important;--soft:#1c2a44!important;--paper:#19263a!important;
  --ink:#edf1ff!important;--ink-2:#c9d3e6!important;--ink-3:#a3b1cb!important;--ink-4:#4a5a78!important;--text:#edf1ff!important;
  --muted:#b4c1d9!important;--mut:#b4c1d9!important;--mute:#b4c1d9!important;--line:#35445e!important;--line-2:#2c3a55!important;--border:#35445e!important;
  --accent:#6f9dff!important;--accent-2:#94b6ff!important;--acc:#6f9dff!important;--ac:#6f9dff!important;--ac-d:#94b6ff!important;--ac-l:#1f3155!important;
  --blue:#6f9dff!important;--blue-2:#94b6ff!important;--blue-bg:#1a2a47!important;--blue-light:#1f3155!important;--blue-light-2:#1a2a47!important;--sb-accent:#6f9dff!important;
  --c-blue:#1f3155!important;--c-purple:#282a52!important;--c-teal:#163a3d!important;--c-pink:#3a2238!important;--c-rose:#2e2334!important;
  --green-bg:#183b33!important;--green-light:#1c4a3a!important;--red-bg:#3c2d30!important;--red-light:#4a2a2e!important;--orange-bg:#3a2c22!important;--orange-light:#4a3322!important;
  --purple-bg:#282a52!important;--purple-light:#2f2d5c!important;--yellow-bg:#393429!important;--teal-bg:#183b3f!important;--teal-light:#1b4447!important;
  --okbg:#183b33!important;--badbg:#3c2d30!important;--tr:#6fd6a8!important;--ok:#6fd6a8!important;--bad:#ffae93!important;--warn:#e9bb75!important;
  --m1-acc:#6f9dff!important;--m1-acc-2:#94b6ff!important;--m1-acc-soft:#1f3155!important;--m1-acc-line:#34507f!important;
  --m1-ink:#edf1ff!important;--m1-ink-2:#c9d3e6!important;--m1-muted:#b4c1d9!important;--m1-faint:#8d9bb6!important;
  --m1-bg:#111b2b!important;--m1-card:#19263a!important;--m1-line:#2c3a55!important;--m1-line-2:#35445e!important;
  --m1-ok:#6fd6a8!important;--m1-ok-soft:#183b33!important;--m1-bad:#ffae93!important;--m1-bad-2:#ff9f9f!important;--m1-bad-soft:#3c2d30!important;--m1-warn:#e9bb75!important;--m1-warn-soft:#393429!important;
  --m1-shadow-1:0 1px 2px #0005!important;--m1-shadow-2:0 8px 28px #0007!important;
  --l2-ground:#111b2b;--l2-surface:#19263a;--l2-soft:#1c2a44;--l2-ink:#edf1ff;--l2-text-2:#b4c1d9;--l2-text-3:#a3b1cb;
  --l2-line:#35445e;--l2-line-2:#2c3a55;--l2-acc:#6f9dff;--l2-acc-press:#94b6ff;--l2-acc-bg:#1f3155;--l2-acc-line:#34507f;
  --l2-sh-1:0 1px 2px #0005;--l2-sh-2:0 6px 16px #0006;--l2-sh-3:0 14px 30px #0007;
  --v4k-bg:#111b2b;--v4k-ink:#edf1ff;--v4k-muted:#b4c1d9;--v4k-line:#35445e;--v4k-acc:#6f9dff;--v4k-acc-2:#94b6ff;--v4k-acc-bg:#1f3155;--v4k-acc-line:#34507f;--v4k-soft:#1c2a44;--v4k-ochre:#e9bb75;--v4k-shadow:0 14px 30px #0005;
  --x-ink:#edf1ff;--x-muted:#b4c1d9;--x-line:#35445e;--x-acc:#6f9dff;--x-soft:#1c2a44;
  --rd-card:#19263a;--rd-ink:#edf1ff;--rd-line:#35445e;--rd-muted:#b4c1d9;--rd-soft:#1c2a44;
  --dtbm-bg:#19263ae6;
  color-scheme:dark
}
/* ---------- 2. literal colours of look2*.css / v4-skin.css (generated by tools/dkgen.py) ---------- */
html[data-theme=dark]{--dkb-d3e0fb:#0e2857;--dkb-dfe9ff:#0b2654;--dkb-e3e9f2:#152c4e;--dkb-e3f4ec:#123a41;--dkb-e7edf7:#132a4e;--dkb-e8eef6:#142b4b;--dkb-e8f6ef:#133740;--dkb-e9f1fe:#0e2850;--dkb-eef2f8:#162947;--dkb-eef5fc:#112a49;--dkb-effaf4:#14333d;--dkb-f3f7ff:#132647;--dkb-f3fbf7:#152f3d;--dkb-f5f8fe:#152644;--dkb-f7faff:#152642;--dkb-fbfcfe:#18263e;--dkb-fcf5e9:#2b2d2e;--dkb-fdeeec:#2e2334;--dkb-fff8f7:#232537;--dkb-ffffff:#19263a;--dkb-ffffffb3:#ffffff0d;--dkb-ffffffc2:#ffffff0d;--dkb-ffffffc7:#ffffff0d;--dkb-ffffffd9:#ffffff0d;--dkd-000000:#c7c7c7;--dkd-003599:#9bb7ff;--dkd-0b6475:#9de3f1;--dkd-155a96:#86bdf0;--dkd-257a36:#86d898;--dkd-46710a:#cef19d;--dkd-4a6829:#b0d485;--dkd-6340a3:#bea2f2;--dkd-6f5f30:#dcc790;--dkd-7d630c:#e8cb66;--dkd-9c1f3a:#f492a7;--dkd-a51f4e:#eda1bb;--dkd-a82222:#eca2a2;--dkd-b34a0a:#ffa578;--dkk:#ffffff;--dkl-b9e2cd:#315a56;--dkl-e7c98f:#5b523d;--dkl-efd3a3:#5e513b;--dkl-ffffff:#35445e;--dkm-fff:#19263a;--dkon:#07132a;--dkt-0b6040:#a3f5d6;--dkt-0f7a4f:#a4f4d4;--dkt-15803d:#a7f1c3;--dkt-1c6fb8:#a6cef2;--dkt-33405a:#bec7da;--dkt-46526a:#b4c1d9;--dkt-56627a:#b4c1d9;--dkt-6b7892:#b4c1d9;--dkt-80520c:#f6d5a2;--dkt-8a97b0:#b4c1d9;--dkt-9a1c12:#f4aaa4;--dkt-b42318:#f3aaa5}

/* ---------- 3. shared ---------- */
html:is(.dt-v4,.dk-page)[data-theme=dark],html:is(.dt-v4,.dk-page)[data-theme=dark] body{background-color:#111b2b!important;color:#edf1ff}
html:is(.dt-v4,.dk-page)[data-theme=dark] :is(input:not([type=checkbox],[type=radio],[type=range],[type=color]),select,textarea){background-color:#152036;color:#edf1ff;border-color:#35445e}
html:is(.dt-v4,.dk-page)[data-theme=dark] :is(input,textarea)::placeholder{color:#8d9bb6}
/* filled accent buttons: dark ink on the light accent (7.6:1) */
html:is(.dt-v4,.dk-page)[data-theme=dark] .l2-btn{color:#07132a}
html:is(.dt-v4,.dk-page)[data-theme=dark] [data-block] .l2-btn{color:#0b1424}
/* block tints: 16% of the block colour on the dark surface; text tone = light block tone (AA on the tint) */
html[data-theme=dark].look2-ob [data-block]{--cbd:color-mix(in oklab,var(--cb) 52%%,#fff)!important}
html[data-theme=dark] .l2-tint[data-block],html[data-theme=dark] .l2-hero[data-block]{background:color-mix(in srgb,var(--cb) 16%,#19263a);border-color:color-mix(in srgb,var(--cb) 38%,#19263a)}
html[data-theme=dark] .l2-hero[data-block] .l2-chip{background:#ffffff0d;border-color:color-mix(in srgb,var(--cb) 30%,#19263a)}
/* porcelain art: reduced so the white glaze does not glare on the dark ground */
html[data-theme=dark] :is(.l2-hero-art,img[src*="/art/pages/"],img[src*="/art-blocks/"],img[src*="/assets/v4/art/"]){opacity:.8}

/* ---------- 4. page fixes (what the generated copy cannot know) ---------- */
/* the media tab strip of the shell (videos / atlas / mafhoom) */
html:is(.dt-v4,.dk-page)[data-theme=dark] .v4m-tabs{background:#19263a;border-color:#35445e;box-shadow:0 2px 10px #0005}
/* fills in the block tone are light in dark mode: dark ink on them */
html:is(.dt-v4,.dk-page)[data-theme=dark].look2 :is(.algo-count,.algo-chip,.vcard-cta,.v4b-num,.algo-card .algo-cta){color:#0b1424}
html:is(.dt-v4,.dk-page)[data-theme=dark].look2 .algo-card .algo-cta{color:var(--cbd)}
/* active filter chips on an accent fill (their own rules paint white text) */
html:is(.dt-v4,.dk-page)[data-theme=dark] :is(.chips .chip.on,.chips .on,.fchip.on,.tbl-chip.on,button.on[data-f],button.on[data-k]){color:#07132a}
html:is(.dt-v4,.dk-page)[data-theme=dark] :is(.chips .on,.fchip.on,button.on[data-f],button.on[data-k],button.active[data-k]) :is(.n,.c){color:#07132a;opacity:.85}
/* disabled rows keep a readable muted tone */
html:is(.dt-v4,.dk-page)[data-theme=dark] .m1-row.is-empty{opacity:1}
html:is(.dt-v4,.dk-page)[data-theme=dark] .m1-row.is-empty :is(.m1-row-t,.m1-row-s){color:#a3b1cb!important}
/* /starkey block pills: the count badge was ink on white */
html:is(.dt-v4,.dk-page)[data-theme=dark] .blkpill .cnt{background:#35445e}
/* /anatomy keeps its tokens on main.an-main / dialog.an-vw */
html:is(.dt-v4,.dk-page)[data-theme=dark] :is(main.an-main,dialog.an-vw){--an-ink:#edf1ff;--an-ink-2:#c9d3e6;--an-ink-3:#b4c1d9;--an-line:#35445e;--an-line-2:#2c3a55;
  --an-surf:#19263a;--an-surf-2:#1c2a44;--an-surf-3:#22314d;--an-acc:#6f9dff;--an-acc-deep:#94b6ff;--an-acc-soft:#6f9dff24}
/* /interactive tags use per-card --ac-l / --ac-d */
html:is(.dt-v4,.dk-page)[data-theme=dark] .iv-tag{background:color-mix(in srgb,var(--ac) 18%,#19263a);color:color-mix(in oklab,var(--ac) 45%,#fff)}
/* PMP keeps its own night palette, moved onto the site tokens (one dark, not two) */
html:is(.dt-v4,.dk-page)[data-theme=dark] body.dtdark{--ink:#edf1ff;--line:#35445e;--soft:#1c2a44;--mute:#b4c1d9;--muted:#b4c1d9;--paper:#19263a;background:#111b2b!important;color:#edf1ff}
/* white text on a block-colour fill (--ac / --fc): the fill goes one deep step so white stays AA on every block colour */
html:is(.dt-v4,.dk-page)[data-theme=dark] :is(.mn-fil.active,.mf-fil.active){background:color-mix(in srgb,var(--fc,#2d5cf5) 65%,#000);border-color:color-mix(in srgb,var(--fc,#2d5cf5) 65%,#000);color:#fff}
html:is(.dt-v4,.dk-page)[data-theme=dark] :is(.mn-poster-btn.solid,.mn-poster-btn:hover,.iv-btn:not(.ghost)){background:color-mix(in srgb,var(--ac) 65%,#000);color:#fff}
html:is(.dt-v4,.dk-page)[data-theme=dark] :is(.mn-poster-btn:not(.solid),.iv-btn.ghost){background:transparent;color:color-mix(in oklab,var(--ac) 45%,#fff)}
html:is(.dt-v4,.dk-page)[data-theme=dark] .v4m-tab:not([aria-current=page]){color:#b4c1d9}
/* /mafhoom: the dark block tone becomes a light block tone */
html:is(.dt-v4,.dk-page)[data-theme=dark].look2 .mf-card{--l2-d:color-mix(in oklab,var(--ac) 45%,#fff)!important}
html:is(.dt-v4,.dk-page)[data-theme=dark].look2 .mf-card .mf-btn.solid{color:#0b1424}
/* light wallpaper photo behind some legacy page mains (obgyn /curriculum): almost gone in dark */
html:is(.dt-v4,.dk-page)[data-theme=dark] main.main::before{opacity:.05!important}
/* phone tab bar: it stayed white "with the light page"; the page is dark now, so the bar is too (same values as the menu) */
html.dt-v4:not(.v4)[data-theme=dark] .v4t{--v4s-bg:#152036;--v4s-line:#2c3a55;--v4s-muted:#b4c1d9;--v4s-acc:#6f9dff;--v4s-hover:#1f2e4b}
