/* The rack: component styles.
   SHARED FILE: identical in mannys-apparel/css/rack.css and momos-cafe/css/rack.css (see js/rack.js).
   Theme it from the site's own stylesheet by overriding these variables on :root (the hanger sprite
   reads them from :root, outside the rack section). Load the site stylesheet AFTER this one. */
:root {
  --rk-ink: #15120e;              /* names, arrows, size labels */
  --rk-muted: #5a5248;            /* meta lines, notes */
  --rk-line: rgb(21 18 14 / .18);
  --rk-surface: #f3efe7;          /* close-up card, size buttons, hang tag */
  --rk-tile: #f3efe7;             /* grid tiles */
  --rk-tile-hover: #fbf8f2;
  --rk-font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --rk-display: var(--rk-font);   /* product names */
  --rk-accent: #f0a818;           /* Add to bag */
  --rk-accent-hover: #ffb92a;
  --rk-on-accent: #15120e;
  --rk-radius: 999px;             /* buttons */
  --rk-new-bg: #f0a818;
  --rk-new-ink: #15120e;
  --rk-focus: #c98500;
  --rk-tag-price-font: 800 normal calc(22 * var(--rk-u)) / 1 var(--rk-font);
  --rk-tag-price-color: #15120e;
  /* the rack's metal and wood */
  --rk-rod: linear-gradient(#eef0f1, #8d9398 55%, #c9cdd0);
  --rk-bracket: linear-gradient(90deg, #6f767a, #b9bec1 50%, #6f767a);
  --rk-wire-1: #d9dcde; --rk-wire-2: #7d8387; --rk-wire-3: #b4b9bc;
  --rk-stem: linear-gradient(90deg, #8d9398, #e2e5e7, #8d9398);
  --rk-wood-1: #2a241e; --rk-wood-2: #0f0c09; --rk-wood-edge: #544a40;
  --rk-clip: #a7adb1; --rk-clip-dark: #6f767a;
  --rk-shadow: 40 26 10;          /* rgb triplet for garment shadows */
  --rk-u: 1px;                    /* rack unit: every hanger and garment size is N * --rk-u */
  --rk-rod-top: 22px;
}
@media (max-width: 700px) {
  :root { --rk-u: calc(min(64vw, 300px) / 300); }
}

/* ---------- filter chips ---------- */
.rk-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.rk-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border: 1px solid var(--rk-line);
  border-radius: 999px; background: transparent; color: var(--rk-ink); font: 600 13px/1 var(--rk-font); cursor: pointer; white-space: nowrap;
}
.rk-chip .rk-n { font-weight: 500; color: var(--rk-muted); font-variant-numeric: tabular-nums; }   /* muted, not faded: keeps 4.5:1 */
.rk-chip[aria-pressed="true"] .rk-n { color: inherit; opacity: .8; }
.rk-chip:hover { border-color: var(--rk-ink); }
.rk-chip[aria-pressed="true"] { background: var(--rk-ink); border-color: var(--rk-ink); color: var(--rk-surface); }
.rk-chip:focus-visible { outline: 3px solid var(--rk-focus); outline-offset: 2px; }
@media (max-width: 700px) {
  /* only the chip strip scrolls sideways, never the page; 6px of room keeps a keyboard focus ring inside the strip */
  .rk-chips { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding: 6px 16px; }
  .rk-chips::-webkit-scrollbar { display: none; }
}

/* ---------- the stage ---------- */
.rk-stage { position: relative; touch-action: pan-y pinch-zoom; outline-offset: -6px; }
.rk-stage:focus-visible { outline: 3px solid var(--rk-focus); outline-offset: -6px; }   /* inset: the stage is full-bleed */
.rk-rod { display: none; }

/* No JS: a plain sideways strip of every piece, each a link to its product page. */
.rk-track { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 20px 4px; }
.rk-garment { flex: 0 0 220px; scroll-snap-align: center; text-align: center; text-decoration: none; color: var(--rk-ink); }
.rk-garment .rk-hook, .rk-garment .rk-stem, .rk-garment .rk-hanger { display: none; }
.rk-garment img { display: block; width: 100%; height: 260px; object-fit: contain; }
.rk-label { display: block; margin-top: 8px; font: 600 13px/1.3 var(--rk-font); }

/* With JS: the rack. */
.rk-stage.is-ready { height: calc(var(--rk-rod-top) + 418 * var(--rk-u) + 10px); overflow: hidden; contain: layout paint; }
.rk-stage.is-ready .rk-rod {
  display: block; position: absolute; left: 3%; right: 3%; top: var(--rk-rod-top); height: 6px; border-radius: 3px; z-index: 0;
  background: var(--rk-rod); box-shadow: 0 3px 5px rgb(21 18 14 / .14);
}
.rk-stage.is-ready .rk-rod::before, .rk-stage.is-ready .rk-rod::after {
  content: ""; position: absolute; top: -22px; width: 7px; height: 30px; border-radius: 2px; background: var(--rk-bracket);
}
.rk-stage.is-ready .rk-rod::before { left: 18px; }
.rk-stage.is-ready .rk-rod::after { right: 18px; }
@media (max-width: 700px) { .rk-stage.is-ready .rk-rod { left: -4px; right: -4px; } }

/* while dragging, rack.js moves the whole track with an inline translate */
.rk-stage.is-ready .rk-track { position: absolute; inset: 0; display: block; overflow: visible; padding: 0; will-change: translate; }
.rk-stage.is-ready .rk-garment {
  /* per-type hanger geometry, all in rack units; build.mjs measures --frac and --arms per garment */
  --arms: 30;      /* where the hanger body starts below the hook */
  --seat: 38;      /* the hanger body's lower edge, below --arms */
  --frac: .085;    /* how far down the garment that lower edge sits (its shoulder line) */
  --bw: 290; --bh: 320;   /* the most room a garment may take (mirrored in build.mjs BOX and Remotion GEOM) */
  --tag-y: .13;           /* where the price tag hangs, as a share of the garment's height */
  --iw: min(calc(var(--bw) * var(--rk-u)), calc(var(--bh) * var(--rk-u) * var(--ar)));
  --ih: calc(var(--iw) / var(--ar));
  position: absolute; top: calc(var(--rk-rod-top) - 2px); left: 50%;
  width: calc(300 * var(--rk-u)); height: calc(430 * var(--rk-u)); margin-left: calc(-150 * var(--rk-u));
  /* rack.js sets translate (slide along the rod), transform (turn and size) and rotate (the swing) inline:
     GPU-only properties, so moving never restyles the garment's insides or repaints it */
  transform-origin: 50% 0;
  transition: translate .62s cubic-bezier(.2, .75, .25, 1), transform .62s cubic-bezier(.2, .75, .25, 1), opacity .35s, visibility 0s;
  cursor: pointer; -webkit-tap-highlight-color: transparent; will-change: transform, translate, rotate;
  -webkit-user-select: none; user-select: none;
}
/* off the ends of the stage: fade out, then hide, so the GPU stops drawing it */
.rk-stage.is-ready .rk-garment.is-off {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: translate .62s cubic-bezier(.2, .75, .25, 1), transform .62s cubic-bezier(.2, .75, .25, 1), opacity .35s, visibility 0s .35s;
}
.rk-stage.is-ready .t-crew { --frac: .09; --bh: 330; --tag-y: .16; }
.rk-stage.is-ready .t-hoodie { --arms: 86; --frac: .19; --bw: 285; --bh: 350; --tag-y: .34; }
/* photo prints hang from a short hook even when the piece is a hoodie (the print has no hood) */
.rk-stage.is-ready .is-photo { --arms: 30; --seat: 31; --frac: 0; --bw: 220; --bh: 290; --tag-y: .06; }
.rk-stage.is-ready .rk-garment.is-recycled { transition: none; }
/* as specific as the .is-off rule above and declared after it, so hidden pieces don't animate during a drag either */
.rk-stage.is-ready.is-dragging .rk-garment { transition: none; }
.rk-stage.is-ready .rk-garment:focus-visible { outline: none; }
.rk-stage.is-ready .rk-garment:focus-visible img { outline: 3px solid var(--rk-focus); outline-offset: 4px; }

.rk-stage.is-ready .rk-swing { position: absolute; inset: 0; }
.rk-stage.is-ready .rk-hook, .rk-stage.is-ready .rk-stem, .rk-stage.is-ready .rk-hanger { display: block; position: absolute; left: 50%; translate: -50% 0; }
.rk-stage.is-ready .rk-hook { top: 0; width: calc(20 * var(--rk-u)); height: calc(32 * var(--rk-u)); overflow: visible; }
.rk-stage.is-ready .rk-stem {
  top: calc(30 * var(--rk-u)); width: max(2px, calc(2.4 * var(--rk-u))); height: calc((var(--arms) - 30 + 2) * var(--rk-u));
  background: var(--rk-stem); border-radius: 2px;
}
.rk-stage.is-ready .rk-hanger { top: calc(var(--arms) * var(--rk-u)); width: calc(190 * var(--rk-u)); height: calc(40 * var(--rk-u)); overflow: visible; }
.rk-stage.is-ready .rk-garment img {
  position: absolute; z-index: 1; width: var(--iw); height: var(--ih); object-fit: fill;
  top: calc((var(--arms) + var(--seat)) * var(--rk-u) - var(--frac) * var(--ih));
  left: calc(50% - var(--neck) * var(--iw));
  filter: drop-shadow(0 calc(10 * var(--rk-u)) calc(7 * var(--rk-u)) rgb(var(--rk-shadow) / .2));
  pointer-events: none;
}
.rk-stage.is-ready .is-photo img {
  border: calc(7 * var(--rk-u)) solid #fbfaf6; border-bottom-width: calc(26 * var(--rk-u)); box-sizing: content-box;
  box-shadow: 0 8px 18px rgb(var(--rk-shadow) / .22); filter: none; object-fit: cover;
  left: calc(50% - var(--iw) / 2 - 7 * var(--rk-u));
}
.rk-stage.is-ready .is-photo .rk-hanger { z-index: 2; }
.rk-stage.is-ready .rk-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }

/* the price tag on the piece in front, tied to the right sleeve */
.rk-hangtag {
  position: absolute; z-index: 3;
  left: calc(50% + (1 - var(--neck)) * var(--iw) - 40 * var(--rk-u));
  top: calc((var(--arms) + var(--seat)) * var(--rk-u) + (var(--tag-y) - var(--frac)) * var(--ih));
  transform-origin: 50% 0; rotate: 7deg;
  display: grid; justify-items: center; padding: calc(9 * var(--rk-u)) calc(9 * var(--rk-u)) calc(8 * var(--rk-u));
  min-width: calc(62 * var(--rk-u)); border-radius: 3px 3px 5px 5px; background: var(--rk-surface); color: var(--rk-ink);
  font-family: var(--rk-font); font-stretch: 62%; text-transform: uppercase; box-shadow: 0 3px 6px rgb(21 18 14 / .18);
  clip-path: polygon(22% 0, 78% 0, 100% 16%, 100% 100%, 0 100%, 0 16%);
  pointer-events: none; animation: rk-tag-in .5s cubic-bezier(.2, .75, .25, 1) both;
}
.rk-hangtag::before { content: ""; width: calc(6 * var(--rk-u)); height: calc(6 * var(--rk-u)); border-radius: 50%; background: var(--rk-tile); box-shadow: inset 0 1px 2px rgb(0 0 0 / .35); margin-bottom: calc(4 * var(--rk-u)); }
.rk-hangtag b { font: var(--rk-tag-price-font); color: var(--rk-tag-price-color); font-stretch: 100%; text-transform: none; }
.rk-hangtag span { margin-top: calc(3 * var(--rk-u)); font-size: max(9px, calc(10 * var(--rk-u))); font-weight: 600; letter-spacing: .06em; }
.rk-hangtag i { font-style: normal; margin-top: calc(4 * var(--rk-u)); padding: 1px 5px; border-radius: 3px; background: var(--rk-new-bg); color: var(--rk-new-ink); font-size: max(9px, calc(10 * var(--rk-u))); font-weight: 800; letter-spacing: .06em; }
@keyframes rk-tag-in { from { opacity: 0; translate: 0 -10px; rotate: -6deg; } }

/* ---------- the panel under the rack ---------- */
.rk-panel { max-width: 600px; margin: 8px auto 0; padding: 0 20px; text-align: center; color: var(--rk-ink); font-family: var(--rk-font); }
.rk-controls { display: flex; justify-content: center; align-items: center; gap: 16px; }
.rk-arrow {
  display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid var(--rk-line); border-radius: 50%;
  background: transparent; color: var(--rk-ink); font: 22px/1 system-ui, sans-serif; cursor: pointer;
}
.rk-arrow:hover { background: var(--rk-ink); color: var(--rk-surface); border-color: var(--rk-ink); }
.rk-arrow:focus-visible { outline: 3px solid var(--rk-focus); outline-offset: 3px; }
.rk-count { min-width: 68px; font-size: 12px; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.rk-tag { margin-top: 12px; }
.rk-name { margin: 0; font-family: var(--rk-display); font-weight: 800; font-size: clamp(21px, 2.3vw, 28px); line-height: 1.15; text-wrap: balance; color: var(--rk-ink); }
.rk-meta { margin: 4px 0 0; font-size: 14px; color: var(--rk-muted); }
.rk-new { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 4px; background: var(--rk-new-bg); color: var(--rk-new-ink); font-size: 11px; font-weight: 800; letter-spacing: .04em; vertical-align: 2px; }

.rk-sizes { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; padding: 0; border: 0; min-inline-size: 0; }
.rk-sizes legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.rk-sizes input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.rk-sizes label {
  display: grid; place-items: center; min-width: 44px; height: 42px; padding: 0 8px; border: 1px solid var(--rk-line); border-radius: 10px;
  font: 700 14px/1 var(--rk-font); font-variant-numeric: tabular-nums; cursor: pointer; background: var(--rk-surface); color: var(--rk-ink);
}
.rk-sizes label:hover { border-color: var(--rk-ink); }
.rk-sizes input:checked + label { background: var(--rk-ink); color: var(--rk-surface); border-color: var(--rk-ink); }
.rk-sizes input:focus-visible + label { outline: 3px solid var(--rk-focus); outline-offset: 2px; }
.rk-sizes input:disabled + label { opacity: .4; text-decoration: line-through; cursor: not-allowed; }
.rk-sizes.is-asking label { animation: rk-nudge .4s; border-color: var(--rk-focus); }
@keyframes rk-nudge { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
@media (max-width: 380px) { .rk-sizes { gap: 5px; } .rk-sizes label { min-width: 40px; padding: 0 5px; } }

.rk-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.rk-add {
  display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 26px; border-radius: var(--rk-radius);
  background: var(--rk-accent); color: var(--rk-on-accent); font: 800 16px/1.1 var(--rk-font); text-decoration: none; cursor: pointer;
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / .14); text-align: center;
}
.rk-add:hover { background: var(--rk-accent-hover); }
.rk-add[aria-disabled="true"] { background: transparent; box-shadow: none; border: 1.5px dashed var(--rk-muted); color: var(--rk-muted); font-weight: 700; }
.rk-add:focus-visible, .rk-ghost:focus-visible, .rk-hold-close:focus-visible, .rk-page-link:focus-visible { outline: 3px solid var(--rk-focus); outline-offset: 3px; }
.rk-ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 20px; border: 1px solid var(--rk-ink); border-radius: var(--rk-radius);
  background: transparent; color: var(--rk-ink); font: 600 15px/1.1 var(--rk-font); cursor: pointer;
}
.rk-ghost:hover { background: var(--rk-ink); color: var(--rk-surface); }
.rk-note { min-height: 1.5em; margin: 10px 0 0; font-size: 13px; color: var(--rk-muted); }

/* ---------- the film band's Pause button (added by rack.js) ---------- */
.rk-film-toggle {
  position: absolute; top: 14px; right: 14px; z-index: 2; min-height: 36px; padding: 0 16px; border-radius: 999px;
  border: 1px solid rgb(255 255 255 / .45); background: rgb(0 0 0 / .5); color: #fff; font: 600 13px/1 var(--rk-font);
  letter-spacing: .02em; cursor: pointer; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.rk-film-toggle:hover { background: rgb(0 0 0 / .7); }
.rk-film-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (max-width: 700px) { .rk-film-toggle { top: 8px; right: 8px; min-height: 30px; padding: 0 12px; font-size: 12px; } }

/* ---------- the grid of everything ---------- */
.rk-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 26px 18px; grid-template-columns: repeat(auto-fill, minmax(min(42vw, 200px), 1fr)); font-family: var(--rk-font); }
.rk-card a { display: block; text-decoration: none; color: var(--rk-ink); }
.rk-tile { display: grid; place-items: center; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 14px; background: var(--rk-tile); transition: background .2s; }
.rk-tile img { width: auto; height: auto; max-width: 84%; max-height: 86%; filter: drop-shadow(0 8px 6px rgb(var(--rk-shadow) / .16)); transition: scale .35s cubic-bezier(.2, .75, .25, 1); }
.rk-tile.is-photo img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; filter: none; }
.rk-card a:hover .rk-tile { background: var(--rk-tile-hover); }
.rk-card a:hover .rk-tile img { scale: 1.04; }
.rk-card a:focus-visible { outline: 3px solid var(--rk-focus); outline-offset: 4px; border-radius: 14px; }
.rk-card-name { display: block; margin-top: 10px; font-family: var(--rk-display); font-weight: 700; font-size: 15px; line-height: 1.3; }
.rk-card-meta { display: block; margin-top: 2px; font-size: 13px; color: var(--rk-muted); }

/* ---------- off the rack (the close-up dialog) ---------- */
html:has(dialog.rk-hold[open]) { overflow: hidden; }
.rk-hold { border: 0; padding: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: transparent; overflow: auto; overscroll-behavior: contain; color: var(--rk-ink); font-family: var(--rk-font); }
.rk-hold::backdrop { background: rgb(21 18 14 / .64); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.rk-hold[open] { display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.rk-hold-card {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: 28px;
  width: min(940px, 100%); padding: 30px; border-radius: 22px; background: var(--rk-surface); box-shadow: 0 30px 80px rgb(0 0 0 / .35);
}
.rk-hold-card:focus { outline: none; }
.rk-hold-close {
  position: absolute; top: 14px; right: 14px; z-index: 2; min-height: 40px; padding: 0 16px; border: 1px solid var(--rk-line); border-radius: 999px;
  background: var(--rk-tile); color: var(--rk-ink); font: 600 14px/1 var(--rk-font); cursor: pointer;
}
.rk-hold-close:hover { border-color: var(--rk-ink); }
.rk-hold-fig { margin: 0; display: grid; place-items: center; min-height: 300px; perspective: 1200px; }
.rk-hold-fig img { display: block; width: auto; height: auto; max-width: 100%; max-height: min(66svh, 560px); filter: drop-shadow(0 18px 14px rgb(var(--rk-shadow) / .24)); }
.rk-hold-fig img.is-photo { border-radius: 10px; filter: none; box-shadow: 0 12px 30px rgb(var(--rk-shadow) / .25); }
.rk-hold-side { text-align: left; }
.rk-hold-side .rk-sizes { justify-content: flex-start; }
.rk-hold-side [data-rk-turn] { margin-top: 14px; }
.rk-hold-side .rk-add { margin-top: 16px; width: 100%; }
.rk-page-link { display: inline-block; margin-top: 14px; font-size: 14px; color: var(--rk-ink); text-underline-offset: 3px; }
@media (max-width: 760px) {
  .rk-hold[open] { place-items: end center; padding: 0; }
  .rk-hold-card { grid-template-columns: 1fr; gap: 14px; padding: 58px 18px calc(20px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; max-height: 100%; overflow: auto; }
  .rk-hold-fig { min-height: 0; }
  .rk-hold-fig img { max-height: 42svh; }
  .rk-hold-side, .rk-hold-side .rk-sizes { text-align: center; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .rk-stage *, .rk-hold *, .rk-grid * { transition: none !important; animation: none !important; }
}
