/* Prototype base: reset, review strip, rack geometry, list, language switch. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; overflow-x: clip; }
img { display: block; max-width: 100%; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure, pre { margin: 0; }
:focus-visible { outline: 2px solid var(--focus, #15171a); outline-offset: 3px; border-radius: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Review strip: not part of the design */
.review-strip { font: 500 12.5px/1.4 ui-sans-serif, system-ui, sans-serif; background: #15171a; color: #e8e8e8; padding: 8px 16px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.review-strip b { color: #fff; }
.appendix { font: 500 12.5px/1.4 ui-sans-serif, system-ui, sans-serif; background: #15171a; color: #ddd; text-align: center; padding: 10px 16px; margin: 0; }

/* ---------- the rack ---------- */
.rack[data-mode="list"] .rail, .rack[data-mode="list"] [data-rack-caption] { display: none; }
.rack[data-mode="rack"] .list { display: none; }

.rail {
  position: relative; width: 100vw; margin-left: calc(50% - 50vw);
  height: 430px; overflow: hidden; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.rail.is-dragging { cursor: grabbing; }
.rod { position: absolute; left: 0; right: 0; top: 27px; height: 4px; pointer-events: none; }
.track { position: absolute; top: 16px; left: 0; display: flex; align-items: flex-start; will-change: transform; }
.garment {
  --w: 212px; --h: 274px; --t: 22px; --slot: 112px;
  flex: 0 0 var(--slot); height: 400px; position: relative;
}
.garment.tier-selected { --w: 184px; --h: 236px; --slot: 100px; }
.garment.tier-experiment { --w: 146px; --h: 186px; --t: 18px; --slot: 82px; }
.hang { position: absolute; top: 0; left: 50%; width: var(--w); margin-left: calc(var(--w) / -2); display: block; text-decoration: none; transform-origin: 50% 8px; -webkit-user-drag: none; }
.hanger { display: block; width: 84%; margin: 0 auto -3px; overflow: visible; }
.hanger path { stroke: var(--hanger, currentColor); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.piece { position: relative; display: block; width: var(--w); height: var(--h); transform-style: preserve-3d; }
.face { position: absolute; display: block; }
.front { inset: 0; overflow: hidden; backface-visibility: hidden; transform: translateZ(calc(var(--t) / 2)); }
.front img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.type-cover { display: grid; place-items: center; height: 100%; padding: 14px; text-align: center; }
.side { top: 0; width: var(--t); height: 100%; overflow: hidden; writing-mode: vertical-rl; display: flex; align-items: center; justify-content: space-between; padding: 10px 0; white-space: nowrap; }
.side em { font-style: normal; }
.side-l { left: 0; transform-origin: left center; transform: translateZ(calc(var(--t) / -2)) rotateY(-90deg); }
.side-r { right: 0; transform-origin: right center; transform: translateZ(calc(var(--t) / -2)) rotateY(90deg); }
.tier-experiment .side em { display: none; }
.tier-experiment .side { justify-content: center; }
.tag { position: absolute; right: 12px; top: calc(100% - 10px); white-space: nowrap; opacity: 0; transition: opacity .3s; }
.garment.is-focus .tag, .hang:hover .tag, .hang:focus-visible .tag { opacity: 1; }

/* Phones and reduced motion get the list */
@media (max-width: 767px), (prefers-reduced-motion: reduce) {
  .rack .rail, .rack [data-rack-caption], .view-toggle { display: none !important; }
  .rack .list { display: block !important; }
}

/* Page bar + quiet language switch (rendered only when a Chinese version exists) */
.page-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; font-size: 13px; color: var(--soft); }
.lang-switch { display: inline-flex; gap: 6px; align-items: center; }
.lang-switch a { color: var(--soft); text-decoration: none; padding: 2px; }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a[aria-current="page"] { color: var(--ink); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }

.code { position: relative; }
.code pre { overflow-x: auto; }
.copy { position: absolute; top: 10px; right: 10px; cursor: pointer; }
