/* site-ui.css — шапка (прячется при прокрутке вниз), меню в бургере, превью выбранных файлов */

/* ---------- шапка ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  transition: top .3s ease, background-color .2s ease, box-shadow .2s ease;
}
/* место, которое шапка занимала в потоке; высоту меряет site-ui.js */
:has(> .header) { padding-top: var(--header-h, 72px); }
html { scroll-padding-top: calc(var(--header-h, 72px) + 16px); }
.header.header--scrolled {
  background-color: var(--paper-dark);
  box-shadow: 0 1px 0 rgb(255 255 255 / 8%);
}
/* прячем через top, а не transform: transform сделал бы fixed-меню внутри шапки относительным к ней */
.header.header--hidden { top: calc(-1 * var(--header-h, 72px) - 4px); }

@media (prefers-reduced-motion: reduce) {
  .header, .header__nav, .burger::before, .burger::after, .burger__line { transition: none !important; }
}

/* ---------- бургер: крестик рисуется на месте бургера, кнопка не меняет размер и позицию ---------- */
@media (max-width: 1024px) {
  .header:has(.menu--active) .header__burger { position: relative; right: auto; top: auto; }
  .burger, .burger--active { padding: 11px; width: 46px; height: 41px; }
  .burger::before, .burger::after, .burger .burger__line,
  .burger--active::before, .burger--active::after { left: 11px; width: 24px; }
  .burger::before { top: 11px; }
  .burger::after { top: calc(100% - 13px); bottom: auto; }
  .burger--active::before { top: calc(50% - 1px); transform: rotate(45deg); }
  .burger--active::after { top: calc(50% - 1px); transform: rotate(-45deg); }
  .burger:focus-visible { outline: 2px solid #86a9e8; outline-offset: 2px; }

  /* панель меню */
  .header__nav {
    justify-content: flex-start;
    gap: 28px;
    padding: calc(var(--header-h, 72px) + 12px) 20px max(28px, env(safe-area-inset-bottom));
    height: 100vh;
    height: 100dvh;
    overscroll-behavior: contain;
    visibility: hidden;
    transition: transform .35s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .35s;
  }
  .header__nav.menu--active {
    visibility: visible;
    transition: transform .35s cubic-bezier(.2, .7, .2, 1);
    /* затемнение страницы за панелью, клик по нему закрывает меню */
    box-shadow: 0 0 0 100vmax rgb(0 0 0 / 55%);
  }
  .header__links { align-items: stretch; width: 100%; gap: 0; }
  .header__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    border-bottom: 1px solid rgb(255 255 255 / 10%);
    font-size: 16px;
    letter-spacing: .02em;
    transition: color .2s ease;
  }
  .header__link::after {
    content: "";
    width: 8px;
    height: 8px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg);
    opacity: .5;
  }
  .header__link:hover, .header__link:focus-visible { color: #86a9e8; }
  .header__nav .header__cta { margin-top: auto; min-height: 52px; font-size: 15px; }
}

/* планшет: кнопка «Начать диагностику» остаётся в потоке, чтобы крестик не съезжал вправо */
@media (min-width: 577px) and (max-width: 1024px) {
  .header__burger.burger--active + .header__cta--bar { display: inline-flex; visibility: hidden; }
}

@media (max-width: 576px) {
  .header__nav { align-items: stretch; padding-left: 16px; padding-right: 16px; }
  .header__links { align-items: stretch; }
  .header__link { font-size: 18px; }
}

/* ---------- превью выбранных файлов ---------- */
.files-tray { display: flex; flex-direction: column; gap: 12px; }
.files-tray[hidden] { display: none; }
.files-tray__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 500;
  font-size: 15px;
  color: var(--text-secondary);
}
.files-tray__clear {
  border: 0;
  padding: 8px 0;
  font: inherit;
  font-weight: 600;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  cursor: pointer;
}
.files-tray__clear:hover { color: var(--danger, #c94a4a); }
.files-tray__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.files-tray__note { margin: 0; font-weight: 500; font-size: 14px; color: #c0392b; }

/* карточка файла: превью, имя, размер, кнопка «убрать» */
.file-chip { position: relative; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); background-color: var(--light-color); }
.file-chip__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background-color: var(--paper, #f9f9f9);
}
.file-chip__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.file-chip__pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 14px;
  color: var(--light-color);
  background-color: var(--danger, #c94a4a);
}
.file-chip__meta { display: flex; flex-direction: column; gap: 2px; padding: 8px; min-width: 0; }
.file-chip__name { overflow: hidden; font-weight: 600; font-size: 13px; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.file-chip__size { font-weight: 500; font-size: 12px; color: var(--text-secondary); }
.file-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  width: 32px;
  height: 32px;
  color: var(--light-color);
  background-color: rgb(30 30 30 / 78%);
  cursor: pointer;
  transition: background-color .2s ease;
}
.file-remove::before, .file-remove::after { content: ""; position: absolute; width: 14px; height: 2px; background-color: currentColor; }
.file-remove::before { transform: rotate(45deg); }
.file-remove::after { transform: rotate(-45deg); }
.file-remove:hover { background-color: var(--danger, #c94a4a); }
.file-remove:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* лендинг: первый экран во всю высоту окна на любом экране; svh не прыгает, когда браузер прячет адресную строку */
.hero { box-sizing: border-box; min-height: 100vh; min-height: 100svh; }

/* без синих подсветок при клике и тапе: ни системной вспышки, ни рамок, ни свечения полей */
html { -webkit-tap-highlight-color: transparent; }
:focus:not(:focus-visible) { outline: none; }
input:focus, textarea:focus, select:focus { outline: none; box-shadow: none !important; }
