/* ==========================================================================
   Каркас: шапка, подвал, мобильное меню, окно ввода номера, QR-сканер.
   Шапка и подвал — по одному компоненту на все страницы (README, §2).
   ========================================================================== */

/* ── Логотип ─────────────────────────────────────────────────────────────── */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo__mark {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--cream);
}

.logo__mark .icon {
  width: 21px;
  height: 21px;
}

.logo__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.logo__kicker {
  color: var(--muted-on-dark);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  white-space: nowrap;
}

.logo__name {
  width: 176px;
  max-width: 100%;
  color: var(--cream);
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
}

/* В подвале логотип набран обычным начертанием и светлее. */
.logo--footer .logo__mark {
  width: 36px;
  height: 36px;
  color: var(--bg);
}

.logo--footer .logo__mark .icon {
  width: 20px;
  height: 20px;
}

.logo--footer .logo__kicker,
.logo--footer .logo__name {
  font-weight: 400;
}

.logo--footer .logo__name {
  width: 200px;
  color: var(--bg);
}

@media (min-width: 768px) {
  .logo--footer {
    gap: 11px;
  }

  .logo--footer .logo__mark {
    width: 40px;
    height: 40px;
  }

  .logo--footer .logo__mark .icon {
    width: 22px;
    height: 22px;
  }

  .logo--footer .logo__kicker {
    font-size: 8px;
    letter-spacing: 1px;
  }

  .logo--footer .logo__name {
    width: auto;
    font-size: 12.5px;
    line-height: normal;
    white-space: nowrap;
  }
}

/* ── Шапка ───────────────────────────────────────────────────────────────── */
.site-header {
  position: relative;
  z-index: 20;
  padding: 14px 14px 0;
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--container);
  margin-inline: auto;
  padding: 10px 10px 10px 12px;
  border-radius: var(--radius-10);
  background: var(--ink);
}

.site-nav {
  display: none;
}

.site-header__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-5);
}

.header-btn--scan {
  background: var(--accent);
  color: #fff;
}

.header-btn--scan .icon {
  width: 19px;
  height: 19px;
}

.header-btn--menu {
  background: var(--cream);
  color: var(--ink);
}

.header-btn--menu .icon {
  width: 20px;
  height: 20px;
}

.header-btn--number {
  display: none;
}

@media (min-width: 768px) {
  .site-header {
    padding-inline: var(--gutter);
  }
}

/* Навигация в шапке помещается только от 1200 px (README, §2). */
@media (min-width: 1200px) {
  .site-header {
    padding-top: 20px;
  }

  /* Три колонки 1fr · auto · 1fr — навигация ровно по центру шапки, хотя
     логотип и кнопка разной ширины. Если боковой колонке не хватает места,
     сетка сама сдвигает навигацию, но не даёт блокам наехать друг на друга. */
  .site-header__bar {
    display: grid;
    grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
    gap: 16px;
    padding: 12px; /* слева 16 px по макету — добран отступом логотипа, чтобы центр не съезжал */
    border-radius: var(--radius-12);
  }

  .site-header .logo {
    gap: 11px;
  }

  .site-header .logo__mark {
    width: 42px;
    height: 42px;
  }

  .site-header .logo__mark .icon {
    width: 23px;
    height: 23px;
  }

  .site-header .logo__kicker {
    font-size: 8px;
    letter-spacing: 1px;
  }

  /* До 1560 px название логотипа в две строки: в одну строку навигация на 1340–1559 px
     вплотную (16 px) прижимается к логотипу. */
  .site-header .logo__name {
    width: 185px;
    font-size: 12.5px;
    line-height: 16px;
  }

  .site-header .logo,
  .header-btn--number {
    flex: none;
  }

  .site-header .logo {
    justify-self: start;
    margin-left: 4px;
  }

  .site-header__actions {
    justify-self: end;
  }

  .site-nav {
    display: flex;
    align-items: center;
    gap: clamp(18px, 1.95vw - 6px, 28px);
  }

  .site-nav a {
    padding: 6px 0;
    color: #fff;
    font-size: 13px;
    font-weight: 300;
    white-space: nowrap;
    transition: opacity 0.15s ease;
  }

  .site-nav a:hover {
    opacity: 0.7;
  }

  .header-btn--scan,
  .header-btn--menu {
    display: none;
  }

  .header-btn--number {
    display: inline-flex;
    gap: 8px;
    width: auto;
    height: 42px;
    padding: 0 14px;
    border-radius: var(--radius-8);
    background: var(--accent);
    color: var(--bg);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
  }

  .header-btn--number .icon {
    width: 16px;
    height: 16px;
  }
}

/* «Экспозиция выставки» длиннее прежних пунктов: на 1200–1279 px навигация чуть плотнее
   (кегль 12.5 вместо 13, просветы 14 px), иначе кнопка «Номер экспоната» вылезает за шапку. */
@media (min-width: 1200px) and (max-width: 1279.98px) {
  .site-nav {
    gap: 14px;
  }

  .site-nav a {
    font-size: 12.5px;
  }
}

@media (min-width: 1560px) {
  .site-header .logo__name {
    width: auto;
    white-space: nowrap;
  }
}

/* ── Подвал ──────────────────────────────────────────────────────────────── */
.site-footer {
  padding: 32px 0 26px;
  border-radius: var(--radius-footer) var(--radius-footer) 0 0;
  background: var(--brown);
  color: var(--bg);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.site-footer__cols {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* На мобайле блоки разделены линиями: 22 px — линия — 22 px. */
.site-footer__nav,
.site-footer__contacts,
.site-footer__bottom {
  padding-top: 22px;
  border-top: 1px solid var(--line-on-dark);
}

.site-footer__org {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-footer__address {
  color: var(--muted-on-dark);
  font-size: 11px;
  font-weight: 300;
  line-height: 17px;
}

.site-footer__label {
  color: var(--muted-on-dark);
  font-size: 8px;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Просвет 24 px: «Экспозиция выставки» длинная, при 12 px колонки почти сливались. */
.site-footer__nav-cols {
  display: flex;
  gap: 24px;
}

.site-footer__nav-cols ul {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 11px;
}

/* Зона нажатия выше строки (25 px вместо 15) — без изменения вида и отступов. */
.site-footer__nav-cols a {
  display: inline-block;
  margin-block: -5px;
  padding-block: 5px;
  font-size: 12px;
  white-space: nowrap;
}

.site-footer__contacts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer__contact {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  white-space: nowrap;
}

.site-footer__contact .icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

/* Соцсети — на всех ширинах (ТЗ 4.2); в мобильном макете их не было. */
.site-footer__socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer__social {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: var(--radius-8);
  background: var(--fill-on-dark);
  font-size: 11.5px;
  white-space: nowrap;
}

.site-footer__social .icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.site-footer__bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 10px;
}

.site-footer__copyright {
  color: var(--muted-on-dark);
  font-weight: 300;
  line-height: 16px;
}

/* «Порядок посещения» и «Политика…» — рядом, при нехватке места переносятся. */
.site-footer__docs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

@media (hover: hover) {
  .site-footer a:hover {
    opacity: 0.8;
  }
}

@media (min-width: 768px) {
  .site-footer {
    padding: 56px 0 32px;
  }

  .site-footer__inner {
    gap: 36px;
  }

  /* Планшет: учреждение во всю ширину, разделы и контакты — в две колонки. */
  .site-footer__cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
  }

  .site-footer__org {
    grid-column: 1 / -1;
  }

  .site-footer__nav,
  .site-footer__contacts {
    padding-top: 0;
    border-top: 0;
  }

  .site-footer__org {
    gap: 16px;
  }

  .site-footer__address {
    font-size: 12px;
    line-height: 19px;
  }

  .site-footer__nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .site-footer__label {
    font-size: 8.5px;
    letter-spacing: 1px;
  }

  .site-footer__nav-cols {
    gap: 32px;
  }

  .site-footer__nav-cols ul {
    gap: 13px;
  }

  .site-footer__nav-cols a {
    font-size: 13px;
  }

  .site-footer__contacts {
    gap: 16px;
  }

  .site-footer__contact {
    gap: 10px;
    font-size: 14px;
  }

  .site-footer__contact .icon {
    width: 16px;
    height: 16px;
  }

  .site-footer__contact {
    white-space: normal;
  }

  .site-footer__bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding-top: 36px;
    font-size: 11px;
  }

  .site-footer__copyright {
    line-height: normal;
  }

  .site-footer__docs {
    flex: none;
    gap: 8px 28px;
  }

  .site-footer__policy {
    white-space: nowrap;
  }
}

@media (min-width: 1200px) {
  .site-footer__cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .site-footer__org {
    grid-column: auto;
  }

  .site-footer__contact {
    white-space: nowrap;
  }
}

/* ── Оверлеи: общее ──────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.overlay__backdrop {
  position: absolute;
  inset: 0;
}

/* При открытии фокус ставится на сам диалог — без обводки. */
[data-dialog-focus]:focus {
  outline: none;
}

/* ── Мобильное меню (y2erJq) ─────────────────────────────────────────────── */
.site-menu .overlay__backdrop {
  background: rgb(27 25 23 / 0.8);
}

.site-menu__panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 14px 16px 30px;
  overflow-y: auto;
  background: var(--ink);
  color: var(--cream);
}

/* На низком экране (iPhone SE, 360 × 640) панель прокручивается, а не сжимает
   кнопку «Найти экспонат» и контакты. */
.site-menu__panel > * {
  flex-shrink: 0;
}

/* Шапка меню повторяет шапку страницы (отступы .site-header и .site-header__bar):
   логотип и крестик стоят там же, где логотип и кнопка меню. */
.site-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-inline: -2px;
  padding: 10px 10px 10px 12px;
}

.site-menu__close {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-5);
  background: var(--cream);
  color: var(--ink);
}

.site-menu__close .icon {
  width: 20px;
  height: 20px;
}

/* Пункты по центру между шапкой меню и кнопкой поиска; кнопка и контакты — внизу экрана.
   Линии сверху у первого пункта и снизу у последнего. */
.site-menu__list {
  display: flex;
  flex-direction: column;
  margin-block: auto;
  border-block: 1px solid var(--menu-divider);
}

.site-menu__divider {
  height: 1px;
  background: var(--menu-divider);
}

.site-menu__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 21px 0;
}

/* Фиксированная ширина — названия пунктов начинаются на одной линии. */
.site-menu__num {
  flex: none;
  width: 16px;
  color: var(--muted-on-dark);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
}

.site-menu__title {
  flex: 1 1 0;
  font-size: 21px;
  line-height: 24px;
}

/* «Экспозиция выставки» на телефонах уже 390 px — в одну строку, как остальные пункты. */
@media (max-width: 389.98px) {
  .site-menu__title {
    font-size: 19px;
  }
}

.site-menu__link .icon {
  width: 17px;
  height: 17px;
  color: var(--muted-on-dark);
}

.site-menu__find {
  --btn-h: 50px;
  font-size: 13px;
}

.site-menu__find .icon {
  width: 18px;
  height: 18px;
}

.site-menu__contacts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-menu__label {
  color: var(--muted-on-dark);
  font-size: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.site-menu__contacts-row {
  display: flex;
  gap: 12px;
}

.site-menu__address {
  flex: 1 1 0;
  color: var(--muted-on-dark);
  font-size: 10.5px;
  font-weight: 300;
  line-height: 15px;
  font-style: normal;
}

.site-menu__links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.site-menu__phone {
  font-size: 13px;
  white-space: nowrap;
}

.site-menu__email {
  color: var(--muted-on-dark);
  font-size: 11px;
  font-weight: 300;
  white-space: nowrap;
}

/* Планшет: меню выезжает панелью справа (на десктопе меню не нужно). */
@media (min-width: 600px) {
  .site-menu__panel {
    left: auto;
    width: 420px;
  }
}

/* От 768 у шапки страницы боковой отступ --gutter — крестик встаёт ровно на место бургера. */
@media (min-width: 768px) {
  .site-menu__head {
    margin-right: calc(var(--gutter) - 16px);
  }
}

/* ── Окно «Введите номер экспоната» (UJ4OI) ──────────────────────────────── */
.number-dialog .overlay__backdrop {
  background: var(--overlay-ink-72);
}

.number-dialog__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 100%;
  padding: 14px 16px 30px;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  background: var(--bg);
  color: var(--ink);
}

.number-dialog__handle {
  flex: none;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

.number-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.number-dialog__title {
  font-size: 19px;
  font-weight: 400;
}

.number-dialog__close {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
}

.number-dialog__close .icon {
  width: 15px;
  height: 15px;
}

.number-dialog__form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.number-field {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 16px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-12);
  background: var(--surface);
}

.number-field input {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  caret-color: var(--accent);
  font-size: 20px;
}

.number-field input::placeholder {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 300;
}

.number-field .icon {
  width: 19px;
  height: 19px;
  color: var(--ink-2);
}

.number-dialog__hint {
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 300;
  line-height: 17px;
}

.number-dialog__example {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 300;
}

.number-dialog__example .icon {
  width: 13px;
  height: 13px;
}

.number-dialog .btn {
  --btn-h: 52px;
  font-size: 14px;
}

.number-dialog__submit {
  font-weight: 400;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1 1 0;
  height: 1px;
  background: var(--line);
}

/* Десктоп: та же панель, но окном по центру (README, §7). */
@media (min-width: 768px) {
  .number-dialog__panel {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(440px, 100% - 2 * var(--gutter));
    max-height: calc(100% - 40px);
    padding: 24px 24px 28px;
    border-radius: 20px;
    transform: translate(-50%, -50%);
  }

  .number-dialog__handle {
    display: none;
  }
}

/* На десктопе QR-сканер не нужен: в шапке только ввод номера. */
@media (min-width: 1200px) {
  .number-dialog__qr {
    display: none !important;
  }
}

/* ── QR-сканер (if1eW, E2f72, u3ZQw, Cyyy3) ──────────────────────────────── */
.qr {
  --qr-frame: 240px;
  --qr-frame-top: calc(50% - var(--qr-frame) / 2 - 12px);
  overflow: hidden;
  background: var(--camera-bg);
  color: var(--cream);
}

.qr__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr__topbar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 74px;
  padding: 16px 16px 0;
}

.qr__close {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--line-on-dark);
  color: var(--cream);
}

.qr__close .icon {
  width: 19px;
  height: 19px;
}

.qr__title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.qr__spacer {
  flex: none;
  width: 42px;
  height: 42px;
}

/* Видоискатель: квадрат 240 px, вокруг затемнение #0E0D0CCC. */
.qr__frame {
  position: absolute;
  top: var(--qr-frame-top);
  left: 50%;
  z-index: 1;
  width: var(--qr-frame);
  height: var(--qr-frame);
  transform: translateX(-50%);
  box-shadow: 0 0 0 200vmax rgb(14 13 12 / 0.8);
}

.qr__corner {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 0 solid var(--cream);
  border-radius: 2px;
}

.qr__corner--tl { top: 0; left: 0; border-top-width: 5px; border-left-width: 5px; }
.qr__corner--tr { top: 0; right: 0; border-top-width: 5px; border-right-width: 5px; }
.qr__corner--bl { bottom: 0; left: 0; border-bottom-width: 5px; border-left-width: 5px; }
.qr__corner--br { right: 0; bottom: 0; border-right-width: 5px; border-bottom-width: 5px; }

.qr__hint {
  position: absolute;
  top: calc(var(--qr-frame-top) + var(--qr-frame) + 28px);
  left: 50%;
  z-index: 2;
  width: min(340px, 100% - 32px);
  transform: translateX(-50%);
  color: var(--bg);
  font-size: 13px;
  font-weight: 300;
  line-height: 20px;
  text-align: center;
}

.qr__bottom {
  position: absolute;
  right: 16px;
  bottom: 34px;
  left: 16px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 440px;
  margin-inline: auto;
}

.qr .btn {
  --btn-h: 52px;
  font-size: 14px;
  font-weight: 400;
}

.qr__btn-primary {
  --btn-h: 54px !important;
}

.qr__btn-primary .icon {
  width: 17px;
  height: 17px;
}

.qr__btn-ghost {
  border-color: var(--line-on-dark-strong);
  border-color: rgb(255 255 255 / 0.24);
  color: var(--cream);
}

/* Сообщения «Разрешите доступ» / «Доступ не получен». */
.qr__message {
  position: absolute;
  top: max(110px, 33%);
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: min(358px, 100% - 32px);
  transform: translateX(-50%);
  text-align: center;
}

.qr__message-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--fill-on-dark);
  color: var(--accent);
}

.qr__message-icon .icon {
  width: 34px;
  height: 34px;
}

.qr__message-title {
  font-size: 22px;
  font-weight: 400;
  line-height: 26px;
}

.qr__message-text {
  color: var(--text-on-camera);
  font-size: 12.5px;
  font-weight: 300;
  line-height: 20px;
}

/* Состояния переключает static/js/main.js: у частей экрана атрибут
   data-qr-part со списком состояний, где их видно; остальным ставится hidden. */
.qr__message,
.qr__sheet {
  display: flex;
}

/* «Посторонний код»: рамка выше и акцентная, снизу — панель-сообщение. */
.qr[data-state="foreign"] {
  --qr-frame-top: max(90px, calc(100% - 404px - var(--qr-frame)));
}

.qr[data-state="foreign"] .qr__corner {
  border-color: var(--accent);
}

.qr[data-state="foreign"] .qr__hint {
  top: calc(var(--qr-frame-top) + var(--qr-frame) + 22px);
}

.qr__sheet {
  min-height: 340px;
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 16px 26px;
  border-radius: 20px 20px 0 0;
  background: var(--bg);
  color: var(--ink);
  text-align: center;
}

.qr__sheet > * {
  width: min(100%, 440px);
}

.qr__sheet-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px !important;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
}

.qr__sheet-icon .icon {
  width: 24px;
  height: 24px;
}

.qr__sheet-title {
  font-size: 19px;
  font-weight: 400;
  line-height: 24px;
}

.qr__sheet-text {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 300;
  line-height: 19px;
}

.qr__sheet-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qr__sheet .btn {
  --btn-h: 50px;
}

.qr__sheet .btn--outline {
  border-color: var(--line);
}

/* Печать: кнопки шапки (QR, меню, «Номер экспоната») на бумаге не нужны. */
@media print {
  .site-header__actions {
    display: none !important;
  }
}
