/* Colour-vision mode (see static/js/colorblind.js).
   <html data-cb="rg|by|mono"> recolours the cues that rely on telling red, orange
   and green apart. "Trained" and "not yet trained" always differ in lightness as
   well as hue, and the tags carry a ✓ / ○ mark, so colour is never the only cue. */

/* ---- Header eye button and menu (all pages, all modes) ---------------- */
#languagePicker.cb-has-eye { display: inline-flex; align-items: center; gap: 10px; }
.cb-eye-btn {
  position: relative; flex-shrink: 0; z-index: 40; width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: #06142b; border: 2px solid #d7aa58; border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .4); transition: transform .2s;
}
.cb-eye-btn:hover { transform: scale(1.1); }
.cb-eye-btn svg { width: 20px; height: 20px; fill: none; stroke: #f0cf8c; stroke-width: 1.7; stroke-linejoin: round; }
.cb-eye-btn svg .cb-pupil { fill: #f0cf8c; stroke: none; }
.cb-eye-btn.is-active { background: #d7aa58; }
.cb-eye-btn.is-active svg { stroke: #06142b; }
.cb-eye-btn.is-active svg .cb-pupil { fill: #06142b; }
.cb-eye-btn--floating { position: fixed; top: 12px; right: 12px; }

.cb-menu {
  position: fixed; z-index: 10000; overflow-y: auto; scrollbar-width: none;
  background: #06142b; border: 2px solid #d7aa58; border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .7); font-family: Georgia, serif; padding: 6px 0 8px;
}
.cb-menu[hidden] { display: none; }
.cb-menu::-webkit-scrollbar { display: none; }
.cb-menu__title { padding: 10px 16px 8px; font-size: 13px; font-weight: 700; color: #d7aa58; border-bottom: 1px solid rgba(215, 170, 88, .3); margin-bottom: 4px; }
.cb-menu__option {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 16px; text-align: left;
  background: transparent; border: 0; color: #f6ecd2; cursor: pointer; font: inherit;
}
.cb-menu__option:hover, .cb-menu__option:focus-visible { background: rgba(215, 170, 88, .14); outline: none; }
.cb-menu__option.is-selected { background: rgba(215, 170, 88, .22); box-shadow: inset 3px 0 0 #d7aa58; }
.cb-menu__option strong { display: block; font-size: 14px; }
.cb-menu__option small { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.3; color: rgba(246, 236, 210, .72); }
/* Two-tone preview of how "trained" / "not yet trained" will look in each mode. */
.cb-menu__swatch { flex: 0 0 34px; height: 22px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, .35); }
.cb-menu__swatch--off  { background: linear-gradient(90deg, #22a06b 50%, #e28b3a 50%); }
.cb-menu__swatch--rg   { background: linear-gradient(90deg, #2b78d6 50%, #f2a31b 50%); }
.cb-menu__swatch--by   { background: linear-gradient(90deg, #0b7f79 50%, #e8553f 50%); }
.cb-menu__swatch--mono { background: linear-gradient(90deg, #1b1b1b 50%, #e3e3e3 50%); }

/* Preferences card icon */
.cb-card-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.cb-card-icon svg .cb-pupil { fill: currentColor; stroke: none; }
.cb-card-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 680px) { .cb-card-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Palettes ----------------------------------------------------------
   --cb-on: "trained" / good.   --cb-off: "not yet trained".   -ink: text on tints. */
html[data-cb="rg"]   { --cb-on: #2b78d6; --cb-off: #f2a31b; --cb-on-ink: #123f7a; --cb-off-ink: #6e4300; --cb-on-rgb: 43,120,214; --cb-off-rgb: 242,163,27; }
html[data-cb="by"]   { --cb-on: #0b7f79; --cb-off: #e8553f; --cb-on-ink: #064a46; --cb-off-ink: #7a1f10; --cb-on-rgb: 11,127,121; --cb-off-rgb: 232,85,63; }
html[data-cb="mono"] { --cb-on: #1b1b1b; --cb-off: #dcdcdc; --cb-on-ink: #111;    --cb-off-ink: #333;    --cb-on-rgb: 27,27,27;  --cb-off-rgb: 220,220,220; }

html[data-cb] { --success-calm: var(--cb-on); --green: var(--cb-on); }

/* Body map: the artwork is made of PNG parts (green = trained, orange = not yet). */
html[data-cb="rg"]   .bodymap-part.is-trained { filter: hue-rotate(104deg) saturate(1.25) brightness(.92); }
html[data-cb="rg"]   .bodymap-part.is-rest    { filter: saturate(1.1) brightness(1.08); }
html[data-cb="by"]   .bodymap-part.is-trained { filter: hue-rotate(48deg) saturate(1.15) brightness(.78); }
html[data-cb="by"]   .bodymap-part.is-rest    { filter: hue-rotate(-14deg) saturate(1.15) brightness(1.06); }
html[data-cb="mono"] .bodymap-part.is-trained { filter: grayscale(1) brightness(.34) contrast(1.35); }
html[data-cb="mono"] .bodymap-part.is-rest    { filter: grayscale(1) brightness(1.7) contrast(.9); }
html[data-cb] .bodymap-atlas .bodymap-part:hover { filter: brightness(1.15); }

/* Body map: vector versions, legend swatches and tags. */
html[data-cb] .legend-swatch.is-trained,
html[data-cb] .rabbit-body-map .body-part.is-trained,
html[data-cb] .body-map-artwork .is-trained,
html[data-cb] .muscle-zone.is-trained,
html[data-cb] .cardio-heart.is-trained { background: var(--cb-on); fill: var(--cb-on); }
html[data-cb] .legend-swatch.is-rest,
html[data-cb] .rabbit-body-map .body-part.is-rest,
html[data-cb] .rabbit-body-map .part-glutes.is-rest,
html[data-cb] .body-map-artwork .is-rest,
html[data-cb] .muscle-zone.is-rest { background: var(--cb-off); fill: var(--cb-off); }
html[data-cb] .legend-swatch { border: 1px solid rgba(10, 17, 40, .55); }
html[data-cb="mono"] .legend-swatch.is-trained { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.25) 0 2px, transparent 2px 5px); }

html[data-cb] .body-map-tags li.is-trained,
html[data-cb] .body-map-tags-critical li.is-trained {
  background: rgba(var(--cb-on-rgb), .16); color: var(--cb-on-ink); border-color: rgba(var(--cb-on-rgb), .55);
}
html[data-cb] .body-map-tags li.is-rest,
html[data-cb] .body-map-tags-critical li.is-rest {
  background: rgba(var(--cb-off-rgb), .2); color: var(--cb-off-ink); border-color: rgba(var(--cb-off-rgb), .6);
}
html[data-cb] .body-map-tags li.is-trained::before,
html[data-cb] .body-map-tags-critical li.is-trained::before { content: "✓ "; font-weight: 700; }
html[data-cb] .body-map-tags li.is-rest::before,
html[data-cb] .body-map-tags-critical li.is-rest::before { content: "○ "; font-weight: 700; }

/* "Live location is on" cue on the map (was green). */
html[data-cb] .map-locate-button.is-live,
html[data-cb] .map-academy .map-locate-button.is-live,
html[data-cb] .map-academy .map-search-row .map-locate-button.is-live {
  border-color: rgba(var(--cb-on-rgb), .85) !important;
  background: rgba(var(--cb-on-rgb), .14) !important;
  color: var(--cb-on-ink) !important;
  box-shadow: 0 0 0 2px rgba(var(--cb-on-rgb), .3);
}
html[data-cb="mono"] .map-locate-button.is-live { background: #fff !important; box-shadow: 0 0 0 3px #111; }

/* Dashboard body-map legend dots. */
html[data-cb] .body-legend i { background: var(--cb-off); border-color: rgba(10, 17, 40, .55); }
html[data-cb] .body-legend i.trained-dot { background: var(--cb-on); }

/* Outdoor map: calm / moderate / busy and the place-type markers (green, amber, red). */
html[data-cb="rg"]   { --cb-calm: #0072b2; --cb-mid: #f0e442; --cb-busy: #d55e00; --cb-park: #004f7f; --cb-rec: #56b4e9; }
html[data-cb="by"]   { --cb-calm: #0b7f79; --cb-mid: #a3a3a3; --cb-busy: #d62f2f; --cb-park: #0b7f79; --cb-rec: #7a4dc9; }
html[data-cb="mono"] { --cb-calm: #f4f4f4; --cb-mid: #8c8c8c; --cb-busy: #151515; --cb-park: #151515; --cb-rec: #6f6f6f; }
html[data-cb] .legend-dot.calm { background: var(--cb-calm); box-shadow: 0 0 0 1px rgba(10, 17, 40, .55); }
html[data-cb] .legend-dot.moderate { background: var(--cb-mid); box-shadow: 0 0 0 1px rgba(10, 17, 40, .55); }
html[data-cb] .legend-dot.busy { background: var(--cb-busy); box-shadow: 0 0 0 1px rgba(10, 17, 40, .55); }
html[data-cb] .marker-park .marker-core { color: var(--cb-park); }
html[data-cb] .marker-recreation .marker-core { color: var(--cb-rec); }

/* Camera view (outdoor-ar): the red End button and the mini-map destination follow the palette. */
html[data-cb] .ar-minimap-actions button.is-end { background: var(--cb-busy); border-color: rgba(255, 255, 255, .85); }
html[data-cb="mono"] .ar-minimap-actions button.is-end { color: #fff; }

/* ---- Whole-page recolour (every page loads this file) ------------------
   The filter is on <html> so it covers photos, videos, the map and the camera view too. */
html[data-cb="mono"] { filter: grayscale(1) contrast(1.12); }
html[data-cb="rg"]   { filter: url(#cb-rg) saturate(1.2); }
html[data-cb="by"]   { filter: url(#cb-by) saturate(1.2); }
