/* =========================================================
   Midnight 1911 · donate page (catalogue)
   Loaded after site.css; reads its tokens only. Sticky category chips,
   category hub, item cards with neon prices, colour swatches, skills,
   lightbox, toast and the engraved-emblem placeholder for missing pictures.
   ========================================================= */

.page-donate {
  --dn-bar-pad: 10px;
  --dn-ph-mark: url("../img/dl_emblem_engrave.png");
}

/* `hidden` must win over component display rules (.btn is inline-flex), or
   status.js / donate.js could not hide the store link or the "soon" button */
.page-donate [hidden] { display: none !important; }

/* ---------- hero extras ---------- */
.page-donate .phero { --street-horizon: 44%; }
.dn-soon .tag { padding: 0 8px; font-size: 11.5px; }
@media (max-width: 480px) {
  .page-donate .phero__actions .btn { white-space: normal; text-align: left; line-height: 1.3; padding-block: 10px; }
}

/* ---------- sticky category bar (horizontal chips on phones) ---------- */
.dn-bar {
  position: sticky; top: var(--nav-h); z-index: 40;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.dn-bar__scroll {
  position: relative;
  display: flex; flex-wrap: nowrap; gap: 8px;
  padding: var(--dn-bar-pad) 6px; /* room for the 3px-offset focus ring of the first/last chip */
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.dn-bar__scroll::-webkit-scrollbar { display: none; }
.dn-bar__scroll .chip { flex: none; scroll-snap-align: start; min-height: 42px; }
.dn-bar__scroll .chip > span:first-child + .chip__n { margin-left: -2px; }
@media (min-width: 1100px) {
  /* all nine chips fit on one line on desktop: no swipe needed */
  .dn-bar__scroll { gap: 6px; }
  .dn-bar__scroll .chip { padding: 0 12px; }
}
/* edge fades tell the reader there is more to swipe to (set by donate.js) */
.dn-bar__scroll.is-r { -webkit-mask-image: linear-gradient(90deg, var(--ink-0) calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, var(--ink-0) calc(100% - 40px), transparent); }
.dn-bar__scroll.is-l { -webkit-mask-image: linear-gradient(90deg, transparent, var(--ink-0) 40px); mask-image: linear-gradient(90deg, transparent, var(--ink-0) 40px); }
.dn-bar__scroll.is-l.is-r { -webkit-mask-image: linear-gradient(90deg, transparent, var(--ink-0) 40px, var(--ink-0) calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, transparent, var(--ink-0) 40px, var(--ink-0) calc(100% - 40px), transparent); }

/* ---------- body ---------- */
.dn__body { padding-block: clamp(40px, 5vw, 72px) clamp(88px, 10vw, 140px); }
.dn-head { margin-bottom: clamp(28px, 3.5vw, 44px); }
.dn-display { margin-top: 14px; font-size: clamp(34px, 4.6vw, 64px); }
.dn-display:focus { outline: none; }
.dn-display:focus-visible { outline: 2px solid var(--focus); outline-offset: 6px; }

/* the engraved emblem placeholder (missing or unusable picture) */
.dn-ph {
  position: absolute; inset: 0;
  display: grid; place-items: center; align-content: center; gap: 12px;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--teal) 12%, transparent), transparent 52%),
    radial-gradient(circle at 50% 78%, color-mix(in srgb, var(--red) 9%, transparent), transparent 50%),
    linear-gradient(160deg, var(--ink-2), var(--ink-film));
}
.dn-ph i {
  display: block; width: min(42%, 150px); aspect-ratio: 1;
  background: linear-gradient(170deg, var(--tube-teal) 0%, var(--steel-2) 48%, var(--tube-red) 100%);
  -webkit-mask: var(--dn-ph-mark) center / contain no-repeat;
  mask: var(--dn-ph-mark) center / contain no-repeat;
  opacity: .5;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--teal) 30%, transparent));
}
.dn-ph__t { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: var(--steel-3); }

/* ---------- category hub ---------- */
.dn-hub {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px;
}
.dn-hub__card {
  --tube: var(--teal);
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  width: 100%; height: 100%; min-height: 280px; padding: 20px 22px 22px;
  border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--ink-film);
  color: var(--steel-0); text-align: left; cursor: pointer;
  transition: border-color .3s, transform .3s var(--ease), box-shadow .3s;
}
.dn-hub__card--red { --tube: var(--red); }
.dn-hub__media { position: absolute; inset: 0; z-index: -2; }
.dn-hub__media img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.72) brightness(.78);
  transition: transform .6s var(--ease), filter .4s;
}
.dn-hub__media .dn-ph { align-content: start; padding-top: 18%; }
.dn-hub__card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(to top, color-mix(in srgb, var(--ink-0) 96%, transparent) 0%, color-mix(in srgb, var(--ink-0) 70%, transparent) 38%, transparent 72%),
    radial-gradient(120% 70% at 50% 120%, color-mix(in srgb, var(--tube) 22%, transparent), transparent 60%);
}
.dn-hub__card::before {
  content: ""; position: absolute; left: 22px; right: 22px; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--tube), transparent); opacity: 0; transition: opacity .3s;
}
.dn-hub__top { position: absolute; top: 16px; left: 18px; right: 16px; display: flex; align-items: center; justify-content: space-between; }
.dn-hub__no { font-family: var(--font-num); font-size: 13px; font-weight: 500; letter-spacing: .12em; color: var(--steel-2); text-shadow: 0 1px 8px var(--ink-0); }
.dn-hub__go {
  width: 40px; height: 40px; padding: 10px; border-radius: 50%;
  color: color-mix(in srgb, var(--tube) 45%, var(--white));
  background: color-mix(in srgb, var(--ink-0) 60%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tube) 45%, transparent);
  transition: box-shadow .3s, transform .3s var(--ease);
}
.dn-hub__name { font-size: clamp(22px, 2vw, 26px); font-weight: 800; font-stretch: 72%; line-height: 1.15; color: var(--steel-0); text-shadow: 0 2px 14px var(--ink-0); }
.dn-hub__desc { font-size: 14.5px; line-height: 1.55; color: var(--steel-1); text-shadow: 0 1px 10px var(--ink-0); }
.dn-hub__count {
  align-self: flex-start; margin-top: 8px;
  display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--steel-1);
  border: 1px solid color-mix(in srgb, var(--tube) 50%, transparent);
  background: color-mix(in srgb, var(--ink-0) 55%, transparent);
}
.dn-hub__count b { font-family: var(--font-num); font-weight: 600; font-size: 14px; color: color-mix(in srgb, var(--tube) 45%, var(--white)); }
.dn-hub__card:hover, .dn-hub__card:focus-visible { border-color: color-mix(in srgb, var(--tube) 45%, transparent); box-shadow: var(--shadow-card); }
.dn-hub__card:hover { transform: translateY(-3px); }
.dn-hub__card:hover::before, .dn-hub__card:focus-visible::before { opacity: 1; }
.dn-hub__card:hover .dn-hub__media img { transform: scale(1.05); filter: saturate(.9) brightness(.9); }
.dn-hub__card:hover .dn-hub__go { transform: translateX(3px); box-shadow: inset 0 0 0 1px var(--tube), 0 0 18px color-mix(in srgb, var(--tube) 35%, transparent); }
.dn-hub__card:focus-visible { outline-offset: 3px; border-radius: var(--r-lg); }
@media (max-width: 560px) {
  .dn-hub { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dn-hub__card { min-height: 188px; padding: 14px; border-radius: var(--r); }
  .dn-hub__top { top: 10px; left: 12px; right: 10px; }
  .dn-hub__go { width: 32px; height: 32px; padding: 8px; }
  .dn-hub__name { font-size: 18px; }
  .dn-hub__desc { display: none; }
  .dn-hub__count { padding: 2px 9px; font-size: 12px; }
  .dn-hub__media .dn-ph { padding-top: 14%; }
  .dn-hub__media .dn-ph i { width: 48%; }
}

/* ---------- category view: head + controls ---------- */
.dn-view__head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 20px 32px;
  margin-bottom: clamp(24px, 3vw, 36px);
}
.dn-view__title .slate { margin-top: 22px; }
.dn-back .ico { transform: rotate(180deg); }
.dn-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.dn-search { position: relative; flex: 1 1 260px; min-width: 0; }
.dn-search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--steel-3); pointer-events: none; }
.dn-search input, .dn-sort select {
  width: 100%; min-height: 48px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--ink-1); color: var(--steel-0);
  font: 500 16px/1.2 var(--font-sans); /* 16px: iOS Safari zooms the page on focus below that */
  -webkit-appearance: none; appearance: none; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.dn-search input { padding: 0 14px 0 42px; }
.dn-search input::placeholder { color: var(--steel-3); }
.dn-search input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; cursor: pointer; }
.dn-sort { position: relative; flex: 0 1 230px; min-width: 0; }
.dn-sort select { padding: 0 42px 0 16px; cursor: pointer; text-overflow: ellipsis; }
.dn-sort::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; margin-top: -6px; pointer-events: none;
  border: solid var(--steel-2); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.dn-sort select option { background: var(--ink-1); color: var(--steel-0); }
.dn-search input:focus, .dn-sort select:focus { border-color: color-mix(in srgb, var(--teal) 70%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 16%, transparent); }
.dn-search input:focus-visible, .dn-sort select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (min-width: 861px) {
  .dn-controls { flex-wrap: nowrap; width: min(540px, 44vw); }
}
@media (max-width: 860px) {
  .dn-view__head { grid-template-columns: minmax(0, 1fr); }
  .dn-controls { width: 100%; }
}
@media (max-width: 480px) {
  .dn-search, .dn-sort { flex: 1 1 100%; }
}

/* ---------- item grid (per-category column widths) ---------- */
.dn-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: clamp(16px, 2vw, 24px);
}
.dn-grid--horse { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.dn-grid--dog, .dn-grid--business { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.dn-grid--item { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.dn-grid--balloon { grid-template-columns: minmax(0, 1fr); max-width: 800px; margin-inline: auto; }
.dn-grid > li { min-width: 0; }

.dn-item {
  --tube: var(--teal);
  position: relative; height: 100%; min-width: 0; overflow: hidden;
  display: flex; flex-direction: column;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--ink-2), var(--ink-1));
  transition: border-color .3s, transform .3s var(--ease), box-shadow .3s;
}
.dn-item--red { --tube: var(--red); }
.dn-item::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: 0; z-index: 3; height: 1px;
  background: linear-gradient(90deg, transparent, var(--tube), transparent); opacity: 0; transition: opacity .3s;
}
.dn-item:hover, .dn-item:focus-within { border-color: color-mix(in srgb, var(--tube) 40%, transparent); box-shadow: var(--shadow-card); }
.dn-item:hover { transform: translateY(-3px); }
.dn-item:hover::before, .dn-item:focus-within::before { opacity: 1; }

/* media */
.dn-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--ink-film); border-bottom: 1px solid var(--line); }
.dn-grid--balloon .dn-media { aspect-ratio: 16 / 9; }
.dn-slot { position: absolute; inset: 0; }
.dn-zoom { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.dn-zoom img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.dn-item:hover .dn-zoom img { transform: scale(1.04); }
.dn-zoom:focus-visible { outline-offset: -4px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.dn-media::after {
  /* keeps the price and the category label readable over bright pictures */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 46%; pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--ink-film) 55%, transparent), transparent);
}
.dn-cat {
  position: absolute; top: 12px; left: 12px; z-index: 2; pointer-events: none;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; line-height: 1.5; color: var(--steel-1);
  background: color-mix(in srgb, var(--ink-film) 70%, transparent); border: 1px solid var(--line-2);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.dn-price {
  position: absolute; top: 10px; right: 10px; z-index: 2; pointer-events: none;
  display: inline-flex; align-items: baseline; gap: 5px; padding: 6px 12px 7px; border-radius: 12px;
  background: color-mix(in srgb, var(--ink-film) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--tube) 55%, transparent);
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--tube) 14%, transparent), 0 8px 20px -8px var(--ink-film);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.dn-price__n {
  font-family: var(--font-num); font-weight: 600; font-size: 24px; line-height: 1; letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  color: var(--tube-teal); text-shadow: var(--glow-teal);
}
.dn-price__c { font-family: var(--font-sans); font-weight: 700; font-size: 16px; line-height: 1; color: var(--steel-0); }
.dn-item--red .dn-price__n { color: var(--tube-red); text-shadow: var(--glow-red); }
.dn-stats {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  font: 600 13px/1 var(--font-sans); color: var(--steel-0); cursor: zoom-in;
  background: color-mix(in srgb, var(--ink-film) 72%, transparent); border: 1px solid var(--line-2);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: border-color .2s, color .2s;
}
.dn-stats .ico { width: 16px; height: 16px; }
.dn-stats:hover { border-color: color-mix(in srgb, var(--tube) 60%, transparent); color: var(--white); }

/* body */
.dn-body { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 22px; }
.dn-name { font-size: 19px; font-weight: 700; line-height: 1.3; color: var(--steel-0); }
.dn-variant { margin-top: 2px; font-size: 13.5px; font-weight: 600; color: color-mix(in srgb, var(--tube) 45%, var(--white)); }
.dn-meta { margin-top: 6px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: var(--steel-3); }
.dn-desc { margin-top: 10px; flex: 1; font-size: 15px; line-height: 1.7; color: var(--steel-2); }
.dn-desc .pnote {
  display: block; margin-top: 10px; font-weight: 700; letter-spacing: .01em;
  color: var(--tube-red); text-shadow: var(--glow-red-soft);
}
.dn-desc .pnote + .pnote { margin-top: 4px; }

/* colour swatches: a 40px tap target around a 24px dot */
.dn-sw { display: flex; flex-wrap: wrap; gap: 2px; margin: 12px -8px 0; }
.dn-sw__b {
  position: relative; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: none; cursor: pointer;
}
.dn-sw__b::before {
  content: ""; position: absolute; inset: 8px; border-radius: 50%;
  background: var(--sw, var(--steel-3));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--white) 22%, transparent), 0 0 0 1px color-mix(in srgb, var(--ink-film) 60%, transparent);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.dn-sw__b:hover::before { transform: scale(1.1); }
.dn-sw__b[aria-pressed="true"]::before {
  transform: scale(1.08);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--white) 22%, transparent), 0 0 0 2px var(--ink-1), 0 0 0 4px var(--tube), 0 0 14px color-mix(in srgb, var(--tube) 45%, transparent);
}
.dn-sw__b:focus-visible { outline-offset: 0; border-radius: 50%; }

/* skills */
.dn-skills { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dn-skills .tag { font-weight: 600; letter-spacing: .02em; }

/* empty search */
.dn-empty {
  grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; padding: 64px 16px;
  font-size: 16px; color: var(--steel-2); text-align: center;
}
.dn-empty .ico { width: 28px; height: 28px; color: var(--steel-3); }

/* one-shot entrance when a category opens (not on search or sort) */
@media (prefers-reduced-motion: no-preference) {
  .dn-grid.is-enter > li { animation: dn-rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
  #catView:not([hidden]) .dn-view__head { animation: dn-rise .4s var(--ease) both; }
}
@keyframes dn-rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- note panel ---------- */
.dn-note {
  margin-top: clamp(48px, 6vw, 88px);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px 28px;
}
.dn-note p { font-size: 16px; line-height: 1.75; color: var(--steel-2); max-width: 62ch; }
.dn-note b { color: var(--steel-0); }
.dn-note__actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 900px) {
  .dn-note { grid-template-columns: auto minmax(0, 1fr); }
  .dn-note__actions { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .dn-note { grid-template-columns: minmax(0, 1fr); }
  .dn-note__actions .btn { flex: 1 1 100%; }
}

/* ---------- lightbox ---------- */
.dn-lb {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center; padding: 72px 16px 24px;
  background: color-mix(in srgb, var(--ink-film) 92%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.dn-lb[hidden] { display: none; }
.dn-lb__fig { margin: 0; display: grid; justify-items: center; gap: 12px; max-width: 100%; }
.dn-lb__fig img {
  width: auto; height: auto; max-width: min(100%, 1100px); max-height: calc(100vh - 140px); max-height: calc(100svh - 140px);
  border-radius: var(--r); border: 1px solid var(--line-2); box-shadow: var(--shadow-card);
}
.dn-lb__fig figcaption { font-size: 14.5px; font-weight: 600; color: var(--steel-1); text-align: center; }
.dn-lb__close {
  position: absolute; top: 14px; right: 14px;
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--ink-2); color: var(--steel-0); cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.dn-lb__close .ico { width: 22px; height: 22px; }
.dn-lb__close:hover { border-color: var(--teal); box-shadow: var(--glow-teal-soft); }
@media (prefers-reduced-motion: no-preference) {
  .dn-lb:not([hidden]) { animation: dn-fade .25s var(--ease) both; }
  .dn-lb:not([hidden]) .dn-lb__fig img { animation: dn-zoom .32s var(--ease) both; }
}
@keyframes dn-fade { from { opacity: 0; } }
@keyframes dn-zoom { from { opacity: 0; transform: scale(.94); } }

/* ---------- toast ---------- */
.dn-toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 95;
  width: max-content; max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 12px;
  font-size: 14.5px; line-height: 1.5; text-align: center; color: var(--steel-0);
  background: var(--ink-2); border: 1px solid color-mix(in srgb, var(--teal) 50%, transparent);
  box-shadow: var(--shadow-card), var(--glow-teal-soft);
  opacity: 0; transform: translate(-50%, 14px); pointer-events: none;
  transition: opacity .25s, transform .3s var(--ease);
}
/* stays in the accessibility tree while empty (a live region that only
   appears together with its text is often not announced) */
.dn-toast:empty { padding: 0; border-width: 0; box-shadow: none; }
.dn-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- reduced motion: keep feedback, drop travel ---------- */
@media (prefers-reduced-motion: reduce) {
  .dn-hub__card, .dn-hub__media img, .dn-hub__go, .dn-item, .dn-zoom img, .dn-sw__b::before, .dn-toast { transition: none; }
  .dn-hub__card:hover, .dn-item:hover, .dn-hub__card:hover .dn-hub__go { transform: none; }
  .dn-hub__card:hover .dn-hub__media img, .dn-item:hover .dn-zoom img { transform: none; }
  .dn-toast, .dn-toast.is-on { transform: translate(-50%, 0); }
}
