/* Light and Dark modes (Settings → Appearance); Dark until someone chooses. The base
   stylesheet is a dark shelf with cream sheets; these modes only swap the neutral
   surfaces, so every sticker colour, the blue stage, binder materials and cards keep
   their look. Light: the shelf turns cream like the sheets. Dark: the sheets, menus
   and buttons turn dark like the shelf. The same classes on a Settings preview tile
   recolour just that miniature. */

/* ---------- Light: cream shelf ---------- */
:is(body.site.ui-mode-light, body.site .ui-mode-light) {
  --chrome: #efe4cf;
  --chrome-2: #f7efdf;
  --chrome-3: #fffaf1;
  --chrome-4: #e6d8bd;
  --line: #cbbfa6;
  --text: #0d0e14;
  --muted: #5b5666;
  --danger: var(--brick);
  --quiet-line: #8a8296;
  --public-text: var(--text);
  --public-muted: var(--muted);
  --card-title-color: var(--cream-ink);
}
body.site.ui-mode-light {
  color-scheme: light;
  scrollbar-color: var(--chrome-4) transparent;
}
/* On the cream shelf the focus ring is ink, as on cream sheets. */
body.site.ui-mode-light :where(button, a, .binder-item, .slot, .library-card, input, select, textarea, [tabindex]):focus-visible { outline-color: var(--ink); }
/* The card hover tooltip is a cream sheet too. As in cream dialogs, a card's title colour
   colours the name (kept mid-tone or darker) and prices are stickers. */
body.site.ui-mode-light .card-tooltip {
  --text: var(--cream-ink);
  --muted: var(--cream-muted);
  --chrome-4: var(--cream-line);
  background: var(--cream);
}
body.site:is(.ui-mode-light, .pixel-theme, .theme-blossom:not(.blossom-dark)) .card-tooltip .tooltip-title-library { color: var(--cream-ink) !important; -webkit-text-fill-color: var(--cream-ink) !important; background: none !important; }
body.site:is(.ui-mode-light, .pixel-theme, .theme-blossom:not(.blossom-dark)) .card-tooltip .tooltip-title-gradient {
  color: oklch(from var(--card-title-color) var(--title-l) c h) !important; -webkit-text-fill-color: currentColor !important; background: none !important;
}
/* Sunflower text washes out on the cream shelf: ink instead, with sunflower as the accent. */
body.site.ui-mode-light .new-binder-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--sun); }
html body.site.ui-mode-light .profile-description a { color: var(--ink); text-decoration: underline 3px var(--sun); text-underline-offset: 3px; }
/* Rarity and variant labels, in both modes, Pixel World and Blossom: a pastel sticker in the rarity's colour with
   ink text and an ink outline, instead of the old glowing foil text. Treated rarities keep
   their shine as a slow sweep across the sticker; Dark uses a slightly deeper pastel. */
html body.site:is(.ui-mode-light, .ui-mode-dark, .pixel-theme, .theme-blossom) :is(.rarity-badge-inline, .variant-badge-inline) {
  --rarity-sticker: hsl(var(--rarity-hue) var(--rarity-saturation) 80%);
  --rarity-sticker-hi: hsl(var(--rarity-hue) var(--rarity-saturation) 92%);
  border: 2px solid var(--ink) !important; border-radius: 10px;
  background: var(--rarity-sticker) !important;
  background-clip: padding-box !important; -webkit-background-clip: padding-box !important;
  color: var(--ink) !important; -webkit-text-fill-color: var(--ink) !important;
  font-family: var(--sans); font-weight: 800; letter-spacing: 0;
  text-shadow: none !important; box-shadow: 0 2px 0 var(--ink) !important; filter: none !important;
  animation: none !important;
}
html body.site.ui-mode-dark :is(.rarity-badge-inline, .variant-badge-inline) {
  --rarity-sticker: hsl(var(--rarity-hue) var(--rarity-saturation) 74%);
  --rarity-sticker-hi: hsl(var(--rarity-hue) var(--rarity-saturation) 87%);
}
html body.site:is(.ui-mode-light, .ui-mode-dark, .pixel-theme, .theme-blossom) :is(.rarity-badge-inline, .variant-badge-inline):is(.rarity-treatment, .variant-treatment, .rarity-rgb-rare, .rarity-mega-hyper-rare, .rarity-classic-collection, .rarity-special-illustration-rare, .rarity-illustration-rare, .rarity-black-white-rare, .rarity-futuristic-rare, .rarity-ace-spec, .variant-treatment-sp, .variant-treatment-manga) {
  background: linear-gradient(110deg, var(--rarity-sticker) 0%, var(--rarity-sticker) 30%, var(--rarity-sticker-hi) 50%, var(--rarity-sticker) 70%, var(--rarity-sticker) 100%) 0 0 / 200% 100% !important;
  animation: rarityLabelSweep 3.2s linear infinite !important;
}
html body.site:is(.ui-mode-light, .ui-mode-dark, .pixel-theme, .theme-blossom) .rarity-badge-inline.rarity-rgb-rare {
  background: linear-gradient(110deg, #ffb3ad, #ffd59e 16%, #fff0a0 32%, #b5ecc1 48%, #a6ece8 64%, #b4dcf5 80%, #e2bdf2 92%, #ffb3ad) 0 0 / 200% 100% !important;
}
/* Staff-coloured registry labels tint the sticker with their own colour. */
html body.site:is(.ui-mode-light, .ui-mode-dark, .pixel-theme, .theme-blossom) :is(.rarity-badge-inline, .variant-badge-inline).rarity-registry-style {
  --rarity-sticker: color-mix(in srgb, var(--registry-label-color, var(--sky)) 45%, #fff);
  --rarity-sticker-hi: color-mix(in srgb, var(--registry-label-color, var(--sky)) 20%, #fff);
}
@media (prefers-reduced-motion: reduce) {
  html body.site:is(.ui-mode-light, .ui-mode-dark, .pixel-theme, .theme-blossom) :is(.rarity-badge-inline, .variant-badge-inline):is([class]) { animation: none !important; }
}
body.site:is(.ui-mode-light, .ui-mode-dark, .pixel-theme, .theme-blossom) .card-tooltip :is(.tooltip-price-market, .tooltip-price-paid) {
  padding: 2px 8px; border: 2px solid var(--ink); border-radius: var(--pill, 999px); color: var(--ink) !important;
}
body.site:is(.ui-mode-light, .ui-mode-dark, .pixel-theme, .theme-blossom) .card-tooltip .tooltip-price-market { background: var(--mint); }
body.site:is(.ui-mode-light, .ui-mode-dark, .pixel-theme, .theme-blossom) .card-tooltip .tooltip-price-paid { background: var(--blush); }

/* ---------- Dark: dark sheets, menus and buttons ---------- */
:is(body.site.ui-mode-dark, body.site .ui-mode-dark) {
  --cream: #2a2d3b;
  --cream-2: #23263a;
  --cream-3: #1f2130;
  --cream-hover: #343849;
  --paper: #1b1d27;
  --cream-ink: #fff8ec;
  --cream-muted: #c9c2b4;
  --cream-line: #474c66;
  --sun-soft: #4d4329;
  --brick: #ff8a73;
}
/* Soft sunflower hovers and panels turn dark gold, so their text stays cream. */
body.site.ui-mode-dark :is(.custom-select-option:hover, .custom-select-option.selected, .card-context-action:is(:hover, :focus-visible), .card-context-action.edit-highlight:is(:hover, :focus-visible) strong, .calendar-day:hover, .calendar-pick-btn:hover, .calendar-year-choice:hover) { color: var(--cream-ink); }
body.site.ui-mode-dark :is(.modal, .card-context-menu, .pop-menu, .calendar-popover, .custom-select-menu, .binder-overview, .profile-binder-tooltip, .toast, #authGate) {
  color-scheme: dark;
}
/* Ink icons drawn into backgrounds (search fields) turn cream with their field. */
body.site.ui-mode-dark :is(.search, .library-set-search-input) {
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff8ec' stroke-width='2.6' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
}
body.site.ui-mode-dark :is(.search, .library-set-search-input, .field input, .field textarea)::placeholder { color: var(--cream-muted); }
/* Inside dark sheets the focus ring returns to sunflower, as on the shelf. */
body.site.ui-mode-dark :is(.modal, .pop-menu, .card-context-menu, .binder-overview, .calendar-popover) :where(button, a, input, select, textarea, [tabindex]):focus-visible { outline-color: var(--sun); }
