/* ==========================================================================
   МОБИЛЬНЫЕ СТИЛИ v3 — устойчивая мобильная версия
   Активны только на экранах до 768px. Десктоп не затрагивается.
   ========================================================================== */
@media (max-width: 768px) {

  /* === БАЗОВАЯ УСТОЙЧИВОСТЬ — никакого горизонтального скролла страницы === */
  html, body { overflow-x: hidden !important; max-width: 100vw !important; }
  * { max-width: 100% !important; }
  img, svg { max-width: 100% !important; height: auto; }
  
  /* отдельно ограничим — иначе раздуют контейнер */
  h1, h2, h3, h4, p { word-wrap: break-word; overflow-wrap: break-word; hyphens: auto; }

  /* === SHELL === */
  .shell { padding: 0 20px !important; box-sizing: border-box !important; }

  /* === TOP BAR + БУРГЕР === */
  .topbar {
    padding: 18px 0 16px !important;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
  }
  .logo-text .name { font-size: 16px !important; }
  .logo-text .sub  { font-size: 8.5px !important; letter-spacing: 0.18em !important; }
  .logo-mark { width: 36px !important; height: 36px !important; }

  .topnav { display: none !important; }
  .topbar-right .contact-cta { display: none !important; }

  .burger-btn {
    display: flex !important;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--ink);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 0;
  }
  .burger-btn span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: var(--ink);
    transition: transform .3s, opacity .3s;
  }
  .burger-btn.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .burger-btn.is-open span:nth-child(2) { opacity: 0; }
  .burger-btn.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--green);
    color: var(--bg);
    z-index: 99;
    transform: translateX(100%);
    transition: transform .4s cubic-bezier(.7,0,.3,1);
    padding: 90px 28px 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-sizing: border-box;
  }
  .mobile-menu.is-open { transform: translateX(0); }
  .mobile-menu a {
    color: var(--bg);
    text-decoration: none;
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    line-height: 1.25;
    padding: 18px 0;
    border-bottom: 1px solid rgba(237, 232, 222, 0.18);
    display: block;
  }
  .mobile-menu .menu-cta {
    margin-top: auto;
    padding-top: 28px;
    border: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(237, 232, 222, 0.7);
  }
  .mobile-menu .menu-cta a { font-family: inherit; font-size: 13px; border: 1px solid var(--bg); padding: 14px 22px; display: inline-block; margin-top: 12px; }

  /* === HERO === */
  .hero {
    grid-template-columns: 1fr !important;
    padding: 32px 0 48px !important;
    min-height: auto !important;
    gap: 24px !important;
  }
  .hero-meta { position: static !important; margin-bottom: 16px; font-size: 9px !important; }
  .hero-eyebrow { display: none !important; }
  .hero h1 { font-size: clamp(28px, 8.5vw, 38px) !important; line-height: 1.08 !important; margin-bottom: 24px !important; }

  .hero-art {
    position: relative !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    width: 100% !important;
    margin: 24px 0 0 !important;
    min-height: auto !important;
    height: auto !important;
  }
  .hero-art svg, .hero-art svg.architecture {
    flex: 1 1 auto !important;
    max-width: 65% !important;
    width: auto !important;
    height: auto !important;
    max-height: 280px !important;
    display: block !important;
    margin: 0 !important;
  }
  .hero-logos {
    flex: 0 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    width: 32% !important;
    max-width: 110px !important;
    position: static !important;
  }
  .hero-logos .hero-logo {
    height: auto !important;
    max-height: 56px !important;
    max-width: 100% !important;
    width: auto !important;
    display: block !important;
    opacity: 1 !important;
  }

  /* === SECTION HEADERS === */
  .sec-head { margin-bottom: 24px !important; }
  .sec-num  { font-size: 10px !important; letter-spacing: 0.2em !important; }
  .sec-title { font-size: clamp(26px, 7vw, 32px) !important; line-height: 1.1 !important; }

  /* === БЛОК 2: ПРАКТИКИ — горизонтальная карусель === */
  /* ВАЖНО: карусель внутри shell, а shell имеет padding 20px.
     Чтобы расширить карусель до края экрана — используем calc, который ровно
     компенсирует padding shell. Это безопасно от выхода за экран. */
  #practices .practice-grid {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scroll-snap-type: x mandatory !important;
    scroll-behavior: smooth !important;
    margin-left: -20px !important;
    margin-right: -20px !important;
    padding: 8px 20px 24px !important;
    grid-template-columns: none !important;
    border-left: none !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }
  #practices .practice-card {
    flex: 0 0 calc(100vw - 80px) !important;
    width: calc(100vw - 80px) !important;
    min-width: calc(100vw - 80px) !important;
    max-width: calc(100vw - 80px) !important;
    min-height: 360px !important;
    scroll-snap-align: start !important;
    padding: 28px 24px !important;
    border-left: 1px solid var(--hairline) !important;
    box-sizing: border-box !important;
  }
  #practices .practice-card h3 { font-size: 24px !important; line-height: 1.15 !important; }
  #practices .practice-card .pc-illu { width: 130px !important; height: 130px !important; right: -16px !important; bottom: -16px !important; }

  /* === БЛОК 3: ПАРТНЁРЫ === */
  #partners .partners {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scroll-snap-type: x mandatory !important;
    scroll-behavior: smooth !important;
    margin-left: -20px !important;
    margin-right: -20px !important;
    padding: 8px 20px 24px !important;
    grid-template-columns: none !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }
  #partners .partner {
    flex: 0 0 calc(100vw - 80px) !important;
    width: calc(100vw - 80px) !important;
    min-width: calc(100vw - 80px) !important;
    max-width: calc(100vw - 80px) !important;
    scroll-snap-align: start !important;
    box-sizing: border-box !important;
  }
  #partners .partner-photo {
    aspect-ratio: 4/5 !important;
    max-height: 65vh !important;
  }
  #partners .partner-name { font-size: 24px !important; }

  /* === БЛОК 7: TELEGRAM === */
  #telegram .tg-grid {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scroll-snap-type: x mandatory !important;
    scroll-behavior: smooth !important;
    margin-left: -20px !important;
    margin-right: -20px !important;
    padding: 8px 20px 24px !important;
    grid-template-columns: none !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }
  #telegram .tg-card {
    flex: 0 0 calc(100vw - 80px) !important;
    width: calc(100vw - 80px) !important;
    min-width: calc(100vw - 80px) !important;
    max-width: calc(100vw - 80px) !important;
    scroll-snap-align: start !important;
    padding: 24px !important;
    box-sizing: border-box !important;
  }

  /* === БЛОК 5: РЕЙТИНГИ === */
  .ratings-publishers { grid-template-columns: 1fr !important; gap: 12px !important; padding-bottom: 28px !important; margin-bottom: 28px !important; }
  .rp-card { padding: 18px 20px !important; gap: 14px !important; }
  .rp-mark { width: 44px !important; height: 44px !important; font-size: 18px !important; }
  .rp-name { font-size: 17px !important; }
  .rp-sub  { font-size: 9px !important; }
  .nominations-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .nom-card { padding: 28px 20px !important; min-height: auto !important; }
  .nom-laurel { width: 70px !important; height: 70px !important; }
  .nom-title { font-size: 17px !important; }

  /* === БЛОК 4: О КОМПАНИИ === */
  .about { padding: 60px 0 !important; }
  .about .principles { grid-template-columns: 1fr !important; gap: 24px !important; }

  /* === БЛОК 8: НОВОСТИ === */
  .news-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .news-grid.carousel {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 8px 0 24px !important;
    scroll-padding-left: 0 !important;
    box-sizing: border-box !important;
  }
  .news-grid.carousel .news-card {
    flex: 0 0 calc(100vw - 80px) !important;
    width: calc(100vw - 80px) !important;
    min-width: calc(100vw - 80px) !important;
    padding: 22px 4px 0 !important;
    box-sizing: border-box !important;
  }
  /* Контейнер #news удерживает shell-padding 20px, карусель не выходит за края */
  #news .shell { overflow: hidden !important; }

/* === FOOTER — скрыть только Направления и Компания === */
  footer { padding: 40px 0 24px !important; }
  .foot-top {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
    padding-bottom: 28px !important;
  }
  /* Скрываем 1-ю и 2-ю колонку футера (Направления, Компания).
     foot-brand идёт первой, поэтому foot-col 1 и 2 — это Направления и Компания.
     Третья .foot-col (Контакты + Документы) остаётся видимой. */
  .foot-top > .foot-col:nth-of-type(1) { display: none !important; }
  .foot-top > .foot-col:nth-of-type(2) { display: none !important; }
  .foot-col h5 { font-size: 9px !important; margin-bottom: 14px !important; }
  .foot-col li { padding: 5px 0 !important; }
  .foot-col a  { font-size: 13px !important; }
  .foot-brand p { font-size: 13px !important; max-width: none !important; }
  .foot-bot {
    flex-direction: column !important;
    gap: 14px !important;
    font-size: 9.5px !important;
    align-items: flex-start !important;
  }
  
  /* === ОБЩЕЕ === */
  section { padding: 48px 0 !important; }
  #home, .hero { padding: 24px 0 32px !important; }

  .contact-section { padding: 60px 0 !important; }
  .contact-section .sec-title { font-size: clamp(28px, 8vw, 36px) !important; }

  .hero h1 .word { animation-delay: 0s !important; }
}

/* Бургер только на мобильном */
.burger-btn { display: none; }
.mobile-menu { display: none; }
@media (max-width: 768px) {
  .mobile-menu { display: flex; }
}

/* ==========================================================================
   БОЛЬШИЕ АЙФОНЫ — Pro Max, Plus
   iPhone 16/15/14 Pro Max + Plus: 430×932
   Активируется на 414-768px (захватывает Pro Max + Plus + большие Android)
   ВАЖНО: shell padding остаётся 20px, чтобы карусели не выходили за экран
   ========================================================================== */
@media (min-width: 414px) and (max-width: 768px) {

  /* SHELL — НЕ увеличиваем padding больше чем у базовых правил,
     иначе margin -20 создаст переполнение. Вместо этого добавляем
     внутренний padding контента, не трогая carousel margin. */

  /* === TOP BAR — крупнее === */
  .logo-text .name { font-size: 18px !important; }
  .logo-text .sub  { font-size: 9.5px !important; }
  .logo-mark { width: 42px !important; height: 42px !important; }
  .burger-btn { width: 44px; height: 44px; }
  .burger-btn span { width: 20px; }

  /* === MOBILE MENU === */
  .mobile-menu { padding: 100px 32px 40px; }
  .mobile-menu a { font-size: 32px; padding: 22px 0; }

  /* === HERO === */
  .hero { padding: 40px 0 56px !important; gap: 32px !important; }
  .hero-meta { font-size: 10px !important; }
  .hero h1 { font-size: clamp(34px, 8vw, 44px) !important; }
  .hero-art { gap: 24px !important; margin: 32px 0 0 !important; }
  .hero-art svg, .hero-art svg.architecture { max-height: 320px !important; max-width: 62% !important; }
  .hero-logos { width: 34% !important; max-width: 130px !important; gap: 22px !important; }
  .hero-logos .hero-logo { max-height: 64px !important; }

  /* === SECTIONS === */
  .sec-num   { font-size: 10.5px !important; }
  .sec-title { font-size: clamp(30px, 7.5vw, 38px) !important; }

  /* === КАРУСЕЛИ — ширина карточки чуть шире, gap чуть больше.
     ВАЖНО: margin остаётся -20px (как у shell padding), не -28!
     calc(100vw - 80px) даёт ~350px на 430px-экране — это нормально. */
  #practices .practice-grid,
  #partners .partners,
  #telegram .tg-grid,
  .news-grid.carousel {
    gap: 18px !important;
  }

  /* === БЛОК 2: КАРТОЧКИ ВЫШЕ === */
  #practices .practice-card { min-height: 400px !important; padding: 32px 28px !important; }
  #practices .practice-card h3 { font-size: 28px !important; }
  #practices .practice-card .pc-illu { width: 150px !important; height: 150px !important; }

  /* === БЛОК 3: ИМЯ КРУПНЕЕ === */
  #partners .partner-name { font-size: 28px !important; }

  /* === БЛОК 7: PADDING ВНУТРИ === */
  #telegram .tg-card { padding: 28px !important; }

  /* === БЛОК 5: КРУПНЕЕ === */
  .rp-card { padding: 22px 24px !important; gap: 16px !important; }
  .rp-mark { width: 50px !important; height: 50px !important; font-size: 20px !important; }
  .rp-name { font-size: 19px !important; }
  .nom-card { padding: 32px 24px !important; }
  .nom-laurel { width: 80px !important; height: 80px !important; }
  .nom-title { font-size: 19px !important; }

  /* === ОБЩЕЕ === */
  section { padding: 56px 0 !important; }
}