/* ====================================================================
   ТКС АВТО — Mobile & Tablet Optimization Layer
   Loaded AFTER styles.css. Preserves all animations/motion/3D from
   desktop, but reflows, retunes weights, and re-paces them for mobile.
   Breakpoints:
     ≤1180px  — small laptop / tablet landscape
     ≤960px   — tablet portrait
     ≤640px   — large phone
     ≤420px   — small phone
   ==================================================================== */

/* iOS-safe min height + dynamic viewport for hero */
:root {
  --vh: 1vh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* svh = stable small viewport height — не «прыгает» на iOS,
   когда адресная строка Safari сворачивается во время скролла.
   dvh здесь использовать нельзя: он перевычисляется на каждом
   скролле и заставляет hero менять высоту → джанк всей страницы. */
@supports (height: 100svh) {
  .hero { min-height: 100svh; }
}

/* ============================================================
   TABLET LANDSCAPE & SMALL DESKTOP (≤1180px)
   ============================================================ */
@media (max-width: 1180px) {
  .container { width: min(1180px, 94vw); }
  section { padding: 100px 0; }

  /* Hero — slightly tighter */
  .hero { padding: 130px 0 80px; }
  .hero-title { font-size: clamp(44px, 8.4vw, 92px); }

  /* Catalog detail / grid breathing room */
  .featured-grid { grid-template-columns: repeat(3, 1fr); }
  .cat-results-grid { grid-template-columns: repeat(3, 1fr); }
  .services-grid { grid-template-columns: repeat(3, 1fr); }
  .benefits-grid { grid-template-columns: repeat(3, 1fr); }
  .order-process { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   TABLET (≤960px) — full layout reorg, motion preserved
   ============================================================ */
@media (max-width: 960px) {
  .container { width: min(960px, 92vw); }
  section { padding: 88px 0; }

  /* ---------- HEADER (pill stays, nav collapsed) ---------- */
  .site-header {
    top: 12px;
    width: calc(100vw - 24px);
    max-width: 100vw;
    padding: 8px 8px 8px 16px;
    border-radius: 28px;
    overflow: hidden;
  }
  .logo .logo-svg { height: 34px; }
  .main-nav { display: none; }
  .nav-burger { display: inline-flex; order: 3; margin-left: 0; }
  .header-cta { gap: 8px; order: 2; margin-left: auto; }
  .phone-link { display: inline-flex; width: 38px; height: 38px; }
  .phone-link svg { width: 15px; height: 15px; }
  .socials { display: none; }
  .cta-btn { padding: 10px 16px; font-size: 12.5px; }

  /* ---------- HERO ---------- */
  .hero { padding: 110px 0 70px; min-height: auto; }
  .hero-title { font-size: clamp(46px, 9vw, 84px); line-height: 0.96; }
  .hero-sub { font-size: 16px; max-width: 560px; }
  .hero-actions { gap: 10px; margin-bottom: 40px; }
  .hero-car-shape { width: 92%; bottom: 14%; }
  .hero-marquee { bottom: 30px; padding: 14px 0; }
  .marquee-track { font-size: 14px; gap: 40px; padding-right: 40px; }

  /* ---------- ABOUT ---------- */
  .about-grid { grid-template-columns: 1fr; gap: 56px; }
  .about-text .section-title { text-align: left; }
  .about-card-3d {
    max-width: 460px;
    margin: 0 auto;
    transform: rotateY(-4deg) rotateX(2deg);
  }

  /* ---------- COUNTERS (2x2) ---------- */
  .counters { grid-template-columns: repeat(2, 1fr); }
  .counter {
    padding: 36px 24px;
    border-bottom: 1px solid var(--line);
  }
  .counter:nth-child(2) { border-right: none; }
  .counter:nth-child(3) { border-right: 1px solid var(--line); }
  .counter:nth-child(3),
  .counter:nth-child(4) { border-bottom: none; }
  .counter-num { font-size: clamp(40px, 7vw, 64px); }

  /* ---------- CATALOG CARDS ---------- */
  .catalog-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cat-card { min-height: 124px; }
  .cat-card-inner { min-height: 124px; padding: 14px 16px; gap: 8px; }
  .cat-card-body h3 { font-size: 17px; margin-bottom: 4px; }
  .cat-card-body p { font-size: 12px; line-height: 1.4; }
  .cat-arrow { width: 32px; height: 32px; }
  .cat-arrow svg { width: 16px; height: 16px; }
  .featured-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }

  /* ---------- ORDER CTA ---------- */
  .order-cta-card {
    grid-template-columns: 1fr;
    padding: 44px 32px;
    gap: 36px;
    text-align: center;
  }
  .order-cta-content p { margin-left: auto; margin-right: auto; }
  .order-cta-stats { justify-content: center; }
  .order-cta-visual { max-width: 240px; justify-self: center; margin: 0 auto; }

  /* ---------- SERVICES ---------- */
  .services-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .service-card { padding: 30px 26px 26px; }
  .table-row { grid-template-columns: 1fr 1fr; gap: 12px 18px; padding: 18px 24px; }
  .table-row > div:nth-child(2) { grid-column: span 2; font-size: 14px; }
  .table-head > div:nth-child(2) { grid-column: span 2; }

  /* ---------- TESTIMONIALS ---------- */
  .reviews-grid { grid-template-columns: 1fr; }
  .review { padding: 28px; }

  /* ---------- CONTACTS ---------- */
  .contacts-grid { grid-template-columns: 1fr; gap: 18px; }
  .contact-info { padding: 36px 28px; }
  .contact-map { min-height: 380px; }

  /* ---------- FOOTER ---------- */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 40px 32px;
  }
  .footer-brand { grid-column: span 2; }

  /* ---------- CATALOG PAGE ---------- */
  .catalog-page-hero { padding: 140px 0 50px; }
  .cat-page-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  .cat-results-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-panel {
    position: static !important;
    max-height: none !important;
  }

  /* ---------- ORDER / PROCESS ---------- */
  .order-process { grid-template-columns: repeat(2, 1fr); }
  .benefits-grid { grid-template-columns: repeat(2, 1fr); }

  /* ---------- DETAILING PAGE (preserve all motion) ---------- */
  .det-hero { padding: 130px 0 70px; }
  .det-hero-inner { grid-template-columns: 1fr; gap: 48px; }
  .det-hero-visual {
    max-width: 460px;
    margin: 0 auto;
    width: 100%;
    aspect-ratio: 1/1;
  }
  .det-services {
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
  }
  .ds-1 { grid-column: span 6; }
  .ds-2, .ds-3 { grid-column: span 3; }
  .ds-4, .ds-5 { grid-column: span 3; }
  .process-strip { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .promise-card { grid-template-columns: 1fr; }
  .promise-visual { min-height: 320px; padding: 40px 0; }
  .promise-text { padding: 44px 32px; }
  .manifesto { padding: 56px 40px; }
  .manifesto-inner { grid-template-columns: 1fr; gap: 28px; }
  .manifesto-text { font-size: clamp(20px, 2.6vw, 28px); }
  .det-cta-card { padding: 56px 36px; }
}

/* ============================================================
   PHONE (≤640px) — heavy reorg, retuned animations, no clutter
   ============================================================ */
@media (max-width: 640px) {
  .container { width: 92vw; }
  section { padding: 72px 0; }

  /* ---------- HEADER ---------- */
  .site-header {
    top: max(8px, env(safe-area-inset-top, 8px));
    width: calc(100vw - 20px);
    max-width: 100vw;
    padding: 7px 6px 7px 14px;
    border-radius: 22px;
    overflow: hidden;
  }
  .logo .logo-svg { height: 30px; }
  .logo .logo-img { height: 34px; }
  .nav-burger {
    width: 38px; height: 38px;
    margin-left: 0;
  }

  /* ---------- HEADER ROW ALIGNMENT (≤640px) ---------- */
  /* Order: logo | (auto space) | phone-icon | CTA | burger
     Burger sits to the RIGHT of "Оставить заявку" */
  .header-inner { gap: 8px; }
  .header-cta  { order: 2; margin-left: auto; gap: 6px; }
  .nav-burger  { order: 3; margin-left: 0; }
  .phone-link  { display: inline-flex; width: 38px; height: 38px; }
  .phone-link svg { width: 15px; height: 15px; }

  /* CTA = compact pill with text "Оставить заявку" instead of a bare red dot */
  .cta-btn {
    width: auto; height: 38px;
    padding: 0 14px 0 12px;
    border-radius: 999px;
    box-shadow: 0 8px 24px -8px rgba(255,31,54,0.5);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1;
    white-space: nowrap;
  }
  /* Re-show the label (styles.css hides it ≤640) — no inner icon (we have a dedicated phone-link) */
  .cta-btn span:not(.cta-shine) {
    display: inline-flex !important;
    align-items: center;
  }
  /* Suppress the desktop icon-only ::after used in styles.css */
  .cta-btn::after { content: none !important; display: none !important; }

  /* ---------- MOBILE MENU ---------- */
  .mobile-menu-panel {
    width: min(360px, 92vw);
    padding: 72px 24px 28px;
    padding-bottom: calc(28px + var(--safe-bottom));
  }
  .mobile-nav a {
    padding: 14px 16px;
    font-size: 16px;
  }

  /* Mobile menu social icons — centered row, equal sizing */
  .mm-socials {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 4px 0;
  }
  .mm-socials a {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .mm-socials a svg {
    width: 22px;
    height: 22px;
  }

  /* Mobile menu phone and CTA — centered */
  .mm-phone {
    justify-content: center;
    width: 100%;
    text-align: center;
    padding: 10px 4px;
    font-size: 17px;
  }
  .mobile-menu-foot .btn-primary {
    width: 100%;
    text-align: center;
  }

  /* ---------- HERO (preserve video/streaks/car/grid) ---------- */
  .hero {
    padding: 100px 0 60px;
    min-height: 92vh;
    min-height: 92svh; /* svh, не dvh — иначе hero меняет высоту на каждом скролле iOS Safari */
  }
  .hero-content { padding: 0 4vw; }
  .hero-eyebrow {
    padding: 6px 12px;
    font-size: 11.5px;
    margin-bottom: 22px;
  }
  .hero-eyebrow span:last-child {
    font-size: 11.5px;
    letter-spacing: 0;
  }
  .hero-title {
    font-size: clamp(38px, 12vw, 64px);
    line-height: 0.98;
    letter-spacing: -0.035em;
    margin-bottom: 22px;
  }
  .hero-sub {
    font-size: 15px;
    line-height: 1.55;
    margin-bottom: 28px;
    max-width: 100%;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 32px;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 15px 22px;
    font-size: 14.5px;
  }
  .hero-car-shape {
    width: 130%;
    bottom: 22%;
    opacity: 0.45;
    animation-duration: 10s; /* slower on mobile to save battery */
  }
  .hero-overlay {
    background:
      linear-gradient(180deg, rgba(10,10,12,0.55) 0%, rgba(10,10,12,0.85) 65%, rgba(10,10,12,1) 100%),
      radial-gradient(800px 600px at 30% 30%, rgba(255,31,54,0.22), transparent 60%);
  }
  .hero-grid-overlay { background-size: 50px 50px; }
  .hero-light-streak { animation-duration: 8s; opacity: 0.5; }
  .streak-3 { display: none; }
  .hero-marquee {
    bottom: 16px;
    padding: 10px 0;
  }
  .marquee-track {
    font-size: 13px;
    gap: 32px;
    padding-right: 32px;
  }
  .marquee-track li::after {
    right: -18.5px;
    width: 4px;
    height: 4px;
    margin-top: -2px;
  }

  /* ---------- BTN — bigger touch targets ---------- */
  .btn { padding: 14px 22px; font-size: 14px; }
  .btn-large { padding: 16px 26px; font-size: 15px; }

  /* ---------- KICKER ---------- */
  .section-head { margin-bottom: 48px; }
  .kicker { padding: 5px 14px; font-size: 11px; letter-spacing: 0.16em; }
  .section-title { font-size: clamp(28px, 7.6vw, 44px); }
  .section-sub { font-size: 15px; line-height: 1.55; }

  /* ---------- BRANDS ---------- */
  .brands { padding-top: 72px; }
  .brands-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .brand-tile { height: 86px; }
  .brand-logo { font-size: 15px; }

  /* ---------- ABOUT (3D card preserved, reduced tilt) ---------- */
  .about-grid { gap: 44px; }
  .about-text .section-title {
    font-size: clamp(28px, 7.6vw, 44px);
    margin-bottom: 22px;
  }
  .about-lead {
    font-size: 15px;
    line-height: 1.6;
  }
  .about-trust {
    gap: 0;
    padding: 16px 0;
  }
  .about-trust-item {
    padding: 0 10px;
    text-align: center;
  }
  .about-trust-num {
    font-size: 22px;
  }
  .about-trust-label {
    font-size: 10px;
    line-height: 1.3;
  }
  .about-actions {
    flex-direction: column;
    gap: 10px;
  }
  .about-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .about-card-3d {
    transform: rotateY(-3deg) rotateX(2deg);
    aspect-ratio: 4/4.4;
    max-width: 100%;
  }
  .about-card-3d:hover { transform: rotateY(-1deg) rotateX(1deg); }
  .about-card-content { padding: 32px 24px; }
  .about-card-content h3 { font-size: 24px; }
  .medal { transform: scale(0.85); margin-bottom: 18px; }

  /* Counter stack */
  .counters { grid-template-columns: 1fr; }
  .counter {
    padding: 28px 0;
    border-right: none;
    border-bottom: 1px solid var(--line);
    text-align: center;
  }
  .counter:last-child { border-bottom: none; }
  .counter-num { font-size: clamp(44px, 14vw, 64px); }
  .counter-label { font-size: 13px; }

  /* ---------- CATALOG CARDS ---------- */
  .catalog-cards { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 48px; }
  .cat-card { min-height: 116px; }
  .cat-card-inner {
    padding: 12px 12px;
    min-height: 116px;
    gap: 8px;
  }
  .cat-card-body h3 { font-size: 14px; margin-bottom: 3px; }
  .cat-card-body p { font-size: 11.5px; line-height: 1.35; }
  .cat-arrow { width: 28px; height: 28px; }
  .cat-arrow svg { width: 14px; height: 14px; }
  .cat-num { font-size: 9.5px; }

  /* Featured cars */
  .featured-strip { margin-top: 16px; }
  .featured-head { gap: 12px; flex-wrap: wrap; }
  .featured-head h3 { font-size: 22px; }
  .featured-grid { grid-template-columns: 1fr; gap: 14px; }
  .car-img { height: 180px; }
  .car-meta { padding: 16px 18px 20px; }
  .car-card h4 {
    font-size: 16px;
    margin-bottom: 6px;
  }
  .car-specs {
    font-size: 12px;
    gap: 4px;
    margin-bottom: 10px;
  }
  .car-price {
    font-size: 16px;
  }
  .car-tag {
    font-size: 10px;
    padding: 3px 8px;
    margin-bottom: 8px;
  }

  /* ---------- ORDER CTA ---------- */
  .order-cta-card {
    padding: 32px 20px;
    border-radius: 20px;
    text-align: left;
  }
  .order-cta-card .section-title {
    font-size: clamp(24px, 7vw, 36px);
  }
  .order-cta-card p {
    font-size: 14.5px;
    line-height: 1.55;
  }
  .order-cta-stats {
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .order-cta-stats strong { font-size: 22px; }
  .order-cta-stats span { font-size: 11px; }
  .order-cta-visual { max-width: 180px; }
  .order-cta-card .btn {
    width: 100%;
    justify-content: center;
  }

  /* ---------- SERVICES ---------- */
  .services-grid { grid-template-columns: 1fr; gap: 12px; margin-bottom: 40px; }
  .service-card { padding: 26px 22px 22px; }
  .service-icon { width: 52px; height: 52px; margin-bottom: 18px; }
  .service-icon svg { width: 26px; height: 26px; }
  .service-card h3 { font-size: 19px; }
  .service-arrow { top: 24px; right: 22px; font-size: 19px; }

  /* Services table — switch to card layout */
  .services-table { border-radius: 18px; }
  .table-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 18px 20px;
  }
  .table-row > div:nth-child(2) { grid-column: 1; font-size: 13.5px; color: var(--ink-faint); }
  .table-head { display: none; }
  .table-row:not(.table-head) > div:first-child {
    font-size: 15px;
    margin-bottom: 4px;
  }
  .price-cell {
    font-size: 17px;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  /* ---------- TESTIMONIALS ---------- */
  .reviews-grid { gap: 12px; margin-bottom: 40px; }
  .review { padding: 22px; }
  .review p { font-size: 14.5px; line-height: 1.6; }
  .review footer { gap: 12px; padding-top: 16px; }
  .avatar { width: 42px; height: 42px; font-size: 13px; }
  .review footer strong { font-size: 14px; }
  .review footer span { font-size: 12px; }
  .quote-mark { font-size: 60px; top: 6px; right: 18px; }
  .review-cta-row {
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .review-platform {
    width: 100%;
    justify-content: center;
  }

  /* ---------- FAQ ---------- */
  .faq-item summary {
    padding: 18px 22px;
    font-size: 16px;
    gap: 14px;
  }
  .faq-toggle { width: 28px; height: 28px; }
  .faq-item p {
    padding: 0 22px 22px;
    font-size: 14.5px;
  }

  /* ---------- CONTACTS ---------- */
  .contact-info { padding: 28px 22px; }
  .info-big { font-size: 20px; }
  .info-label { margin-bottom: 8px; font-size: 10px; }
  .info-block p { font-size: 14.5px; line-height: 1.5; }
  .contact-map { min-height: 280px; }
  .contact-info .btn-primary {
    width: 100%;
    justify-content: center;
    font-size: 14px;
    padding: 14px 20px;
  }

  /* ---------- FOOTER ---------- */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-bottom: 36px;
  }
  .footer-brand { grid-column: span 1; }
  .footer-brand p { max-width: 100%; }
  .footer-brand .socials {
    display: flex;
    gap: 10px;
    margin-top: 16px;
  }
  .footer-brand .socials a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .footer-brand .socials a svg {
    width: 18px;
    height: 18px;
  }
  .footer-col {
    padding-top: 0;
  }
  .footer-col h4 {
    margin-bottom: 14px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
    text-align: center;
  }

  /* ---------- MODAL — bottom sheet on phone ---------- */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 32px 24px calc(32px + var(--safe-bottom));
    animation: card-in-sheet 0.45s var(--ease);
    max-height: 92vh;
    overflow-y: auto;
  }
  .modal-card::before {
    content: "";
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 44px; height: 4px;
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
  }
  @keyframes card-in-sheet {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
  }
  /* (modal icon/h3/inputs sizing handled in unified FORMS block at bottom of file) */

  /* ---------- DETAILING — full mobile reflow ---------- */
  .det-hero { padding: 110px 0 56px; }
  .det-hero-inner { gap: 40px; }
  .det-breadcrumb { font-size: 11px; margin-bottom: 22px; }
  .det-eyebrow {
    padding: 6px 12px;
    font-size: 10.5px;
    letter-spacing: 0.16em;
    margin-bottom: 18px;
  }
  .det-title {
    font-size: clamp(40px, 12vw, 64px);
    margin-bottom: 22px;
  }
  .det-lead { font-size: 15.5px; margin-bottom: 28px; }
  .det-hero-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .det-hero-actions .btn { width: 100%; justify-content: center; }
  .det-hero-visual { max-width: 360px; }

  /* Hero gloss visual — keep all motion, scale floating pills smaller */
  .det-pill {
    padding: 10px 12px;
    border-radius: 12px;
    transform: scale(0.85);
    transform-origin: top left;
  }
  .det-pill .pill-icon { width: 30px; height: 30px; border-radius: 8px; }
  .det-pill-1 { top: 4%; left: -4%; }
  .det-pill-2 {
    top: auto;
    bottom: 38%;
    right: -8%;
    transform-origin: top right;
  }
  .det-pill-3 { bottom: 2%; left: 6%; }

  /* Manifesto */
  .manifesto-section { padding: 24px 0 72px; }
  .manifesto {
    padding: 36px 24px;
    border-radius: 22px;
  }
  .manifesto::after {
    font-size: 200px;
    top: -20px; right: 20px;
  }
  .manifesto-inner { gap: 22px; }
  .manifesto-mark { width: 68px; height: 68px; border-radius: 18px; }
  .manifesto-mark svg { width: 30px; height: 30px; }
  .manifesto-text { font-size: 18px; line-height: 1.4; }
  .manifesto-sig { font-size: 10px; margin-top: 18px; }

  /* Det section heads */
  .det-section-head { margin-bottom: 36px; }
  .det-section-head h2 { font-size: clamp(28px, 7.6vw, 44px); }
  .det-section-head p { font-size: 15px; line-height: 1.55; }

  /* Services - single col, but feature cards keep watermark */
  .det-services-section { padding: 16px 0 72px; }
  .det-services { grid-template-columns: 1fr; gap: 12px; }
  .ds-1, .ds-2, .ds-3, .ds-4, .ds-5 { grid-column: span 1; }
  .det-service {
    padding: 26px 22px;
    min-height: 0;
    border-radius: 20px;
  }
  .det-service .ds-num { top: 22px; right: 22px; font-size: 11px; }
  .det-service .ds-icon { width: 48px; height: 48px; margin-bottom: 18px; border-radius: 12px; }
  .det-service .ds-icon svg { width: 22px; height: 22px; }
  .det-service h3 { font-size: 19px; }
  .det-service p { font-size: 14px; }
  .det-service .ds-watermark {
    font-size: 130px;
    right: -6px;
    bottom: -38px;
  }

  /* Process strip */
  .process-section { padding: 16px 0 72px; }
  .process-strip { grid-template-columns: 1fr; gap: 10px; margin-top: 32px; }
  .proc-step { padding: 24px 22px; border-radius: 18px; }
  .proc-step .ps-num { font-size: 38px; margin-bottom: 12px; }
  .proc-step h4 { font-size: 17px; }
  .proc-step p { font-size: 13.5px; }

  /* Promise card */
  .promise-section { padding: 16px 0 72px; }
  .promise-card {
    grid-template-columns: 1fr;
    border-radius: 22px;
    min-height: 0;
  }
  .promise-text { padding: 36px 24px; }
  .promise-text h3 { font-size: clamp(24px, 7vw, 36px); }
  .promise-text p { font-size: 15px; }
  .promise-visual {
    min-height: 280px;
    padding: 30px 0;
  }
  .promise-rings { width: 75%; }
  .promise-rings .ring-stat strong { font-size: 38px; }
  .promise-rings .ring-stat span { font-size: 10px; letter-spacing: 0.18em; }

  /* Det CTA */
  .det-cta-section { padding: 0 0 80px; }
  .det-cta-card {
    padding: 40px 24px;
    border-radius: 22px;
  }
  .det-cta-card h3 { font-size: clamp(28px, 8vw, 42px); }
  .det-cta-card p { font-size: 15.5px; margin-bottom: 24px; }
  .det-cta-card .btn { width: 100%; justify-content: center; }

  /* ---------- ORDER / REGISTRATION / INSURANCE pages ---------- */
  .order-hero {
    padding: 120px 0 50px;
    text-align: center;
  }
  .order-hero .hero-title {
    font-size: clamp(32px, 9vw, 56px);
    margin: 0 auto 18px;
    text-align: center;
  }
  .order-hero .hero-title .line {
    display: block;
    padding-right: 0;
  }
  .order-hero .hero-sub {
    font-size: 14.5px;
    line-height: 1.55;
    max-width: 100% !important;
    margin: 0 auto 24px !important;
    text-align: center;
  }
  .order-hero .hero-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin: 0 auto;
    max-width: 400px;
  }
  .order-hero .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .order-hero .container {
    text-align: center;
  }
  .page-breadcrumb {
    justify-content: center !important;
    font-size: 11px !important;
    margin-bottom: 20px !important;
  }

  /* ---------- TRADE-IN page ---------- */
  .ti-hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .ti-lead {
    max-width: 100% !important;
    font-size: 15.5px !important;
  }
  .order-process { grid-template-columns: 1fr; gap: 12px; padding: 56px 0; }
  .process-step {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
  }
  .process-step .step-num {
    font-size: 40px;
    margin-bottom: 14px;
    line-height: 1;
  }
  .process-step h4 {
    font-size: 17px;
    margin-bottom: 6px;
  }
  .process-step p {
    font-size: 13.5px;
    line-height: 1.55;
  }
  .benefits-grid { grid-template-columns: 1fr; gap: 12px; }
  .benefit {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  .benefit-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
  }
  .benefit-icon svg {
    width: 22px;
    height: 22px;
  }
  .benefit h3 {
    font-size: 18px;
    margin-bottom: 8px;
  }
  .benefit p {
    font-size: 14px;
    line-height: 1.55;
  }
  .order-form-section { padding: 56px 0 96px; }
  .order-form-card {
    padding: 28px 20px;
    border-radius: 22px;
    overflow: hidden;
  }
  .order-form-card .kicker {
    margin-bottom: 14px;
  }
  .order-form-card .section-title {
    font-size: clamp(24px, 7vw, 32px) !important;
    text-align: left !important;
    margin: 12px 0 12px !important;
    line-height: 1.15;
  }
  .order-form-card p {
    font-size: 14.5px !important;
    line-height: 1.55 !important;
    margin-bottom: 24px !important;
  }
  .form-row { grid-template-columns: 1fr; }

  /* ---------- CATALOG PAGE ---------- */
  .catalog-page-hero { padding: 120px 0 36px; }
  .cat-tabs {
    display: flex;
    width: 100%;
    margin-bottom: 24px;
  }
  .cat-tab {
    flex: 1;
    padding: 10px 14px;
    font-size: 13px;
    text-align: center;
  }
  .cat-results-grid { grid-template-columns: 1fr; gap: 14px; }
  .cat-results-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .sort-select { width: 100%; }

  /* ---------- INSURANCE page ---------- */
  .ins-lead {
    max-width: 100% !important;
    font-size: 15.5px !important;
  }
  .ins-hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* ---------- REGISTRATION page ---------- */
  .reg-lead {
    max-width: 100% !important;
    font-size: 15.5px !important;
  }
  .reg-hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* ---------- BUYOUT page ---------- */
  .by-lead {
    max-width: 100% !important;
    font-size: 15.5px !important;
  }
  .by-hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
}

/* ============================================================
   COMPACT PHONES / SMALL TABLETS (≤480px)
   The ТКС АВТО wordmark is much wider than the old logo, so keep the
   header row on one line: compact logo + shortened CTA label.
   ============================================================ */
@media (max-width: 480px) {
  .logo .logo-img { height: 30px; padding: 3px 8px; border-radius: 7px; }
  /* The ТКС АВТО wordmark is much wider than the old logo. Reclaim the
     needed header width by dropping the redundant quick-call icon here —
     the phone number is still one tap away inside the mobile menu. */
  .phone-link { display: none; }
}

/* ============================================================
   SMALL PHONE (≤420px) — micro-tuning, never broken
   ============================================================ */
@media (max-width: 420px) {
  .container { width: 94vw; }
  section { padding: 64px 0; }

  .site-header {
    top: max(6px, env(safe-area-inset-top, 6px));
    width: calc(100vw - 16px);
    max-width: 100vw;
    padding: 6px 5px 6px 12px;
    overflow: hidden;
  }
  .logo .logo-svg { height: 28px; }

  .hero-title { font-size: clamp(34px, 12.6vw, 50px); }
  .hero-sub { font-size: 14.5px; }

  .section-title { font-size: clamp(26px, 8vw, 38px); }
  .det-title { font-size: clamp(36px, 13vw, 56px); }

  .cat-card-body h3 { font-size: 13px; }
  .cat-card-body p { font-size: 11px; }
  .counter-num { font-size: 44px; }

  /* Mobile pills (det-hero) hide on tiny screens to keep gloss focal */
  .det-pill-2 { display: none; }
  .det-pill-1 { transform: scale(0.78); }
  .det-pill-3 { transform: scale(0.78); }

  .manifesto-text { font-size: 16.5px; }
  .det-cta-card h3 { font-size: 26px; }
}

/* ============================================================
   MODERN PHONE (≤390px) — fits iPhone 12 mini, Pixel, etc.
   Header overflow fix + tighter spacing.
   ============================================================ */
@media (max-width: 390px) {
  /* Compact logo */
  .logo .logo-img {
    height: 26px;
    padding: 3px 8px;
    border-radius: 7px;
  }

  /* Header row: prevent any item from shrinking past min-content,
     tighten gaps, and reduce internal right padding */
  .header-inner {
    gap: 6px;
    padding-right: 4px;
  }
  .header-inner > * { flex-shrink: 0; }

  /* CTA: replace "Оставить заявку" with shorter "Заявка" via CSS-only swap.
     We hide the original text node and inject a shorter label via ::before. */
  .cta-btn {
    height: 36px;
    padding: 0 12px;
    font-size: 11.5px;
    box-shadow: 0 6px 20px -8px rgba(255,31,54,0.5);
  }
  .cta-btn span:not(.cta-shine) {
    /* Hide original text but keep the span as a positioning anchor */
    font-size: 0;
    line-height: 0;
  }
  .cta-btn span:not(.cta-shine)::before {
    content: "Заявка";
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1;
  }

  /* Compact touch targets in header (still tappable, denser) */
  .nav-burger { width: 36px; height: 36px; }
  .phone-link { width: 36px; height: 36px; }
  .phone-link svg { width: 14px; height: 14px; }
}

/* ============================================================
   ULTRA-NARROW (≤340px) — fallback for very small screens.
   Drop the phone icon since the number is in the mobile menu anyway.
   ============================================================ */
@media (max-width: 340px) {
  .phone-link { display: none; }
  .cta-btn { padding: 0 10px; font-size: 11px; }
  .cta-btn span:not(.cta-shine)::before { font-size: 11px; }
}

/* ============================================================
   TOUCH-DEVICE TUNING
   - Replace hover-only effects with always-on lite versions
   - Keep keyframe animations (gloss spin, pulse, marquee, etc.)
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  /* Hover lift becomes a subtle tap depress */
  .btn-primary:hover,
  .btn-ghost:hover,
  .service-card:hover,
  .car-card:hover,
  .cat-card:hover,
  .review:hover,
  .det-service:hover,
  .proc-step:hover,
  .benefit:hover,
  .process-step:hover {
    transform: none;
  }
  .btn-primary:active { transform: scale(0.97); }
  .btn-ghost:active,
  .btn-outline:active { transform: scale(0.97); }
  .cat-card:active { transform: scale(0.99); }
  .service-card:active,
  .car-card:active,
  .det-service:active,
  .review:active { transform: scale(0.99); }

  /* Disable mouse-tilt JS effect on touch — JS already gated, but pin transform off */
  .cat-card,
  .about-card-3d,
  .car-card { transform: none !important; }
  .about-card-3d {
    transform: rotateY(-3deg) rotateX(2deg) !important;
  }

  /* Hover-revealed states get permanent “mid” treatment so motion still reads */
  .det-service::before { transform: scaleX(1); opacity: 0.5; }
  .service-card::before { transform: scaleX(0.4); }
  .brand-tile { /* keep shimmer animation only */ }

  /* Make floating pills feel responsive on tap */
  .det-pill { animation-duration: 7s; }
}

/* ============================================================
   REDUCED-MOTION respect (already partially in styles.css)
   Disable continuous loops too on phones, cheaper
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .gloss-stage::before,
  .gloss-stage::after,
  .gloss-shine,
  .det-pill,
  .hero-car-shape,
  .hero-fallback-bg::before,
  .hero-light-streak,
  .marquee-track,
  .about-card-glow,
  .order-globe,
  .pin-pulse,
  .det-eyebrow .pulse {
    animation: none !important;
  }
}

/* ============================================================
   ORIENTATION & LANDSCAPE PHONES — keep hero usable
   ============================================================ */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .hero { min-height: auto; padding: 100px 0 56px; }
  .hero-marquee { display: none; }
  .hero-car-shape { width: 60%; bottom: -10%; }
  .det-hero { padding: 100px 0 56px; }
  .det-hero-visual { max-width: 280px; }
}

/* ============================================================
   PERFORMANCE: lighten heavy filters on small screens to keep
   60fps scroll on mid-range phones, without removing the look.
   ============================================================ */
@media (max-width: 640px) {
  .site-header { backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%); }
  body::before {
    background:
      radial-gradient(600px 400px at 80% -10%, rgba(255,31,54,0.16), transparent 60%),
      radial-gradient(500px 400px at 50% 110%, rgba(176,7,20,0.10), transparent 60%);
  }
  .det-pill {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  /* Slightly slower glow rotate to save battery */
  .about-card-glow { animation-duration: 22s; }
  .order-globe { animation-duration: 28s; }

  /* ===== JANK REDUCTION ===== */

  /* Reveal animations: keep the beautiful opacity+transform timing,
     only remove filter:blur (the main jank source on mobile GPUs) */
  .reveal {
    filter: none !important;
    transition:
      opacity 1s cubic-bezier(0.22, 1, 0.36, 1),
      transform 1.1s cubic-bezier(0.22, 1, 0.36, 1) !important;
    transition-delay: var(--reveal-delay, 0ms) !important;
    will-change: opacity, transform;
  }
  .reveal.in { filter: none !important; }

  .reveal-rise { filter: none !important; }
  .reveal-rise.in { filter: none !important; }

  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .reveal-tilt {
    filter: none !important;
  }

  /* Remove will-change from non-essential elements to free GPU memory */
  .marquee-track { will-change: auto; }

  /* Remove hover transforms on mobile (no hover on touch) */
  .brand-tile:hover { transform: none; }
  .brand-tile::after { display: none; }

  /* Simpler hero background — no animated stars on mobile */
  .hero-fallback-bg::before { animation: none; opacity: 0.25; }

  /* Reduce car-shape animation complexity */
  .hero-car-shape {
    animation-duration: 14s;
    filter: drop-shadow(0 15px 30px rgba(255,31,54,0.3));
  }

  /* Simplify light streaks */
  .hero-light-streak {
    animation-duration: 10s;
    filter: none;
  }

  /* Simpler counter animation */
  .counter::before { display: none; }

  .order-globe {
    filter: drop-shadow(0 0 20px rgba(255,31,54,0.25));
  }

  /* Simpler modal transitions */
  .modal-card {
    animation-duration: 0.3s;
  }

  /* Disable backdrop-filter on map and marquee to save GPU */
  .hero-marquee {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(0,0,0,0.5);
  }
  .map-cta {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ============================================================
   FORMS — iOS zoom prevention (font-size ≥16px on inputs)
   ============================================================ */
@media (max-width: 640px) {
  .modal-form input,
  .modal-form textarea,
  .sort-select,
  .range-group input,
  .filter-list input[type="text"] {
    font-size: 16px !important;
  }

  /* Allow flex-shrunk filter inputs to actually shrink below their UA intrinsic 200px */
  .range-group input {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
}

/* ============================================================
   AUTO-RESPONSIVE GRID PRIMITIVES
   Universal classes — используй на любой новой секции вместо
   собственных media-queries. Сетка сама перестроится.
   ============================================================ */
.auto-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.auto-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.auto-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

@media (max-width: 1180px) {
  .auto-grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .auto-grid-3, .auto-grid-4 { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (max-width: 640px) {
  .auto-grid-2, .auto-grid-3, .auto-grid-4 { grid-template-columns: 1fr; gap: 12px; }
}

/* Touch-friendly card: добавь .touch-card к карточке — получишь
   правильные active-эффекты и tilt-блокировку автоматом */
@media (hover: none) and (pointer: coarse) {
  .touch-card:hover { transform: none !important; }
  .touch-card:active { transform: scale(0.99) !important; transition: transform 0.15s ease-out; }
}

/* Tilt-on-scroll: добавь .scroll-tilt — JS подхватит автоматически */
.scroll-tilt { transition: transform 0.4s var(--ease); will-change: transform; }

/* ============================================================
   SCROLL SNAP for horizontal mobile rails (used by JS)
   ============================================================ */
.mobile-rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 4px 6vw 8px;
  margin: 0 -6vw;
  -webkit-overflow-scrolling: touch;
}
.mobile-rail::-webkit-scrollbar { display: none; }
.mobile-rail > * {
  flex: 0 0 78%;
  scroll-snap-align: start;
}
@media (min-width: 641px) {
  /* desktop: behave as normal grid */
  .mobile-rail { display: contents; }
}

/* ============================================================
   FORMS — universal adaptive layer (all callback / lead forms)
   Applies to .modal-form across modals + .order-form-card inline.
   Fixes ranged from desktop micro-pad → tablet 2col→1col → phone
   bottom-sheet → tiny-phone micro tuning.
   ============================================================ */

/* ---------- Tablet wide (961–1180): keep generous, no cramped 2-cols ---------- */
@media (max-width: 1180px) and (min-width: 961px) {
  .order-form-card { padding: 48px 44px; }
  .form-row { gap: 12px; }
}

/* ---------- Tablet (≤960): collapse 2-col, soften padding ---------- */
@media (max-width: 960px) {
  /* Inline order-form */
  .order-form-card { padding: 40px 32px; }
  .form-row { grid-template-columns: 1fr; gap: 12px; }

  /* Modal — slightly more breathing room than phone */
  .modal { padding: 32px 24px; }
  .modal-card {
    width: min(520px, 100%);
    padding: 36px 32px 30px;
    border-radius: 22px;
    max-height: 88vh;
  }
  .modal-icon { width: 64px; height: 64px; margin-bottom: 16px; }
  .modal-icon svg { width: 32px; height: 32px; }
  .modal-card h3 { font-size: 22px; }
  .modal-sub { font-size: 14px; margin-bottom: 20px; }
  .modal-form { gap: 12px; }
  .modal-form label > span { font-size: 11.5px; }
}

/* ---------- Phone (≤640): bottom-sheet refinements ---------- */
@media (max-width: 640px) {
  /* Bigger drag handle area, click-through to backdrop */
  .modal-card {
    padding: 36px 20px calc(20px + var(--safe-bottom, 0px));
    border-radius: 22px 22px 0 0;
    max-height: 92vh;
    /* Make modal scroll feel native */
    overscroll-behavior: contain;
  }
  .modal-card::before {
    top: 10px;
    width: 48px; height: 5px;
    background: rgba(255,255,255,0.22);
  }

  /* Close button — bigger touch target, doesn't clash with handle */
  .modal-close {
    width: 40px; height: 40px;
    margin: -4px -6px 0 0;
    font-size: 26px;
    background: rgba(20,20,24,0.94);
    border-color: rgba(255,255,255,0.12);
  }

  /* Header pack — center content, breathe */
  .modal-icon { width: 56px; height: 56px; margin-bottom: 14px; margin-top: 4px; }
  .modal-icon svg { width: 28px; height: 28px; }
  .modal-card h3 { font-size: 20px; line-height: 1.25; }
  .modal-sub { font-size: 14px; margin-bottom: 18px; line-height: 1.5; }

  /* Form fields — iOS-safe sizing, enough vertical rhythm */
  .modal-form { gap: 11px; }
  .modal-form label > span { font-size: 11px; letter-spacing: 0.08em; }
  .modal-form input,
  .modal-form textarea {
    padding: 14px 14px;
    font-size: 16px !important;  /* prevent iOS zoom */
    min-height: 50px;
    border-radius: 12px;
  }
  .modal-form textarea { min-height: 96px; }

  /* Sticky submit on phone — always reachable in long forms */
  .modal-form .btn[type="submit"],
  .modal-form button[type="submit"].btn {
    width: 100%;
    min-height: 52px;
    font-size: 14.5px;
    margin-top: 8px;
    position: sticky;
    bottom: var(--safe-bottom, 0px);
    z-index: 2;
  }

  /* Consent checkbox — readable & tappable on small screens */
  label.check { padding: 10px 4px; gap: 12px !important; }
  label.check input[type="checkbox"] { width: 22px; height: 22px; }
  label.check span { padding-left: 32px; font-size: 13px !important; line-height: 1.5; }
  label.check span::before { width: 22px; height: 22px; border-radius: 6px; }
  label.check span::after { left: 5.5px; top: 5px; width: 11px; height: 6px; }

  /* Inline order-form (.order-form-card) — match modal density */
  .order-form-section { padding: 56px 0 100px; }
  .order-form-card {
    padding: 32px 22px;
    border-radius: 22px;
  }
  .order-form-card .modal-form input,
  .order-form-card .modal-form textarea {
    font-size: 16px !important;
    min-height: 50px;
  }
  /* Inline form's submit can stay non-sticky (whole card is visible inline) */
  .order-form-card .modal-form .btn[type="submit"] {
    position: static;
    width: 100%;
  }
}

/* ---------- Small phone (≤420): final micro-tuning ---------- */
@media (max-width: 420px) {
  .modal-card { padding: 32px 18px calc(18px + var(--safe-bottom, 0px)); }
  .modal-icon { width: 52px; height: 52px; margin-bottom: 12px; }
  .modal-icon svg { width: 26px; height: 26px; }
  .modal-card h3 { font-size: 19px; }
  .modal-sub { font-size: 13.5px; margin-bottom: 16px; }
  .modal-form { gap: 10px; }
  .modal-form input,
  .modal-form textarea { padding: 12px 13px; min-height: 48px; }
  .modal-form textarea { min-height: 88px; }

  .order-form-card { padding: 28px 18px; border-radius: 20px; }
  .order-form-card .section-title {
    font-size: clamp(22px, 7vw, 30px) !important;
  }

  /* Catalog pages */
  .catalog-page-hero .section-sub {
    max-width: 100% !important;
    text-align: left !important;
  }

  /* Trade-In */
  .ti-title {
    font-size: clamp(28px, 9vw, 40px) !important;
  }
  .step-card .step-num {
    margin-top: -48px;
  }

  /* ---------- INSURANCE page ---------- */
  .ins-intro { padding: 22px 18px !important; }
  .panel-main { padding: 22px 18px !important; }
  .ins-cta-card { padding: 32px 18px !important; }

  /* ---------- REGISTRATION page ---------- */
  .penalty-amount { font-size: 36px !important; }
  .penalty-amount sup { font-size: 16px !important; }
  .alert-date strong { font-size: 26px !important; }
  .docs-aside .stat-row strong { font-size: 22px !important; }
  .dayof-card { padding: 28px 18px !important; }
  .reg-cta-card { padding: 32px 18px !important; }
  .deadline-main { padding: 22px 18px !important; }
  .reg-section-head { margin-bottom: 32px !important; }

  /* ---------- BUYOUT page ---------- */
  .def-card { padding: 28px 18px !important; }
  .def-stats { grid-template-columns: 1fr !important; }
  .by-cta-card { padding: 32px 18px !important; }
  .by-cta-card::after { font-size: 200px !important; right: -20px !important; }
  .by-path-name { font-size: 18px !important; }
  .by-paths-mark { width: 42px !important; height: 42px !important; }
}

/* ---------- Landscape phones — short height, prioritise viewport ---------- */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .modal-card {
    max-height: 96vh;
    padding-top: 24px;
  }
  .modal-icon { width: 44px; height: 44px; margin-bottom: 8px; }
  .modal-icon svg { width: 22px; height: 22px; }
  .modal-card h3 { font-size: 18px; margin-bottom: 4px; }
  .modal-sub { font-size: 13px; margin-bottom: 12px; }
  .modal-form { gap: 9px; }
  .modal-form .btn[type="submit"] { position: static; }
}

/* ---------- Touch device: tap states for form inputs ---------- */
@media (hover: none) and (pointer: coarse) {
  .modal-form input:focus,
  .modal-form textarea:focus {
    /* slightly stronger feedback on touch since :hover is irrelevant */
    box-shadow: 0 0 0 3px rgba(255,31,54,0.2);
  }
  /* Make the whole label clickable feel — increase hit area */
  .modal-form label { padding: 1px 0; }
}


/* ============================================================
   MOBILE TEXT-CLIP SAFETY NET (added)
   Prevents Russian italic gradient headlines from being clipped
   on the right edge in mobile WebKit / Safari. Pairs with the
   global rules at the end of styles.css.
   ============================================================ */
@media (max-width: 720px) {
  /* All italic gradient headlines: extra glyph space + no ancestor clipping */
  .hero-title em,
  .section-title em,
  .det-title em,
  .ti-title em,
  .by-title em,
  .ins-title em,
  .reg-title em,
  h1 em, h2 em, h3 em {
    display: inline-block;
    padding-right: 0.22em !important;
    margin-right: -0.04em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

  /* Long Russian words like "Премиальные" should NOT be hyphenated —
     they wrap to next line if needed, but font-size caps below ensure they fit. */
  .hero-title,
  .section-title,
  .det-title,
  .ti-title,
  .by-title,
  .ins-title,
  .reg-title {
    overflow-wrap: normal;
    word-break: keep-all;
    hyphens: manual;
    -webkit-hyphens: manual;
  }

  /* Container-level guard: page sections must not clip horizontally */
  .container { overflow: visible; }
  main, body { overflow-x: clip; }

  /* Let unbreakable Russian compound words wrap on narrow viewports (≤320 mainly) */
  .ins-title {
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    min-width: 0;
  }
  .ins-hero-inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  /* On the smallest screens give italic gradient text even more room */
  .hero-title em,
  .section-title em,
  h1 em, h2 em, h3 em {
    padding-right: 0.26em !important;
  }
  /* Drop letter-spacing slightly so words fit */
  .hero-title { letter-spacing: -0.025em; }
  .section-title { letter-spacing: -0.02em; }

  /* Hard cap font sizes so long Russian italic words physically fit
     within the content area. "Премиальные" / "автомобили" are ~10
     glyphs — at >=46px they overflow a 316px content box. */
  .hero-title { font-size: clamp(30px, 9.5vw, 44px) !important; }
  .det-title,
  .ti-title,
  .by-title,
  .ins-title,
  .reg-title { font-size: clamp(30px, 9.2vw, 42px) !important; }
  .section-title { font-size: clamp(24px, 7vw, 34px) !important; }
}

@media (max-width: 380px) {
  /* iPhone SE and narrower — pull in even tighter */
  .hero-title { font-size: clamp(26px, 9vw, 34px) !important; }
  .det-title,
  .ti-title,
  .by-title,
  .ins-title,
  .reg-title { font-size: clamp(26px, 8.8vw, 34px) !important; }
  .section-title { font-size: clamp(22px, 6.6vw, 30px) !important; }
}

/* ============================================================
   GLOBAL MOBILE SAFETY — prevent overflow, safe-area, touch
   ============================================================ */

/* ===== HARD OVERFLOW GUARD — prevents any element from causing horizontal scroll ===== */
@supports (overflow: clip) {
  html { overflow-x: clip; }
}
html {
  overflow-x: hidden;
  max-width: 100vw;
}

@media (max-width: 640px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Every section on the landing page must be clipped */
  .hero,
  .about,
  .brands,
  .catalog-preview,
  .order-cta-section,
  .services,
  .testimonials,
  .faq,
  .contacts,
  .site-footer,
  .order-hero,
  .ti-hero,
  .det-hero,
  .catalog-page-hero {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Container must never push wider than viewport */
  .container {
    max-width: 100vw;
    overflow: hidden;
  }

  /* Hero content must stay within viewport */
  .hero-content {
    max-width: 100vw;
    overflow: hidden;
  }

  /* Prevent featured-track and brands-track from overflowing */
  .featured-track,
  .brands-track {
    padding-left: 4px;
    padding-right: 4px;
  }

  /* Order CTA card — prevent overflow */
  .order-cta-card {
    max-width: 100%;
    overflow: hidden;
  }
  .order-cta-visual {
    max-width: 160px;
  }
  .order-cta-stats {
    gap: 12px;
  }
  .order-cta-stats > div {
    min-width: 0;
  }

  /* Footer bottom text must not overflow */
  .footer-bottom {
    max-width: 100%;
  }
  .footer-disclaimer {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Contacts info — address text wrapping */
  .info-block p {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Review text must wrap */
  .review p {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Service card text wrapping */
  .service-card p {
    overflow-wrap: break-word;
  }

  /* Catalog card body text */
  .cat-card-body p {
    overflow-wrap: break-word;
  }

  /* FAQ text */
  .faq-item summary {
    overflow-wrap: break-word;
    word-break: break-word;
    padding-right: 48px;
  }

  /* Ensure all buttons with text wrap properly */
  .btn {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Touch-friendly tap targets — minimum 44px */
  .nav-burger,
  .modal-close,
  .mobile-menu-close,
  .faq-toggle,
  .cat-tab,
  .cta-btn,
  .phone-link {
    min-height: 44px;
    min-width: 44px;
  }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .site-footer {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .mobile-menu-panel {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
  }

  ::selection {
    background: rgba(255, 31, 54, 0.3);
  }
}
