/* ============================================================================
   MisterTools — тёмно-серый и светло-серый фон, «рубиновый» градиент,
   глассморфизм. Один CSS без сборщиков (на сервере нет node).
   ============================================================================ */

:root {
  /* Две поверхности: тёмная (шапка, акценты) и светлая (контент). */
  --bg-dark: #1c1c20;
  --bg-dark-2: #24242a;
  --bg-light: #f4f4f6;
  --bg-light-2: #fbfbfc;

  --surface-dark: rgba(255, 255, 255, 0.055);
  --surface-light: rgba(28, 28, 32, 0.045);
  --stroke-dark: rgba(255, 255, 255, 0.10);
  --stroke-light: rgba(28, 28, 32, 0.10);

  /* Рубиновый градиент управления. */
  --ruby-1: #5c0f1f;
  --ruby-2: #8e1230;
  --ruby-3: #a81438;
  --grad: linear-gradient(120deg, var(--ruby-1) 0%, var(--ruby-3) 100%);
  --grad-hover: linear-gradient(120deg, #6d1226 0%, #c2183f 100%);

  /* Ссылки на светлом фоне: тёмно-серые, чтобы отличались от серого текста
     абзацев (#5f5f6b), а при наведении — рубиновые. */
  --link: #3d3d47;
  --link-hover: #a81438;

  --text-dark: #f2f2f4;
  --muted-dark: #a9a9b3;
  --text-light: #1c1c20;
  --muted-light: #5f5f6b;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 16px 40px rgba(20, 20, 26, 0.12);
  --wrap: 1080px;
  --nav-h: 92px;
}

* { box-sizing: border-box; }

/* Атрибут hidden должен побеждать display:block/flex у наших классов. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-light);
  color: var(--text-light);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color .16s ease;
}
a:hover { color: var(--link-hover); }

/* Кнопки и пункты меню — не «обычные» ссылки: у них свой цвет, наведение его
   не перекрашивает (иначе белый текст на рубиновом градиенте стал бы рубиновым). */
.btn:hover { color: var(--text-light); }
.btn-primary:hover { color: #fff; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

/* === ШАПКА (тёмная) ======================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(28, 28, 32, 0.88);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dark);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: var(--nav-h);
  padding: 12px 0;
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--text-dark); }
/* Логотип и название — не «обычная» ссылка: наведение их не перекрашивает. */
.brand:hover { color: var(--text-dark); }

/* Место под картинку-логотип (мистер кролик). Пока — заглушка с инициалами. */
.logo-slot {
  width: 46px; height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  overflow: hidden;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 650; letter-spacing: -0.01em; color: var(--text-dark); }
.brand-role { font-size: 12px; color: var(--muted-dark); }

.site-nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

.nav-link {
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted-dark);
  border: 1px solid transparent;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.nav-link:hover { color: var(--text-dark); background: var(--surface-dark); border-color: var(--stroke-dark); }
.nav-link.is-active {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 8px 20px rgba(140, 18, 48, 0.35);
}

/* === ОСНОВА =============================================================== */

.site-main { flex: 1 0 auto; padding: 56px 0 72px; text-align: center; }
.site-main .wrap > * { margin-left: auto; margin-right: auto; }

.eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-light);
  margin: 0 0 12px;
}

h1, h2, h3 { margin: 0 0 14px; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(30px, 4.6vw, 46px); font-weight: 700; }
h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 650; }
h3 { font-size: 18px; font-weight: 600; }

p { margin: 0 0 14px; color: var(--muted-light); }

.lead {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--muted-light);
  max-width: 660px;
  margin-left: auto;
  margin-right: auto;
}

.gradient-text {
  background: var(--grad-hover);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* === ГЕРОЙ ================================================================ */

.hero { padding: 8px 0 26px; }

.hero-logo {
  width: 112px; height: 112px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--grad);
  color: #fff;
  font-size: 30px; font-weight: 700; letter-spacing: 0.04em;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 18px 44px rgba(140, 18, 48, 0.28);
  overflow: hidden;
}

/* Тёмная полоса под героем: контраст тёмно-/светло-серого. */
.hero-band {
  margin-top: 30px;
  padding: 26px 0;
  background: var(--bg-dark);
  color: var(--text-dark);
  border-radius: var(--radius);
}

.hero-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px;
}

/* === КНОПКИ =============================================================== */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--stroke-light);
  background: #fff;
  color: var(--text-light);
  font-size: 15px; font-weight: 550;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(20, 20, 26, 0.10); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--grad);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: 0 12px 28px rgba(140, 18, 48, 0.28);
}
.btn-primary:hover { background: var(--grad-hover); box-shadow: 0 16px 34px rgba(160, 20, 55, 0.36); }

.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.btn-block { display: flex; justify-content: center; width: 100%; }
.btn-disabled { opacity: .5; cursor: default; pointer-events: none; }

/* === КАРТОЧКИ / СЕТКИ ===================================================== */

.card {
  position: relative;
  background: #fff;
  border: 1px solid var(--stroke-light);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: left;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .9), transparent);
}
.card-hover { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card-hover:hover { transform: translateY(-3px); border-color: rgba(168, 20, 56, 0.30); }

.grid {
  display: grid; gap: 18px; margin-top: 26px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.section { margin-top: 60px; }
.section-head { margin-bottom: 8px; }

/* Плитка-иконка у карточки-инструмента. */
.tool-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--grad);
  color: #fff;
  font-size: 19px;
  margin-bottom: 6px;
}
.tool-icon + h3 { margin-top: 14px; }

.chip {
  display: inline-flex; padding: 5px 12px;
  border-radius: 999px; font-size: 13px;
  color: var(--muted-light); background: #fff;
  border: 1px solid var(--stroke-light);
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--stroke-light); color: var(--muted-light);
  white-space: nowrap;
}
.badge-live { color: #1f7a4d; border-color: rgba(31, 122, 77, .3); background: rgba(31, 122, 77, .08); }
.badge-soon { color: #8a6a1f; border-color: rgba(138, 106, 31, .3); background: rgba(138, 106, 31, .08); }

.feature-list {
  list-style: none; padding: 0; margin: 16px 0 0;
  display: grid; gap: 10px; text-align: left;
}
.feature-list li { position: relative; padding-left: 24px; color: var(--muted-light); }
.feature-list li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--grad);
}

/* === ФОРМЫ / ИНСТРУМЕНТЫ ================================================== */

/* <label> — строчный элемент, и его padding «наезжал» на соседние блоки:
   фон выглядел съехавшим. Поэтому блочная коробка задаётся явно. */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 132px;
  margin-top: 20px;
  padding: 26px 20px;
  border-radius: var(--radius);
  border: 2px dashed rgba(168, 20, 56, 0.28);
  background: var(--bg-light-2);
  color: var(--muted-light);
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.dropzone:hover, .dropzone.is-drag { border-color: rgba(168, 20, 56, 0.6); background: #fff; }
.dropzone.is-drag { border-style: solid; }
.dropzone strong { color: var(--text-light); font-weight: 650; }
.dropzone-hint { font-size: 13.5px; color: var(--muted-light); }
.dropzone-hint[hidden] { display: none; }

/* Список выбранных файлов: миниатюра, имя и размер. */
.dz-files { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.dz-files[hidden] { display: none; }
.dz-file {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--stroke-light);
  font-size: 14px; text-align: left;
}
.dz-thumb {
  flex: 0 0 44px; width: 44px; height: 44px;
  border-radius: 8px; overflow: hidden; object-fit: cover;
  background: var(--bg-light-2); border: 1px solid var(--stroke-light);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: var(--muted-light);
  letter-spacing: .04em;
}
.dz-name {
  flex: 1 1 auto; min-width: 0; color: var(--text-light);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dz-size { flex: 0 0 auto; color: var(--muted-light); font-size: 13px; }
.dz-note { margin: 10px 0 0; font-size: 13.5px; color: #a81438; text-align: left; }
.dz-note:empty { display: none; }

.field { display: block; margin: 14px 0 4px; text-align: left; }
.field-label { display: block; font-size: 13px; color: var(--muted-light); margin-bottom: 6px; }

.textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-light);
  background: #fff;
  color: var(--text-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
}
.textarea:focus {
  outline: none; border-color: rgba(168, 20, 56, 0.55);
  box-shadow: 0 0 0 3px rgba(168, 20, 56, 0.12);
}

/* Готовый текст (JSON, CSV, Base64): сохраняем переносы и разрешаем длинные строки. */
.output {
  margin: 0;
  max-height: 60vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-light);
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

/* Таблица предпросмотра CSV и список хешей. */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--stroke-light);
  text-align: left;
  vertical-align: top;
}
.data-table thead th {
  position: sticky; top: 0;
  background: #fff;
  font-weight: 650;
  white-space: nowrap;
}
.data-table tbody tr:hover { background: rgba(168, 20, 56, 0.04); }

.input, .select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-light);
  background: #fff;
  color: var(--text-light);
  font-size: 15px;
  font-family: inherit;
}
.input:focus, .select:focus {
  outline: none; border-color: rgba(168, 20, 56, 0.55);
  box-shadow: 0 0 0 3px rgba(168, 20, 56, 0.12);
}

.gallery {
  display: grid; gap: 14px; margin-top: 22px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.gallery-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--stroke-light);
  background: #fff;
  box-shadow: var(--shadow);
}
.gallery-item img { display: block; width: 100%; height: 130px; object-fit: cover; }
.gallery-item figcaption {
  padding: 8px 10px; font-size: 12px; color: var(--muted-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.notice {
  margin-top: 22px; padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-light);
  background: #fff; color: var(--muted-light);
  font-size: 14.5px; display: inline-block; text-align: left;
}

/* === КОДЫ (штрих-коды и QR) ============================================== */

/* Белая «подложка» под код: с экрана телефона так сканируется надёжнее. */
.code-card {
  display: inline-block;
  max-width: 100%;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke-light);
  background: #fff;
  box-shadow: var(--shadow);
}
.code-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto 14px;
  /* Код рисуется «по пикселям» — при растяжении не мылим границы. */
  image-rendering: pixelated;
}
.code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  color: var(--text-light);
  word-break: break-all;
}
.scan-image {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-light);
  background: var(--bg-light-2);
}
.checkbox-line {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 0;
  font-size: 14px; color: var(--muted-light);
}
.checkbox-line input { width: 18px; height: 18px; accent-color: var(--ruby-3); }

/* === ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА ================================================= */

.lang-picker { position: relative; flex: 0 0 auto; }
.lang-current {
  list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke-dark);
  background: var(--surface-dark);
  color: var(--muted-dark);
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer;
}
.lang-current::-webkit-details-marker { display: none; }
.lang-current:hover { color: var(--text-dark); }
.lang-picker[open] .lang-current { color: #fff; background: var(--grad); border-color: transparent; }
.lang-list {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px);
  z-index: 40;
  margin: 0; padding: 8px; list-style: none;
  min-width: 220px; max-height: 62vh; overflow: auto;
  border-radius: 14px; border: 1px solid var(--stroke-light);
  background: #fff; box-shadow: var(--shadow); text-align: left;
}
.lang-link {
  display: block; padding: 7px 10px; border-radius: 9px;
  font-size: 14px; color: var(--text-light); white-space: nowrap;
}
.lang-link:hover { background: var(--bg-light); }
.lang-link.is-active { color: #fff; background: var(--grad); }

/* === ПОДВАЛ ============================================================== */

.site-footer {
  border-top: 1px solid var(--stroke-light);
  padding: 24px 0;
  background: var(--bg-dark);
  color: var(--muted-dark);
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.copyright { margin: 0; font-size: 14px; color: var(--muted-dark); }
.footer-links { margin: 0; font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.soft-link {
  color: var(--link);
  border-bottom: 1px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}
.soft-link:hover { color: var(--link-hover); border-color: rgba(168, 20, 56, 0.45); }

/* Подвал тёмный: там рубиновый на почти чёрном не читается — светлый вариант. */
.site-footer .soft-link { color: var(--muted-dark); }
.site-footer .soft-link:hover { color: #fff; border-color: rgba(255, 255, 255, .35); }
.dot { color: rgba(255, 255, 255, .3); }

/* === АДАПТИВ ============================================================= */

@media (max-width: 820px) {
  :root { --nav-h: auto; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 0; }
  .site-nav { justify-content: flex-start; gap: 4px; }
  .nav-link { padding: 7px 12px; font-size: 13.5px; }
  .site-main { padding: 34px 0 54px; }
  .section { margin-top: 44px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .gallery-item img { height: 100px; }
  .hero-logo { width: 88px; height: 88px; font-size: 24px; }
  .lang-list { inset-inline-start: 0; inset-inline-end: auto; min-width: 200px; }
}

/* === ЯЗЫКИ С ПИСЬМОМ СПРАВА НАЛЕВО ====================================== */

[dir="rtl"] .hero, [dir="rtl"] .section { text-align: right !important; }
[dir="rtl"] .dz-file, [dir="rtl"] .notice { text-align: right; }
[dir="rtl"] .feature-list li { padding-left: 0; padding-right: 24px; }
[dir="rtl"] .feature-list li::before { left: auto; right: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
