/* === Базовые переменные === */
:root {
  --color-bg:        #f7f6f2;
  --color-surface:   #ffffff;
  --color-text:      #28251d;
  --color-muted:     #7a7974;
  --color-primary:   #01696f;
  --color-primary-h: #0c4e54;
  --color-border:    #d4d1ca;
  --color-error:     #a12c7b;
  --color-success:   #437a22;
  --font-body: 'Raleway', 'Helvetica Neue', sans-serif;
  --font-display: 'Raleway', Georgia, serif;
  --space-2: 0.5rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --radius: 0.5rem;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);

  /* Шапка: размеры в двух состояниях */
  --header-height-full:    115px;
  --header-height-compact: 56px;
  --logo-height-full:      90px;
  --logo-height-compact:   32px;
  --wordmark-height-full:  56px;
  --wordmark-height-compact: 22px;
  --header-transition:     0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  padding-top: var(--header-height-full);
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-h); }

/* === Шапка === */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height-full);
  transition:
    height var(--header-transition),
    box-shadow var(--header-transition),
    background var(--header-transition);
  will-change: height;
}

.site-header--compact {
  height: var(--header-height-compact);
  box-shadow: 0 2px 16px rgba(0,0,0,0.09);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--space-4);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* === Лого === */
.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.nav__logo-img {
  height: var(--logo-height-full);
  width: auto;
  display: block;
  transition: height var(--header-transition);
  will-change: height;
}

.site-header--compact .nav__logo-img {
  height: var(--logo-height-compact);
}

.nav__logo-wordmark {
  height: var(--wordmark-height-full);
  width: auto;
  display: block;
  transition: height var(--header-transition);
  will-change: height;
}

.site-header--compact .nav__logo-wordmark {
  height: var(--wordmark-height-compact);
}

/* === Навигация === */
.nav__links {
  list-style: none;
  display: flex;
  gap: var(--space-6);
}

.nav__links a {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-text);
  transition: color 0.18s;
  position: relative;
}

.nav__links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.nav__links a:hover::after,
.nav__links a.active::after {
  transform: scaleX(1);
}

.nav__links a:hover,
.nav__links a.active {
  color: var(--color-primary);
}

/* === Основной контент === */
.main {
  min-height: calc(100dvh - var(--header-height-full));
  padding: var(--space-8) var(--space-4);
}

.container {
  max-width: 960px;
  margin: 0 auto;
}

.container--narrow {
  max-width: 720px;
  margin: 0 auto;
}

/* === Герой === */
.hero {
  max-width: 720px;
  margin: var(--space-16) auto;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.hero p {
  font-size: 1.15rem;
  color: var(--color-muted);
  margin-bottom: var(--space-8);
}

/* === Кнопка === */
.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.18s;
}

.btn:hover { background: var(--color-primary-h); color: #fff; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn--small {
  padding: 0.4rem 1rem;
  font-size: 0.875rem;
}

.btn--full {
  width: 100%;
  text-align: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* === Список статей === */
.page-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  margin-bottom: var(--space-8);
}

.post-list {
  display: grid;
  gap: var(--space-8);
}

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr;
}

.post-card__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-card__body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.post-card__date {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.post-card__title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
}

.post-card__title a { color: var(--color-text); }
.post-card__title a:hover { color: var(--color-primary); }

.post-card__preview {
  color: var(--color-muted);
  font-size: 0.95rem;
  flex: 1;
}

.empty-state { color: var(--color-muted); font-size: 1rem; }

/* === Страница статьи === */
.breadcrumb {
  margin-bottom: var(--space-6);
  font-size: 0.9rem;
}

.article__cover {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: var(--space-6);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.article__header {
  margin-bottom: var(--space-6);
}

.article__date {
  display: block;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: var(--space-2);
}

.article__title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.25;
}

.article__content {
  font-size: 1rem;
  line-height: 1.8;
}

.article__content h2 { font-size: 1.4rem; margin: var(--space-8) 0 var(--space-4); }
.article__content h3 { font-size: 1.15rem; margin: var(--space-6) 0 var(--space-2); }
.article__content p  { margin-bottom: var(--space-4); max-width: 68ch; }
.article__content img {
  border-radius: var(--radius);
  margin: var(--space-6) 0;
  max-width: 100%;
}
.article__content ul,
.article__content ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}
.article__content blockquote {
  border-left: 3px solid var(--color-primary);
  padding-left: var(--space-4);
  color: var(--color-muted);
  font-style: italic;
  margin: var(--space-6) 0;
}
.article__content code {
  background: #f0efeb;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* === Подвал === */
.site-footer {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  font-size: 0.85rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
}

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

@media (max-width: 640px) {
  :root {
    --header-height-full:    auto;
    --header-height-compact: 56px;
    --logo-height-full:      60px;
    --logo-height-compact:   28px;
    --wordmark-height-full:  36px;
    --wordmark-height-compact: 18px;
  }

  body {
    padding-top: 130px;
  }

  .site-header {
    height: auto !important;
    padding: var(--space-2) 0;
  }

  .site-header--compact {
    height: var(--header-height-compact) !important;
    padding: 0;
    overflow: hidden;
  }

  .nav {
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    padding: var(--space-2) var(--space-4);
    gap: var(--space-2) 0;
  }

  .nav__logo {
    flex: 1 1 100%;
  }

  .nav__links {
    flex: 1 1 100%;
    gap: var(--space-4);
    padding-bottom: var(--space-2);
  }

  .nav__links a { font-size: 0.95rem; }

  .site-header--compact .nav {
    flex-wrap: nowrap;
  }
  .site-header--compact .nav__logo {
    flex: 0 0 auto;
  }
  .site-header--compact .nav__links {
    display: none;
  }
}

/* ============================================================
   МАГАЗИН — сетка карточек
   ============================================================ */

.shop-lead {
  color: var(--color-muted);
  margin-bottom: var(--space-8);
  font-size: 1.05rem;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-6);
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: var(--color-text);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s, transform 0.18s;
}
.product-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.11);
  transform: translateY(-2px);
  color: var(--color-text);
}

.product-card__thumb {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #f0efeb;
}
.product-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.product-card:hover .product-card__thumb img { transform: scale(1.04); }

.product-card__thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}
.product-card__thumb--placeholder svg { width: 60px; height: 60px; }

.product-card__body {
  padding: var(--space-4) var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.product-card__name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.product-card__price {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: 0.25rem;
}

.product-card__price-unit {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--color-muted);
}

.product-card__status {
  display: inline-block;
  margin-top: auto;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  align-self: flex-start;
}
.product-card__status--in  { background: #d4dfcc; color: #1e3f0a; }
.product-card__status--out { background: #e7d7c4; color: #713417; }

/* ============================================================
   СТРАНИЦА ТОВАРА
   ============================================================ */

.product-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: start;
  margin-top: var(--space-6);
}

@media (max-width: 680px) {
  .product-page { grid-template-columns: 1fr; }
}

/* ============================================================
   БЛОК ОПИСАНИЯ ТОВАРА (полная ширина, внизу страницы)
   ============================================================ */

.product-description {
  padding: var(--space-6) var(--space-4);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-4);
}

.product-description__title {
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  font-weight: 700;
  margin-bottom: var(--space-6);
  color: var(--color-text);
}

.product-description__body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text);
}

.product-description__body h2 { font-size: 1.4rem; margin: var(--space-8) 0 var(--space-4); }
.product-description__body h3 { font-size: 1.15rem; margin: var(--space-6) 0 var(--space-2); }
.product-description__body p  { margin-bottom: var(--space-4); max-width: 72ch; }
.product-description__body ul,
.product-description__body ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}
.product-description__body li { margin-bottom: var(--space-2); }
.product-description__body img {
  border-radius: var(--radius);
  margin: var(--space-6) 0;
  max-width: 100%;
  height: auto;
}
.product-description__body blockquote {
  border-left: 3px solid var(--color-primary);
  padding-left: var(--space-4);
  color: var(--color-muted);
  font-style: italic;
  margin: var(--space-6) 0;
}
.product-description__body strong { font-weight: 700; }
.product-description__body code {
  background: #f0efeb;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* ============================================================
   КАРУСЕЛЬ
   ============================================================ */

.carousel {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #f0efeb;
  user-select: none;
}

.carousel__track {
  display: flex;
  width: 100%;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.carousel__slide {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
}

.carousel__slide img {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.carousel__slide--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0efeb;
}

.product-placeholder-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}
.product-placeholder-img svg { width: 120px; height: 120px; }

.carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
  z-index: 2;
}
.carousel__btn:hover { background: #fff; }
.carousel__btn--prev { left: 0.5rem; }
.carousel__btn--next { right: 0.5rem; }

.carousel__dots {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.35rem;
  z-index: 2;
}

.carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s;
}
.carousel__dot[aria-selected="true"] { background: #fff; }

/* ============================================================
   ЛАЙТБОКС
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}
.lightbox[hidden] { display: none; }

.lightbox__img-wrap {
  max-width: min(90vw, 600px);
  max-height: 90vh;
  display: flex;
  align-items: center;
}

.lightbox__img-wrap img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius);
  object-fit: contain;
  height: auto !important;
}

.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox__close:hover { background: rgba(255,255,255,0.3); }

.lightbox__nav {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.lightbox__nav:hover { background: rgba(255,255,255,0.3); }

.product-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.product-info__name {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 700;
  line-height: 1.2;
}

.product-info__price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.product-info__price-rub {
  font-size: 1.6rem;
  font-weight: 700;
}

.product-info__price-unit {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-muted);
}

.product-info__desc {
  color: var(--color-muted);
  line-height: 1.7;
}

.order-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
}

.order-form__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-muted);
}

.order-form__qty-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.qty-btn:hover { background: var(--color-bg); }

.qty-input {
  width: 60px;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  font-size: 1rem;
  font-family: inherit;
}
.qty-input:focus { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.order-form__stock { font-size: 0.8rem; color: var(--color-muted); }
.order-form__note  { font-size: 0.82rem; color: var(--color-muted); }

/* ============================================================
   ФОРМА ПРЕДЗАКАЗА
   ============================================================ */

.preorder-section {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.preorder-section__badge {
  display: inline-block;
  background: #e7d7c4;
  color: #713417;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  align-self: flex-start;
}

.preorder-section__text { font-size: 1rem; color: var(--color-muted); }

.preorder-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.contact-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--color-muted);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.contact-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: #f0f7f7;
}

.contact-chip.active {
  border-color: var(--color-primary);
  background: #e2f0ef;
  color: var(--color-primary);
  font-weight: 600;
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.contact-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.contact-input-wrap input {
  width: 100%;
  padding: 0.6rem 2.25rem 0.6rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--color-text);
}

.contact-input-wrap input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(1,105,111,0.12);
}

.contact-input-wrap.is-valid input {
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(67,122,34,0.1);
}

.contact-input-wrap.is-invalid input {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(161,44,123,0.1);
}

.contact-input-status {
  position: absolute;
  right: 0.6rem;
  display: flex;
  align-items: center;
  pointer-events: none;
  line-height: 0;
  transition: opacity 0.18s;
}

.contact-input-hint {
  font-size: 0.78rem;
  color: var(--color-muted);
  line-height: 1.4;
}

.contact-input-hint--err {
  color: var(--color-error);
}

.preorder-spam-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--color-muted);
  line-height: 1.4;
}

.preorder-spam-hint svg {
  flex-shrink: 0;
  position: relative;
  top: 0;
}

.form-feedback {
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  min-height: 1.5rem;
}
.form-feedback--ok  { background: #d4dfcc; color: #1e3f0a; }
.form-feedback--err { background: #e0ced7; color: #56173f; }

/* ============================================================
   ДОСТАВКА
   ============================================================ */

.delivery-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.delivery-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

.delivery-section p {
  color: var(--color-muted);
  line-height: 1.8;
  max-width: 66ch;
}

.delivery-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.delivery-list li {
  padding: var(--space-3, 0.75rem) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--color-text);
}

.delivery-list li strong {
  color: var(--color-primary);
}
