/* merch.css — 29 Oct 2026, reworked 30 Oct 2026. THE MERCH page (src/MerchPage.jsx): a grid of costume cards (the
   Assets page's own .character-card.glass look), and a dress view: one big STAGE picture, the three level cards under
   it, then the versions strip (older versions folded away). Colours are tokens only (invariants 28 + 31: a skin
   repaints, never resizes). NO SHIFT (invariant 20): the stage has a fixed height and swaps its picture in place, every
   text line has a fixed height, a selection only draws a ring (box-shadow), and an edited value and its input share
   one box. Pictures sit on the white matte. */
.view-page.mer-page { gap: 0; min-width: 0; }
.mer-scroll {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 20px 24px;
  margin: 0 -20px;
}

/* ── page head ── */
.mer-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; height: 64px; margin-bottom: 18px; }
.mer-head-titles { min-width: 0; }
.mer-title { font-family: var(--font-display); font-size: var(--fs-44); line-height: 1; color: var(--ink); letter-spacing: 0.02em; }
.mer-sub { margin-top: 6px; height: 18px; font-size: var(--fs-13); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mer-note { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--r-sm); font-size: var(--fs-13); color: var(--ink); background: var(--panel-raised); }
.mer-note--err { color: var(--danger); }
.mer-empty { padding: 80px 20px; text-align: center; color: var(--ink-muted); font-size: var(--fs-14); }
.mer-empty-big { font-family: var(--font-display); font-size: var(--fs-32); color: var(--ink); margin-bottom: 8px; }
.mer-none { font-size: var(--fs-12); color: var(--ink-muted); }
.mer-dash { color: var(--ink-muted); }

/* ── grid ── */
.mer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 22px; align-items: start; }
.mer-card.character-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; cursor: pointer; }
.mer-card-hero { position: relative; width: 100%; background: var(--asset-matte); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mer-card-hero img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mer-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.mer-card-titles { min-width: 0; }
.mer-card-name { font-family: var(--font-display); font-size: var(--fs-26); line-height: 1.1; height: 29px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.02em; }
.mer-card-who { margin-top: 2px; height: 18px; font-size: var(--fs-13); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mer-card-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mer-card-lv { min-width: 0; }
.mer-card-lv-pic { aspect-ratio: 21 / 9; border-radius: var(--r-xs); overflow: hidden; background: var(--asset-matte); border: 1px solid var(--card-border); }
.mer-card-lv-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mer-card-lv-pic.is-empty { background: transparent; border-style: dashed; border-color: color-mix(in srgb, var(--ink-muted) 60%, transparent); }
.mer-card-lv-name { margin-top: 4px; height: 16px; font-size: var(--fs-11-5); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); text-align: center; white-space: nowrap; overflow: hidden; }
.mer-card-price { height: 26px; font-size: var(--fs-22); font-weight: var(--fw-bold); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── dress view ── */
.mer-dress { display: flex; flex-direction: column; gap: 18px; }
.mer-dress-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; height: 64px; }
.mer-back {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px 0 10px;
  border-radius: var(--r-pill); border: 1px solid var(--card-border); background: var(--panel-raised);
  color: var(--ink); font: inherit; font-size: var(--fs-13); font-weight: var(--fw-semi); cursor: pointer;
}
.mer-back:hover { background: color-mix(in srgb, var(--panel-raised) 70%, var(--mix-light)); }
.mer-dress-titles { min-width: 0; }
.mer-dress-name { font-family: var(--font-display); font-size: var(--fs-44); line-height: 1; height: 44px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.02em; }
.mer-dress-who { margin-top: 4px; height: 18px; font-size: var(--fs-14); color: var(--ink-muted); }
.mer-step { display: flex; align-items: center; gap: 8px; }
.mer-step-n { min-width: 56px; text-align: center; font-size: var(--fs-13); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.mer-step-btn.modal-nav-btn { position: static; transform: none; width: 36px; height: 36px; }

/* the stage: a fixed box, the picture contained in it, swapped in place */
.mer-stage-wrap { display: flex; flex-direction: column; gap: 8px; }
.mer-stage {
  position: relative; height: clamp(300px, 54vh, 640px); border-radius: var(--r-card); overflow: hidden;
  background: var(--asset-matte); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
}
.mer-stage-img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* 30 Oct 2026: two panels (the princess wearing it | the contact sheet), one height, each column as wide as its
   picture's shape (grid-template-columns set inline). The sheet's level pictures are stacked; only .is-on shows. */
.mer-stage-row { display: grid; gap: 12px; height: auto; width: 100%; }
.mer-stage-row > .mer-stage { height: 100%; min-width: 0; }
.mer-stage-layer { position: absolute; inset: 0; visibility: hidden; }
.mer-stage-layer.is-on { visibility: visible; }
.mer-stage-cap { height: 20px; text-align: center; font-size: var(--fs-12); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the three level cards */
.mer-lvs { display: grid; gap: 18px; align-items: stretch; }
.mer-lv {
  display: flex; flex-direction: column; gap: 14px; padding: 14px 14px 16px; border-radius: var(--r-card); min-width: 0;
  cursor: pointer; transition: box-shadow var(--dur-2);
}
.mer-lv.is-selected { box-shadow: 0 0 0 2px color-mix(in srgb, var(--status-accent) 55%, transparent); }
.mer-lv:focus-visible { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--status-accent) 80%, transparent); }
.mer-lv-top { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); gap: 14px; align-items: center; }
.mer-lv-pic { aspect-ratio: 21 / 9; border-radius: var(--r-sm); overflow: hidden; background: var(--asset-matte); }
.mer-lv-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mer-lv-pic.is-empty { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--ink-muted) 60%, transparent); }
.mer-lv-id { min-width: 0; }
.mer-lv-name { font-family: var(--font-display); font-size: var(--fs-30); line-height: 1; height: 30px; color: var(--ink); letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mer-lv-price { margin-top: 6px; height: 40px; display: flex; align-items: center; min-width: 0; }
.mer-lv-price .mer-lv-price-val { font-size: var(--fs-32); font-weight: var(--fw-bold); line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mer-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.mer-stat { min-width: 0; padding: 7px 9px; border-radius: var(--r-sm); background: var(--panel-raised); height: 52px; box-sizing: border-box; }
.mer-stat-k { display: flex; align-items: center; gap: 5px; height: 14px; font-size: var(--fs-10); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); white-space: nowrap; }
.mer-est { padding: 0 5px; border-radius: var(--r-pill); font-size: var(--fs-9); letter-spacing: 0.04em; text-transform: none; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); line-height: 12px; }
.mer-stat .mer-stat-v { display: block; margin-top: 4px; height: 20px; font-size: var(--fs-15); font-weight: var(--fw-semi); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; max-width: 100%; }

.mer-how-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 24px; margin-bottom: 4px; }
.mer-how-k { font-size: var(--fs-10-5); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted); font-weight: var(--fw-semi); }
.mer-cx-set { display: inline-flex; gap: 4px; }
.mer-cx {
  height: 22px; padding: 0 9px; border-radius: var(--r-pill); font: inherit; font-size: var(--fs-11);
  font-weight: var(--fw-semi); color: var(--ink-muted); background: transparent; display: inline-flex; align-items: center;
  border: 1px solid color-mix(in srgb, var(--ink-muted) 40%, transparent);
}
button.mer-cx { cursor: pointer; }
.mer-cx.is-on.mer-cx--easy { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 60%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.mer-cx.is-on.mer-cx--medium { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 60%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.mer-cx.is-on.mer-cx--hard { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); }
/* "How it's made": five labelled one-line rows */
.mer-rows { margin: 0; display: flex; flex-direction: column; }
.mer-row { display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: center; gap: 10px; height: 30px; border-top: 1px solid color-mix(in srgb, var(--ink) 7%, transparent); }
.mer-row.is-void { visibility: hidden; }
.mer-row-k { margin: 0; font-size: var(--fs-10); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted); font-weight: var(--fw-semi); }
.mer-row-v { margin: 0; min-width: 0; }
.mer-row .mer-row-val { display: block; max-width: 100%; font-size: var(--fs-13-5); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 22px; }
.mer-row input.mer-input { height: 22px; }

/* click-to-edit: the text and its input take the same box */
.mer-val { display: inline-block; max-width: 100%; }
button.mer-val--edit {
  font: inherit; color: inherit; background: transparent; border: 0; padding: 0; margin: 0; text-align: left; cursor: text;
  border-radius: var(--r-xs); box-shadow: 0 0 0 0 transparent; transition: box-shadow var(--dur-2);
}
button.mer-val--edit:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-accent) 30%, transparent); }
.mer-input {
  font: inherit; color: var(--ink); background: var(--input-bg); border: 0; outline: none; margin: 0; padding: 0;
  border-radius: var(--r-xs); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-accent) 55%, transparent); box-sizing: border-box;
}
input.mer-input { width: 100%; }
.mer-lv-price input.mer-input { height: 38px; }
.mer-stat input.mer-input { height: 20px; }

/* the versions strip: the three chosen pictures, older versions folded away */
.mer-strip { border-radius: var(--r-card); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.mer-strip-row { display: flex; align-items: flex-start; gap: 12px; }
.mer-strip-more { margin-left: auto; height: 84px; display: flex; align-items: center; flex: none; }
.mer-tile { width: 196px; flex: none; min-width: 0; }
.mer-tile-pic { display: block; width: 100%; aspect-ratio: 21 / 9; padding: 0; border: 0; border-radius: var(--r-xs); overflow: hidden; background: var(--asset-matte); cursor: pointer; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent); transition: box-shadow var(--dur-2); }
.mer-tile-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mer-tile.is-on .mer-tile-pic { box-shadow: 0 0 0 2px color-mix(in srgb, var(--status-accent) 70%, transparent); }
.mer-tile--empty .mer-tile-pic { background: transparent; box-shadow: none; border: 1.5px dashed color-mix(in srgb, var(--ink-muted) 60%, transparent); cursor: default; }
.mer-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 24px; }
.mer-tile-v { font-size: var(--fs-11-5); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mer-tile-use {
  height: 20px; padding: 0 8px; border-radius: var(--r-pill); font: inherit; font-size: var(--fs-11); cursor: pointer; flex: none;
  color: var(--ink-muted); background: transparent; border: 1px solid color-mix(in srgb, var(--ink-muted) 40%, transparent);
  opacity: 0; transition: opacity var(--dur-2);
}
.mer-tile:hover .mer-tile-use, .mer-tile-use:focus-visible { opacity: 1; }
.mer-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--card-border); background: var(--panel-raised); color: var(--ink);
  font: inherit; font-size: var(--fs-13); font-weight: var(--fw-semi); cursor: pointer; white-space: nowrap;
}
.mer-pill-chev { transition: transform var(--dur-2); }
.mer-pill.is-on .mer-pill-chev { transform: rotate(180deg); }
.mer-older { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding-top: 12px; border-top: 1px solid var(--card-border); }
.mer-older-k { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-13-5); font-weight: var(--fw-semi); color: var(--ink); padding-top: 2px; }
.mer-older-n { font-size: var(--fs-12); color: var(--ink-muted); }
.mer-older-tiles { display: flex; flex-wrap: wrap; gap: 10px; min-width: 0; }
.mer-older-tiles .mer-tile { width: 160px; }

/* ── notes ── */
.mer-notes { border-radius: var(--r-card); padding: 6px 18px; }
.mer-notes-head { display: flex; align-items: center; gap: 8px; height: 40px; width: 100%; padding: 0; border: 0; background: transparent; font: inherit; font-size: var(--fs-14); font-weight: var(--fw-semi); color: var(--ink); cursor: pointer; text-align: left; }
.mer-notes-chev { transition: transform var(--dur-2); }
.mer-notes-head[aria-expanded="true"] .mer-notes-chev { transform: rotate(90deg); }
.mer-notes-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--status-accent); }
textarea.mer-input.mer-notes-edit { display: block; width: 100%; min-height: 140px; resize: vertical; padding: 8px 10px; margin-bottom: 12px; font-size: var(--fs-13-5); line-height: 1.5; }
.mer-val--edit.mer-notes-edit { display: block; width: 100%; min-height: 40px; padding: 8px 10px; margin-bottom: 12px; white-space: pre-wrap; font-size: var(--fs-13-5); }

@media (max-width: 1100px) {
  .mer-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .mer-lvs { grid-template-columns: minmax(0, 1fr) !important; }
  .mer-dress-head { grid-template-columns: minmax(0, 1fr) auto; height: auto; }
  .mer-dress-head .mer-back { grid-column: 1 / -1; justify-self: start; }
  .mer-dress-name { font-size: var(--fs-32); height: 34px; }
  .mer-stage-row { height: auto; }
  .mer-strip-row { flex-wrap: wrap; }
  .mer-strip-row > .mer-tile { width: calc(33.333% - 8px); }
  .mer-strip-more { margin-left: 0; height: auto; }
  .mer-older { grid-template-columns: minmax(0, 1fr); }
  .mer-older-tiles .mer-tile { width: calc(50% - 5px); }
}
/* 29 Oct 2026 — every money value in the title font (Hugo: "the font of the currencies are not the same as the title") */
.mer-lv-price .mer-lv-price-val, .mer-card-price, .mer-stat .mer-stat-v.mer-money { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.03em; }
.mer-lv-price .mer-lv-price-val { font-size: var(--fs-38); }
.mer-stat .mer-stat-v.mer-money { font-size: var(--fs-18); }

/* 30 Oct 2026: the Dresses / Plushies / Toys tab row and the On Posy row */
.mer-tabs { margin: 0 0 16px; }
.mer-card--plush { cursor: default; }
.mer-posy { margin-top: 12px; }
/* 30 Oct 2026 (Hugo: "why is the thumbnail offset"): On Posy = the label above, the cards right under it, lined up with the level cards above (same left edge, width and gap) */
.mer-older.mer-posy { display: block; }
.mer-posy .mer-older-k { margin-bottom: 8px; }
.mer-posy .mer-older-tiles { gap: 12px; }
/* 30 Oct 2026: Plushies = small cards, six per row, the animal's main picture only */
.mer-grid.mer-grid--plush { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.mer-card--plush .mer-card-hero { aspect-ratio: 4 / 5; }
.mer-card--plush .mer-card-name { font-size: var(--fs-18); }
.mer-card--plush .mer-card-price { font-size: var(--fs-13); }
@media (max-width: 1100px) { .mer-grid.mer-grid--plush { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .mer-grid.mer-grid--plush { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mer-posy .mer-older-tiles .mer-tile { width: 196px; }
@media (max-width: 640px) { .mer-posy .mer-older-tiles .mer-tile { width: calc(33.333% - 8px); } }
/* 30 Oct 2026: no white bars - a picture of the panel's own shape fills it edge to edge */
.mer-stage-img.is-fill { object-fit: cover; }
