/**
 * Unified responsive layer — Garant
 * Devices: PC / laptop / tablet portrait+landscape / phone portrait+landscape
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  max-width: 100%;
}

body {
  overflow-x: clip;
  max-width: 100%;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

.container,
.content-wrap,
.section-inner {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(14px, 3.2vw, 48px);
  box-sizing: border-box;
}

.btn,
.nav-toggle,
.mobile-cta-bar a,
.mobile-cta-bar__call,
.mobile-cta-bar__apply,
.form-input,
.form-textarea,
input[type="text"],
input[type="tel"],
input[type="email"],
textarea {
  min-height: 44px;
}

/* Utilities */
.show-mobile-only {
  display: none !important;
}

/* ========== Laptop ≤1280 ========== */
@media (max-width: 1280px) {
  .service-hero__title,
  .page-imm .service-hero__title {
    font-size: clamp(2rem, 3.5vw, 3.1rem) !important;
  }
}

/* ========== Tablet landscape / small laptop ≤1100 ========== */
@media (max-width: 1100px) {
  .btn--header {
    display: none !important;
  }

  .service-hero__content,
  .page-imm .service-hero__content {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .service-hero__visual,
  .page-imm .service-hero__visual {
    order: -1;
    max-width: min(460px, 90vw);
    margin-inline: auto;
  }

  .service-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .cases-grid,
  .benefits-grid,
  .team-grid,
  .portrait-grid,
  .home-svc__grid,
  .home-dna__grid,
  .listing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .consultation-form-wrapper,
  .media-split,
  .media-split--process {
    grid-template-columns: 1fr !important;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .hero-particles {
    opacity: 0.4;
  }
}

/* ========== Tablet portrait ≤900 ========== */
@media (max-width: 900px) {
  .page-imm {
    --imm-header-h: 80px;
  }

  .site-header,
  .page-imm .site-header {
    gap: 8px;
    padding-inline: 12px !important;
  }

  .page-imm .service-hero > .site-header {
    padding: 8px 14px 10px !important;
    min-height: var(--imm-header-h);
  }

  .page-imm .brand__mark,
  .page-imm img.brand__mark {
    height: 60px !important;
    max-height: 64px !important;
    max-width: min(240px, 40vw) !important;
    object-position: center center !important;
  }

  .page-imm .service-hero > .site-header:has(#nav-toggle) {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 44px !important;
    align-items: center !important;
    justify-items: center;
    gap: 8px !important;
  }

  .page-imm .service-hero > .site-header:has(#nav-toggle) .brand {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }

  .page-imm .service-hero > .site-header:has(#nav-toggle) .header-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  .brand__slogan,
  .header-phone__hours,
  .header-phone__label {
    display: none !important;
  }

  .service-hero,
  .page-imm .service-hero {
    padding: 10px 12px 28px !important;
    min-height: 0 !important;
  }

  .page-imm .service-hero {
    padding-top: calc(var(--imm-header-h) + 8px) !important;
    padding-bottom: 48px !important;
  }

  .page-imm .service-hero__visual {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .page-imm .service-hero__content {
    gap: 48px !important;
    align-items: start !important;
  }

  .page-imm .breadcrumbs {
    margin: 0 0 18px !important;
  }

  .service-stats {
    grid-template-columns: 1fr !important;
  }

  .process-timeline,
  .checklist--board {
    grid-template-columns: 1fr !important;
  }

  .content-section,
  .imm-block {
    padding-block: clamp(32px, 5vw, 52px) !important;
  }

  .section-title {
    font-size: clamp(1.4rem, 3.8vw, 1.8rem) !important;
  }

  /* Hide: decorative hero captions (duplicate page meaning) */
  .hero-shot__cap {
    display: none !important;
  }
}

/* Global mobile overflow safety + phone layout */
@media (max-width: 700px) {
  .page-home.page-imm,
  .page-home.page-imm .service-hero,
  .page-home.page-imm .service-hero__content,
  .page-home.page-imm .service-hero__main,
  .page-home.page-imm .imm-shell,
  .page-home.page-imm .imm-stream {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .page-home.page-imm .service-hero__title .kinetic-line,
  .page-home.page-imm .service-hero__title .kinetic-line--sub {
    white-space: normal !important;
  }

  .cases-grid,
  .benefits-grid,
  .team-grid,
  .portrait-grid,
  .home-svc__grid,
  .home-dna__grid,
  .listing-grid,
  .footer-grid,
  .faq-grid {
    grid-template-columns: 1fr !important;
  }

  .service-hero__cta,
  .hero__cta,
  .cta-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .service-hero__cta .btn,
  .hero__cta .btn,
  .btn--large {
    width: 100%;
    justify-content: center;
  }

  /* Center "Записаться на консультацию" link under CTA buttons */
  .service-hero__cta .hero-quick-link,
  .hero__cta .hero-quick-link {
    width: 100%;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .service-hero__title {
    font-size: clamp(1.7rem, 7vw, 2.25rem) !important;
    line-height: 1.15 !important;
  }

  /* Particles stay visible; JS reduces count on small screens */
  .hero-particles,
  canvas.hero-particles,
  canvas#particles {
    display: block !important;
    opacity: 0.85;
  }

  /* Sticky bottom CTA clearance */
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-cta-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    position: fixed;
    z-index: 950;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    padding: 8px;
    border-radius: 14px;
    background: rgba(22, 16, 42, 0.96);
    border: 1px solid rgba(212, 165, 116, 0.35);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  }

  .hide-mobile {
    display: none !important;
  }

  .show-mobile-only {
    display: block !important;
  }

  .form-row,
  .consultation-form .form-grid,
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  input,
  textarea,
  select {
    font-size: 16px !important;
  }

  .page-home.page-imm .service-hero > .service-hero__visual {
    max-width: min(260px, 72vw) !important;
    width: min(260px, 72vw) !important;
    height: auto !important;
    overflow: visible !important;
    background: transparent !important;
  }

  .portrait-grid,
  .team-grid--portraits {
    max-width: 360px;
    margin-inline: auto;
  }

  .breadcrumbs {
    font-size: 0.74rem;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .breadcrumbs::-webkit-scrollbar {
    display: none;
  }
}

/* ========== Phone portrait ≤480 ========== */
@media (max-width: 480px) {
  .page-imm {
    --imm-header-h: 72px;
  }

  .site-header,
  .page-imm .site-header,
  .page-imm .service-hero > .site-header {
    padding-block: 8px 10px !important;
    min-height: var(--imm-header-h, 72px);
  }

  .brand img,
  .brand__mark,
  .page-imm .brand__mark,
  .page-imm img.brand__mark {
    height: 52px !important;
    max-height: 56px !important;
    max-width: min(200px, 48vw) !important;
    width: auto !important;
  }

  .page-imm .brand__slogan {
    font-size: 0.5rem !important;
  }

  .header-phone__num {
    font-size: 0.8rem;
  }

  .btn--header {
    padding: 10px 12px;
    font-size: 0.76rem;
  }

  .hero-shot__img,
  .page-imm .hero-shot__img {
    max-height: 230px;
    object-fit: cover;
    width: 100%;
  }

  .section-title {
    font-size: 1.32rem !important;
  }

  .content-section {
    padding-block: 28px !important;
  }

  .hide-xs {
    display: none !important;
  }

  .mobile-cta-bar {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* ========== Phone / short landscape ========== */
@media (max-height: 500px) and (orientation: landscape) {
  .service-hero,
  .page-imm .service-hero,
  .page-home.page-imm .service-hero {
    min-height: 0 !important;
    padding-block: 6px 16px !important;
  }

  .page-home.page-imm .service-hero > .service-hero__visual {
    height: auto !important;
    max-height: min(220px, 58vh) !important;
    max-width: min(140px, 32vw) !important;
    width: min(140px, 32vw) !important;
    overflow: visible !important;
    background: transparent !important;
  }

  .service-hero__visual,
  .hero-shot {
    max-height: 40vh;
  }

  .hero-shot__img {
    max-height: 36vh !important;
  }

  .service-stats,
  .hero-shot__cap {
    display: none !important;
  }

  .hero-particles,
  canvas.hero-particles,
  canvas#particles {
    display: block !important;
    opacity: 0.75;
  }

  .mobile-cta-bar a,
  .mobile-cta-bar__call,
  .mobile-cta-bar__apply {
    min-height: 40px;
    font-size: 0.85rem;
  }
}

/* ========== Tablet landscape: keep useful 2-col ========== */
@media (min-width: 701px) and (max-width: 1100px) and (orientation: landscape) {
  .cases-grid,
  .benefits-grid,
  .home-svc__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .service-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .service-hero__content {
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr) !important;
    align-items: center !important;
  }

  .service-hero__visual {
    order: 0 !important;
    max-width: none !important;
  }
}

/* Desktop: hide mobile-only chrome */
@media (min-width: 701px) {
  .mobile-cta-bar {
    display: none !important;
  }

  body {
    padding-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Keep canvas mounted; JS freezes animation */
  .hero-particles,
  canvas.hero-particles,
  canvas#particles {
    display: block !important;
    opacity: 0.55;
  }
}
