/* ==========================================================================
   MUHCINE / shop
   Draggable print wall with a detail panel.
   Adapted from github.com/joffreysp/draggable-grid (MIT).
   ========================================================================== */

body.shop {
  overflow: hidden;
}

.line,
.char {
  transform: translate3d(0, 110%, 0);
}

.shop-stage {
  position: fixed;
  inset: 0;
  transform-origin: center center;
  will-change: transform;
  direction: ltr; /* the wall keeps its order in every language */
}

.shop-stage.is-loaded {
  overflow: hidden;
}

.shop-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: max-content;
  height: max-content;
  display: flex;
  gap: 5vw;
}

.shop-stage.is-loaded .shop-grid {
  cursor: grab;
}

/* The wall takes the drag itself, in any direction, rather than the browser
   reading it as a scroll and stealing it. */
.shop-grid {
  touch-action: none;
}

.shop-grid.is-dragging {
  cursor: grabbing;
}

.shop-col {
  display: flex;
  flex-direction: column;
  gap: 5vw;
}

.shop-col:nth-child(even) {
  margin-top: 10vw;
}

/* Every print keeps its own proportions, on the wall and in the panel. */
.print {
  position: relative;
  width: var(--print-size, 17vw);
  line-height: 0;
}

.print > div {
  width: var(--print-size, 17vw);
  cursor: pointer;
}

.print img {
  width: 100%;
  height: auto;
  display: block;
  will-change: transform;
  transition: transform 0.4s var(--ease);
  -webkit-user-drag: none;
}

.print img:hover {
  transform: scale(1.03);
}

@media (max-width: 700px) {
  .print,
  .print > div {
    width: 42vw;
  }
}

/* --- detail panel --------------------------------------------------------- */

.details {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  width: 50vw;
  height: 100vh;
  padding: calc(var(--chrome-h) + 3vw) 4vw 3vw;
  background: var(--panel);
  border-inline-start: 1px solid var(--line);
  transform: translate3d(50vw, 0, 0);
  z-index: 6;
  overflow-y: auto;
}

html[dir="rtl"] .details {
  transform: translate3d(-50vw, 0, 0);
}

/* A close button that is always there. The cross that follows the pointer
   only exists where there is a pointer, which is not a phone. */
.details__close {
  position: absolute;
  top: calc(var(--chrome-h) + 12px);
  inset-inline-end: 4vw;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  z-index: 9;
  background: var(--panel);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), color 0.3s var(--ease);
}

.details__close:hover {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.details__title {
  display: grid;
  margin-bottom: 3vw;
  padding-inline-end: 46px;
}

.details__title p {
  grid-area: 1 / -1;
  overflow: hidden;
  font-size: clamp(22px, 2.6vw, 44px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.details__body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 2vw;
}

.details__thumb {
  position: relative;
  width: 20vw;
  z-index: 3;
  will-change: transform;
  line-height: 0;
}

.details__thumb div {
  width: 100%;
}

.details__thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.details__texts {
  position: relative;
  display: grid;
  max-width: 20rem;
  flex: 1 1 220px;
}

/* The descriptions share one grid cell. Without this the last one in the
   stack swallows every click and Enquiry never answers. */
.details__texts [data-text] {
  grid-area: 1 / -1;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

.details__texts [data-text].is-live {
  visibility: visible;
  pointer-events: auto;
}

.details__title p {
  visibility: hidden;
}

.details__title p.is-live {
  visibility: visible;
}

.details__price {
  display: block;
  font-size: 18px;
  margin-bottom: 14px;
}

.spec {
  display: flex;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.spec b {
  font-weight: 500;
  color: var(--fg);
  margin-inline-start: auto;
  text-align: end;
}

html[dir="rtl"] .spec {
  letter-spacing: 0;
}

/* --- sizes ---------------------------------------------------------------- */

.sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0 4px;
}

.size {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease), background 0.3s var(--ease);
}

html[dir="rtl"] .size {
  letter-spacing: 0;
}

.size:hover {
  border-color: var(--fg);
  color: var(--fg);
}

.size[aria-pressed="true"] {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.details__cta {
  display: inline-block;
  margin-top: 22px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  padding: 9px 22px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}

.details__cta:hover {
  background: var(--fg);
  color: var(--bg);
}

.details.is-showing {
  opacity: 1;
}

.shop-stage.is-details-showing {
  cursor: pointer;
}

.shop-stage.is-details-showing .shop-grid {
  pointer-events: none;
}

@media (max-width: 700px) {
  /* On a phone the panel is the screen. Full width, its own scroll, room at
     the foot for the bar. */
  .details {
    width: 100vw;
    transform: translate3d(100vw, 0, 0);
    padding: calc(var(--chrome-h) + 18px) 7vw calc(var(--bar-h) + 28px);
    border-inline-start: 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  html[dir="rtl"] .details {
    transform: translate3d(-100vw, 0, 0);
  }

  .details__title {
    margin-bottom: 22px;
  }

  .details__body {
    gap: 22px;
  }

  .details__thumb {
    width: 62vw;
  }

  .details__texts {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .details__close {
    inset-inline-end: 7vw;
  }

  .size {
    padding: 9px 15px;
    font-size: 11px;
  }

  .details__cta {
    padding: 12px 26px;
    font-size: 11px;
  }
}

/* Without a pointer there is nothing to hang a following cross on. */
@media (hover: none), (pointer: coarse) {
  .cross {
    display: none;
  }
}

/* --- close cursor --------------------------------------------------------- */

.details.is-showing:hover ~ .cross {
  opacity: 0;
}

.cross {
  position: fixed;
  top: 0;
  left: 0;
  width: 34px;
  height: 34px;
  z-index: 8;
  pointer-events: none;
  transform: scale(0);
  color: var(--fg);
}

.cross svg {
  width: 34px;
  height: 34px;
}
