/* Мобильная версия (по макету 390 px) и планшеты: шапка с бургером, полноэкранное меню,
   hero с блоком преимуществ, карточки списков. Подключается последним. */

/* Элементы, которые существуют только в мобильной вёрстке */
.features, .mobile-menu, .lang-select, .news-card__go, .staff-card__go { display: none; }
.hero__t-mobile { display: none; }
.footer__search { display: none; }
.footer__chev { display: none; }

/* --- Подвал: колонки-«гармошка» на любых экранах (на десктопе всегда раскрыты) -- */
.footer__col > summary { list-style: none; cursor: default; }
.footer__col > summary::-webkit-details-marker { display: none; }

/* ========================================================================== */
/*  ≤1099 px: шапка с бургером                                                */
/* ========================================================================== */
@media (max-width: 1099px) {
  :root { --header-h: 64px; }

  .navbar { display: none; }
  .topbar__cta, .lang--desktop, .search { display: none; }
  .brand img { height: 40px; }
  .topbar__inner { gap: var(--s-3); }

  .burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; margin-right: -8px; border-radius: var(--r-md);
    font-size: 30px; color: var(--c-primary);
  }

  /* Компактный выбор языка «RU ▾» (главная) */
  .lang-select { display: block; position: relative; }
  .lang-select > summary {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
    border: 1px solid var(--c-border); border-radius: var(--r-md); font-weight: var(--fw-sb);
    font-size: 0.9375rem; cursor: pointer; list-style: none; background: transparent; color: inherit;
  }
  .lang-select > summary::-webkit-details-marker { display: none; }
  .lang-select[open] > summary .icon { rotate: 180deg; }
  .lang-select__list {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: var(--z-dropdown); min-width: 96px;
    padding: 6px; border-radius: var(--r-md); background: #fff; color: var(--c-text);
    box-shadow: var(--sh-lift); list-style: none;
  }
  .lang-select__list a {
    display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm);
    font-weight: var(--fw-sb);
  }
  .lang-select__list a:hover, .lang-select__list a[aria-current="true"] { background: var(--c-primary-50); color: var(--c-primary); }

  /* Шапка поверх hero на главной */
  .site-header--over-hero:not(.is-scrolled) .topbar { background: transparent; }
  .site-header--over-hero:not(.is-scrolled) .brand img { filter: brightness(0) invert(1); }
  .site-header--over-hero:not(.is-scrolled) .burger {
    color: #fff; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.35);
  }
  .site-header--over-hero:not(.is-scrolled) .lang-select > summary {
    color: #fff; border-color: rgba(255, 255, 255, 0.5); background: rgba(0, 0, 0, 0.12);
  }
  .site-header--over-hero .topbar { transition: background-color var(--t-base); }
  .hero { margin-top: calc(-1 * var(--header-h)); }
  .hero__inner { padding-top: calc(var(--header-h) + var(--s-6)); }

  /* --- Полноэкранное меню --------------------------------------------------- */
  html.is-menu-open, html.is-menu-open body { overflow: hidden; }

  .mobile-menu {
    display: block; position: fixed; inset: 0; z-index: var(--z-menu); overflow-y: auto;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: #fff; color: var(--c-text);
  }
  .mobile-menu[hidden] { display: none; }
  .mobile-menu__panel {
    position: relative; isolation: isolate; display: flex; flex-direction: column;
    min-height: 100%; min-height: 100dvh; padding: var(--s-3) var(--s-5) var(--s-5);
  }
  .mobile-menu__top { display: flex; align-items: center; gap: var(--s-3); min-height: 56px; }
  .mobile-menu__close {
    display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px;
    margin-right: -8px; font-size: 30px; color: var(--c-primary);
  }

  .segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); margin: var(--s-4) 0 var(--s-5); }
  .segmented__item {
    display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
    border: 1px solid var(--c-border); border-radius: var(--r-md); background: #fff;
    font-weight: var(--fw-sb); box-shadow: var(--sh-card);
  }
  .segmented__item[aria-current="true"] { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

  .mobile-nav { display: grid; }
  .mobile-nav__row, .mobile-nav__link--single { display: flex; align-items: stretch; }
  .mobile-nav__link {
    display: flex; flex: 1; align-items: center; gap: var(--s-5); min-height: 62px;
    font-size: 1.1875rem; font-weight: var(--fw-m);
  }
  .mobile-nav__icon { font-size: 28px; color: var(--c-primary); stroke-width: 1.5; flex: none; }
  .mobile-nav__go, .mobile-nav__toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 48px; flex: none;
    margin-left: auto; color: var(--c-primary); font-size: 22px;
  }
  .mobile-nav__toggle .icon { transition: rotate var(--t-fast); }
  .mobile-nav__toggle[aria-expanded="true"] .icon { rotate: 90deg; }
  .mobile-nav__sub { padding: 0 0 var(--s-3) calc(28px + var(--s-5)); display: grid; gap: 2px; }
  .mobile-nav__sub[hidden] { display: none; }
  .mobile-nav__sub a { display: flex; align-items: center; min-height: 46px; color: var(--c-text-muted); font-weight: var(--fw-m); }
  .mobile-nav__sub a:hover { color: var(--c-primary); }

  .mobile-menu__actions {
    margin-top: auto; padding-top: var(--s-8); display: grid; grid-template-columns: repeat(3, 1fr); text-align: center;
  }
  .mobile-menu__actions a { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-3) 0; font-size: 0.875rem; font-weight: var(--fw-m); }
  .mobile-menu__actions .icon { font-size: 32px; color: var(--c-primary); stroke-width: 1.5; }

  /* светлая тема: едва заметный силуэт здания внизу */
  .mobile-menu--light .mobile-menu__panel::before {
    content: ""; position: absolute; inset: auto 0 0 0; height: 48%; z-index: -1; opacity: 0.14;
    background: var(--menu-bg, none) center bottom / cover no-repeat; filter: grayscale(1);
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45%, #000 70%, transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 45%, #000 70%, transparent);
  }

  /* тёмная тема */
  .mobile-menu--dark { background: linear-gradient(180deg, var(--c-dark-menu-a), var(--c-dark-menu-b)); color: #fff; }
  .mobile-menu--dark .mobile-menu__panel::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.22;
    background: var(--menu-bg, none) center / cover no-repeat; mix-blend-mode: luminosity;
  }
  .mobile-menu--dark .brand img { filter: none; }
  .mobile-menu--dark .mobile-menu__close { color: #fff; }
  .mobile-menu--dark .lang-select > summary { color: #fff; border-color: rgba(255, 255, 255, 0.5); }
  .mobile-menu--dark .mobile-nav { margin-top: var(--s-8); }
  .mobile-menu--dark .mobile-nav__item { border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
  .mobile-menu--dark .mobile-nav__link { min-height: 54px; font-size: 1.0625rem; }
  .mobile-menu--dark .mobile-nav__go, .mobile-menu--dark .mobile-nav__toggle { color: #fff; }
  .mobile-menu--dark .mobile-nav__sub a { color: rgba(255, 255, 255, 0.78); }
  .mobile-menu__foot { margin-top: var(--s-8); display: grid; gap: var(--s-4); }
  .mobile-menu__foot p { font-size: 0.875rem; line-height: 1.5; color: rgba(255, 255, 255, 0.62); }
  .mobile-menu--dark .socials a { color: #fff; }
}

/* ========================================================================== */
/*  ≤767 px: телефон                                                           */
/* ========================================================================== */
@media (max-width: 767px) {
  :root { --gutter: 16px; }

  .page-head { padding-top: var(--s-4); padding-bottom: var(--s-4); }
  .breadcrumbs { font-size: 0.875rem; margin-bottom: var(--s-2); }
  .page-head__title { font-size: 1.75rem; line-height: 1.15; }
  .section { padding-block: var(--s-6); }
  .section__title { font-size: 1.375rem; }

  .btn--lg { min-height: 56px; font-size: 1rem; }

  /* --- Hero на весь экран ---------------------------------------------------- */
  .hero {
    display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh;
  }
  .hero__slides { position: absolute; inset: 0; }
  .hero__overlay {
    background: linear-gradient(180deg, rgba(150, 10, 25, 0.94) 0%, rgba(150, 10, 25, 0.78) 34%,
      rgba(150, 10, 25, 0.18) 60%, rgba(108, 5, 9, 0.78) 100%);
  }
  .hero__overlay::after { display: none; }
  .hero__bg { object-position: 62% center; }
  .hero__slide { display: flex; flex-direction: column; }
  .hero__inner { flex: 1; padding-bottom: calc(110px + var(--s-4)); justify-content: flex-start; min-height: 0; }
  .hero__content { max-width: none; display: flex; flex: 1; flex-direction: column; }
  .hero__eyebrow { display: none; }
  .hero__t-desktop { display: none; }
  .hero__t-mobile { display: inline; }
  .hero__title { font-size: clamp(1.75rem, 7.4vw, 2.25rem); line-height: 1.1; }
  .hero__subtitle { font-size: 1.0625rem; max-width: none; margin-top: var(--s-4); }
  .hero__actions { flex-direction: column; align-items: stretch; gap: var(--s-3); margin-top: auto; padding-top: var(--s-8); }
  .hero__actions .btn { width: 100%; justify-content: center; }
  .hero__actions .btn--outline-light { background: #fff; color: var(--c-primary); border-color: #fff; }
  .hero__arrows { display: none; }
  .hero__dots { justify-content: center; margin-top: var(--s-4); }

  .features {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); list-style: none;
    position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
    padding: var(--s-4) var(--s-3) calc(var(--s-4) + env(safe-area-inset-bottom));
    background: var(--c-mobile-bar); color: #fff; text-align: center;
  }
  .features__item { display: grid; justify-items: center; gap: var(--s-2); font-size: 0.8125rem; line-height: 1.25; font-weight: var(--fw-m); }
  .features__icon { font-size: 30px; stroke-width: 1.4; }

  /* --- Быстрые ссылки и главные блоки --------------------------------------- */
  .quick { margin-top: 0; }
  .quick__panel { border-radius: 0; box-shadow: none; padding: var(--s-4) 0 0; }
  .quick__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* вертикальная плитка: иконка сверху, текст на всю ширину, стрелка в углу */
  .quick-card {
    position: relative; flex-direction: column; align-items: flex-start; gap: var(--s-3);
    min-height: 124px; padding: var(--s-4);
  }
  .quick-card__text { width: 100%; }
  .quick-card__title { font-size: 0.9375rem; }
  .quick-card__sub { font-size: 0.75rem; }
  .quick-card .round-btn { position: absolute; top: var(--s-3); right: var(--s-3); }

  .news-strip { border: 0; border-radius: 0; background: transparent; }
  .news-item { padding: var(--s-4) 0; gap: var(--s-4); }
  .news-item + .news-item { border-top: 1px solid var(--c-border-soft); }
  .news-item__media { width: 104px; max-width: none; }
  .news-item__media img, .news-item__placeholder { aspect-ratio: 3 / 4.2; }
  .news-item__title { font-size: 1.0625rem; -webkit-line-clamp: 3; }
  .news-item__excerpt { font-size: 0.9375rem; margin-right: 0; -webkit-line-clamp: 4; }
  .news-item .round-btn { display: none; }

  /* Карточка направления: фото сверху, подпись и стрелка снизу */
  .dir-grid, .dir-grid--page { grid-template-columns: 1fr !important; gap: var(--s-4); }
  .dir-card {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "media media" "body go";
    min-height: 0 !important; align-items: center; border-radius: var(--r-lg); box-shadow: var(--sh-card);
  }
  .dir-card__media {
    position: static; grid-area: media; width: 100%; height: auto; aspect-ratio: 16 / 8;
    -webkit-mask-image: none; mask-image: none;
  }
  .dir-card__body { grid-area: body; width: auto; padding: var(--s-4); gap: 0; }
  .dir-card__icon, .dir-card .field__hint { display: none; }
  .dir-card__title { font-size: 1.125rem; }
  .dir-card .round-btn { position: static; grid-area: go; margin: 0 var(--s-4) 0 0; box-shadow: none; border: 1px solid var(--c-primary-200); color: var(--c-primary); width: 36px; height: 36px; }

  /* --- Цифры ---------------------------------------------------------------- */
  .stats-band__list { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4) var(--s-2); padding: var(--s-5) var(--gutter); }
  .stat { padding-inline: 0; }
  .stat--text { grid-column: 1 / -1; }
  .stats-band__label, .stats-band__quote { padding-inline: var(--gutter); }

  /* --- Список новостей: фото слева, красный шеврон справа --------------------- */
  .news-grid { gap: 0; }
  .news-card {
    display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--s-4);
    border: 0; border-radius: 0; border-top: 1px solid var(--c-border-soft); padding: var(--s-4) 0;
    background: transparent; box-shadow: none !important; transform: none !important;
  }
  .news-grid > li:first-child .news-card { border-top: 0; }
  .news-card__media img, .news-card__placeholder { aspect-ratio: 3 / 4.2; border-radius: var(--r-md); }
  .news-card__body { padding: 0; gap: var(--s-1); position: relative; padding-right: 24px; }
  .news-card__go { display: inline-flex; position: absolute; right: 0; top: 0; color: var(--c-primary); font-size: 20px; }
  .news-card__title { font-size: 1.0625rem; }
  .news-card__excerpt { font-size: 0.9375rem; -webkit-line-clamp: 4; }

  .chips, .tabs { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .tab { background: var(--c-surface); border-color: transparent; }
  .tab[aria-selected="true"] { background: var(--c-primary); color: #fff; }

  /* --- Структура: строка «фото — должность — ФИО — шеврон» ----------------- */
  .staff-grid { grid-template-columns: 1fr; gap: var(--s-3); }
  .staff-card {
    flex-direction: row; align-items: center; gap: var(--s-4); padding: var(--s-2); border-radius: var(--r-lg);
    box-shadow: var(--sh-card); transform: none !important;
  }
  .staff-card__photo { flex: none; width: 108px; }
  .staff-card__photo img, .staff-card__placeholder { aspect-ratio: 4 / 3; border-radius: var(--r-md); }
  .staff-card__body { padding: 0; flex: 1; min-width: 0; }
  .staff-card__position { font-size: 1.0625rem; color: var(--c-text); text-transform: none; letter-spacing: 0; }
  .staff-card__name { font-size: 0.9375rem; font-weight: var(--fw-m); color: var(--c-text-muted); }
  .staff-card__go { display: inline-flex; color: var(--c-primary); font-size: 22px; margin-right: var(--s-2); }

  /* --- Документы -------------------------------------------------------------- */
  .doc-list { border: 0; display: grid; gap: var(--s-2); border-radius: 0; }
  .doc-row { background: var(--c-surface); border-radius: var(--r-lg); padding: var(--s-3) var(--s-4); }
  .doc-row + .doc-row { border-top: 0; }
  .doc-row__title { font-size: 1.0625rem; font-weight: var(--fw-m); line-height: 1.25; }

  /* --- Страницы раздела и список «Абитуриентам» ----------------------------- */
  .page-cover { border-radius: var(--r-xl); margin-bottom: var(--s-5); }
  .prose { font-size: 1.0625rem; }
  .info-cards { margin-top: var(--s-5); }
  .link-rows { border-top: 0; display: grid; gap: var(--s-2); max-width: none; margin-top: var(--s-5); }
  .link-row { background: var(--c-surface); border-radius: var(--r-lg); border-bottom: 0; padding: var(--s-4); }
  .link-row .icon--chev { color: var(--c-primary); }

  /* --- Контакты: карта сверху ---------------------------------------------- */
  .contact-grid > div:last-child { order: -1; }
  .map { min-height: 230px; border-radius: var(--r-xl); }
  .map .leaflet-tile-pane { filter: grayscale(0.55) contrast(0.92) brightness(1.06); }
  .contact-list { gap: var(--s-5); }

  /* --- Подвал: колонки-гармошка ---------------------------------------------- */
  .site-footer { margin-top: var(--s-10); }
  .footer__grid { grid-template-columns: 1fr; gap: 0; padding-block: var(--s-6); }
  .footer__brand { padding-bottom: var(--s-5); }
  .footer__search { display: flex; border-radius: var(--r-md); background: rgba(255, 255, 255, 0.12); overflow: hidden; }
  .footer__search input { flex: 1; min-width: 0; min-height: 48px; padding: 0 var(--s-4); background: transparent; border: 0; color: #fff; font-size: 1rem; }
  .footer__search input::placeholder { color: rgba(255, 255, 255, 0.7); }
  .footer__search button { width: 52px; font-size: 20px; color: #fff; }
  .footer__col { border-top: 1px solid rgba(255, 255, 255, 0.14); }
  .footer__col > summary {
    display: flex; align-items: center; justify-content: space-between; min-height: 52px; margin: 0;
    cursor: pointer; font-size: 1rem;
  }
  .footer__chev { display: inline-block; transition: rotate var(--t-fast); }
  .footer__col[open] .footer__chev { rotate: 180deg; }
  .footer__links { padding-bottom: var(--s-4); gap: 2px; font-size: 0.9375rem; }
  .footer__links a { display: inline-flex; align-items: center; min-height: 40px; }
  .footer__col--contacts { padding-top: var(--s-4); }
  .footer__contacts { font-size: 0.9375rem; }
}

@media (min-width: 768px) {
  .footer__col > summary { pointer-events: none; }
}

/* --- Очень узкие экраны (320–359 px) ------------------------------------------- */
@media (max-width: 359px) {
  .brand img { height: 32px; }
  .topbar__inner { gap: var(--s-2); }
  .lang-select > summary { min-height: 36px; padding: 0 10px; font-size: 0.875rem; }
  .burger { width: 40px; height: 40px; margin-right: -4px; font-size: 26px; }
  .hero__title { font-size: 1.625rem; }
}
@media (max-width: 767px) {
  .section__head { flex-wrap: wrap; row-gap: var(--s-2); }
  .search-page__form input { min-width: 0; }
  .search-page__form .btn { flex: none; }
}

@media (max-width: 767px) {
  /* длинные подписи кнопок переносятся, а не вылезают за экран */
  .btn { white-space: normal; text-align: center; line-height: 1.25; padding-block: 12px; }

  /* контакты: подпись жирная тёмная, значение — спокойное серое (как на макете) */
  .contact-list h2 { color: var(--c-text); font-size: 1.0625rem; font-weight: var(--fw-b); margin-bottom: 2px; }
  .contact-list p, .contact-list a { font-size: 1rem; font-weight: var(--fw-m); color: #4b5563; }
  .contact-list .contact-note { color: var(--c-text-muted); }
  .map .leaflet-control-zoom { display: none; }
}
