/* Holiday accents + time-based dark mode for MunchMakers (Tomer 16 Nov 2026: "slightly holiday themed ... more
   christmasy colors" and "dark mode too, depending on users time").
   - html[data-holiday="1"]: server-side, 18 Nov - 6 Jan Pacific (src/lib/theme.ts), or HOLIDAY_THEME=on|off.
   - html[data-theme="dark"]: set before first paint by the inline script in views/layouts/main*.hbs; the visitor's
     sun/moon choice (localStorage mm-theme) wins, else OS dark mode or local time 19:00-06:59.
   - Hard-coded colours are handled by the generated mm-dark.20261116.css (scripts/gen-dark-overrides.py).
   - These files live in public/assets/theme/, NOT public/css or public/js: webpack's output.clean empties those two
     folders on every build (including Heroku's postbuild), so anything hand-written there is deleted at deploy.
   Product photos, the design tool, swatches and payment widgets are never tinted. */

/* ---------- Holiday: accents only (lime brand green shifts to holly, orange to holiday red, a little gold) ---------- */
html[data-holiday="1"] {
  --mm-lime: #3A9A5B;
  --mm-lime-ink: #1F6B45;
  --mm-lime-tint: #E5F2E9;
  --mm-accent-orange: #B3122E;
}
/* body in the selector + !important: the generated dark rules re-assert the ink bar colour */
html[data-holiday="1"] body .mm-utility-bar { background: #7A0E1F !important; border-bottom: 2px solid #D4A62A; }
html[data-holiday="1"] .mm-utility-bar__promo::before { content: "\2744\FE0E  "; color: rgba(255, 255, 255, 0.7); }
html[data-holiday="1"] .mm-utility-bar__code { color: #F2D27A; }
/* "OPEN NOW" status is green text: on the red bar it must be light (the dot stays green) */
html[data-holiday="1"] .mm-utility-bar .mm-phone-status,
html[data-holiday="1"] .mm-utility-bar .mm-phone-status [data-mm-phone-status-label] { color: #F4EFE6 !important; }
html[data-holiday="1"] body .mm-mobile-bar__promo { background: #7A0E1F !important; }
html[data-holiday="1"] .mm-mobile-bar__promo strong { color: #F2D27A !important; }
html[data-holiday="1"] .mm-mobile-bar__promo::before { content: "\2744\FE0E  "; color: rgba(255, 255, 255, 0.7); }

/* ---------- Dark mode ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --mmd-page: #12100D;
  --mmd-surface: #1B1814;
  --mmd-raised: #25211C;
  --mmd-text: #F2EFE8;
  --mmd-mute: #B3ACA1;
  --mmd-line: #3A352E;
  --mm-text: #F2EFE8;
  --mm-text-2: #D3CDC3;
  --mm-text-3: #ADA69B;
  --mm-text-4: #8A847A;
  --mm-ok: #5CC77A;
  --mm-danger: #F07560;
}
html[data-theme="dark"] body { background-color: var(--mmd-page) !important; color: var(--mmd-text); }
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background-color: var(--mmd-raised) !important;
  color: var(--mmd-text) !important;
  border-color: var(--mmd-line) !important;
}
html[data-theme="dark"] ::placeholder { color: #8E877C !important; }

/* Black line art (logo wordmark, trust-strip icons) would vanish on dark: invert it, keeping the green leaf's hue */
html[data-theme="dark"] .mm-logo__img,
html[data-theme="dark"] .mm-trust__icon { filter: invert(1) hue-rotate(180deg); }

/* Never darken product colour or payment widgets */
html[data-theme="dark"] [data-keep-light],
html[data-theme="dark"] [class*="gallery"],
html[data-theme="dark"] [class*="paypal"],
html[data-theme="dark"] [class*="authorize"] {
  background-color: #FFFFFF !important;
  color: #14110F !important;
  color-scheme: light;
}

/* Selected volume-pricing tier: the legacy app.css rule paints it bright lime (white text on lime is unreadable);
   in dark it gets a deep green tint with light text. Higher specificity than the generated rule on purpose. */
html[data-theme="dark"] .pdp-variant-pricing__table tbody tr.is-active,
html[data-theme="dark"] .mm-pdp-volume__table .mm-pdp-volume__row.is-active {
  background-color: #1E3B28 !important;
  color: var(--mmd-text) !important;
}

/* Sun/moon toggle (public/assets/theme/theme-toggle.20261116.js) */
.mm-theme-toggle {
  position: fixed; left: 14px; bottom: 14px; z-index: 900;
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid #d9d6cd; background: #fafaf7; color: #14110f;
  box-shadow: 0 4px 12px rgba(20, 17, 15, 0.18);
  display: grid; place-items: center; cursor: pointer;
}
html[data-theme="dark"] .mm-theme-toggle { background: #25211C; color: #F2D27A; border-color: #3A352E; }
.mm-theme-toggle:focus-visible { outline: 2px solid #2e6eb5; outline-offset: 2px; }
@media print { .mm-theme-toggle { display: none; } }
/* Below 1024px the fixed bottom tab bar (64px) and, on product pages, the sticky price bar (~72px) are shown: sit the toggle above both */
@media (max-width: 1023px) {
  .mm-theme-toggle { bottom: calc(150px + env(safe-area-inset-bottom)); width: 36px; height: 36px; }
}
