/*
 * HIME theme: the site stays readable with a browser's dark mode on.
 *
 *   Chrome / Edge "auto dark" (and Samsung Internet's) repaint a page's light surfaces dark and its dark ink light. On
 *   the paper notices and the manila tags that turned ink and paper into a muddy grey. "color-scheme: light only" on
 *   those surfaces tells the browser they are paper, always light: it leaves them, and what is drawn on them, alone.
 *   Safari and Firefox do not repaint pages; with the system in dark mode they draw form controls and their own
 *   defaults dark where a page has not said otherwise. So every control and overlay gets its colours written out.
 *   Forced colours (Windows contrast themes): the system's colours, with the borders and the small icons kept.
 *
 * Nothing here changes what a visitor sees in the ordinary light view: the colours written out are the ones each part
 * already had. The controls' rules are wrapped in :where() so that any rule of the site's own CSS still wins.
 */

/* ---------- 1. paper and manila: always light ---------- */
.hime-buy, .hime-vintage-cta, .hime-note,     /* the bulletin-board notices */
.amp-tag, .amp-tag-pair,                      /* the manila price tags */
.hv-card, .hv-sheet,                          /* Shop Vintage's catalogue card and spec sheets */
.hime-merch__badge {                          /* the Merch page's "Limited Run" label */
  color-scheme: light only;
}

/* ---------- 2. controls: background, text and border written out ---------- */
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea) {
  background-color: #fff; color: #1d1d1d; border-color: #767676;
}
:where(input, select, textarea)::placeholder { color: #6b6b6b; opacity: 1; }
:where(button:not([class])) { background-color: #efefef; color: #111; border-color: #767676; }
/* the notices' own fold button sits on the paper: ink on nothing */
body:not(#_) .hime-buy .hime-drop__btn { background-color: transparent; }

/* ---------- 3. overlays: their colours written out (they are dark by design; the menu panel's are in base.css) ---------- */
.hime-viewer { background-color: rgba(8, 7, 6, .93); color: #e8c878; }
.hime-viewer__close { background-color: rgba(20, 17, 13, .85); color: #e8c878; border-color: rgba(201, 174, 106, .6); }
.hime-ql__card { color: #efe5cd; border-color: rgba(232, 200, 120, .3); }
.hime-ql__x { color: #efe5cd; }
/* drawings in the overlays and on the paper follow their text colour where they have no colour of their own */
.hime-viewer svg, .hime-ql svg { color: inherit; }
.hime-viewer svg:not([fill]), .hime-ql svg:not([fill]) { fill: currentColor; }

/* ---------- 4. forced colours (Windows contrast themes) ---------- */
@media (forced-colors: active) {
  /* the notices: the system's page colours, a border where the frame was; the tack and the paper drawing stand back */
  .hime-buy, .hime-vintage-cta, .hime-note, .amp-tag, .hv-card, .hv-sheet { border: 2px solid CanvasText !important; }
  .hime-buy::before, .hime-vintage-cta::before, .hime-note::before, .hime-buy::after, .hime-vintage-cta::after, .hime-note::after { display: none; }
  .hime-buy__zap { display: none !important; }
  /* the small icons are drawn as a mask over their colour: keep them in the text colour */
  [class^="icon-"]::before, [class*=" icon-"]::before { forced-color-adjust: none; background-color: CanvasText; }
  a [class^="icon-"]::before, a[class^="icon-"]::before, a[class*=" icon-"]::before { background-color: LinkText; }
  /* the menu button's three lines */
  .mobile-menu-button span { forced-color-adjust: none; background-color: ButtonText !important; }
  /* overlays: solid system colours, no see-through blur */
  .mobile-nav, .hime-ql__card, .hime-viewer, .hime-ql__scrim {
    background: Canvas !important; color: CanvasText; border: 1px solid CanvasText; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .hime-viewer__close, .hime-ql__x, .hime-drop__btn { border: 1px solid ButtonText; color: ButtonText; background-color: ButtonFace; }
  svg { forced-color-adjust: auto; }
  svg:not([fill]) { fill: currentColor; }
  :focus-visible { outline: 2px solid Highlight !important; outline-offset: 2px; }
}
