/* ecoeat.ru — new static site, mobile-first */

:root {
  --green: #3b7d2c;
  --green-d: #2c5f20;
  --green-l: #e9f3e2;
  --beige: #f6f1e4;
  --cream: #faf6ec;
  --line: #e2dccd;
  --accent: #c8531f;
  --text: #2a2a2a;
  --mute: #6c6c6c;
  --bg: #fff;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .05);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--cream);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PT Sans", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--green); text-decoration: none; transition: color .15s; }
a:hover { color: var(--green-d); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; color: var(--text); font-weight: 700; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 .9em; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 14px;
}

/* ============ Header ============ */
.site-header {
  background: #fff;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50;
}
.header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding-top: 10px; padding-bottom: 10px;
  gap: 14px;
  flex-wrap: wrap;
}
.logo { display: inline-flex; flex-direction: column; line-height: 1.1; }
.logo-mark {
  font-size: 1.6rem; font-weight: 800;
  color: var(--green); letter-spacing: -.02em;
}
.logo-dot { color: var(--accent); }
.logo-sub { font-size: .75rem; color: var(--mute); font-weight: 500; margin-top: 2px; }

.nav-toggle {
  display: flex; flex-direction: column; gap: 4px;
  width: 38px; height: 38px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; }

.nav-menu {
  list-style: none; margin: 0; padding: 0;
  display: none;
  width: 100%;
  background: #fff;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding: 8px 0;
}
.nav-menu.is-open { display: block; }
.nav-menu li { padding: 0; }
.nav-menu a {
  display: block;
  padding: 10px 8px;
  color: var(--text);
  font-weight: 500;
  border-radius: 6px;
}
.nav-menu a:hover { background: var(--green-l); text-decoration: none; }
.nav-menu a[aria-current="page"] { background: var(--green); color: #fff; }

@media (min-width: 760px) {
  .nav-toggle { display: none; }
  .nav-menu {
    display: flex !important;
    width: auto;
    background: none;
    border: none;
    margin: 0;
    padding: 0;
    gap: 4px;
  }
  .nav-menu a { padding: 8px 14px; }
}

/* ============ Crumbs ============ */
.crumbs {
  padding: 14px 0 6px;
  font-size: .85rem;
  color: var(--mute);
  display: flex; flex-wrap: wrap; gap: 4px;
}
.crumbs a { color: var(--mute); }
.crumbs a:hover { color: var(--green-d); }
.crumb-sep { opacity: .4; }

.page-h1 { margin: 6px 0 16px; font-size: 1.6rem; }

/* ============ Layout ============ */
.main { padding-bottom: 30px; }
.layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.content {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.sidebar { display: flex; flex-direction: column; gap: 14px; }

@media (min-width: 1000px) {
  .layout { flex-direction: row; align-items: flex-start; }
  .content { flex: 1 1 auto; min-width: 0; padding: 26px 30px; }
  .sidebar { flex: 0 0 300px; max-width: 300px; position: sticky; top: 80px; }
}

/* ============ Sape block ============ */
.sape-box {
  background: var(--beige);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  max-width: 300px;
  overflow-wrap: anywhere;
  word-wrap: break-word;
  box-sizing: border-box;
}
.sape-label {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 8px;
}
.sape-links { font-size: .88rem; line-height: 1.55; overflow-wrap: anywhere; }
.sape-links a { color: var(--mute); display: inline; overflow-wrap: anywhere; }
.sape-links a:hover { color: var(--green-d); }
.sape-links > * { min-height: 1em; }

/* ============ Link-boost panel (low-inbound products) ============ */
.boost-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  max-width: 300px;
  box-sizing: border-box;
}
.boost-label {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 10px;
}
.boost-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.boost-list li { padding: 0; }
.boost-list a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  color: var(--text);
  font-size: .86rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.boost-list a:hover { background: var(--green-l); color: var(--green-d); text-decoration: none; }
.boost-list .bl-title { flex: 1 1 auto; }
.boost-list .bl-price { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* ============ Home ============ */
.hero .lead {
  font-size: 1.05rem;
  color: var(--mute);
  margin: 0 0 18px;
}
.usp {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 0 22px;
}
.usp-item {
  background: var(--green-l);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: .88rem;
  color: var(--text);
  display: flex; flex-direction: column;
}
.usp-item strong { display: block; color: var(--green-d); font-size: .95rem; margin-bottom: 2px; }
.usp-ic { font-size: 1.4rem; margin-bottom: 6px; }
@media (min-width: 600px) { .usp { grid-template-columns: repeat(4, 1fr); } }

.cats h2 { margin-bottom: 14px; }
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.cat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 14px;
  display: flex; flex-direction: column;
  min-height: 80px;
  justify-content: center;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.cat-card:hover {
  border-color: var(--green);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
}
.cat-title { font-weight: 600; color: var(--text); }
.cat-count { font-size: .8rem; color: var(--mute); margin-top: 4px; }

.intro { margin-top: 24px; }

/* ============ Category grid ============ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex; flex-direction: column;
  gap: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.product-card:hover {
  border-color: var(--green);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.product-title { font-weight: 500; color: var(--text); line-height: 1.35; }
.product-price { font-weight: 700; color: var(--accent); font-size: 1.05rem; }

.subcats { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.subcat-link {
  background: var(--green-l);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: .88rem;
  color: var(--green-d);
  font-weight: 500;
}
.subcat-link:hover { background: var(--green); color: #fff; text-decoration: none; }

/* ============ Product page ============ */
.product {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}
.product-image img {
  width: 100%;
  border-radius: 8px;
  background: var(--beige);
}
.product-meta {
  display: flex; flex-direction: column; gap: 14px;
}
.price-block {
  font-size: 1.15rem;
  display: flex; align-items: baseline; gap: 8px;
}
.price-label { color: var(--mute); font-size: .9rem; }
.price-value { color: var(--accent); font-weight: 700; font-size: 1.45rem; }

.order-form {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--beige);
  padding: 14px;
  border-radius: 8px;
}
.order-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: .85rem; color: var(--mute);
}
.order-form input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.order-form input:focus { outline: none; border-color: var(--green); }
.btn-primary {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 22px;
  font: 600 1rem inherit;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--green-d); color: #fff; text-decoration: none; }

.form-success {
  background: #e4f2dc;
  border: 1px solid #b8d9a6;
  color: var(--green-d);
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 10px;
  font-size: .95rem;
}
.form-success strong { display: block; margin-bottom: 3px; }

.delivery-note {
  font-size: .85rem;
  color: var(--mute);
  background: var(--green-l);
  padding: 10px 12px;
  border-radius: 6px;
}

@media (min-width: 700px) {
  .product { flex-direction: row; }
  .product-image { flex: 0 0 45%; }
  .product-meta { flex: 1 1 auto; }
}

/* ============ Prose (generic content) ============ */
.prose { font-size: 1rem; line-height: 1.6; overflow-wrap: anywhere; word-wrap: break-word; }
.prose p { margin: 0 0 .9em; }
.prose h2 { margin-top: 1.2em; }
.prose h3 { margin-top: 1em; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 1em; }
.prose img { margin: 10px 0; border-radius: 6px; max-width: 100%; height: auto; }
.prose table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: .92rem; table-layout: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--beige); font-weight: 600; }

/* --- Mobile responsive tables: stack each row as labeled card (no h-scroll) --- */
@media (max-width: 640px) {
  .prose table,
  .prose thead,
  .prose tbody,
  .prose tfoot {
    display: block;
    width: 100%;
  }
  .prose thead,
  .prose th {
    display: none !important;
  }
  /* rows that contain no <td> (i.e., only <th>) — empty, hide */
  .prose tr:not(:has(td)) {
    display: none !important;
  }
  .prose tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    margin: 0 0 10px;
    background: #fff;
    box-sizing: border-box;
  }
  .prose td {
    display: block;
    border: none;
    padding: 4px 0;
    text-align: left;
    font-size: .92rem;
    min-height: auto;
  }
  .prose td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--mute);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: inline-block;
    margin-right: 6px;
  }
  .prose td:empty {
    display: none;
  }
  .prose input[type="text"],
  .prose input[type="number"] {
    max-width: 100px;
  }
}

/* --- Global overflow defenses (every breakpoint) --- */
html, body { overflow-x: hidden; max-width: 100%; }
.prose pre, .prose code {
  overflow-x: auto;
  max-width: 100%;
}
/* legacy form inputs in body content must never exceed viewport */
.prose input, .prose textarea, .prose select,
.content input, .content textarea, .content select {
  max-width: 100%;
  box-sizing: border-box;
}
/* legacy .big/.mid/.small classes from default.css */
.big, .mid, .small { max-width: 100%; box-sizing: border-box; }
/* any element with inline [width] attribute */
[width]:not([width="100%"]) { max-width: 100% !important; height: auto; }

/* ============ FAQ / News ============ */
.faq-list, .news-list { display: flex; flex-direction: column; gap: 8px; }
.faq-entry, .news-entry {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-decoration: none;
  color: var(--text);
}
.faq-entry:hover, .news-entry a:hover { border-color: var(--green); text-decoration: none; }
.faq-entry h3, .news-entry h3 { margin: 0; font-size: 1rem; color: var(--green-d); }

/* ============ Cart / Contacts ============ */
.cart-empty, .contact-block { text-align: center; padding: 30px 10px; }
.cart-empty p, .contact-block p { margin: 0 0 14px; }
.contact-block { text-align: left; }

/* ============ Footer ============ */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}
.footer-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 22px 14px;
  font-size: .9rem;
  color: var(--mute);
}
.foot-col { flex: 1 1 180px; }
.foot-col a { color: var(--mute); }
.foot-col a:hover { color: var(--green-d); }
.foot-links { display: flex; flex-direction: column; gap: 4px; }
.foot-copy { width: 100%; text-align: center; font-size: .85rem; opacity: .7; border-top: 1px solid var(--line); padding-top: 12px; }
