/* Окно, которое выезжает справа (таблица размеров, фильтры).
   Сделано на <dialog>: браузер сам держит фокус внутри и закрывает по Esc. */

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(100%, 560px);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  transform: translateX(100%);
  transition:
    transform .45s cubic-bezier(.2, .8, .2, 1),
    overlay .45s allow-discrete,
    display .45s allow-discrete;
}

.drawer[open] { transform: none; }

@starting-style {
  .drawer[open] { transform: translateX(100%); }
}

.drawer::backdrop {
  background: rgba(33, 33, 33, 0);
  transition:
    background-color .45s,
    overlay .45s allow-discrete,
    display .45s allow-discrete;
}

.drawer[open]::backdrop { background: rgba(33, 33, 33, .4); }

@starting-style {
  .drawer[open]::backdrop { background: rgba(33, 33, 33, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .drawer,
  .drawer::backdrop { transition: none; }
}

.drawer__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px var(--side);
}

.drawer__title {
  font-size: var(--fs-24);
  font-weight: var(--fw-medium);
  line-height: 32px;
}

.drawer__close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -8px;
  cursor: pointer;
  transition: color .25s;
}

.drawer__close:hover { color: var(--link-hover); }

/* прокручивается только содержимое, страница под окном стоит (Lenis остановлен) */
.drawer__body {
  flex: 1;
  padding: 8px var(--side) 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer__foot {
  display: flex;
  gap: 8px;
  padding: 16px var(--side) 24px;
  border-top: 1px solid var(--line);
}

.drawer__foot .btn { flex: 1; }

.drawer__section + .drawer__section { margin-top: 32px; }

.drawer__label {
  margin-bottom: 12px;
  font-size: var(--fs-18);
  font-weight: var(--fw-semibold);
}

.drawer__text {
  font-size: var(--fs-16);
  color: var(--fg);
}

.drawer__text + .drawer__text { margin-top: 8px; }

@media (min-width: 768px) {
  .drawer__head { padding: 32px 40px 24px; }
  .drawer__body { padding: 8px 40px 40px; }
  .drawer__foot { padding: 16px 40px 32px; }
}

/* ---------- таблица размеров ---------- */
.size-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-16);
  font-variant-numeric: tabular-nums;
}

.size-table th,
.size-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.size-table th:first-child,
.size-table td:first-child { padding-left: 0; }

.size-table thead th {
  color: var(--muted);
  font-weight: var(--fw-regular);
}

.size-table tbody th { font-weight: var(--fw-semibold); }

/* ---------- фильтры ---------- */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: var(--fs-16);
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.choice input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--fg);
  cursor: pointer;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip { position: relative; }

.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chip span {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding-inline: 16px;
  border-radius: var(--r-8);
  background: var(--surface);
  font-size: var(--fs-16);
  box-shadow: inset 0 0 0 var(--stroke) transparent;
  transition: box-shadow .25s;
}

.chip input:hover + span { box-shadow: inset 0 0 0 var(--stroke) var(--muted); }
.chip input:checked + span { box-shadow: inset 0 0 0 var(--stroke) var(--fg); }
.chip input:focus-visible + span { outline: 2px solid var(--muted); outline-offset: 2px; }

.chip i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(33, 33, 33, .12);
}

.price-range {
  display: flex;
  gap: 8px;
}

.price-range label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding-inline: 16px;
  border-radius: var(--r-8);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-16);
}

.price-range input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  outline: none;
}
