.weekly-rail {
  --rail-edge: 4.7%;
  --rail-top: 53.5%;
  --rail-bottom: 8.5%;
  --rail-metal: #a29f94;
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 0;
  min-height: 192px;
  aspect-ratio: 1.88;
  overflow: hidden;
  container-type: inline-size;
  border-radius: 4px;
  background: #151515;
}
.rail-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 6%; }
.weekly-rail::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(180deg, #15151508 10%, #15151530 37%, #15151598 56%, #151515f0 83%, #151515 100%),
    linear-gradient(90deg, #151515 0%, transparent 7%, transparent 94%, #151515 100%);
  pointer-events: none;
}
.weekly-rail h2 {
  position: absolute;
  z-index: 1;
  left: var(--rail-edge);
  bottom: calc(100% - var(--rail-top) + clamp(10px, 2.2cqw, 22px));
  color: #fff;
  font-size: clamp(13px, 2.2cqw, 29px);
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: .035em;
  text-transform: uppercase;
  text-shadow: 0 1px 10px #121212b0;
}
.rail-frame, .rail-lineup { position: absolute; inset: var(--rail-top) var(--rail-edge) var(--rail-bottom); }
.rail-frame { z-index: 2; pointer-events: none; }
.rail-frame::before, .rail-frame > span, .rail-hook, .rail-slot--shoes::after { content: ''; position: absolute; }
.rail-frame::before {
  inset: 0 0 auto;
  height: clamp(2px, .48cqw, 5px);
  background: linear-gradient(#77736a 0%, #e3e0d7 36%, #aca89d 49%, #3a3934 100%);
  box-shadow: 0 2px 4px #0008;
  border-radius: 2px;
}
.rail-frame > span {
  inset: 0 auto 0 0;
  width: clamp(2px, .37cqw, 4px);
  background: linear-gradient(90deg, #535048, var(--rail-metal) 56%, #6c685f);
}
.rail-frame > span:last-child { inset: 0 0 0 auto; }
.rail-frame > span::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: clamp(11px, 2.9cqw, 26px);
  height: clamp(3px, .64cqw, 6px);
  transform: translate(-50%, 40%);
  border-radius: 45% 30% 40% 30%;
  background: linear-gradient(#a09b8e, #554f43);
  box-shadow: 0 3px 8px #0009;
}
.rail-lineup { z-index: 3; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rail-slot { position: relative; min-width: 0; }
.rail-target { position: absolute; inset: 0; border-radius: 4px; }
a.rail-target { -webkit-tap-highlight-color: transparent; }
.rail-target:focus-visible { outline: 1px solid #e8e4d6; outline-offset: 0; }
.rail-slot:focus-within, .rail-slot:hover { z-index: 1; }
.rail-hook {
  top: 0;
  left: 50%;
  width: clamp(5px, 1cqw, 10px);
  height: 16%;
  transform: translate(-32%, -2%);
  border-right: 1px solid #cbc6b9;
  border-top: 1px solid #cbc6b9;
  border-radius: 44% 58% 54% 0;
  box-shadow: 1px 0 2px #14141470;
}
.rail-light {
  position: absolute;
  inset: 3% -15% -8%;
  background: radial-gradient(ellipse at 50% 45%, #e7e2ce44, #b8b3a828 24%, transparent 67%);
  opacity: 0;
  transition: opacity 260ms ease;
  pointer-events: none;
}
.rail-object {
  position: absolute;
  inset: 13% 3% 0;
  display: grid;
  justify-items: center;
  align-items: start;
  container-type: size;
  transform-origin: center top;
  filter: brightness(.94) drop-shadow(0 5px 4px #0007);
  transition: transform 260ms cubic-bezier(.2,.65,.3,1), filter 260ms ease;
  pointer-events: none;
}
.rail-slot--shoes .rail-object {
  inset: auto 5% 5.5%;
  height: 48%;
  align-items: end;
  transform-origin: center bottom;
}
.rail-slot--shoes::after {
  inset: auto 5% 4%;
  height: clamp(2px, .52cqw, 5px);
  background: linear-gradient(#716959, #36332e);
  border-radius: 1px;
  box-shadow: 0 4px 8px #0009;
  pointer-events: none;
}
.rail-photo { width: 100%; height: 100%; object-fit: contain; object-position: center top; }
.rail-slot--shoes .rail-photo { object-position: center bottom; }
.rail-photo--cover { width: 76%; }
.rail-text {
  align-self: center;
  padding: 5px;
  border-radius: 4px;
  background: #201f1f;
  color: #f4f4f4;
  font-size: clamp(9px, 1.4cqw, 14px);
  overflow-wrap: anywhere;
  text-align: center;
}
.rail-caption {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 0;
  width: max-content;
  max-width: min(24cqw, 180px);
  padding: 4px 6px;
  transform: translateX(-50%);
  border: 1px solid #6b675f;
  border-radius: 3px;
  background: #181818;
  color: #fff;
  font-size: clamp(10px, 1.35cqw, 14px);
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
.rail-slot:first-child .rail-caption { left: 0; transform: none; }
.rail-slot:last-child .rail-caption { right: 0; left: auto; transform: none; }
.rail-target:is(:focus-visible, :active) .rail-object { transform: scale(1.05); filter: brightness(1.14) drop-shadow(0 5px 5px #0009); }
.rail-target:is(:focus-visible, :active) :is(.rail-light, .rail-caption) { opacity: 1; }
@media (hover: hover) {
  .rail-target:hover .rail-object { transform: scale(1.05); filter: brightness(1.14) drop-shadow(0 5px 5px #0009); }
  .rail-target:hover :is(.rail-light, .rail-caption) { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .rail-object, .rail-light, .rail-caption { transition: none; }
  .rail-target:is(:hover, :focus-visible, :active) .rail-object { transform: none; }
}

/* The cutouts use the approved mockup as a shared image source. */
.rail-sprite {
  position: relative;
  display: block;
  width: var(--sprite-width);
  width: min(var(--sprite-width), calc(100cqh * var(--sprite-aspect)));
  aspect-ratio: var(--sprite-ratio);
  clip-path: var(--sprite-clip);
}
.rail-sprite::before, .rail-sprite[data-rail-art="hoodie"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/assets/rail/garments.webp') var(--sprite-position) / var(--sprite-size) no-repeat;
}
.rail-sprite[data-rail-art="hoodie"]::before, .rail-sprite[data-rail-art="hoodie"]::after { clip-path: inset(0 50% 0 0); }
.rail-sprite[data-rail-art="hoodie"]::after { transform: scaleX(-1); }

.rail-sprite[data-rail-art="tee"] {
  --sprite-width: 82%;
  --sprite-aspect: 0.81;
  --sprite-ratio: 196 / 242;
  --sprite-size: 970.918% 341.322%;
  --sprite-position: 29.936% 88.185%;
  --sprite-clip: polygon(
    1.531% 53.306%, 17.857% 21.074%, 20.408% 17.769%, 28.061% 13.636%, 39.286% 7.438%,
    44.388% 1.653%, 54.592% 0.826%, 57.653% 5.785%, 68.878% 10.744%, 82.143% 16.116%,
    98.98% 52.893%, 86.224% 60.744%, 82.653% 57.851%, 80.102% 98.347%, 70.918% 97.934%,
    57.143% 95.455%, 44.388% 95.868%, 29.592% 97.934%, 20.408% 99.174%, 19.388% 59.091%,
    14.796% 59.917%
  );
}
.rail-sprite[data-rail-art="cargo"] {
  --sprite-width: 69%;
  --sprite-aspect: 0.644;
  --sprite-ratio: 170 / 264;
  --sprite-size: 1119.412% 312.879%;
  --sprite-position: 43.451% 91.993%;
  --sprite-clip: polygon(
    23.529% 0.758%, 78.235% 1.136%, 77.059% 5.682%, 72.353% 5.682%, 81.176% 23.485%,
    88.824% 38.258%, 91.765% 56.818%, 95.882% 74.621%, 96.471% 96.591%, 84.118% 98.106%,
    67.647% 98.864%, 57.059% 97.348%, 53.529% 88.258%, 51.765% 72.727%, 48.824% 60.227%,
    42.353% 88.258%, 41.176% 97.348%, 26.471% 98.864%, 11.765% 98.485%, 4.706% 96.212%,
    1.765% 79.167%, 5.294% 61.364%, 11.176% 38.636%, 18.235% 21.212%, 24.118% 6.061%,
    21.176% 6.061%
  );
}
.rail-sprite[data-rail-art="hoodie"] {
  --sprite-width: 91%;
  --sprite-aspect: 0.899;
  --sprite-ratio: 232 / 258;
  --sprite-size: 820.259% 320.155%;
  --sprite-position: 58.049% 90.493%;
  --sprite-clip: polygon(
    50% 1.55%, 43.966% 1.163%, 40.948% 3.876%, 31.466% 4.264%, 28.017% 5.814%,
    28.017% 10.078%, 28.879% 12.403%, 22.845% 16.279%, 16.379% 25.194%, 10.345% 37.209%,
    6.466% 48.45%, 2.586% 59.302%, 0.862% 67.054%, 1.293% 81.008%, 3.879% 86.822%,
    3.448% 90.31%, 7.759% 93.411%, 17.241% 98.837%, 18.966% 96.124%, 21.121% 87.984%,
    24.569% 91.473%, 34.052% 90.698%, 43.534% 89.922%, 50% 89.922%, 56.466% 89.922%,
    65.948% 90.698%, 75.431% 91.473%, 78.879% 87.984%, 81.034% 96.124%, 82.759% 98.837%,
    92.241% 93.411%, 96.552% 90.31%, 96.121% 86.822%, 98.707% 81.008%, 99.138% 67.054%,
    97.414% 59.302%, 93.534% 48.45%, 89.655% 37.209%, 83.621% 25.194%, 77.155% 16.279%,
    71.121% 12.403%, 71.983% 10.078%, 71.983% 5.814%, 68.534% 4.264%, 59.052% 3.876%,
    56.034% 1.163%
  );
}
.rail-sprite[data-rail-art="longsleeve"] {
  --sprite-width: 72%;
  --sprite-aspect: 0.668;
  --sprite-ratio: 171 / 256;
  --sprite-size: 1112.865% 322.656%;
  --sprite-position: 72.344% 90%;
  --sprite-clip: polygon(
    15.205% 14.063%, 31.579% 7.422%, 42.105% 1.563%, 54.386% 0.781%, 57.31% 5.078%,
    64.912% 8.984%, 80.117% 14.453%, 85.38% 19.141%, 90.643% 39.063%, 94.152% 56.25%,
    97.076% 76.953%, 96.491% 91.016%, 94.152% 91.406%, 93.567% 98.047%, 84.211% 98.047%,
    83.041% 92.969%, 81.287% 91.406%, 63.743% 92.578%, 49.123% 92.578%, 21.637% 91.016%,
    18.713% 89.453%, 15.789% 98.438%, 5.263% 98.438%, 3.509% 91.016%, 1.754% 89.453%,
    2.339% 75.391%, 6.433% 49.219%, 10.526% 27.344%
  );
}
