/* MERARY Premium — final candidate. Loaded last. Desktop (≥861px) is unchanged except the font fallback below.
 *  1. Fonts   — the 23px jump: «max-width: 34ch» depends on the glyph «0» from Montserrat's LATIN file, while the Russian
 *               text uses the CYRILLIC file; Google Fonts delivers them separately. Whichever came first, the paragraph
 *               briefly wrapped to 5 (or 3) lines. Fix: measure in em, a fallback with Montserrat's widths,
 *               and a 4/3-line floor for system fallbacks we cannot measure here (Android Roboto).
 *  2. Stage   — phones/tablets: smaller window, arrows beside the arch, product panel = name · text · price + button.
 *  3. Arcade  — cut-outs lit where they stand, boxes as wide as the niche, the grand phone niche less dominant.
 *  4. Tablet  — 641–860px uses the phone logic for the film (3:2 window, title inside, text + buttons below) and arcade. */

/* ====================== 1. Fonts ====================== */
@font-face {
  font-family: 'MR Montserrat Fallback';
  src: local('Arial'), local('ArialMT'), local('Helvetica Neue'), local('Helvetica');
  font-weight: 100 499; size-adjust: 112.6%;
}
@font-face {
  font-family: 'MR Montserrat Fallback';
  src: local('Arial Bold'), local('Arial-BoldMT'), local('Helvetica Neue Bold'), local('Helvetica Bold');
  font-weight: 500 900; size-adjust: 107.8%;
}
:root { --ui: 'Montserrat', 'MR Montserrat Fallback', system-ui, sans-serif; }

@media (min-width: 861px) { .v2-hero__copy p { max-width: 29.1em; } }   /* = 44ch of Montserrat, without the font dependency */
@media (max-width: 640px) { .v2-hero__copy p { max-width: 22.5em; min-height: calc(4 * 1.6em); } }  /* = 34ch; 4 lines at 358–640px */

/* ====================== 4. Tablet 641–860: phone logic for the film ====================== */
@media (min-width: 641px) and (max-width: 860px) {
  .v2-hero { height: auto; min-height: 0; max-height: none; background: var(--night); padding-top: 72px; display: flex; flex-direction: column; }
  .v2-hero::after { display: none; }
  /* 3:2 window onto the 16:9 film: 8% off each side */
  .v2-hero__media { position: relative; width: 100%; aspect-ratio: 3 / 2; 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%);
  }
  .v2-hero__copy { position: static; display: block; width: auto; max-width: none; margin: 0; padding: 4px var(--gut) 48px; text-align: center; pointer-events: auto; }
  .v2-hero__copy > * { opacity: 1; transform: none; filter: none; }
  .v2-hero__actions { visibility: visible; justify-content: center; }
  .v2-hero__copy p { font-size: 16px; margin: 8px auto 24px; max-width: 29em; min-height: calc(3 * 1.6em); }
  .v2-hero h1 {
    position: absolute; z-index: 3; left: var(--gut); right: var(--gut); top: 72px; height: 66.667vw; margin: 0;
    display: flex; align-items: center; justify-content: center; text-align: center;
    font-size: clamp(44px, 7.4vw, 60px); line-height: 1.02; pointer-events: none;
    opacity: 0; transform: translateY(14px); filter: blur(6px);
    transition: opacity .38s var(--vf-out), transform .38s var(--vf-out), filter .38s var(--vf-out);
  }
  .v2-hero[data-phase="final"] h1 { opacity: 1; transform: none; filter: none; transition: opacity 1s var(--vf-in), transform 1.1s var(--vf-in), filter 1s var(--vf-in); }
  .v2-hero__side { top: calc(72px + 66.667vw - 50px); 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); }
  .vf-quick { display: none; }
}

/* ====================== 2. Stage on phones and tablets ====================== */
@media (max-width: 860px) {
  .v2-stage { --win-h: clamp(300px, 92vw, 400px); padding-bottom: var(--s5); }
  .v2-stage__grid { margin-top: var(--s3); gap: 14px; }
  .v2-show__pieces { height: var(--win-h); }
  .v2-piece--arch .v2-arch { height: 92%; }
  /* arrows beside the arch instead of a row under it */
  .v2-show__nav { position: absolute; left: 0; right: 0; top: calc(var(--win-h) / 2 - 22px); margin: 0; justify-content: space-between; pointer-events: none; z-index: 3; }
  .v2-show__nav .v2-arrow { pointer-events: auto; width: 44px; height: 44px; background: rgba(23, 10, 16, .55); }
  .v2-show__count { display: none; }
  /* cut-outs: the light falls where the object stands, not on the empty top of the niche */
  .v2-piece--niche .v2-arch { background: radial-gradient(74% 46% at 50% 68%, color-mix(in srgb, var(--glow) 85%, #fff 8%) 0%, #14080d 82%); }
  .v2-piece--niche .v2-arch.is-box img { padding: 26% 0 3%; }

  /* product panel: name and text, then price and the button on one line, directly under them */
  .v2-info {
    display: grid; grid-template-columns: auto 1fr auto; column-gap: 14px; align-items: center; align-content: start;
    grid-template-areas: "count tag more" "name name name" "comp comp comp" "price act act";
  }
  .v2-info__count { display: block; grid-area: count; margin: 0; font-size: 12.5px; }
  .v2-info__tag { grid-area: tag; justify-self: start; margin: 0; }
  .v2-info__name { grid-area: name; margin-top: 10px; font-size: clamp(28px, 8vw, 34px); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .v2-info__comp { grid-area: comp; margin: 8px 0 0; max-width: none; font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .v2-info__meta { display: none; }
  .v2-info__price { grid-area: price; margin: 18px 0 0; padding: 0; font-size: 26px; white-space: nowrap; }
  .v2-info__actions { display: contents; }
  .v2-info__actions > .v2-btn { grid-area: act; margin: 18px 0 0; width: 100%; min-height: 48px; padding: 0 16px; }
  .v2-info__actions > .v2-link { grid-area: more; justify-self: end; margin: 0; font-size: 13px; }
  /* demo looks: no price to show, the florist button takes the full line */
  .v2-info:has(.v2-info__tag:not([hidden])) { grid-template-areas: "count tag more" "name name name" "comp comp comp" "price price price" "act act act"; }
  .v2-info:has(.v2-info__tag:not([hidden])) .v2-info__price { font-family: var(--ui); font-size: 14px; color: var(--mist); margin-top: 14px; }
  .v2-info:has(.v2-info__tag:not([hidden])) .v2-info__actions > .v2-btn { margin-top: 10px; }
  .v2-thumbs { margin-top: var(--s3); }
  .v2-thumbs button { width: 52px; }
}
@media (max-width: 400px) { .v2-show__nav .v2-arrow { width: 40px; height: 40px; } }
/* tablet: arch and panel side by side, the whole show fits the screen */
@media (min-width: 641px) and (max-width: 860px) {
  .v2-stage { --win-h: min(46vw, 400px); }   /* arch narrow enough for the arrows to stand beside it (≥46px each side) */
  .v2-stage__grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; gap: 28px; }
  .v2-show__nav .v2-arrow { width: 40px; height: 40px; }
}

/* ====================== 3. Arcade on phones and tablets ====================== */
@media (max-width: 860px) {
  /* the single grand niche no longer dwarfs the pairs (1.5× instead of 1.9× a pair niche) */
  .v3-row--1:has(.is-grand) { padding: 0 13%; }
  /* cut-outs stand lit on the ledge; boxes use the full niche width */
  .v3-bay.is-cut .v3-niche__arch { background: radial-gradient(76% 48% at 50% 68%, color-mix(in srgb, var(--glow) 85%, #fff 8%) 0%, #14080d 82%); }
  .v3-bay.is-box .v3-niche__arch img { padding: 30% 0 2%; }
}
@media (min-width: 641px) and (max-width: 860px) {
  .v3-row--1:has(.is-grand) { padding: 0 20%; }
  .v3-plaque--compact h3 { font-size: 20px; }
  .v3-plaque--compact .v3-price { font-size: 21px; }
  .v3-bay.is-grand .v3-plaque h3 { font-size: 28px; }
  .v3-plaque__comp { font-size: 13.5px; }
}

/* ====================== 5. Desktop stage: cut-outs stay inside the show window ======================
 * Same root cause as on phones in B v3: «max-height: 74%» inside auto-height grid rows is a cyclic percentage and is
 * ignored, so at 1440 the bouquet without background rose 414px above the window (over «Коллекция») and its reflection
 * fell below it; the hatboxes sat 49px too high. Explicit rows give the percentages something to resolve against.
 * Photographed compositions are untouched. */
@media (min-width: 861px) {
  .v2-piece--cut { grid-template-rows: minmax(0, 80%) minmax(0, 14%); align-content: center; }
  .v2-piece--cut img { width: min(100%, 780px); height: 100%; max-width: none; max-height: none; object-fit: contain; object-position: 50% 100%; }
  /* reflection: same box as the object, flipped about its base, fading out within ~90px */
  .v2-piece--cut .v2-piece__mirror {
    align-self: start; height: calc(100% * 80 / 14); max-height: none; object-fit: contain; object-position: 50% 100%;
    -webkit-mask-image: linear-gradient(0deg, rgba(0, 0, 0, .9), transparent 18%); mask-image: linear-gradient(0deg, rgba(0, 0, 0, .9), transparent 18%);
  }
}

/* the stage hint mentions «программа показа», which exists only above 1180px (below it there is a thumbnail rail) */
@media (max-width: 1180px) { .v2-stage__head p { display: none; } }
