/* ==========================================================================
   Hangtime — full-screen overlays: the product viewer and the cart drawer.
   Both are real dialogs: focus is trapped, the page behind is made inert.
   ========================================================================== */

body.ht-view-open,
body.ht-cart-open,
body.ht-search-open {
  overflow: hidden;
}

/* --- Search layer --------------------------------------------------------- */

.ht-search {
  position: fixed;
  inset: 0;
  z-index: var(--ht-z-search);
  display: block;
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: hidden;
  background: var(--ht-wall);
  opacity: 0;

  /* Visibility is delayed on the way out so the fade is seen, and instant on
     the way in so the layer is rendered — and focusable — on the same frame
     the class lands. */
  transition: opacity var(--ht-dur) var(--ht-ease), visibility 0s linear var(--ht-dur);
}

body.ht-search-open .ht-search {
  visibility: visible;
  opacity: 1;
  transition: opacity var(--ht-dur) var(--ht-ease), visibility 0s;
}

.ht-search__bar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ht-wall);
  border-bottom: var(--ht-border);
}

.ht-search__bar-in {
  display: flex;
  gap: 18px;
  align-items: center;
  height: calc(var(--ht-header-h) + 8px);
}

.ht-search__back,
.ht-search__bag {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 -8px;
}

.ht-search__form {
  flex: 1;
  min-width: 0;
}

/* The field is the page's focus, so it is set at reading size and given no
   border of its own — the bar under it does that job. */
.ht-search__field {
  width: 100%;
  height: 40px;
  padding: 0;
  font-size: clamp(18px, 2.2vw, 26px);
  color: inherit;
  background: none;
  border: 0;
  outline: none;
  appearance: none;
}

.ht-search__field::placeholder {
  color: var(--ht-steel);
}

.ht-search__field::-webkit-search-cancel-button {
  appearance: none;
}

.ht-search__body {
  padding: clamp(28px, 4vw, 52px) var(--ht-gutter) 80px;
}

.ht-search__idle {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 4fr;
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}

.ht-search__heading {
  margin-bottom: 18px;
  font-family: var(--ht-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ht-steel);
  text-transform: uppercase;
}

.ht-search__popular ul {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.ht-search__popular a {
  font-size: 15px;
  text-decoration: none;
}

.ht-search__popular a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ht-search__tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: clamp(10px, 1.4vw, 20px);
}

.ht-search__tile {
  display: block;
  text-decoration: none;
}

.ht-search__tile-art {
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--ht-panel);
}

.ht-search__tile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ht-ease);
}

.ht-search__tile:hover .ht-search__tile-art img {
  transform: scale(1.04);
}

.ht-search__tile-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  font-family: var(--ht-mono);
  font-size: 11.5px;
  letter-spacing: var(--ht-ls-mono);
  text-transform: uppercase;
}

/* --- Live results --------------------------------------------------------- */

.ht-search__group + .ht-search__group {
  margin-top: clamp(26px, 3vw, 44px);
}

.ht-search__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.ht-search__links a {
  font-size: 15px;
  text-decoration: none;
}

.ht-search__links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ht-search__products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: clamp(14px, 2vw, 26px);
}

.ht-search__product {
  display: block;
  text-decoration: none;
}

.ht-search__product-art {
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--ht-panel);
}

.ht-search__product-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ht-search__product-name {
  display: block;
  padding-top: 10px;
  font-size: 14px;
}

.ht-search__product-price {
  display: block;
  font-family: var(--ht-mono);
  font-size: 12px;
  color: var(--ht-ink-2);
}

.ht-search__all {
  display: inline-block;
  margin-top: clamp(24px, 3vw, 40px);
  font-family: var(--ht-mono);
  font-size: 11.5px;
  letter-spacing: var(--ht-ls-mono);
  color: var(--ht-accent-text, var(--ht-accent));
  text-transform: uppercase;
  text-underline-offset: 3px;
}

.ht-search__empty {
  color: var(--ht-ink-2);
}

@media screen and (max-width: 860px) {
  .ht-search__idle {
    grid-template-columns: 1fr;
  }
}

/* --- Product viewer ------------------------------------------------------- */

.ht-view {
  position: fixed;
  inset: 0;
  z-index: var(--ht-z-view);
  display: grid;
  grid-template-columns: 1.25fr minmax(360px, 1fr);
  visibility: hidden;
  pointer-events: none;
}

body.ht-view-open .ht-view,
body.ht-view-closing .ht-view {
  visibility: visible;
}

body.ht-view-open .ht-view {
  pointer-events: auto;
}

/* The stage frosts the storefront rather than covering it, so the product
   still reads as being lifted off the same wall. */
.ht-view__stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: color-mix(in srgb, var(--ht-wall) 94%, transparent);
  opacity: 0;
  transition: opacity var(--ht-dur-slow) var(--ht-ease);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.ht-view-open .ht-view__stage {
  opacity: 1;
}

/* The length of rail the viewed garment hangs from. */
.ht-view__stage::before {
  content: "";
  position: absolute;
  top: 9vh;
  right: 12%;
  left: 12%;
  height: 6px;
  background: linear-gradient(#fbfbfc, #a3a6ac 55%, #d9dbde);
  border-radius: 3px;
  box-shadow: 0 6px 10px -6px rgb(0 0 0 / 35%);
}

.ht-view__img {
  position: absolute;
  top: calc(9vh + 2px);
  left: 50%;
  width: auto;
  /* Wide, flat-shot garments have to fit the stage as well as fill it. */
  max-width: 86%;
  height: min(78vh, 760px);
  object-fit: contain;
  object-position: top center;
  filter: drop-shadow(0 26px 26px rgb(20 22 30 / 16%));
  touch-action: pan-y;
  user-select: none;
  -webkit-user-drag: none;
  translate: -50%;
  transform-origin: 50% 0;
}

/* A product photographed on a model rather than cut out should be contained
   in the stage instead of hung from the rail line. */
.ht-view__img--cover {
  top: 50%;
  width: min(86%, 820px);
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  translate: -50% -50%;
}

/* Shown only when the stage image could not be loaded. */
.ht-view__fallback {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  font-family: var(--ht-mono);
  font-size: var(--ht-fs-mono);
  letter-spacing: var(--ht-ls-mono);
  color: var(--ht-ink-2);
  text-transform: uppercase;
  translate: -50% -50%;
}

.ht-view__stage:has(> [data-ht-failed]) .ht-view__fallback {
  display: block;
}

.ht-view__nav {
  position: absolute;
  right: 0;
  bottom: 26px;
  left: 0;
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: center;
}

.ht-view__nav button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: color-mix(in srgb, var(--ht-tag) 70%, transparent);
  border: var(--ht-border);
  border-radius: 50%;
  transition: border-color var(--ht-dur-fast), background var(--ht-dur-fast);
}

.ht-view__nav button:hover {
  background: var(--ht-tag);
  border-color: var(--ht-ink);
}

.ht-view__count {
  min-width: 64px;
  font-family: var(--ht-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.ht-view__panel {
  position: relative;
  padding: clamp(64px, 9vh, 96px) clamp(24px, 3.4vw, 56px) 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--ht-tag);
  border-left: var(--ht-border);
  transition: transform var(--ht-dur-panel) var(--ht-ease);
  transform: translateX(100%);
}

body.ht-view-open .ht-view__panel {
  transform: none;
}

.ht-view__close {
  position: absolute;
  top: 20px;
  right: 22px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-family: var(--ht-mono);
  font-size: var(--ht-fs-mono);
  font-weight: 500;
  letter-spacing: var(--ht-ls-mono);
  text-transform: uppercase;
}

.ht-view__kind {
  color: var(--ht-ink-2);
}

/* The display face is set very large, which a short drop name carries and a
   long catalogue title does not. `--ht-title-scale` steps it down by title
   length so a four-line heading does not swallow the panel, and the wrap
   rules stop an unbroken word running past the edge. */
.ht-view__name {
  margin: 14px 0 12px;
  font-family: var(--ht-display);
  font-size: calc(var(--ht-fs-display) * var(--ht-title-scale, 1));
  font-weight: var(--ht-display-weight, 800);
  line-height: 0.86;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  overflow-wrap: break-word;
  hyphens: auto;
}

.ht-view__name a {
  text-decoration: none;
}

.ht-view__price {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-family: var(--ht-mono);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}

.ht-view__price s {
  font-size: 15px;
  color: var(--ht-steel);
}

.ht-view__price .ht-view__save {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ht-warn);
  text-transform: uppercase;
}

.ht-view__meta {
  max-width: 40ch;
  margin-top: 18px;
  color: var(--ht-ink-2);
}

.ht-view__meta p + p {
  margin-top: 0.75em;
}

.ht-view .ht-btn {
  width: 100%;
  margin-top: 14px;
}

.ht-view__details {
  margin-top: 30px;
}

.ht-view__status {
  margin-top: 10px;
  font-family: var(--ht-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ht-warn);
}

.ht-view__status:empty {
  margin-top: 0;
}

.ht-view__pagelink {
  display: inline-block;
  margin-top: 20px;
  font-family: var(--ht-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ht-accent-text, var(--ht-accent));
  text-transform: uppercase;
  text-underline-offset: 3px;
}

/* --- Option selectors ----------------------------------------------------- */

.ht-options {
  margin-top: 30px;
}

.ht-option + .ht-option {
  margin-top: 22px;
}

.ht-option__head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ht-option__name {
  font-family: var(--ht-mono);
  font-size: var(--ht-fs-mono);
  font-weight: 500;
  letter-spacing: var(--ht-ls-mono);
  text-transform: uppercase;
}

.ht-option__note {
  font-size: 13px;
  color: var(--ht-ink-2);
}

.ht-option__values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 6px;
  padding: 0;
  margin: 0;
  border: 0;
}

/* A short, even list of values (sizes) sits on one tidy row. */
.ht-option__values[data-count="6"],
.ht-option__values[data-count="5"],
.ht-option__values[data-count="4"],
.ht-option__values[data-count="3"],
.ht-option__values[data-count="2"] {
  grid-template-columns: repeat(var(--ht-opt-count, 6), 1fr);
}

.ht-option__value {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  min-height: var(--ht-option-h);
  padding: 6px 4px;
  font-family: var(--ht-mono);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  background: #fff;
  border: var(--ht-border);
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s;
}

.ht-option__value small {
  font-family: var(--ht-mono);
  font-size: 9.5px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--ht-ink-2);
}

.ht-option__value small.is-low {
  color: var(--ht-warn);
}

.ht-option__value:hover {
  border-color: var(--ht-ink);
}

.ht-option__value[aria-pressed="true"] {
  color: #fff;
  background: var(--ht-ink);
  border-color: var(--ht-ink);
}

.ht-option__value[aria-pressed="true"] small {
  color: rgb(255 255 255 / 70%);
}

.ht-option__value:disabled {
  color: var(--ht-steel);
  cursor: default;
  background: none;
  border-style: dashed;
}

.ht-option__value:disabled > span:first-child {
  text-decoration: line-through;
}

/* Colour and pattern values read better as swatches than as words. */
.ht-option__value--swatch {
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
}

/* Swatches sit together at the start of the row. A grid would space them
   across the full width, which reads as a gap rather than a set. */
.ht-option__values--swatch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ht-option__values--swatch .ht-option__value {
  flex: none;
  width: 34px;
  height: 34px;
}

.ht-option__swatch {
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: cover;
}

.ht-option__value[aria-pressed="true"].ht-option__value--swatch {
  box-shadow: 0 0 0 2px var(--ht-tag), 0 0 0 3px var(--ht-ink);
}

/* A product with many values per option gets a select instead of a wall of
   buttons; this is also what shows for high-variant products. */
.ht-option__select {
  width: 100%;
  height: var(--ht-control-h);
  padding: 0 14px;
  font-family: var(--ht-mono);
  font-size: 13px;
  background: #fff;
  border: var(--ht-border);
  border-radius: 0;
}

.ht-qty {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.ht-qty__label {
  font-family: var(--ht-mono);
  font-size: var(--ht-fs-mono);
  letter-spacing: var(--ht-ls-mono);
  text-transform: uppercase;
}

.ht-qty__control {
  display: inline-flex;
  align-items: center;
  border: var(--ht-border);
}

.ht-qty__control button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  font-size: 15px;
  line-height: 1;
}

.ht-qty__control input {
  width: 44px;
  height: 36px;
  font-family: var(--ht-mono);
  font-size: 13px;
  text-align: center;
  background: none;
  border: 0;
  border-right: var(--ht-border);
  border-left: var(--ht-border);
  -moz-appearance: textfield;
  appearance: textfield;
}

.ht-qty__control input::-webkit-outer-spin-button,
.ht-qty__control input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

/* --- Cart drawer ---------------------------------------------------------- */

.ht-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--ht-z-scrim);
  visibility: hidden;
  background: rgb(20 21 26 / 32%);
  opacity: 0;
  transition: opacity var(--ht-dur), visibility 0s linear var(--ht-dur);
}

body.ht-cart-open .ht-scrim {
  visibility: visible;
  opacity: 1;
  transition: opacity var(--ht-dur), visibility 0s;
}

.ht-cart {
  position: fixed;
  top: 0;
  right: 0;
  z-index: var(--ht-z-drawer);
  display: flex;
  flex-direction: column;
  width: min(420px, 100vw);
  height: 100dvh;
  visibility: hidden;
  background: var(--ht-tag);
  box-shadow: var(--ht-shadow-drawer);
  transition: transform var(--ht-dur-slow) var(--ht-ease), visibility 0s linear var(--ht-dur-slow);
  transform: translateX(100%);
}

body.ht-cart-open .ht-cart {
  visibility: visible;
  transform: none;
  transition: transform var(--ht-dur-slow) var(--ht-ease), visibility 0s;
}

.ht-cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: var(--ht-border);
}

.ht-cart__head h2 {
  font-family: var(--ht-display);
  font-size: 30px;
  font-weight: var(--ht-display-weight, 800);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Both overlay close controls are small type, so the pressable area is made
   by padding rather than by the glyph, and pulled back with a margin so the
   composition is unchanged. */
.ht-cart__close,
.ht-view__close {
  padding: 13px 12px;
  margin: -13px -12px;
}

.ht-cart__close {
  font-family: var(--ht-mono);
  font-size: var(--ht-fs-mono);
  font-weight: 500;
  letter-spacing: var(--ht-ls-mono);
  text-transform: uppercase;
}

.ht-cart__progress {
  padding: 16px 24px;
  border-bottom: var(--ht-border);
}

.ht-cart__progress p {
  margin-bottom: 9px;
  font-size: 13px;
  color: var(--ht-ink-2);
}

.ht-bar {
  height: 3px;
  overflow: hidden;
  background: var(--ht-panel);
}

.ht-bar > i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ht-accent);
  transition: width var(--ht-dur-slow) var(--ht-ease);
}

.ht-cart__items {
  flex: 1;
  padding: 4px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ht-line {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 14px;
  padding: 16px 0;
  border-bottom: var(--ht-border);
}

.ht-line.is-busy {
  opacity: 0.5;
}

.ht-line__thumb {
  display: grid;
  place-items: center;
  width: 62px;
  height: 76px;
  overflow: hidden;
  background: var(--ht-panel);
}

.ht-line__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A cut-out garment has to be seen whole; cropping it to the thumb leaves a
   square of sleeve. */
.ht-line__thumb--cutout img {
  padding: 4px;
  object-fit: contain;
}

.ht-line__title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.ht-line__title:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ht-line__opts {
  display: block;
  font-size: 12.5px;
  color: var(--ht-ink-2);
}

.ht-line__qty {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.ht-line__qty button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 14px;
  line-height: 1;
  border: var(--ht-border);
}

.ht-line__qty button:hover:not(:disabled) {
  border-color: var(--ht-ink);
}

.ht-line__qty button:disabled {
  color: var(--ht-steel);
  cursor: default;
}

.ht-line__qty em {
  min-width: 14px;
  font-family: var(--ht-mono);
  font-size: 13px;
  font-weight: 500;
  font-style: normal;
  line-height: 1;
  text-align: center;
}

.ht-line__right {
  text-align: right;
}

.ht-line__right b {
  font-family: var(--ht-mono);
  font-size: 13px;
  font-weight: 500;
}

.ht-line__right s {
  display: block;
  font-family: var(--ht-mono);
  font-size: 11px;
  color: var(--ht-steel);
}

.ht-line__discount {
  display: block;
  margin-top: 4px;
  font-family: var(--ht-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ht-ok);
  text-transform: uppercase;
}

.ht-line__remove {
  display: block;
  margin: 10px 0 0 auto;
  font-size: 12px;
  color: var(--ht-ink-2);
}

.ht-line__remove:hover {
  color: var(--ht-ink);
}

.ht-line__error {
  grid-column: 1 / -1;
  margin-top: 8px;
  font-family: var(--ht-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ht-warn);
}

.ht-cart__empty {
  padding: 56px 0;
  color: var(--ht-ink-2);
  text-align: center;
}

.ht-cart__empty p {
  margin-bottom: 16px;
}

.ht-cart__foot {
  padding: 18px 24px calc(20px + env(safe-area-inset-bottom));
  border-top: var(--ht-border);
}

.ht-cart__total {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.ht-cart__total span:last-child {
  font-family: var(--ht-mono);
  font-weight: 500;
}

.ht-cart__discounts {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  font-family: var(--ht-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ht-ok);
  text-transform: uppercase;
}

.ht-cart__note {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ht-ink-2);
}

.ht-cart__foot .ht-btn {
  width: 100%;
  margin-top: 14px;
}

.ht-cart__error {
  margin-top: 10px;
  font-family: var(--ht-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ht-warn);
}

.ht-cart.is-busy .ht-cart__items {
  pointer-events: none;
}

/* --- Overlay responsive --------------------------------------------------- */

@media screen and (max-width: 1100px) {
  .ht-view {
    grid-template-columns: 1fr minmax(340px, 1fr);
  }
}

@media screen and (max-width: 760px) {
  .ht-view {
    grid-template-rows: 52svh 1fr;
    grid-template-columns: 1fr;
  }

  .ht-view__panel {
    padding-top: 28px;
    border-left: 0;
    transform: translateY(100%);
  }

  .ht-view__close {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: 14px;
    z-index: 2;

    /* The negative margins that widen the tap target elsewhere would be
       added to this corner inset, so they go here. The padding keeps the
       target the same size. */
    padding: 11px 14px;
    margin: 0;
    background: var(--ht-tag);
  }

  .ht-view__stage::before {
    top: 4svh;
    right: 6%;
    left: 6%;
  }

  .ht-view__img {
    top: calc(4svh + 4px);
    max-width: 92%;
    height: 44svh;
  }

  .ht-view__img--cover {
    top: 50%;
    height: auto;
    max-height: 44svh;
  }

  .ht-view__nav {
    bottom: 14px;
  }

  .ht-option__values[data-count="6"],
  .ht-option__values[data-count="5"],
  .ht-option__values[data-count="4"] {
    grid-template-columns: repeat(3, 1fr);
  }

  .ht-cart {
    width: 100vw;
  }
}
