/* home-services.css — "Услуги" services block + the standalone Conference panel
   (merged: they are two halves of one responsive design).

   Desktop (>1024): three full-bleed image columns (Ресторан / Нобиль СПА /
   Dessange) with the copy overlaid at the bottom, plus a standalone full-bleed
   Conference panel (block 5). The in-grid Conference card is hidden here.
   Up to 1024 (tablet & mobile only): a horizontal card carousel (image on top,
   copy below) that also includes the Conference card; the standalone panel hides.
   The 1024 design frame is itself a carousel, so the carousel range ends at 1024
   and the full-bleed desktop layout starts at 1025.

   Flex + grid only — no absolute positioning. Canon breakpoints: 768 / 1024 / 1440. */

.home-services {
  background: #141414;
  color: #fff;
}

.home-service-card__button {
  flex: 0 0 auto;
  color: inherit;
  border-color: #fff;
  font-weight: 400;
}

.home-service-card__button:hover,
.home-service-card__button:focus-visible {
  background: var(--button-light-hover-fill);
}

/* ============================================================
   Carousel — base (mobile <=767)
   ============================================================ */
.home-services {
  min-height: 913px;
  padding: 103px 0 72px;
  overflow: hidden;
}

.home-services__intro {
  margin: 0 0 48px;
  padding-inline: 16px;
  opacity: 0.8;
}

.home-services__intro .home-display-subtitle {
  margin: 0 0 16px;
  font-size: 50px;
  line-height: 50px;
  letter-spacing: 0;
}

.home-services__intro p {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.home-services__grid {
  width: 100%;
  box-sizing: border-box;
  padding: 0 16px 8px;
  display: flex;
  gap: 24px;
  /* equal-height cards (stretch) so titles, copy and buttons line up on one
     baseline across the whole carousel range — mobile up through 1024 */
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.home-services__grid::-webkit-scrollbar {
  display: none;
}

.home-service-card,
.home-service-card.is-mobile-service-only {
  flex: 0 0 256px;
  width: 256px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: transparent;
  color: #fff;
  scroll-snap-align: start;
}

.home-service-card__image {
  width: 100%;
  height: 318px;
  flex: 0 0 318px;
  object-fit: cover;
  object-position: center;
}

/* content fills the equal-height card and the text block flex-grows to absorb
   the difference in copy length, so every card's button lands on the same
   baseline (with its fixed 24px gap) — i18n-safe, no hardcoded copy heights.
   At >=1025 the card becomes display:grid, so these flex rules are no-ops. */
.home-service-card__content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  margin-top: 24px;
}

.home-service-card__text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 8px;
}

.home-service-card__title {
  margin: 0;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.home-service-card__copy {
  margin: 0;
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.3;
  color: #bababa;
}

/* fixed 24px gap below the text block (never margin-top:auto, which collapsed
   that gap on the tallest card) */
.home-service-card__button {
  width: 144px;
  min-height: 38px;
  height: 38px;
  margin-top: 24px;
  padding: 0 32px;
  border-color: #c6c1a1;
  color: #fff;
  font-size: 12px;
  letter-spacing: 1.8px;
}

/* Conference card: shorter copy on mobile (full copy is too tall in 256px) */
.home-service-card.is-conference .home-service-card__copy {
  display: none;
}

.home-service-card.is-conference .home-service-card__copy--mobile {
  display: block;
}

/* standalone Conference panel is replaced by the in-grid card on small screens */
.home-conference {
  display: none;
}

@media (max-width: 374px) {
  .home-service-card,
  .home-service-card.is-mobile-service-only {
    flex-basis: 248px;
    width: 248px;
  }
}

/* Short, narrow phones (e.g. iPhone SE 375x667): the 318px image pushes the card
   title + copy below the fold. Shrink the image and tighten the top padding / intro
   so at least the text shows. Gated on height too — taller 414-wide phones are fine. */
@media (max-width: 413px) and (max-height: 670px) {
  .home-services {
    padding-top: 80px;
    padding-bottom: 80px;
    min-height: 0;
  }

  .home-services__intro {
    margin-bottom: 32px;
  }

  .home-service-card__image {
    height: 240px;
    flex-basis: 240px;
  }
}

/* ============================================================
   Carousel — tablet (768-1024)
   ============================================================ */
@media (min-width: 768px) and (max-width: 1024px) {
  .home-services {
    padding: 110px 0 56px;
    background: #1d1d1d;
  }

  .home-services__intro {
    max-width: 774px;
    margin: 0 0 38px;
    padding-inline: 32px;
  }

  .home-services__intro .home-display-subtitle {
    font-size: 60px;
    line-height: 50px;
  }

  .home-services__intro p {
    font-size: 20px;
  }

  /* side gutter 32px in the 768 frame; the 1024 frame bumps it to 48px below */
  .home-services__grid {
    padding: 0 32px 8px;
    scroll-padding-inline: 32px;
  }

  .home-service-card,
  .home-service-card.is-mobile-service-only {
    flex-basis: 431px;
    width: 431px;
  }

  .home-service-card__image {
    height: 450px;
    flex-basis: 450px;
  }

  .home-service-card__copy {
    font-size: 18px;
  }

  /* equal-height cards + aligned buttons come from the base rules (they apply
     through the whole carousel range). The Conference card keeps its short
     (first-sentence) copy here too — the second sentence shows only in the
     standalone desktop panel (>=1025). So the default mobile copy switch is left
     as-is (copy hidden, copy--mobile shown); no override here. */
}

/* 1024 frame: 48px side gutter + more, narrower cards (3 fit) — last carousel width */
@media (min-width: 1024px) and (max-width: 1024px) {
  .home-services__intro {
    padding-inline: 48px;
  }

  .home-services__grid {
    padding: 0 48px 8px;
    scroll-padding-inline: 48px;
  }

  .home-service-card,
  .home-service-card.is-mobile-service-only {
    flex-basis: 373px;
    width: 373px;
  }

  .home-service-card__image {
    height: 320px;
    flex-basis: 320px;
  }
}

/* ============================================================
   Full-bleed columns — desktop (>1024; carousel ends at the 1024 frame)
   ============================================================ */
@media (min-width: 1025px) {
  .home-services {
    min-height: 100svh;
    padding: 0;
    background: #141414;
    overflow: visible;
  }

  .home-services__intro {
    display: none;
  }

  .home-services__grid {
    width: 100%;
    min-height: 100svh;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    overflow: visible;
  }

  .home-service-card {
    width: auto;
    /* DEFINITE height (not min-height) so each column is exactly one screen.
       With min-height the grid row is indefinite, so a portrait image's
       intrinsic height (which grows with column width) inflated the cell past
       one screen at 4K — the tallest card became 1440px, leaving a black gap
       under the shorter cards and dropping its copy lower. A definite height +
       minmax(0,1fr) lets the image's height:100% resolve cleanly, no inflation. */
    height: 100svh;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    color: #f7f1e7;
    overflow: hidden;
    isolation: isolate;
  }

  .home-service-card.is-restaurant {
    background: #292621;
  }

  .home-service-card.is-spa {
    background: #202429;
  }

  .home-service-card.is-mobile-service-only {
    display: none;
  }

  .home-service-card__image,
  .home-service-card::before,
  .home-service-card__content {
    grid-area: 1 / 1;
  }

  .home-service-card__image {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    object-position: center;
  }

  .home-service-card::before {
    content: "";
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
    background: linear-gradient(50deg, #000 9%, rgba(0, 0, 0, 0) 79%);
  }

  .home-service-card__content {
    align-self: end;
    z-index: 2;
    margin: 0 40px 120px 56px;
    display: flex;
    flex-direction: column;
    text-shadow: 0 1px 14px rgba(0, 0, 0, 0.45);
  }

  .home-service-card__text {
    gap: 16px;
  }

  .home-service-card__title {
    font-size: 65px;
    line-height: 1;
    white-space: normal;
  }

  .home-service-card__copy {
    max-width: 544px;
    font-size: 24px;
    line-height: 1.3;
    color: #fff;
  }

  .home-service-card.is-conference .home-service-card__copy {
    display: block;
  }

  .home-service-card.is-conference .home-service-card__copy--mobile {
    display: none;
  }

  .home-service-card__button {
    align-self: flex-start;
    width: auto;
    height: auto;
    min-height: var(--button-height);
    margin-top: 39px;
    padding: 0 var(--button-padding-x);
    border-color: #fff;
    font-size: var(--button-font-size);
    letter-spacing: var(--button-letter-spacing-compact);
  }

  /* ---- standalone Conference panel (full-bleed, no absolute) ---- */
  .home-conference {
    position: relative;
    height: 100svh;
    display: grid;
    grid-template-columns: 1fr;
    /* minmax(0,1fr) so the media image can't push the panel past 100svh */
    grid-template-rows: minmax(0, 1fr);
    background: #141414;
    color: #f7f1e7;
    overflow: hidden;
  }

  .home-conference__media,
  .home-conference::before,
  .home-conference::after,
  .home-conference__content {
    grid-area: 1 / 1;
  }

  .home-conference__media {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .home-conference__media img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    object-position: center;
  }

  .home-conference::before {
    content: "";
    pointer-events: none;
    background: rgba(255, 255, 255, 0.1);
  }

  .home-conference::after {
    content: "";
    pointer-events: none;
    background: linear-gradient(54deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0) 84.65%);
  }

  .home-conference__content {
    align-self: end;
    z-index: 3;
    width: min(600px, calc(100% - 80px));
    margin-left: max(40px, calc(8.333vw + 26px));
    padding-bottom: clamp(120px, 14svh, 151px);
  }

  .home-conference__content h2 {
    margin: 0 0 20px;
    font-size: 65px;
    line-height: 1.15;
    letter-spacing: 0;
  }

  .home-conference__content p {
    margin: 0;
    max-width: 600px;
    color: #fff;
    font-size: 24px;
    line-height: 1.32;
  }

  .home-conference__button {
    margin-top: 42px;
    font-weight: 400;
    letter-spacing: var(--button-letter-spacing-compact);
  }
}

/* ============================================================
   Full-bleed, narrow range (1025-1439): the 1440 design's 65px headings overflow
   the ~250-340px columns here (one-word titles like "Ресторан" can't wrap and clip).
   Ramp the type and side margins down, reaching the exact 1440 values at 1440 so the
   proven >=1440 design is untouched. (No Figma frame exists for this in-between range.)
   ============================================================ */
@media (min-width: 1025px) and (max-width: 1439px) {
  .home-service-card__title {
    font-size: clamp(46px, calc(46px + (100vw - 1025px) * 0.0458), 65px);
  }

  .home-service-card__copy {
    font-size: clamp(18px, calc(18px + (100vw - 1025px) * 0.01446), 24px);
  }

  .home-service-card__content {
    margin: 0 40px 120px 30px;
  }
}

/* ============================================================
   XL >=1920: wider columns let the copy breathe
   ============================================================ */
@media (min-width: 1920px) {
  .home-service-card__content {
    margin: 0 48px 145px 64px;
  }

  /* wider screen — let the conference copy breathe past the 600 cap used 1440-1919.
     Beyond 1920 the page content band caps at 1842 and centres, so its gutters grow
     (~359px at 2560). The old viewport-vw margin (8.333vw+26) grows slower and would
     drift the text LEFT of the grid past ~2273px. Lock it to the content grid instead:
     the band's left edge (--site-content-offset) + the design's one-column indent.
     +147px reproduces the approved 1920 position (offset 39 + 147 = 186) exactly. */
  .home-conference__content {
    width: min(755px, calc(100% - 80px));
    margin-left: calc(var(--site-content-offset) + 147px);
  }

  .home-conference__content p {
    max-width: 755px;
  }
}
