/* terra-agro.uz — публичная часть
   Палитра по ТЗ: белый, тёмно-синий, чёрный.
   Опорный визуальный приём — «клетка таблицы Менделеева»:
   элементы питания (N, Ca, K, B, Mn, Zn) показаны как в химии,
   одинаково в карточке товара, в фильтрах и в расчёте. */

:root {
  --paper: #ffffff;
  --mist: #f2f5f9;
  --navy: #102a4c;
  --navy-deep: #071a33;
  --ink: #000000;
  --muted: #5a6675;
  --line: #d7dfe9;
  --focus: #2f6fd0;

  --wrap: 1180px;
  --r: 4px;
  --shadow: 0 18px 40px -28px rgba(7, 26, 51, .55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Golos Text", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

h1, h2, h3 { font-weight: 800; line-height: 1.12; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(30px, 4.6vw, 52px); }
h2 { font-size: clamp(24px, 3vw, 34px); }
h3 { font-size: 20px; font-weight: 600; }
p { margin: 0 0 1em; max-width: 68ch; }

.lead { font-size: 19px; color: var(--muted); }

/* --------------------------------------------------------------- Кнопки */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 24px; border: 1px solid var(--navy); border-radius: var(--r);
  background: var(--navy); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; transition: background .15s, color .15s;
}
.btn:hover { background: var(--navy-deep); border-color: var(--navy-deep); text-decoration: none; color: #fff; }
.btn--ghost { background: transparent; color: var(--navy); }
.btn--ghost:hover { background: var(--navy); color: #fff; }
.btn--light { background: #fff; color: var(--navy); border-color: #fff; }
.btn--light:hover { background: var(--mist); color: var(--navy); border-color: var(--mist); }
.btn--wide { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* -------------------------------------------------------------- Шапка */
.topline {
  background: var(--navy-deep); color: #c9d6e6; font-size: 14px;
}
.topline .wrap { display: flex; gap: 20px; align-items: center; justify-content: space-between; min-height: 40px; }
.topline a { color: #fff; }

.lang { display: flex; gap: 4px; align-items: center; }
.lang a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: var(--r); color: #c9d6e6; font-weight: 600;
}
.lang a.is-on { background: #fff; color: var(--navy-deep); }
.lang a:hover { text-decoration: none; color: #fff; }
.lang a.is-on:hover { color: var(--navy-deep); }
.lang .flag { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }

header.head { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 50; }
.head__in { display: flex; align-items: center; gap: 28px; min-height: 76px; }
.logo { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 21px; letter-spacing: -.02em; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo__mark {
  width: 38px; height: 38px; border-radius: 3px; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-size: 15px; font-weight: 800;
}
nav.main { display: flex; gap: 22px; margin-left: auto; }
nav.main a { color: var(--ink); font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent; }
nav.main a:hover { text-decoration: none; border-bottom-color: var(--navy); }
nav.main a.is-on { border-bottom-color: var(--navy); font-weight: 600; }

.head__tools { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 42px; height: 42px; border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--navy);
}
.icon-btn:hover { border-color: var(--navy); }
.burger { display: none; }

/* ---------------------------------------------------------- Поиск (overlay) */
.search-layer {
  position: fixed; inset: 0; background: rgba(7, 26, 51, .6); z-index: 100;
  display: none; padding: 8vh 20px;
}
.search-layer.is-open { display: block; }
.search-box { max-width: 760px; margin: 0 auto; background: #fff; border-radius: var(--r); overflow: hidden; }
.search-box input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 22px 24px;
  font: inherit; font-size: 20px;
}
.search-box input:focus { outline: none; border-bottom-color: var(--navy); }
.search-res { max-height: 60vh; overflow: auto; }
.search-res a { display: flex; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--line); color: var(--ink); }
.search-res a:hover { background: var(--mist); text-decoration: none; }
.search-res img { width: 54px; height: 54px; object-fit: contain; background: var(--mist); }
.search-res .t { font-weight: 600; }
.search-res .s { color: var(--muted); font-size: 14px; }
.search-empty { padding: 26px 24px; color: var(--muted); }

/* ------------------------------------------------------------- Слайдер */
.slider { position: relative; background: var(--navy-deep); overflow: hidden; }
.slide { display: none; position: relative; min-height: 460px; }
.slide.is-on { display: block; }
.slide__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slide__veil { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(7,26,51,.86), rgba(7,26,51,.45)); }
.slide__in { position: relative; padding: 92px 0; color: #fff; }
.slide__in h1, .slide__in h2 { color: #fff; max-width: 17ch; }
.slide__in p { color: #d7e2f0; max-width: 52ch; font-size: 19px; }
.slider__dots { position: absolute; left: 0; right: 0; bottom: 22px; display: flex; gap: 8px; justify-content: center; }
.slider__dots button { width: 28px; height: 4px; border: 0; background: rgba(255,255,255,.4); cursor: pointer; padding: 0; }
.slider__dots button.is-on { background: #fff; }

/* -------------------------------------------------------------- Секции */
.sec { padding: 72px 0; }
.sec--mist { background: var(--mist); }
.sec__head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 34px; flex-wrap: wrap; }
.sec__head p { margin: 0; color: var(--muted); }

/* ------------------------------------------------- Карточки товаров */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); }

.card {
  border: 1px solid var(--line); background: #fff; display: flex; flex-direction: column;
  color: var(--ink); border-radius: var(--r); overflow: hidden;
}
.card:hover { text-decoration: none; border-color: var(--navy); }
.card__pic { aspect-ratio: 4 / 3; background: var(--mist); display: grid; place-items: center; padding: 18px; }
.card__pic img { max-height: 100%; width: auto; object-fit: contain; }
.card__body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card__cat { font-size: 13px; color: var(--muted); }
.card__name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.card__solves { color: var(--muted); font-size: 15px; flex: 1; }
.card__more { font-weight: 600; color: var(--navy); }

/* Клетка элемента — фирменный приём */
.els { display: flex; flex-wrap: wrap; gap: 5px; }
.el {
  min-width: 42px; border: 1px solid var(--navy); border-radius: 2px; padding: 4px 6px 5px;
  line-height: 1.05; text-align: left; background: #fff;
}
.el b { display: block; font-size: 15px; font-weight: 700; }
.el span { font-size: 11px; color: var(--muted); }
.el--solid { background: var(--navy); border-color: var(--navy); color: #fff; }
.el--solid span { color: #b9c9de; }

/* ------------------------------------------------------------- Каталог */
.catalog { display: grid; grid-template-columns: 268px 1fr; gap: 34px; align-items: start; }
.side { border: 1px solid var(--line); border-radius: var(--r); position: sticky; top: 96px; }
.side__block { padding: 18px; border-bottom: 1px solid var(--line); }
.side__block:last-child { border-bottom: 0; }
.side__block h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.side__block label { display: flex; gap: 9px; align-items: center; padding: 5px 0; cursor: pointer; font-size: 15px; }
.side__block input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--navy); }
.cats a { display: block; padding: 7px 0; color: var(--ink); }
.cats a.is-on { font-weight: 700; color: var(--navy); }
.filters-actions { padding: 16px 18px; display: flex; gap: 10px; }

/* ------------------------------------------------------- Страница товара */
.product { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.product__pic { border: 1px solid var(--line); background: var(--mist); padding: 32px; display: grid; place-items: center; min-height: 340px; }
.product__pic img { max-height: 420px; object-fit: contain; }
.spec { width: 100%; border-collapse: collapse; margin: 22px 0; }
.spec td { padding: 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec td:first-child { color: var(--muted); width: 45%; }
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin: 48px 0 26px; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 0;
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tabs button.is-on { color: var(--ink); border-bottom-color: var(--navy); }
.tabpane { display: none; }
.tabpane.is-on { display: block; }

/* Инструкция по применению — прилипающая кнопка + модалка */
.usage-cta {
  display: flex; gap: 18px; align-items: center; justify-content: space-between;
  border: 1px solid var(--navy); border-left: 5px solid var(--navy); padding: 18px 20px; margin: 22px 0;
  flex-wrap: wrap;
}
.usage-cta b { display: block; font-size: 17px; }
.usage-cta span { color: var(--muted); font-size: 15px; }

.modal { position: fixed; inset: 0; background: rgba(7,26,51,.62); z-index: 120; display: none; padding: 5vh 20px; overflow: auto; }
.modal.is-open { display: block; }
.modal__box { max-width: 760px; margin: 0 auto; background: #fff; border-radius: var(--r); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 26px; border-bottom: 1px solid var(--line); }
.modal__head h3 { margin: 0; }
.modal__body { padding: 26px; }
.modal__x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; }

/* --------------------------------------------------------------- Формы */
.form { display: grid; gap: 16px; }
.form--2 { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 600; }
.field .req { color: var(--navy); }
.field input, .field textarea, .field select {
  border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px;
  font: inherit; background: #fff; width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.field textarea { min-height: 110px; resize: vertical; }
.field small { color: var(--muted); font-size: 13px; }
.field.has-error input, .field.has-error textarea { border-color: #b3261e; }
.field .err { color: #b3261e; font-size: 13px; }
.form-note { color: var(--muted); font-size: 14px; }
.ok-msg { border: 1px solid var(--navy); border-left: 5px solid var(--navy); padding: 18px 20px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }

/* ---------------------------------------------------------- Калькулятор */
.calc-res { border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }
.calc-res ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.calc-res li { display: flex; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.calc-res li:last-child { border-bottom: 0; padding-bottom: 0; }
.calc-res .qty { font-weight: 800; font-size: 22px; white-space: nowrap; }

/* ----------------------------------------------------------------- Чат */
.chat { border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; height: 560px; }
.chat__head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.chat__dot { width: 9px; height: 9px; border-radius: 50%; background: #1e9e5a; }
.chat__log { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 76%; padding: 11px 15px; border-radius: 10px; font-size: 16px; }
.msg--client { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 2px; }
.msg--agronom { align-self: flex-start; background: var(--mist); border-bottom-left-radius: 2px; }
.msg time { display: block; font-size: 11px; opacity: .65; margin-top: 4px; }
.chat__form { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.chat__form input { flex: 1; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font: inherit; }

/* --------------------------------------------------- Плавающие кнопки */
.floats { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column-reverse; gap: 10px; align-items: flex-end; }
.float {
  width: 52px; height: 52px; border-radius: 50%; background: var(--navy); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow); border: 0; cursor: pointer;
}
.float:hover { background: var(--navy-deep); text-decoration: none; color: #fff; }
.float svg { width: 24px; height: 24px; }

.chatbox {
  position: fixed; right: 18px; bottom: 84px; width: 340px; max-width: calc(100vw - 36px);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  display: none; z-index: 95; overflow: hidden;
}
.chatbox.is-open { display: block; }
.chatbox .chat { border: 0; height: 430px; }

/* -------------------------------------------------------------- Подвал */
footer.foot { background: var(--navy-deep); color: #c6d3e3; padding: 56px 0 30px; margin-top: 72px; }
footer.foot a { color: #fff; }
.foot__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 40px; }
.foot__phone { font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; letter-spacing: -.02em; color: #fff; display: inline-block; margin: 10px 0; }
.foot__phone:hover { text-decoration: none; }
.foot h3 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.socials { display: flex; gap: 10px; margin-top: 14px; }
.socials a { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.28); border-radius: var(--r); display: grid; place-items: center; }
.socials a:hover { background: #fff; color: var(--navy-deep); }
.socials svg { width: 20px; height: 20px; }
.foot__bottom { border-top: 1px solid rgba(255,255,255,.16); margin-top: 40px; padding-top: 20px; font-size: 14px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ----------------------------------------------------------- Мелочи */
.crumbs { font-size: 14px; color: var(--muted); padding: 22px 0 0; }
.crumbs a { color: var(--muted); }
.empty { padding: 60px 0; color: var(--muted); }
.employee { border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.employee b { display: block; font-size: 17px; }
.employee .pos { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.offline { display: grid; place-items: center; min-height: 100vh; text-align: center; padding: 40px; }

@media (max-width: 980px) {
  .catalog, .product, .split, .foot__grid, .form--2 { grid-template-columns: 1fr; }
  .side { position: static; }
  nav.main {
    display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff;
    border-bottom: 1px solid var(--line); flex-direction: column; gap: 0; padding: 8px 20px 18px;
  }
  nav.main.is-open { display: flex; }
  nav.main a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .burger { display: grid; }
  .head__in { position: relative; }
  .slide__in { padding: 62px 0; }
  .slide { min-height: 380px; }
  .sec { padding: 52px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
