.monolith-hand-cards{
  position: relative;
  width: min(980px, 92vw);
  height: calc(var(--mhc-card-h, 340px) + 24px);
  margin: 32px auto;
  perspective: 1200px;
  user-select: none;

  /* fan strength base */
  --mhc-x-step: 115px;
  --mhc-r-step: 6deg;

  /* card sizing (shortcode can override via inline style) */
  --mhc-card-w: 240px;
  --mhc-card-h: 340px;

  /* top/front scale (shortcode can override) */
  --mhc-top-scale: 1.06;
}

.monolith-hand-cards--fan-soft{
  --mhc-x-step: 95px;
  --mhc-r-step: 4deg;
}

.monolith-hand-cards--fan-strong{
  --mhc-x-step: 130px;
  --mhc-r-step: 8deg;
}

.monolith-hand-cards__card{
  position: absolute;
  left: 50%;
  top: 0;

  width: var(--mhc-card-w);
  height: var(--mhc-card-h);

  /* IMPORTANT:
     Use CSS variables for transform so theme-level transform rules are less likely to break it.
     Also add !important to win against hostile theme rules (e.g., button{transform:none!important}).
  */
  transform: translateX(-50%)
    translateX(var(--mhc-x, 0px))
    rotate(var(--mhc-r, 0deg))
    translateZ(var(--mhc-z, 0px))
    scale(var(--mhc-scale, 1)) !important;

  transform-origin: 50% 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 18px;
  transition: transform 220ms ease;
  box-shadow: 0 14px 34px rgba(0,0,0,.30);
}

.monolith-hand-cards__card:focus{
  outline: 2px solid rgba(255,255,255,.55);
  outline-offset: 3px;
}

.monolith-hand-cards__img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 18px;
}

@media (hover:hover){
  .monolith-hand-cards__card:hover{
    transform: translateX(-50%)
      translateX(var(--mhc-x, 0px))
      rotate(var(--mhc-r, 0deg))
      translateZ(var(--mhc-z, 0px))
      scale(calc(var(--mhc-scale, 1) * 1.03))
      translateY(-10px) !important;
  }
}

/* =========================================================
   Responsive: smartphone "peek" frame (300px max) + right fade
   - Wrapper is a fixed frame and clips overflow (no horizontal scroll)
   - Cards are arranged horizontally; next card peeks slightly
   - Inline style variables from shortcode are overridden on cards (important)
   - Right edge gets a subtle fade to imply continuation
   ========================================================= */
@media (max-width: 640px){
  .monolith-hand-cards{
    /* frame */
    width: min(300px, 92vw);
    margin: 18px auto;

    height: auto;
    perspective: none;

    display: flex;
    gap: 12px;

    /* swipe enabled */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;

    /* shadowが切れないように“枠内側に逃げ”を作る */
    padding: 14px 28px 14px 14px; /* 右だけ多め＝→の置き場も確保 */

    position: relative;

    /* hide scrollbar */
    scrollbar-width: none;
  }

  .monolith-hand-cards::-webkit-scrollbar{
    display: none;
  }

  .monolith-hand-cards__card{
    position: relative;
    left: auto;
    top: auto;

    flex: 0 0 auto;
    scroll-snap-align: start;

    /* 300px枠で2枚目チラ見せ想定 */
    --mhc-card-w: clamp(210px, 72vw, 248px) !important;
    --mhc-card-h: calc(var(--mhc-card-w) * 1.42) !important;

    width: var(--mhc-card-w);
    height: var(--mhc-card-h);

    transform: none !important;
    transition: none;

    -webkit-tap-highlight-color: rgba(0,0,0,0);
  }

  /* 右端の「→」インジケータ（スワイプ促し） */
  .monolith-hand-cards::after{
    content: "→";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);

    width: 28px;
    height: 28px;
    border-radius: 999px;

    display: grid;
    place-items: center;

    /* 背景は“影を濁らせない”透明系 */
    background: rgba(255,255,255,0.55);
    box-shadow: 0 8px 18px rgba(0,0,0,0.18);

    font-size: 18px;
    line-height: 1;

    pointer-events: none;
    user-select: none;
    opacity: 0.95;
  }
}


/* =========================================================
   Small tablets: keep fan but shrink steps and card sizes
   ========================================================= */
@media (min-width: 641px) and (max-width: 900px){
  .monolith-hand-cards{
    /* reduce fan step so it fits */
    --mhc-x-step: clamp(70px, 10vw, 105px);
    --mhc-r-step: clamp(3deg, 0.7vw, 6deg);

    --mhc-card-w: clamp(180px, 26vw, 240px);
    --mhc-card-h: clamp(260px, 38vw, 340px);
  }
}
