/* Бланк заказа Platinum Sharks. Сначала телефон, потом всё остальное. */

:root {
  --ink: #1c1917;
  --bg: #f4f4f4;
  --surface: #ffffff;
  --line: #e2e2e0;
  --text: #1c1917;
  --muted: #6f6f6c;
  --accent: #0e97a0;
  --accent-dark: #0b7f87;
  --hint: #c00d0d;
  --qty: #fff3c4;
  --qty-line: #ecdfa6;
  --display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --body: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bar-height: 76px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--body);
  padding-bottom: calc(var(--bar-height) + env(safe-area-inset-bottom) + 16px);
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Шапка ---------- */

.top {
  background: var(--ink);
  color: #fff;
  padding: 18px 0 20px;
}

.top__row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  align-items: center;
}

.top__logo {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: #3a3734;
}

.top__title h1 {
  margin: 0;
  font: 800 24px/1.1 var(--display);
  letter-spacing: -0.01em;
}

.top__title p {
  margin: 6px 0 0;
  color: #c9c7c3;
  font-size: 13px;
}

.top__contacts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  align-items: baseline;
  margin-top: 10px;
  font-size: 14px;
}

.top__contacts span {
  color: #a8a6a2;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top__contacts a {
  color: #fff;
  text-decoration: none;
}

/* ---------- Вкладки, поиск, разделы ---------- */

.tools {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 10px 0 10px;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab {
  flex: none;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.tab small {
  font-weight: 500;
  font-size: 0.85em;
  opacity: 0.8;
}

.tab[aria-selected='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 3px 0 var(--accent);
}

.tools__row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.search {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.toggle {
  flex: none;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
}

.toggle[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chips {
  display: flex;
  gap: 8px;
  margin: 10px -16px 0;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar,
.tabs::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  white-space: nowrap;
}

/* ---------- Список ---------- */

.note {
  margin: 14px 0;
  color: var(--muted);
  font-size: 14px;
}

.state {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

.elsewhere {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 20px;
}

.section {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  /* Высота шапки инструментов: к разделу прокручивают кнопкой, и он не должен уйти под неё. */
  scroll-margin-top: var(--tools-height, 170px);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0;
  padding: 14px 14px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font: 600 15px/1.2 var(--display);
  text-transform: uppercase;
}

.section__head small {
  color: var(--muted);
  font: 500 13px var(--body);
  text-transform: none;
}

.group__head {
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 4px 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  /* Строк больше пятисот: браузер не раскладывает те, что за экраном. */
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

.group:last-child .item:last-child {
  border-bottom: 0;
}

.item--picked {
  background: #fffdf3;
}

.item__photo {
  grid-row: 1 / span 2;
  width: 60px;
  height: 60px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}

.item__photo--none {
  display: grid;
  place-items: center;
  color: #c4c4c1;
  font-size: 11px;
}

.item__name {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.item__hint {
  margin: 3px 0 0;
  color: var(--hint);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
}

.item__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
}

.item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  color: var(--muted);
  font-size: 13px;
}

.item__price {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.item__price--ask {
  font-size: 13px;
  font-weight: 600;
}

.qty {
  display: flex;
  align-items: center;
  flex: none;
  width: 128px;
  height: 42px;
  /* На узком экране счётчик уходит на свою строку — прижимаем к правому краю, под палец. */
  margin-left: auto;
  border: 1px solid var(--qty-line);
  border-radius: 10px;
  background: var(--qty);
}

.qty button {
  flex: none;
  width: 40px;
  height: 100%;
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
}

.qty input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  text-align: center;
  font-weight: 700;
  /* 16px — меньше нельзя: iOS приближает страницу при фокусе на мелком поле. */
  font-size: 16px;
}

.qty input:focus,
.search:focus,
.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ---------- Нижняя полоса ---------- */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  background: var(--ink);
  color: #fff;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}

.bar__row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar__sum {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.bar__sum span {
  color: #b5b3af;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bar__sum strong {
  font: 800 20px/1.2 var(--display);
  white-space: nowrap;
}

.btn {
  flex: none;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
}

.btn--ghost {
  border-color: #56524e;
  background: none;
  color: #fff;
}

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

.btn--accent:disabled {
  background: #4a4744;
  color: #9d9b97;
  cursor: default;
}

.btn--wide {
  width: 100%;
}

/* ---------- Оформление ---------- */

.sheet {
  width: min(100%, 520px);
  max-width: none;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  color: var(--text);
}

.sheet::backdrop {
  background: rgba(20, 18, 16, 0.6);
}

.sheet__body {
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet h2 {
  margin: 0;
  font: 800 19px/1.2 var(--display);
}

.sheet__close {
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
}

.sheet__summary {
  margin: 8px 0 14px;
  color: var(--muted);
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field span {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  font-weight: 600;
}

.field em {
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  resize: vertical;
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.sheet__error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fdecec;
  color: var(--hint);
  font-size: 14px;
}

.sheet__hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.sheet__done {
  text-align: center;
}

.sheet__done p {
  color: var(--muted);
}

.done__mark {
  width: 56px;
  height: 56px;
  margin: 6px auto 14px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  line-height: 56px;
}

/* ---------- Шире телефона ---------- */

@media (min-width: 600px) {
  .wrap {
    padding: 0 24px;
  }

  .top__row {
    grid-template-columns: auto 1fr auto;
  }

  .top__title h1 {
    font-size: 30px;
  }

  .top__contacts {
    grid-column: auto;
    flex-direction: column;
    gap: 2px;
    margin-top: 0;
  }

  .chips {
    margin-left: 0;
    margin-right: 0;
    padding: 0;
  }

  /* Счётчик встаёт справа от названия, как в бланке. */
  .item {
    grid-template-columns: 72px 1fr auto;
    align-items: center;
  }

  .item__photo {
    width: 72px;
    height: 72px;
  }

  .item__foot {
    display: contents;
  }

  .item__meta {
    grid-column: 2;
  }

  .qty {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .sheet {
    margin: auto;
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
