/* ---------- Awards shelf ----------
   Trophies are transparent cut-outs standing on the shelf's contact line.
   Geometry is taken from shelf-bg.webp (2560×1200 → 32:15, so the stage keeps
   that ratio and the background is stretched 100% 100%; every vertical value is
   a percentage of the stage height and therefore holds at any width.

   baseline 74.0%  (contact line, y=888 of 1200)
   lip      75.4%  (brightest front-lip hairline)
   rim      78.0%  (lower rim hairline)
   caption  81.0%  (top edge of the dark front panel)                       */

.awards__stage.shelf {
  --baseline: 74%;
  --lip: 75.4%;
  --rim: 78%;
  --cap-top: 81%;
  --pitch: 17.5cqw;

  position: relative;
  max-inline-size: 1280px;
  margin-inline: auto;
  aspect-ratio: 32 / 15;
  container-type: inline-size;
  isolation: isolate;
  overflow: hidden;
  border-radius: 26px;
  background-color: #0a0a0a;
  background-image: image-set(
    url("../img/awards/shelf-bg.webp") type("image/webp"),
    url("../img/awards/shelf-bg.jpg") type("image/jpeg")
  );
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.shelf__viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
}

.shelf__rail {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  display: flex;
  block-size: 100%;
  direction: ltr;
  cursor: grab;
  will-change: transform;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.shelf__rail[data-dragging="true"] {
  cursor: grabbing;
}

.shelf__item {
  position: relative;
  flex: 0 0 var(--pitch);
  block-size: 100%;
  margin: 0;
}

/* the box whose bottom edge is the contact line */
.shelf__trophy {
  position: absolute;
  left: 50%;
  bottom: calc(100% - var(--baseline));
  transform: translateX(-50%);
  block-size: calc(48% * var(--scale, 1));
  max-inline-size: 88%;
  inline-size: max-content;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.shelf__img {
  display: block;
  block-size: 100%;
  inline-size: auto;
  max-inline-size: 100%;
  filter: grayscale(1) sepia(0.12) brightness(calc(0.85 * var(--lit, 1))) contrast(1.06)
    drop-shadow(0 0 12px rgba(255, 186, 132, 0.08));
  transition: filter 0.35s ease-out, transform 0.35s ease-out;
}

/* under the pointer the award comes back in its own colours
   (not gated on `hover: hover`: touch laptops report hover:none and would never
   see it, and a stray :hover on touch simply never fires) */
.shelf__item:hover .shelf__img,
.shelf__item:focus-within .shelf__img {
  filter: grayscale(0) sepia(0) brightness(calc(1.03 * var(--lit, 1))) contrast(1.03)
    drop-shadow(0 0 18px rgba(255, 198, 142, 0.24));
  transform: translateY(-2px) scale(1.025);
}

.shelf__item:hover .shelf__cap,
.shelf__item:focus-within .shelf__cap {
  color: #fff;
}

.shelf__item:hover .shelf__shadow {
  opacity: 0.9;
}

/* ---- grounding: shadow (centred on the baseline) ---- */
.shelf__shadow {
  position: absolute;
  left: 50%;
  bottom: 0;
  inline-size: 118%;
  block-size: 1.42cqw;
  transform: translate(-50%, 50%);
  border-radius: 50%;
  background: radial-gradient(
    50% 50% at 50% 50%,
    rgba(0, 0, 0, 0.75) 0%,
    rgba(0, 0, 0, 0.5) 42%,
    rgba(0, 0, 0, 0) 72%
  );
  filter: blur(2px);
  pointer-events: none;
}

.shelf__shadow::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 50%;
  inline-size: 54%;
  block-size: 58%;
  transform: translate(-50%, 50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0));
}

/* ---- grounding: reflection, clipped to baseline → lip ---- */
.shelf__reflect {
  position: absolute;
  left: 50%;
  bottom: -0.66cqw;            /* baseline → lip, 8.4px at a 1280 stage */
  inline-size: 100%;
  block-size: 0.66cqw;
  transform: translateX(-50%) scaleY(-1);
  background-image: var(--src);
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: 100% auto;
  opacity: 0.28;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, #000 0, transparent 85%);
  mask-image: linear-gradient(to top, #000 0, transparent 85%);
}

/* ---- caption: on the dark front panel, never on the rim ---- */
.shelf__cap {
  position: absolute;
  top: var(--cap-top);
  left: 50%;
  transform: translateX(-50%);
  inline-size: calc(var(--pitch) - 1.4cqw);
  margin: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: max(14px, 1.2cqw);
  font-weight: 500;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0;
  text-shadow: none;
  direction: rtl;
  transition: color 0.35s ease-out;
}

/* ---- small screens ---- */
@media (max-width: 767px) {
  .awards__stage.shelf {
    --pitch: 45cqw;
    aspect-ratio: 4 / 3;
    background-size: auto 100%;
    background-position: center bottom;
  }

  .shelf__cap {
    font-size: 13px;
  }

  .shelf__img {
    filter: grayscale(1) sepia(0.12) brightness(calc(0.87 * var(--lit, 1))) contrast(1.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  .shelf__rail {
    will-change: auto;
  }
}
