/* ==========================================================================
   MUAMS — Clothing Rail
   Uses the site's design tokens (muams.css :root). Only transform + opacity are
   animated per frame. Tuning: see assets/js/rail/README.md
   ========================================================================== */

.crail {
  position: relative; width: 100vw; margin: 0 0 clamp(36px, 5vw, 72px) calc(50% - 50vw);
  background: #fff; overflow: hidden; isolation: isolate; color: var(--ink); font-family: var(--sans);
  border-bottom: 1px solid var(--line);
}
.crail::before { content: ''; position: absolute; inset: auto 0 0 0; height: 46%; z-index: -1; pointer-events: none; background: radial-gradient(70% 90% at 50% 100%, rgba(17, 17, 17, .05), transparent 72%); }

/* ---------- heading ---------- */
.crail__head { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: clamp(30px, 4.4vw, 60px) var(--gutter) 0; }
.crail__eyebrow { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--ink); line-height: 1; }
.crail__eyebrow span { color: var(--muted); }
.crail__eyebrow i { display: inline-block; width: 1px; height: 11px; margin: 0 12px -2px; background: var(--line-2); }
.crail__title { margin: 16px 0 0; font-family: var(--sans); font-size: clamp(2.3rem, 5.4vw, 5rem); font-weight: 600; line-height: .98; letter-spacing: -.045em; color: var(--ink); }
.crail__title em { font-style: normal; background: linear-gradient(90deg, #8a8a8a 0%, #cdcdcd 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }

/* ---------- stage ---------- */
.crail__stage { position: relative; width: 100%; height: 520px; cursor: grab; touch-action: pan-y; -webkit-user-select: none; user-select: none; outline: none; transition: filter .55s var(--ease), opacity .55s var(--ease); }
.crail__stage.is-drag { cursor: grabbing; }
.crail__stage:focus-visible::after { content: ''; position: absolute; inset: 6px var(--gutter); border-radius: 14px; box-shadow: 0 0 0 2px var(--accent); pointer-events: none; }
.crail__bar { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.crail__track { position: absolute; inset: 0; pointer-events: none; }
.crail__empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 var(--gutter); text-align: center; font-size: 15px; font-weight: 500; color: var(--stone); pointer-events: none; }
.crail__empty[hidden] { display: none; }

/* ---------- one garment ---------- */
.crail-item { position: absolute; left: 0; top: 0; opacity: 0; transform-origin: 50% 0; will-change: transform, opacity; pointer-events: none; contain: layout style; }
.crail-item__swing { position: absolute; inset: 0; will-change: transform; pointer-events: none; }
.crail-item__hanger { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.crail-item__img { position: absolute; max-width: none; -webkit-user-drag: none; user-select: none; pointer-events: none; }
/* a soft contact shadow on the wall: painted once per garment layer, so swinging stays cheap */
.crail-item__img { filter: drop-shadow(0 18px 12px rgba(17, 17, 17, .13)); }
.crail-item.is-photo .crail-item__img { filter: none; }
.crail-item.is-photo .crail-item__img { object-fit: cover; border-radius: 8px; box-shadow: 0 18px 34px -20px rgba(0, 0, 0, .55); }
.crail-item__tag { position: absolute; width: 0; height: 0; transform-origin: 0 0; pointer-events: none; will-change: transform; }
.crail-item__tag i { position: absolute; left: 0; top: 0; width: 1px; height: 36px; background: rgba(17, 17, 17, .5); }
.crail-item__tag b { position: absolute; left: -24px; top: 35px; width: 48px; height: 28px; display: grid; place-items: center; border-radius: 3px; background: #fff; font-size: 11px; font-weight: 600; letter-spacing: .01em; color: var(--ink); box-shadow: 0 0 0 1px rgba(17, 17, 17, .07), 0 8px 14px -8px rgba(0, 0, 0, .4); font-variant-numeric: tabular-nums; }
.crail-item__tag b::before { content: ''; position: absolute; top: 3px; left: 50%; width: 3.5px; height: 3.5px; margin-left: -1.75px; border-radius: 50%; background: rgba(17, 17, 17, .22); }
.crail-item__btn { position: absolute; left: 4%; right: 4%; top: 22px; bottom: 0; border-radius: 12px; background: transparent; cursor: pointer; pointer-events: auto; -webkit-tap-highlight-color: transparent; }
.crail-item__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- "Drag to explore" pill (fades after the first interaction) ---------- */
.crail__drag { position: absolute; left: 50%; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 12px; margin: 0; padding: 9px 16px; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 0 0 1px var(--line-2), 0 14px 28px -18px rgba(0, 0, 0, .4); font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--stone); pointer-events: none; transform: translateX(-50%); }
.crail__drag[hidden] { display: none; }
.crail__drag m-icon { --is: 14px; }
.crail__drag m-icon:first-child { animation: crail-nudge-l 2.4s ease-in-out infinite; }
.crail__drag m-icon:last-child { animation: crail-nudge-r 2.4s ease-in-out infinite; }
@keyframes crail-nudge-l { 50% { transform: translateX(-4px); } }
@keyframes crail-nudge-r { 50% { transform: translateX(4px); } }

/* ---------- footer: hovered garment · progress · caption ---------- */
.crail__foot { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 20px; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) clamp(24px, 3vw, 40px); transition: filter .55s var(--ease), opacity .55s var(--ease); }
.crail__now { min-height: 46px; opacity: 0; }
.crail__now.is-in { animation: rail-now .5s var(--ease) both; }
.crail__now b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.crail__now span { display: block; margin-top: 3px; font-size: 13px; font-weight: 500; color: var(--stone); font-variant-numeric: tabular-nums; }
@keyframes rail-now { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.crail__nav { display: flex; align-items: center; gap: 14px; justify-self: center; }
.crail__arrow { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--line-2); transition: background .3s, color .3s, transform .4s var(--ease-back); }
.crail__arrow:hover { background: var(--ink); color: #fff; }
.crail__arrow:active { transform: scale(.92); }
.crail__arrow m-icon { --is: 16px; }
.crail__progress { position: relative; width: clamp(96px, 13vw, 170px); height: 2px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.crail__progress i { position: absolute; left: 0; top: 0; height: 100%; width: 20%; border-radius: 2px; background: var(--ink); will-change: transform; }
.crail__note { justify-self: end; max-width: 21em; margin: 0; text-align: right; font-size: 12.5px; font-weight: 500; line-height: 1.5; color: var(--stone); }

/* the whole rail steps back while a quick view is open */
.crail.is-dim .crail__stage, .crail.is-dim .crail__foot { filter: blur(7px); opacity: .22; pointer-events: none; }

/* ---------- filters changed with nothing to show ---------- */
.crail.is-empty .crail__foot .crail__nav { visibility: hidden; }

/* ==========================================================================
   Quick view
   ========================================================================== */
.qv { position: fixed; inset: 0; z-index: 9200; font-family: var(--sans); color: var(--ink); }
.qv[hidden] { display: none; }
.qv__backdrop { position: absolute; inset: 0; background: rgba(255, 255, 255, .74); -webkit-backdrop-filter: blur(12px) saturate(1.1); backdrop-filter: blur(12px) saturate(1.1); opacity: 0; transition: opacity .5s var(--ease); cursor: pointer; }
.qv.is-on .qv__backdrop { opacity: 1; }

.qv__stage { position: absolute; inset: 0 44% 0 0; display: grid; place-items: center; padding: 76px 24px 40px; pointer-events: none; }
.qv__garment { pointer-events: auto; touch-action: pan-y; cursor: grab; position: relative; height: min(74vh, 800px); max-width: 100%; aspect-ratio: var(--ar, .8); will-change: transform; }
.qv__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; filter: drop-shadow(0 32px 34px rgba(0, 0, 0, .2)); transition: opacity .55s var(--ease), transform .7s var(--ease); }
.qv.is-photo .qv__img { object-fit: cover; border-radius: 14px; }
.qv__img--back { opacity: 0; transform: scale(.965); }
.qv__img--back.is-mirror { transform: scaleX(-1) scale(.965); }
.qv[data-face="back"] .qv__img--front { opacity: 0; transform: scale(.965); }
.qv[data-face="back"] .qv__img--back { opacity: 1; transform: none; }
.qv[data-face="back"] .qv__img--back.is-mirror { transform: scaleX(-1); }

.qv__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(44%, 580px); display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 4vw, 64px); overflow-y: auto; outline: none; overscroll-behavior: contain; opacity: 0; transform: translateX(28px); transition: opacity .45s var(--ease), transform .7s var(--ease); }
.qv.is-on .qv__panel { opacity: 1; transform: none; }
.qv__panel > * { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .8s var(--ease); }
.qv.is-on .qv__panel > * { opacity: 1; transform: none; }
.qv.is-on .qv__panel > :nth-child(2) { transition-delay: .06s; } .qv.is-on .qv__panel > :nth-child(3) { transition-delay: .1s; }
.qv.is-on .qv__panel > :nth-child(4) { transition-delay: .14s; } .qv.is-on .qv__panel > :nth-child(5) { transition-delay: .18s; }
.qv.is-on .qv__panel > :nth-child(6) { transition-delay: .22s; } .qv.is-on .qv__panel > :nth-child(7) { transition-delay: .26s; }
.qv.is-on .qv__panel > :nth-child(8) { transition-delay: .3s; } .qv.is-on .qv__panel > :nth-child(9) { transition-delay: .34s; }
.qv__grab { display: none; }

.qv__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: clamp(22px, 3vw, 40px); }
.qv__count { font-size: 12px; font-weight: 600; letter-spacing: .16em; color: var(--stone); font-variant-numeric: tabular-nums; }
.qv__close { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 16px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; box-shadow: inset 0 0 0 1px var(--line-2); transition: background .3s, color .3s; }
.qv__close m-icon { --is: 15px; }
.qv__close:hover { background: var(--ink); color: #fff; }
.qv__name { margin: 0; font-size: clamp(1.9rem, 3.3vw, 3rem); font-weight: 600; line-height: 1.04; letter-spacing: -.04em; }
.qv__price { margin: 12px 0 0; font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; }
.qv__price s { margin-left: 8px; font-size: 14px; color: var(--muted); }

.qv__tabs { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; width: 224px; margin-top: 26px; padding: 4px; border-radius: 999px; background: var(--paper-2); }
.qv__tab { position: relative; z-index: 1; height: 38px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--stone); transition: color .35s; }
.qv__tab.is-on { color: #fff; }
.qv__tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qv__tabbar { position: absolute; z-index: 0; top: 4px; left: 4px; width: calc(50% - 4px); height: 38px; border-radius: 999px; background: var(--ink); transform: translateX(calc(var(--tab, 0) * 100%)); transition: transform .55s var(--ease); }

.qv__label { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--stone); }
.qv__label a { font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
.qv__sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.qv__size { min-width: 58px; height: 48px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 600; background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); transition: background .3s, color .3s, box-shadow .3s, transform .3s var(--ease-back); }
.qv__size:hover:not([disabled]) { box-shadow: inset 0 0 0 1.5px var(--ink); }
.qv__size:active:not([disabled]) { transform: scale(.95); }
.qv__size.is-on { background: var(--ink); color: #fff; box-shadow: none; }
.qv__size[disabled] { color: var(--muted); text-decoration: line-through; box-shadow: inset 0 0 0 1px var(--line); cursor: not-allowed; }
.qv__size:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qv__msg { min-height: 20px; margin: 10px 0 8px; font-size: 13px; font-weight: 500; color: var(--stone); }
.qv__msg.is-err { color: var(--err); }
.qv__add { position: relative; width: 100%; height: 60px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; transition: background .35s, transform .35s var(--ease), box-shadow .35s; }
.qv__add:hover:not([disabled]) { transform: translateY(-2px); box-shadow: 0 22px 32px -20px rgba(0, 0, 0, .7); }
.qv__add:active:not([disabled]) { transform: scale(.985); }
.qv__add.is-done { background: var(--ok); }
.qv__add[disabled] { opacity: .45; cursor: not-allowed; }
.qv__add:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.qv__links { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; }
.qv__lname { color: var(--stone); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qv__page { display: inline-flex; align-items: center; gap: 6px; flex: none; font-weight: 600; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.qv__page m-icon { --is: 14px; transition: transform .4s var(--ease); }
.qv__page:hover m-icon { transform: translateX(4px); }

.qv__nav { position: absolute; top: 50%; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%; display: none; align-items: center; justify-content: center; background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line-2), 0 14px 26px -14px rgba(0, 0, 0, .35); pointer-events: auto; transition: background .3s, color .3s, transform .4s var(--ease-back), opacity .4s; opacity: 0; }
.qv.has-nav .qv__nav { display: inline-flex; }
.qv.is-on .qv__nav { opacity: 1; transition-delay: .25s; }
.qv__nav m-icon { --is: 18px; }
.qv__nav--prev { left: clamp(12px, 2.4vw, 36px); }
.qv__nav--next { right: clamp(12px, 2.4vw, 36px); }
.qv__nav:hover { background: var(--ink); color: #fff; }
.qv__nav:active { transform: scale(.92); }
.qv__nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- phones: bottom sheet ---------- */
@media (max-width: 760px) {
  .crail__head { padding-top: 26px; }
  .crail__foot { grid-template-columns: 1fr auto; row-gap: 12px; }
  .crail__nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: center; }
  .crail__now { grid-column: 1; }
  .crail__note { grid-column: 2; grid-row: 1; max-width: 13em; font-size: 11.5px; }
  .crail__arrow { width: 34px; height: 34px; }

  .qv__stage { inset: 0 0 auto 0; height: 46vh; padding: 52px 16px 6px; }
  .qv__garment { height: min(100%, 33vh); }
  .qv__nav { width: 40px; height: 40px; margin-top: -20px; top: 38%; }
  .qv__panel { top: auto; left: 0; right: 0; width: auto; max-height: 66vh; justify-content: flex-start; border-radius: 26px 26px 0 0; background: #fff; padding: 0 22px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -30px 70px -30px rgba(0, 0, 0, .38); transform: translateY(104%); opacity: 1; transition: transform .65s var(--ease-io); }
  .qv.is-on .qv__panel { transform: none; }
  .qv__grab { display: block; padding: 10px 0 12px; touch-action: none; }
  .qv__grab i { display: block; width: 44px; height: 4px; margin: 0 auto; border-radius: 4px; background: var(--line-2); }
  .qv__top { margin-bottom: 14px; touch-action: none; }
  .qv__name { font-size: 1.75rem; touch-action: none; }
  .qv__price { margin-top: 8px; font-size: 17px; }
  .qv__tabs { margin-top: 16px; }
  .qv__label { margin-top: 18px; }
  .qv__size { height: 44px; min-width: 52px; }
  .qv__add { height: 56px; }
  .qv__links { margin-top: 14px; padding-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .crail__drag m-icon { animation: none !important; }
  .crail__stage, .crail__foot, .qv__backdrop, .qv__panel, .qv__panel > *, .qv__img, .qv__tabbar { transition-duration: .01ms !important; transition-delay: 0s !important; }
  .crail__now.is-in { animation: none; opacity: 1; }
}
