/* 3 John Labs website: dark-mode pieces that belong to no other stylesheet.
   The tokens and their dark values live in tjl.css (Brand Kit). A page is dark when <html> has
   data-theme="dark", or when the device prefers dark and the visitor hasn't picked light. The <head>
   script on every page applies a remembered choice; core.js runs the toggle. */

/* One version per theme: the logos (design.md 2.1: primary lockup on light, knockout on dark) and the
   toggle's icon and words. These rules only hide, so the version that shows keeps its own display. */
:root[data-theme="dark"] .tjl-light-only,
:root[data-theme="light"] .tjl-dark-only { display: none; }
@media (prefers-color-scheme: dark) {
  :root.tjl-site:not([data-theme="light"]) .tjl-light-only { display: none; }
}
@media not all and (prefers-color-scheme: dark) {
  :root:not([data-theme="dark"]) .tjl-dark-only { display: none; }
}

/* Placeholder text: the browser's grey (#757575) is 3.3:1 on the dark surface, so dark mode uses the caption colour
   (6.6:1). :where() keeps these at zero specificity, under any component's own placeholder rule. */
:where(:root[data-theme="dark"]) ::placeholder { color: var(--tjl-muted); opacity: 1; }
@media (prefers-color-scheme: dark) {
  :where(:root.tjl-site:not([data-theme="light"])) ::placeholder { color: var(--tjl-muted); opacity: 1; }
}

/* Focus ring: the browser's own is near-black (#101010) in dark, 1.24:1 on navy, so dark mode draws the brand ring
   (2 px, Blue Lifted) on whatever has keyboard focus. :where() keeps the theme part at zero specificity, so a
   component's own ring (.tjl-btn, .theme-row, the tracker's) or its outline: none still wins. */
:where(:root[data-theme="dark"]) :focus-visible { outline: 2px solid var(--tjl-link); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  :where(:root.tjl-site:not([data-theme="light"])) :focus-visible { outline: 2px solid var(--tjl-link); outline-offset: 2px; }
}

/* Checkboxes and radios shown as boxes: the browser's dark ones are a grey (#3B3B3B) fill on navy, so dark mode
   draws its own. Chip groups (the tracker's day, dose, check-in and calculator chips) hide their input and style the
   label instead, so they aren't listed. :where() leaves these at the weight of input[type], so the components' own
   rules still place and size the box (Customize Today's stay 18 px). */
:where(:root[data-theme="dark"]) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input:is([type="checkbox"], [type="radio"]) { appearance: none; flex: none; width: 16px; height: 16px; border: 1.5px solid var(--tjl-muted); border-radius: 3px; background: var(--tjl-surface) center / 12px no-repeat; }
:where(:root[data-theme="dark"]) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input[type="radio"] { border-radius: 50%; }
:where(:root[data-theme="dark"]) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input[type="checkbox"]:checked { border-color: var(--tjl-blue); background-color: var(--tjl-blue); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
:where(:root[data-theme="dark"]) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input[type="radio"]:checked { border: 5px solid var(--tjl-blue); background: #fff; }
:where(:root[data-theme="dark"]) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input:is([type="checkbox"], [type="radio"]):disabled { opacity: .5; }
@media (prefers-color-scheme: dark) {
  :where(:root.tjl-site:not([data-theme="light"])) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input:is([type="checkbox"], [type="radio"]) { appearance: none; flex: none; width: 16px; height: 16px; border: 1.5px solid var(--tjl-muted); border-radius: 3px; background: var(--tjl-surface) center / 12px no-repeat; }
  :where(:root.tjl-site:not([data-theme="light"])) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input[type="radio"] { border-radius: 50%; }
  :where(:root.tjl-site:not([data-theme="light"])) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input[type="checkbox"]:checked { border-color: var(--tjl-blue); background-color: var(--tjl-blue); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
  :where(:root.tjl-site:not([data-theme="light"])) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input[type="radio"]:checked { border: 5px solid var(--tjl-blue); background: #fff; }
  :where(:root.tjl-site:not([data-theme="light"])) :where(.check-row, .ack-row, .ship-opt, .trk-stack-pick) input:is([type="checkbox"], [type="radio"]):disabled { opacity: .5; }
}

/* Theme toggle. In the header bar it is also an .icon-btn (site.css), which gives it the look of the
   other header buttons; on the access-code page (login.html) these rules are its whole look. */
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; padding: 0;
  border: 1px solid var(--tjl-hairline); border-radius: var(--tjl-radius-md);
  background: var(--tjl-surface); color: var(--tjl-heading); cursor: pointer;
}
.theme-btn:hover { border-color: var(--tjl-heading); }
.icon-btn.theme-btn { width: 42px; padding: 0; justify-content: center; }
.theme-btn svg, .theme-row svg { width: 20px; height: 20px; flex: none; }
.theme-btn:focus-visible { outline: 2px solid var(--tjl-link); outline-offset: 2px; }
/* A 44 px touch target with no visible change: an empty box 1 px past the 42 px button on every side (inset counts
   from inside the 1 px border). The button is positioned: relative as an .icon-btn, fixed on login.html. */
.theme-btn::after { content: ""; position: absolute; inset: -2px; }
/* At 860 px and below the bar is full (signed in at 360-390 px it has 23-37 px to spare), so there the
   toggle is a row in the mobile menu, under the account links. */
@media (max-width: 860px) { .hd-actions .theme-btn { display: none; } }
.theme-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px 28px;
  border: 0; border-bottom: 1px solid var(--tjl-hairline); background: none;
  color: var(--tjl-heading); font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.theme-row svg { color: var(--tjl-link); }
.theme-row:focus-visible { outline: 2px solid var(--tjl-link); outline-offset: -2px; }

/* Product-page guide rings (build_site.py): pale blue on white, plain rules on the dark surface. */
.pdp-media .pdp-ring { border: 1px solid #C9DBF6; }
.pdp-media .pdp-ring--dash { border: 1px dashed #B5CDF2; }
:root[data-theme="dark"] .pdp-media .pdp-ring { border-color: var(--tjl-hairline); }
@media (prefers-color-scheme: dark) {
  :root.tjl-site:not([data-theme="light"]) .pdp-media .pdp-ring { border-color: var(--tjl-hairline); }
}
