/* The hero: headline and logo above, the rail of tees across the bottom of the first screen. */
.hero--rail { grid-template-columns: 1.15fr .85fr; grid-template-rows: minmax(0, 1fr) auto; }
.hero--rail .hero__text { grid-template-rows: auto auto; align-content: center; gap: .9rem; padding-top: calc(var(--margin) + 3.75rem); padding-bottom: 1rem; }
.hero--rail .hero__text h1 { font-size: clamp(2.75rem, 5.2vw, 5.25rem); line-height: .95; }
.hero--rail .hero__foot { max-width: 44rem; gap: .75rem; }
.hero--rail .lead { font-size: var(--step-body); }
.hero--rail .mosaic { display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; place-items: center; background: none; padding: 4rem var(--margin) .5rem; }
.hero--rail .tile--logo { grid-column: 1; grid-row: 1; width: min(100%, 31svh); aspect-ratio: 1; }
.hero--rail .spin { width: 100%; }

.rail { --h: clamp(400px, 58svh, 600px); --w: calc((var(--h) - 176px) / 1.08); position: relative; z-index: 2; grid-column: 1 / -1; height: var(--h); background: var(--bg-deep); overflow-x: clip; perspective: 1300px; perspective-origin: 50% 50%; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.rail--live { cursor: grab; }
.rail--drag { cursor: grabbing; }
.rail__bar { position: absolute; left: 0; right: 0; top: 30px; height: 12px; background: var(--ink); }
.rail__list { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; transform-style: preserve-3d; }
.rail__item { position: absolute; left: 50%; top: 22px; width: var(--w); margin-left: calc(var(--w) / -2); transform-style: preserve-3d; opacity: 0; transition: opacity 500ms var(--ease-out); }
.rail--in .rail__item { opacity: 1; }
.rail__tee { display: block; width: 100%; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: center; cursor: inherit; transform-origin: 50% 0; transform: rotateY(-56deg); transition: transform 460ms var(--ease-out); }
.is-near .rail__tee { transform: translateZ(70px) rotateY(0deg); }
.is-picked .rail__tee { transform: translateZ(150px) rotateY(0deg); }
.rail__tee:focus-visible { outline: 4px solid var(--accent); outline-offset: 4px; }
.rail__tee:active .tee { scale: .98; }
.rail--picked .rail__item:not(.is-picked) { opacity: .35; }

/* the hook over the bar */
.rail__hook { display: block; width: 44px; height: 40px; margin: 0 auto -4px; }
.rail__hook svg { display: block; width: 100%; height: 100%; overflow: visible; }
.rail__hook path { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }

/* the tee: a drawn shirt in the stock item's own colour with its print on the chest */
.tee { position: relative; display: block; width: 100%; aspect-ratio: 200 / 216; }
.tee svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tee__cloth { fill: var(--tee); stroke: var(--ink); stroke-width: 5; stroke-linejoin: round; }
.tee__neck { fill: rgb(0 0 0 / .32); stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.tee img { position: absolute; left: 30%; top: 23%; width: 40%; height: 46%; object-fit: contain; pointer-events: none; }

/* name and price: on the tee that faces you */
.rail__tag { display: grid; justify-items: center; gap: .1rem; margin-top: .6rem; font-size: var(--step-small); font-weight: 600; line-height: 1.2; opacity: 0; transition: opacity var(--t-ui) ease; }
.rail__tag strong { font-size: var(--step-body); font-weight: 600; background: var(--ink); color: var(--light); padding: .3rem .6rem .35rem; }
.rail__tag span { background: var(--accent); padding: .25rem .55rem .3rem; }
.rail__tag em { font-style: normal; background: var(--orange); padding: .2rem .5rem; }
.is-near .rail__tag, .is-picked .rail__tag { opacity: 1; }
.rail--picked .is-picked .rail__tag { opacity: 0; }

/* the details of the one you picked */
.rail__card { position: absolute; z-index: 3; right: var(--margin); bottom: 1.25rem; width: min(22rem, calc(100% - 2 * var(--margin))); background: var(--ink); color: var(--light); padding: 1.25rem; display: grid; gap: .4rem; cursor: auto; -webkit-user-select: text; user-select: text; }
.rail__card[hidden] { display: none; }
.rail__card :focus-visible { outline-color: var(--accent); }
.rail__name { font: 600 var(--step-lead)/1.2 var(--font); letter-spacing: -0.01em; }
.rail__price { font: 600 var(--step-head)/1 var(--font); color: var(--accent); }
.rail__row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.rail__shut { min-height: 52px; padding: 0 1.2rem; border: 0; border-radius: 999px; background: var(--brick); color: var(--light); font: 600 var(--step-body)/1 var(--font); cursor: pointer; transition: transform var(--t-press) var(--ease-out); }
.rail__shut:active { transform: scale(.96); }
.rail .btn:hover { background: var(--light); color: var(--ink); }

/* before the stock arrives, and when there is no JavaScript: one real photo and the words */
.rail__plain { height: 100%; display: flex; align-items: center; justify-content: center; gap: var(--margin); padding: 1rem var(--margin); }
.rail__plain img { height: 100%; width: auto; object-fit: cover; aspect-ratio: 3 / 4; }
.rail__plain p { font-size: var(--step-lead); font-weight: 500; line-height: 1.3; max-width: 22ch; }
.rail__none { height: 100%; display: grid; place-items: center; font-size: var(--step-lead); font-weight: 500; }

/* the real 3D tees (src/rail3d.js) are drawn on this canvas; the drawn ones and the flat bar step aside */
.rail__gl { position: absolute; left: 0; top: -70px; pointer-events: none; }
.rail--gl .tee svg, .rail--gl .tee img, .rail--gl .rail__hook svg, .rail--gl .rail__bar { visibility: hidden; }

/* reduced motion: every tee faces you and stays put */
.rail--still .rail__tee, .rail--still .is-near .rail__tee { transform: none; transition: none; }
.rail--still .is-picked .rail__tee { transform: translateZ(120px); }
.rail--still .rail__tag { opacity: 1; }
.rail--still .rail__item { transition: none; }

@media (max-width: 900px) {
  .hero--rail { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .hero--rail .hero__text h1 { font-size: clamp(2.5rem, 10.5vw, 5.5rem); }
  .hero--rail .mosaic { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; max-height: none; padding: 0 var(--margin) 1rem; }
  .hero--rail .tile--logo { grid-column: 1; width: min(70vw, 340px); }
  .rail { --h: 420px; perspective: 900px; order: 2; }   /* on a phone the rail comes straight after the words, the logo after it */
  .hero--rail .mosaic { order: 3; padding-top: 1.5rem; }
  .rail__card { left: var(--margin); right: var(--margin); width: auto; bottom: .75rem; padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .rail__tee, .rail__tag, .rail__item, .rail__shut { transition: none; }
}
