/* MERARY Premium B v3 · mobile fix. Loaded after premium-b2.css and premium-b3-gallery.css.
 * Phones/tablet-portrait only: every rule below sits inside a max-width query, desktop is untouched.
 * Three problems, three causes (measured with Playwright, see HANDOFF.md):
 *   A. hero  — 16:9 film in a portrait box with object-fit: cover shows only ~29% of the frame width;
 *   B. stage — cut-outs were sized with % max-height inside auto-height grid rows (cyclic % → ignored), so a hatbox
 *              collapsed to 187px and the portrait bouquet grew to 375px and overflowed 214px above its box;
 *              the info panel changed height 266→414px per slide; scrollIntoView() on the thumbnail rail scrolled the page;
 *   C. arcade — pair niches are ~155–170px wide, the full desktop plaque (name, 2-line text, price, button) did not fit. */

/* ====================== A. Hero: the whole frame, uncropped from the sides ====================== */
@media (max-width: 640px) {
  .v2-hero { height: auto; min-height: 0; max-height: none; background: var(--night); padding-top: 58px; display: flex; flex-direction: column; }
  .v2-hero::after { display: none; }
  /* 4:3 window onto the 16:9 film: 12.5% off each side, nothing stretched. Both bouquets sit inside the middle 75%. */
  .v2-hero__media { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #0d0508; }
  .v2-hero__media > * { object-position: 50% 50%; }
  .v2-hero__media::after {
    content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background:
      linear-gradient(0deg, var(--night) 0%, rgba(23, 10, 16, .55) 14%, rgba(23, 10, 16, 0) 34%),
      linear-gradient(180deg, rgba(23, 10, 16, .5) 0%, rgba(23, 10, 16, 0) 14%);
  }
  /* text lives below the picture, never over the bouquets */
  .v2-hero__copy { position: relative; left: auto; right: auto; bottom: auto; width: auto; padding: 0 var(--gut) 40px; }
  .v2-hero h1 { font-size: clamp(36px, 10.6vw, 46px); }
  /* film control sits on the picture's bottom-right edge, on the dark fade */
  .v2-hero__side { top: calc(58px + 75vw - 46px); bottom: auto; right: var(--gut); }
  .v2-film { padding: 8px 0; }
  .v2-film__label { text-shadow: 0 1px 6px rgba(0, 0, 0, .8); color: var(--champ); }
}

/* ====================== B. Stage: one stable viewing window ====================== */
@media (max-width: 860px) {
  /* one window for all nine; ~12% smaller than before (479px at 393) */
  .v2-show__pieces { height: clamp(340px, 104vw, 460px); min-height: 0; }
  .v2-show { touch-action: pan-y; }
  .v2-piece--arch .v2-arch { height: 88%; outline-offset: 8px; }

  /* cut-outs (hatboxes, bouquet without background) stand inside the same arch niche as the photographs */
  .v2-piece--niche .v2-arch {
    box-shadow: inset 0 0 0 1px rgba(244, 233, 227, .14), 0 60px 90px -40px rgba(0, 0, 0, .85), 0 0 140px -30px color-mix(in srgb, var(--glow) 90%, #fff 10%);
    background: radial-gradient(70% 55% at 50% 38%, color-mix(in srgb, var(--glow) 82%, #fff 6%) 0%, #14080d 80%);
  }
  .v2-piece--niche .v2-arch img {
    object-fit: contain; object-position: 50% 100%;
    padding: 16% 4% 4%;
    filter: drop-shadow(0 18px 16px rgba(0, 0, 0, .6));
  }
  .v2-piece--niche .v2-arch.is-box img { padding: 14% 0 3%; }

  /* info panel: height is reserved by JS (tallest composition); price and buttons are pinned to the bottom */
  .v2-info { display: flex; flex-direction: column; }
  .v2-info__tag { align-self: flex-start; }
  .v2-info__name { font-size: 34px; }
  .v2-info__price { margin: auto 0 var(--s2); padding-top: var(--s3); }
}

/* ====================== C. Arcade: compact plaque for the pair niches ====================== */
@media (max-width: 760px) {
  .v3-bay.is-compact .v3-plaque { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: none; padding-top: 28px; text-align: center; }
  .v3-plaque--compact h3 { font-size: 17px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  /* price/mark + button are pinned to the bottom, so the two buttons of a pair always line up */
  .v3-plaque--compact .v3-plaque__buy { margin-top: auto; width: 100%; flex-direction: column; align-items: stretch; gap: 10px; }
  .v3-plaque--compact .v3-price { font-size: 19px; line-height: 24px; height: 24px; }
  .v3-demo { align-self: center; height: 24px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 12px; color: var(--champ); }
  .v3-plaque--compact .v2-btn { width: 100%; min-height: 44px; padding: 0 8px; font-size: 13px; }
}

/* ====================== D. Close-up view on phones: one screen, close button never scrolls away ====================== */
@media (max-width: 760px) {
  .v3-view__room {
    --view-arch-h: min(44svh, 420px);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    gap: 14px; padding: 64px var(--gut) 20px; overflow-y: auto;
  }
  .v3-view__piece { flex: none; width: 100%; }
  .v3-view__arch { height: var(--view-arch-h); width: auto; max-width: 100%; aspect-ratio: 4 / 5; outline-offset: 10px; }
  .v3-view__info { width: 100%; text-align: left; }
  .v3-view__count, .v3-view__meta { display: none; }
  .v3-view__name { font-size: clamp(28px, 8.2vw, 34px); line-height: 1.08; }
  .v3-view__comp { margin: 8px 0 0; font-size: 15px; }
  .v3-view__price { margin: 14px 0 12px; font-size: 28px; }
  .v3-view__actions { flex-wrap: nowrap; gap: 14px; }
  .v3-view__actions .v2-btn { flex: 1 1 auto; min-width: 0; padding: 0 16px; }
  .v3-view__actions .v2-link { flex: none; }
  /* previous / next sit beside the arch instead of taking a row of their own */
  .v3-view__nav { position: absolute; left: 8px; right: 8px; top: calc(64px + var(--view-arch-h) / 2 - 22px); margin: 0; justify-content: space-between; pointer-events: none; z-index: 2; }
  .v3-view__nav .v2-arrow { pointer-events: auto; width: 44px; height: 44px; background: rgba(23, 10, 16, .6); }
  /* was absolute inside the scrolling room: it left the screen as soon as the room scrolled */
  .v3-view__close { position: fixed; top: 10px; right: 12px; z-index: 5; width: 44px; height: 44px; background: rgba(23, 10, 16, .8); }
}
