/* ═══════════════════════════════════════════════════════════════
   LUMÉ — база витрины
   Токены, сброс, типографика, кнопки, поля, общие мелочи.
   Палитра — «натуральные красители»: графит для текста и шапки,
   индиго для действий, крапп для скидок, резеда для предупреждений.
   ═══════════════════════════════════════════════════════════════ */

/* ── Шрифт Inter (локально, SIL OFL — assets/fonts/LICENSE-Inter.txt) ── */
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/inter-cyrillic-ext.woff2") format("woff2-variations"), url("/assets/fonts/inter-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/inter-cyrillic.woff2") format("woff2-variations"), url("/assets/fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/inter-latin-ext.woff2") format("woff2-variations"), url("/assets/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2-variations"), url("/assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* ── Токены ────────────────────────────────────────────────────── */
:root {
  --bg:        #ffffff;
  --bg-soft:   #f3f3f1;   /* лён: подложки, панели */
  --bg-plate:  #ececea;   /* заглушки картинок */
  --text:      #1c1d21;   /* графит */
  --text-dim:  #666a72;
  --line:      #d9dadd;
  --line-soft: #ebebed;

  --ink:       #1c1d21;   /* тёмная шапка в любой теме */
  --ink-2:     #2a2c31;
  --ink-text:  #f4f4f5;
  --ink-dim:   #a9acb3;

  --indigo:       #2c3d8f;
  --indigo-hover: #22317a;
  --indigo-ink:   #ffffff;
  --indigo-soft:  #e9ecf8;

  --madder:      #b3312a;   /* скидки, ошибки */
  --madder-soft: #f8e9e7;
  --weld:        #8a6414;   /* «осталось мало», текст */
  --weld-dot:    #d6a431;
  --moss:        #2f6b45;   /* «в наличии», успех */

  /* совместимость со старыми классами и админкой */
  --accent:       var(--indigo);
  --accent-hover: var(--indigo-hover);
  --accent-ink:   var(--indigo-ink);
  --surface:   rgba(255, 255, 255, .92);
  --shadow:    0 4px 18px rgba(20, 22, 30, .08);
  --shadow-lg: 0 20px 60px rgba(20, 22, 30, .18);

  --label-bg:   #fbfaf7;    /* «вшитая этикетка» */
  --label-edge: #c9c6bd;

  --wrap:   1400px;
  --gutter: clamp(16px, 3vw, 32px);
  --radius: 2px;
  --ease:   cubic-bezier(.28, .11, .32, 1);
  --pop:    cubic-bezier(.16, 1, .3, 1);

  --font-display: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-mono: var(--font);   /* коды, номера заказов — тоже Inter (цифры одной ширины) */

  --header-h: 64px;
  --zoom: 1;           /* масштаб витрины (см. layout.css) */
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg:        #000000;
  --bg-soft:   #1c1c1e;
  --bg-plate:  #2c2c2e;
  --text:      #f5f5f7;
  --text-dim:  #98989d;
  --line:      #38383a;
  --line-soft: #2c2c2e;

  --ink:       #161617;
  --ink-2:     #1c1c1e;

  --indigo:       #f5f5f7;
  --indigo-hover: #ffffff;
  --indigo-ink:   #000000;
  --indigo-soft:  #2c2c2e;

  --madder:      #ff8577;
  --madder-soft: #3a2220;
  --weld:        #e3b75a;
  --moss:        #7bc596;

  --surface:   rgba(22, 22, 23, .82);
  --shadow:    0 6px 24px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .65);

  --label-bg:   #1c1c1e;
  --label-edge: #48484a;
  color-scheme: dark;
}

/* ── Сброс ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.15; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }

::selection { background: var(--indigo); color: var(--indigo-ink); }

:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Каркас ────────────────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 300;
  transform: translateY(-200%);
  background: var(--indigo); color: var(--indigo-ink);
  padding: 10px 16px; font-weight: 600;
}
.skip-link:focus { transform: none; text-decoration: none; }

/* ── Типографика ───────────────────────────────────────────────── */
/* Заголовки — Inter, обычный регистр, плотная посадка (как в каталоге). */
.display,
.page-title,
.section-title {
  font-family: var(--font);
  letter-spacing: -.02em;
  font-weight: 700;
  line-height: 1.1;
}
.page-title   { font-size: clamp(28px, 3.4vw, 44px); }
.section-title { font-size: clamp(22px, 2.2vw, 28px); }

.lead { font-size: 16px; color: var(--text-dim); max-width: 62ch; }
.muted { color: var(--text-dim); }
.small { font-size: 13px; }

/* Моно-подпись: номера заказов, коды, этикетки */
.mono {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: .04em;
}

/* ── «Вшитая этикетка» — фирменная деталь ─────────────────────── */
/* Состав ткани в виде пришитого ярлыка: моно-шрифт, прописные,
   пунктирная «строчка» по краю. */
.label-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font);
  font-size: 10.5px; line-height: 1.2;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--text);
  background: var(--label-bg);
  padding: 4px 8px 4px 9px;
  border: 1px solid var(--label-edge);
  outline: 1px dashed var(--label-edge);
  outline-offset: -4px;
  border-radius: 1px;
  white-space: nowrap;
}
.label-tag--lg {
  font-size: 12px; padding: 12px 14px; white-space: normal;
  display: block; outline-offset: -6px; line-height: 1.6;
}

/* ── Кнопки ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease), transform .18s var(--pop);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-busy { opacity: .6; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn--primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn--primary:hover { background: color-mix(in srgb, var(--text) 82%, var(--bg)); }

.btn--dark { background: var(--text); color: var(--bg); }
.btn--dark:hover { background: var(--ink-2); color: #fff; }
html[data-theme="dark"] .btn--dark:hover { background: #fff; color: #111; }

.btn--ghost, .btn--secondary {
  background: transparent; color: var(--text);
  border-color: var(--line);
}
.btn--ghost:hover, .btn--secondary:hover { background: var(--text); color: var(--bg); }

.btn--light { background: #fff; color: #1c1d21; }
.btn--light:hover { background: #f0f0f0; }

.btn--link {
  min-height: 0; padding: 0; border: 0; background: none;
  font-family: var(--font);
  text-transform: none; letter-spacing: 0; font-weight: 400;
  text-decoration: underline !important; text-underline-offset: 3px;
  color: inherit;
}

.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn--lg { min-height: 52px; padding: 0 28px; font-size: 17px; }
.btn--full { width: 100%; }

/* Кружок-иконка (шапка, закрыть, сердце) */
.icon-btn {
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  background: none; border: 0; border-radius: 50%;
  color: inherit; position: relative;
  transition: background .18s var(--ease);
}
.icon-btn:hover { background: rgba(127, 127, 127, .14); }
.icon-btn svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}

.icon-sun, .icon-moon { display: block; }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun  { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

/* Счётчик на иконке */
.count-dot {
  position: absolute; top: 4px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--indigo); color: var(--indigo-ink);
  font: 700 11px/18px var(--font);
  text-align: center;
}
.count-dot.is-bump { animation: bump .45s var(--pop); }
@keyframes bump { 35% { transform: scale(1.35); } }

/* ── Поля форм ─────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field label, .field .field__label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 600;
}
.field label i, .req { color: var(--madder); font-style: normal; }
.input, .field input, .field textarea, .field select, .select {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field textarea { min-height: 96px; resize: vertical; }
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--text-dim); opacity: .8; }
.input:hover, .field input:hover, .field textarea:hover, .field select:hover, .select:hover { border-color: var(--text-dim); }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus, .select:focus {
  outline: 0; border-color: var(--text); box-shadow: 0 0 0 1px var(--text);
}
.select, .field select {
  appearance: none; -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
.field small, .field__error {
  display: block; min-height: 16px; margin-top: 5px;
  font-size: 12px; color: var(--madder);
}
.field.has-error input, .field.has-error textarea, .field.has-error select,
[aria-invalid="true"] { border-color: var(--madder) !important; box-shadow: none; }

.check {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14px; cursor: pointer; line-height: 1.4;
}
.check input {
  width: 18px; height: 18px; margin: 1px 0 0; flex: none;
  accent-color: var(--indigo);
}

/* ── Цены ──────────────────────────────────────────────────────── */
.price { font-weight: 700; white-space: nowrap; }
.price--sale { color: var(--madder); }
.price__old {
  color: var(--text-dim); font-weight: 400;
  text-decoration: line-through; white-space: nowrap;
}
.price__off {
  display: inline-block; font-weight: 700; font-size: .85em;
  color: var(--madder); white-space: nowrap;
}

/* ── Плашки ────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: var(--font);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 7px;
  background: var(--bg); color: var(--text);
  border-radius: 1px;
}
.badge--sale { background: var(--madder); color: #fff; }
html[data-theme="dark"] .badge--sale { color: #2a0d0a; }
.badge--dark { background: var(--text); color: var(--bg); }

/* ── Хлебные крошки ────────────────────────────────────────────── */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0;
  list-style: none; margin: 18px 0 14px; padding: 0;
  font-size: 14px; line-height: 1.4; color: var(--text-dim);
}
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before {                 /* тонкая стрелка-разделитель */
  content: ""; width: 6px; height: 6px; margin: 0 12px 0 10px;
  border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor;
  transform: rotate(45deg); opacity: .55;
}
.crumbs a { color: var(--text-dim); text-decoration: none; transition: color .15s var(--ease); }
.crumbs a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.crumbs [aria-current] { color: var(--text); font-weight: 500; }

/* ── Аккордеон (details) ───────────────────────────────────────── */
.acc { border-top: 1px solid var(--line); }
.acc__item { border-bottom: 1px solid var(--line); }
.acc__item summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 2px;
  font-family: var(--font);
  font-weight: 700; font-size: 15px; letter-spacing: -.01em; text-transform: none;
}
.acc__item summary::-webkit-details-marker { display: none; }
.acc__item summary::after {
  content: ""; width: 10px; height: 10px; flex: none;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  transition: transform .25s var(--pop);
}
.acc__item[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.acc__body { padding: 0 2px 18px; font-size: 14px; color: var(--text-dim); }
.acc__body p:last-child { margin-bottom: 0; }
.acc__body b, .acc__body strong { color: var(--text); }

/* ── Скелетоны и загрузка ──────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, var(--bg-plate) 0%, var(--bg-soft) 50%, var(--bg-plate) 100%);
  background-size: 200% 100%;
  animation: skel 1.3s linear infinite;
}
@keyframes skel { to { background-position: -200% 0; } }

.route-bar {
  position: fixed; top: 0; left: 0; z-index: 400;
  height: 3px; width: 0; background: var(--indigo);
  transition: width .3s var(--ease), opacity .3s var(--ease);
  opacity: 0; pointer-events: none;
}
.route-bar.is-on { opacity: 1; width: 70%; transition: width 2s var(--ease); }
.route-bar.is-done { opacity: 0; width: 100%; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--text);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Пустые состояния ──────────────────────────────────────────── */
.empty {
  text-align: center; padding: 64px 16px 72px;
  max-width: 520px; margin: 0 auto;
}
.empty svg {
  width: 48px; height: 48px; margin: 0 auto 18px;
  fill: none; stroke: currentColor; stroke-width: 1.2;
}
.empty h2 { margin-bottom: 10px; }
.empty p { color: var(--text-dim); margin-bottom: 22px; }

/* ── Тост ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--tabbar-h, 0px)); z-index: 350;
  display: flex; align-items: center; gap: 16px;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg);
  padding: 13px 18px; font-size: 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease), transform .35s var(--pop);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.is-error { background: var(--madder); color: #fff; }
.toast a, .toast button {
  color: inherit; font-weight: 700; text-decoration: underline;
  background: none; border: 0; padding: 0; white-space: nowrap;
}

/* ── Диалоги и шторки ──────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(12, 13, 16, .45);
  opacity: 0; transition: opacity .3s var(--ease);
}
.scrim.is-open { opacity: 1; }

.dialog {
  position: fixed; z-index: 210;
  background: var(--bg); color: var(--text);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  max-height: 100%;
  outline: 0;
}
.dialog--center {
  left: 50%; top: 50%;
  width: min(var(--dialog-w, 640px), calc(100% - 32px));
  max-height: min(88%, 900px);
  transform: translate(-50%, -48%) scale(.98);
  opacity: 0;
  transition: transform .35s var(--pop), opacity .25s var(--ease);
}
.dialog--center.is-open { transform: translate(-50%, -50%); opacity: 1; }

.dialog--right, .dialog--left {
  top: 0; bottom: 0;
  width: min(var(--dialog-w, 440px), 100%);
  transition: transform .4s var(--pop);
}
.dialog--right { right: 0; transform: translateX(100%); }
.dialog--left  { left: 0;  transform: translateX(-100%); }
.dialog--right.is-open, .dialog--left.is-open { transform: none; }

.dialog--full {
  inset: 0;
  opacity: 0; transition: opacity .25s var(--ease);
}
.dialog--full.is-open { opacity: 1; }

.dialog__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 12px 14px 22px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.dialog__title {
  font-family: var(--font);
  font-size: 20px; font-weight: 700; letter-spacing: -.01em; text-transform: none;
}
.dialog__body { padding: 20px 22px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.dialog__foot {
  flex: none; padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  display: flex; gap: 10px;
}

/* ── Таблицы (таблица размеров и пр.) ──────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse;
  font-size: 14px; white-space: nowrap;
}
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table th {
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-dim); font-weight: 600;
}
.table tbody tr:hover { background: var(--bg-soft); }

/* ── Адаптив для полей ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .dialog--center { width: 100%; max-height: 92%; top: auto; bottom: 0; left: 0;
    transform: translateY(24px); }
  .dialog--center.is-open { transform: none; }
}
