/* Основа сайта home.tehsonoff.ru.
   Палитра взята с sonoff.ru: синий #0061B2, акцент #FF531A. */

:root {
  --brand: #0061b2;
  --brand-strong: #0062e8;
  --accent: #ff531a;
  --accent-dark: #d8410f;
  --ink: #1a1a1a;
  --ink-soft: #333333;
  --muted: #808080;
  --line: #e6e6ea;
  --bg: #f8f8fa;
  --surface: #ffffff;
  --ok: #12805c;
  --ok-bg: #e7f5ef;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --err: #b3261e;
  --err-bg: #fdecea;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.12);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-left: 1.2em; }

.container { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.section { padding: 3rem 0; }
.section--tight { padding: 2rem 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.stack { display: grid; gap: 1rem; }
.row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.hidden { display: none !important; }

/* ---------- шапка ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header__inner { display: flex; align-items: center; gap: 1.5rem; padding: 0.75rem 0; }
.logo { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.1rem; color: var(--ink); }
.logo:hover { text-decoration: none; color: var(--ink); }
.logo__mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff; display: grid; place-items: center; font-size: 0.95rem; letter-spacing: -0.02em;
}
.logo__text small { display: block; font-size: 0.7rem; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }
.nav { display: flex; gap: 0.25rem; margin-left: auto; }
.nav a {
  color: var(--ink-soft); padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 500;
}
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--brand); background: #eaf3fc; }
.header__actions { display: flex; gap: 0.5rem; align-items: center; }
.burger { display: none; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.7rem 1.2rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: 0.15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-strong); color: #fff; }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-dark); color: #fff; }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--link { background: none; color: var(--brand); padding: 0.25rem 0; }
.btn--sm { padding: 0.45rem 0.8rem; font-size: 0.875rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(0, 98, 232, 0.35); outline-offset: 2px;
}

/* ---------- первый экран ---------- */

.hero { padding: 3.5rem 0 2.5rem; background: linear-gradient(180deg, #ffffff, var(--bg)); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 3rem; align-items: center; }
.hero h1 { margin-bottom: 0.6rem; }
.hero__lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 34em; }
.hero__actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero__note { margin-top: 1.25rem; font-size: 0.875rem; color: var(--muted); }

.hero__demo {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 1.1rem;
}
.demo-line { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.5rem; border-radius: var(--radius-sm); }
.demo-line + .demo-line { border-top: 1px dashed var(--line); }
.demo-line__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.demo-line__dot--ok { background: var(--ok); }
.demo-line__dot--err { background: var(--err); }
.demo-line__dot--unknown { background: var(--warn); }
.demo-line__text { font-size: 0.9rem; }
.demo-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.4rem; }

/* ---------- карточки ---------- */

.grid { display: grid; gap: 1.25rem; }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card--link { transition: 0.15s ease; }
.card--link:hover { border-color: #b9d7f2; box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.card h3 { margin-bottom: 0.35rem; }
.card p { color: var(--ink-soft); font-size: 0.95rem; }
.card__foot { margin-top: auto; padding-top: 0.75rem; display: flex; gap: 0.5rem; align-items: center; }
.card__num {
  width: 30px; height: 30px; border-radius: 50%; background: #eaf3fc; color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.6rem;
}

/* ---------- каталог ---------- */

.filters {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; display: grid; gap: 0.9rem; margin-bottom: 1.5rem;
}
.filters__row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: end; }
.field { display: grid; gap: 0.3rem; }
.field > label { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); min-width: 0;
}
input[type="search"] { min-width: 260px; }
.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft); border-radius: 999px;
  padding: 0.4rem 0.85rem; font: inherit; font-size: 0.9rem; cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.product {
  display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 0.9rem; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem; transition: 0.15s ease;
}
.product:hover { border-color: #b9d7f2; box-shadow: var(--shadow); }
.product__img {
  width: 92px; height: 92px; border-radius: var(--radius-sm); background: #f2f5f9;
  display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 0.7rem; text-align: center;
}
.product__img img { width: 100%; height: 100%; object-fit: contain; }
.product__title { font-weight: 600; font-size: 0.98rem; margin-bottom: 0.25rem; }
.product__meta { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.4rem 0; }
.product__foot { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.4rem; }
.price { font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.price--unknown { color: var(--muted); font-weight: 600; font-size: 0.9rem; }

.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.18rem 0.55rem;
  border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge--proto { background: #eaf3fc; color: var(--brand); }
.badge--eco { background: #f0eefc; color: #4b3fa8; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--err { background: var(--err-bg); color: var(--err); }
.badge--muted { background: #f1f1f4; color: var(--muted); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ---------- конструктор ---------- */

.constructor { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; align-items: start; }
.stepper { position: sticky; top: 84px; display: grid; gap: 0.35rem; }
.stepper__item {
  display: flex; gap: 0.65rem; align-items: center; padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm); color: var(--muted); font-size: 0.925rem; background: none; border: 0;
  text-align: left; cursor: pointer; font-family: inherit;
}
.stepper__item[data-state="current"] { background: #eaf3fc; color: var(--brand); font-weight: 600; }
.stepper__item[data-state="done"] { color: var(--ink-soft); }
.stepper__num {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid currentColor;
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; flex: none;
}
.stepper__item[data-state="current"] .stepper__num { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper__item[data-state="done"] .stepper__num { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 1.25rem; }
.panel__head { margin-bottom: 1.25rem; }
.panel__head h2 { margin-bottom: 0.25rem; }
.panel__head p { color: var(--muted); margin: 0; font-size: 0.95rem; }

.choice { display: grid; gap: 0.6rem; }
.choice--inline { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.option {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.8rem 0.9rem;
  display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; background: #fff;
}
.option:hover { border-color: #b9d7f2; }
.option input { margin-top: 0.25rem; }
.option__title { font-weight: 600; font-size: 0.95rem; }
.option__hint { color: var(--muted); font-size: 0.85rem; }
.option:has(input:checked) { border-color: var(--brand); background: #f6faff; }

.nav-buttons { display: flex; gap: 0.75rem; justify-content: space-between; margin-top: 1.5rem; }

.devicerow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.75rem; align-items: center;
  padding: 0.7rem 0; border-bottom: 1px solid var(--line);
}
.devicerow:last-child { border-bottom: 0; }
.devicerow__name { font-weight: 600; font-size: 0.95rem; }
.devicerow__why { color: var(--muted); font-size: 0.82rem; }
.qty { display: inline-flex; align-items: center; gap: 0.4rem; }
.qty button {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: 1rem; line-height: 1; color: var(--ink-soft);
}
.qty button:hover { border-color: var(--brand); color: var(--brand); }
.qty__value { min-width: 1.5em; text-align: center; font-weight: 600; }

.summary-bar {
  position: sticky; bottom: 0; background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line);
  padding: 0.9rem 0; display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  backdrop-filter: blur(6px);
}
/* чтобы липкая полоса итога не закрывала последний блок */
body[data-page="constructor"] main { padding-bottom: 2rem; }
body[data-page="constructor"] .nav-buttons { margin-bottom: 2.5rem; }

.check { border-radius: var(--radius-sm); padding: 0.8rem 0.9rem; border: 1px solid var(--line); display: grid; gap: 0.2rem; }
.check--error { background: var(--err-bg); border-color: #f3c3bf; }
.check--unknown { background: var(--warn-bg); border-color: #f0dcb4; }
.check--warning { background: var(--warn-bg); border-color: #f0dcb4; }
.check--ok { background: var(--ok-bg); border-color: #bfe6d6; }
.check__title { font-weight: 700; font-size: 0.9rem; }
.check__text { font-size: 0.9rem; }
.check__src { font-size: 0.8rem; color: var(--muted); word-break: break-all; }

/* ---------- таблицы и текст ---------- */

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--line); font-size: 0.93rem; vertical-align: top; }
.table th { background: #f6f8fb; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }

.prose { max-width: 46rem; }
.prose h2 { margin-top: 2rem; }
.prose p, .prose li { color: var(--ink-soft); }

.notice { border-radius: var(--radius-sm); padding: 1rem 1.1rem; border: 1px solid var(--line); background: #fff; }
.notice--info { background: #f2f8ff; border-color: #cfe4fb; }
.notice--warn { background: var(--warn-bg); border-color: #f0dcb4; }

.kv { display: grid; grid-template-columns: minmax(120px, 0.4fr) minmax(0, 1fr); gap: 0.4rem 1rem; font-size: 0.93rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- подвал ---------- */

.footer { margin-top: 4rem; background: #10243a; color: #cfd8e3; padding: 2.5rem 0 1.5rem; }
.footer a { color: #eaf3fc; }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
.footer h4 { color: #fff; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.75rem; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; font-size: 0.9rem; }
.footer__bottom { border-top: 1px solid rgba(255, 255, 255, 0.12); margin-top: 2rem; padding-top: 1rem; font-size: 0.8rem; color: #92a2b6; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- адаптив ---------- */

@media (max-width: 980px) {
  .hero__grid { grid-template-columns: 1fr; }
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .constructor { grid-template-columns: 1fr; }
  .stepper { position: static; display: flex; overflow-x: auto; gap: 0.25rem; padding-bottom: 0.5rem; }
  .stepper__item { white-space: nowrap; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .nav { display: none; }
  .nav.is-open {
    display: grid; position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--line); padding: 0.5rem 1.25rem 1rem; gap: 0.15rem;
  }
  .burger {
    display: inline-flex; margin-left: auto; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; font-size: 1.1rem; cursor: pointer;
  }
  .grid--3, .grid--4, .grid--2 { grid-template-columns: 1fr; }
  .product { grid-template-columns: 72px minmax(0, 1fr); }
  .product__img { width: 72px; height: 72px; }
  .footer__grid { grid-template-columns: 1fr; }
  .summary-bar { flex-direction: column; align-items: stretch; }
}

@media print {
  .header, .footer, .stepper, .nav-buttons, .summary-bar, .btn { display: none !important; }
  body { background: #fff; }
  .panel, .card { box-shadow: none; border-color: #ddd; }
}
