/* ===== СБРОС СТИЛЕЙ ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Roboto', 'Inter', system-ui, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #fff;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  min-width: 44px;
  min-height: 44px;
}

input, textarea, select {
  font-family: inherit;
}

/* Скрытые заголовки для доступности */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ===== Шаг 2: Flexbox для горизонтального меню ===== */
.header__menu {
  display: flex;
  justify-content: center;
  gap: 2rem;
  list-style: none;
  padding: 1rem 0;
  margin: 0;
  width: 100%;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.main-menu__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-weight: 500;
  color: #555;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.main-menu__link:hover {
  background-color: #f0f0f0;
  color: #255330;
}

.main-nav {
  width: 100%;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  background-color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.menu-toggle:focus-visible {
  outline: 2px solid #2c5530;
  outline-offset: 2px;
}

.menu-toggle__bar {
  width: 22px;
  height: 2px;
  background-color: #2c5530;
  border-radius: 2px;
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 1000;
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.menu-open {
  overflow: hidden;
}

/* ===== Шаг 3: Grid-сетка для контентных блоков ===== */
.features__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature-card {
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* ===== Шаг 4: Masonry-раскладка (по желанию) ===== */
/* Создаем секцию Masonry Grid */
.masonry-section {
  margin: 3rem 0;
  padding: 2rem 0;
}

.masonry-section__title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  text-align: center;
  color: #2c5530;
}

.masonry-grid__container {
  column-count: 3;
  column-gap: 24px;
  margin-top: 2rem;
}

.masonry-item {
  display: inline-block;
  margin: 0 0 1em;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  transition: transform 0.3s ease;
  break-inside: avoid;
}

.masonry-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.masonry-item__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #2c5530;
}

.masonry-item__text {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Разные высоты элементов */
.masonry-item--short {
  height: 150px;
}

.masonry-item--tall {
  height: 300px;
}

.masonry-item--very-tall {
  height: 400px;
}

/* ===== Шаг 5: Адаптивность (Desktop First) ===== */
/* Базовые стили (Desktop) */
.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
}

.section-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  text-align: center;
}

/* Ноутбуки (меньше 1200px) */
@media (max-width: 1199px) {
  .hero__title {
    font-size: 2.2rem;
  }
  
  .section-title {
    font-size: 1.8rem;
  }
  
  .masonry-grid__container {
    column-count: 2;
  }
}

/* Планшеты (меньше 992px) */
@media (max-width: 991px) {
  .header__nav {
    flex-direction: column;
    align-items: stretch;
  }
  
  .header__search {
    max-width: 100%;
  }
  
  .hero__title {
    font-size: 1.9rem;
  }
  
  .section-title {
    font-size: 1.6rem;
  }
  
  .features__list {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .products__list {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .masonry-grid__container {
    column-count: 2;
  }
  
  .product-card--large {
    grid-column: span 2;
  }
}

/* Мобильные в альбомной ориентации (меньше 768px) */
@media (max-width: 767px) {
  /* Меню становится вертикальным */
  .header__menu {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
  }
  
  .hero {
    flex-direction: column;
  }
  
  .hero__title {
    font-size: 1.7rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .features__list {
    grid-template-columns: 1fr;
  }
  
  .products__list {
    grid-template-columns: 1fr;
  }
  
  .product-card--large {
    grid-column: span 1;
  }
  
  .masonry-grid__container {
    column-count: 1;
  }
  
  .about {
    flex-direction: column;
  }
  
  .newsletter__form,
  .footer__form {
    flex-direction: column;
  }
  
  .newsletter__input,
  .footer__input {
    border-radius: 6px;
    margin-bottom: 1rem;
  }
  
  .newsletter__button,
  .footer__button {
    border-radius: 6px;
  }
  
  .footer__links {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Мобильные (меньше 576px) */
@media (max-width: 575px) {
  .hero__title {
    font-size: 1.5rem;
  }
  
  .section-title {
    font-size: 1.3rem;
  }
  
  .newsletter__title,
  .about__title {
    font-size: 1.6rem;
  }
  
  .footer__links {
    grid-template-columns: 1fr;
  }
  
  .footer__social-list {
    flex-wrap: wrap;
  }
}

/* Очень маленькие экраны (меньше 400px) */
@media (max-width: 399px) {
  .page {
    padding: 0 10px;
  }
  
  .hero__title {
    font-size: 1.3rem;
  }
  
  .section-title {
    font-size: 1.2rem;
  }
  
  .newsletter__title,
  .about__title {
    font-size: 1.4rem;
  }
  
  .button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* ===== ОСНОВНЫЕ СТИЛИ ===== */
.section-divider {
  border: none;
  border-top: 1px solid #eaeaea;
  margin: 3rem 0;
}

/* ===== HEADER ===== */
.header {
  padding: 1rem 0;
}

.header__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.header__search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 300px;
}

.search-form__input {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px 0 0 4px;
  font-size: 0.875rem;
  min-height: 44px;
}

.search-form__button {
  padding: 0.5rem 1rem;
  background-color: #2c5530;
  border-radius: 0 4px 4px 0;
  transition: background-color 0.3s ease;
}

.search-form__button:hover {
  background-color: #1e3a22;
}

.header__logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c5530;
}

.header__user-actions {
  display: flex;
  gap: 1rem;
}

.user-actions__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #f8f9fa;
  transition: all 0.3s ease;
}

.user-actions__link:hover {
  background-color: #e9ecef;
  transform: translateY(-2px);
}

.user-actions__icon {
  width: 20px;
  height: 20px;
}

.header__divider {
  border: none;
  border-top: 2px solid #2c5530;
  margin: 0;
}

/* ===== HERO ===== */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3rem;
  margin: 3rem 0;
}

.hero__content {
  flex: 1;
  min-width: 300px;
}

.hero__text {
  font-size: 1.125rem;
  margin-bottom: 2rem;
  color: #666;
}

.hero__image {
  flex: 1;
  min-width: 300px;
  position: relative;
}

.hero__caption {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ===== FEATURES ===== */
.features {
  margin: 3rem 0;
}

.feature-card__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
}

.feature-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #2c5530;
}

.feature-card__text {
  color: #666;
  font-size: 0.95rem;
}

/* ===== PRODUCTS ===== */
.products {
  margin: 3rem 0;
}

.products__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.product-card {
  border: 1px solid #eaeaea;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.product-card__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-card__caption {
  padding: 1.5rem;
}

.product-card__name {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.product-card__price {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2c5530;
}

.products__action {
  text-align: center;
}

/* ===== NEWSLETTER ===== */
.newsletter {
  text-align: center;
  padding: 3rem;
  background-color: #f8f9fa;
  border-radius: 12px;
  margin: 3rem 0;
}

.newsletter__text {
  font-size: 1.125rem;
  color: #666;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.newsletter__form {
  display: flex;
  max-width: 500px;
  margin: 0 auto;
}

.newsletter__input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px 0 0 6px;
  font-size: 1rem;
}

/* ===== ABOUT ===== */
.about {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3rem;
  margin: 3rem 0;
}

.about__content {
  flex: 1;
  min-width: 300px;
}

.about__text {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: #666;
}

.about__image {
  flex: 1;
  min-width: 300px;
  position: relative;
}

.about__caption {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ===== BUTTONS ===== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.button--primary {
  background-color: #2c5530;
  color: white;
}

.button--primary:hover {
  background-color: #1e3a22;
  transform: scale(1.05);
}

.button--primary:active {
  transform: scale(0.98);
}

.button--primary:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
}

.button--secondary {
  background-color: transparent;
  color: #2c5530;
  border: 2px solid #2c5530;
}

.button--secondary:hover {
  background-color: #2c5530;
  color: white;
  transform: translateY(-2px);
}

.scroll-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: #2c5530;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 950;
}

.scroll-top:hover {
  transform: translateY(-2px);
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

/* ===== FOOTER ===== */
.footer {
  margin-top: 3rem;
  padding: 3rem 0;
  background-color: #f8f9fa;
  border-radius: 12px 12px 0 0;
}

.footer__links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #2c5530;
}

.footer__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer__link {
  color: #666;
  transition: color 0.3s ease;
}

.footer__link:hover {
  color: #2c5530;
}

.footer__newsletter {
  margin-bottom: 2rem;
  text-align: center;
}

.footer__form {
  display: flex;
  max-width: 400px;
  margin: 1rem auto 0;
}

.footer__input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px 0 0 6px;
  font-size: 1rem;
}

.footer__social {
  text-align: center;
  margin-bottom: 2rem;
}

.footer__social-list {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: white;
  transition: all 0.3s ease;
}

.footer__social-link:hover {
  background-color: #2c5530;
  transform: translateY(-2px);
}

.footer__social-link:hover .footer__social-icon {
  filter: brightness(0) invert(1);
}

.footer__social-icon {
  width: 20px;
  height: 20px;
}

.footer__copyright {
  text-align: center;
  color: #999;
  font-size: 0.875rem;
  padding-top: 2rem;
  border-top: 1px solid #eaeaea;
}
