/* Сочинская мебельная фабрика — основные стили */
:root {
  --color-bg: #faf9f7;
  --color-surface: #fff;
  --color-wood: #8b6914;
  --color-wood-dark: #5c4610;
  --color-wood-light: #c9a227;
  --color-text: #2c2c2c;
  --color-text-muted: #666;
  --color-border: #e5e2dd;
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --transition: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .animate-in { opacity: 1; transform: none !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-wood-dark);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--color-wood); }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  background: var(--color-surface);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}
.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-wood-dark);
}
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}
.menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--color-text);
}
.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  color: var(--color-text);
  padding: 0.25rem 0;
}
.nav-list a:hover { color: var(--color-wood); }

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .nav { display: none; }
  .nav.open { display: block; position: absolute; top: 100%; left: 0; right: 0; background: var(--color-surface); box-shadow: var(--shadow); }
  .nav.open .nav-list { flex-direction: column; padding: 1rem; }
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform 0.15s ease;
}
.btn:active { transform: scale(0.98); }
@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }
.btn-primary {
  background: var(--color-wood);
  color: #fff;
}
.btn-primary:hover { background: var(--color-wood-dark); }
.btn-secondary { background: var(--color-border); color: var(--color-text); }
.btn-secondary:hover { background: #ddd; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--color-wood);
  color: var(--color-wood-dark);
}
.btn-outline:hover { background: var(--color-wood); color: #fff; }

/* Hero */
.hero {
  background: linear-gradient(135deg, #f5f0e8 0%, #e8e0d4 100%);
  padding: 3rem 0 4rem;
  text-align: center;
}
.hero-inner { max-width: 720px; margin: 0 auto; }
.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--color-wood-dark);
  margin: 0 0 0.75rem;
}
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  margin: 0 0 1.5rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* Sections */
.section {
  padding: 2.5rem 0;
}
.section-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 1.5rem;
  color: var(--color-wood-dark);
}
.section-cta { text-align: center; margin: 1.5rem 0 0; }

/* Benefits */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.benefit-card {
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.benefit-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.benefit-card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  margin: 0 0 0.35rem;
}
.benefit-card p { margin: 0; font-size: 0.9rem; color: var(--color-text-muted); }

/* Categories grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.category-card, .product-card, .portfolio-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}
@media (prefers-reduced-motion: reduce) { .category-card, .product-card, .portfolio-card { transition: none; } }
.category-card:hover, .product-card:hover, .portfolio-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.category-link, .product-link, .portfolio-link {
  display: block;
  color: inherit;
}
.category-link img, .product-link img, .portfolio-link img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.category-placeholder, .product-placeholder, .portfolio-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #e8e0d4 0%, #ddd5c8 100%);
}
.product-placeholder-lg { aspect-ratio: 4/3; max-height: 400px; }
.category-title, .product-title, .portfolio-card-title {
  display: block;
  padding: 1rem;
  font-family: var(--font-heading);
  font-weight: 600;
}
.category-desc, .product-desc {
  padding: 0 1rem 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0;
}
.product-cta {
  display: block;
  padding: 0 1rem 1rem;
  font-size: 0.9rem;
  color: var(--color-wood);
  font-weight: 500;
}

/* Portfolio full */
.portfolio-grid-full {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.portfolio-item .portfolio-thumb {
  width: 100%;
  padding: 0;
  border: none;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.portfolio-item .portfolio-thumb:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
.portfolio-item .portfolio-thumb img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.portfolio-item-title {
  display: block;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Reviews */
.reviews-slider, .reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.review-card, .review-card-full {
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.review-card blockquote, .review-card-full blockquote { margin: 0; }
.review-card p, .review-card-full p { margin: 0 0 0.5rem; }
.review-card footer, .review-card-full footer {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.review-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

/* Forms */
.form-section { background: var(--color-surface); }
.form-block {
  max-width: 480px;
  margin: 0 auto;
}
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-label { flex: 1; min-width: 180px; }
.form-label {
  display: block;
  margin-bottom: 1rem;
}
.form-label input, .form-label textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
.form-label input:focus, .form-label textarea:focus {
  outline: none;
  border-color: var(--color-wood);
}
.form-message {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  min-height: 1.4em;
}
.form-message.success { color: #2d7a3e; }
.form-message.error { color: #c0392b; }

/* Contacts */
.contacts-block, .contacts-list {
  text-align: center;
  margin-bottom: 1.5rem;
}
.contacts-block p { margin: 0.25rem 0; }
.contacts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 768px) { .contacts-grid { grid-template-columns: 1fr; } }
.contacts-map.map-placeholder, .map-placeholder {
  min-height: 200px;
  background: #e8e4de;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

/* Page head */
.page-head { padding-top: 1.5rem; }
.page-title { font-family: var(--font-heading); font-size: 1.75rem; margin: 0 0 0.5rem; }
.breadcrumb { font-size: 0.9rem; color: var(--color-text-muted); margin-bottom: 0.5rem; }
.breadcrumb a { color: var(--color-wood); }
.page-desc { margin: 0 0 1rem; color: var(--color-text-muted); }
.prose { max-width: 720px; }
.prose h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
.prose ul { margin: 0.5rem 0; padding-left: 1.5rem; }

/* Product detail */
.product-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 768px) { .product-layout { grid-template-columns: 1fr; } }
.product-main-img img { width: 100%; border-radius: var(--radius); }
.product-thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}
.thumb-btn {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  background: none;
}
.thumb-btn.active { border-color: var(--color-wood); }
.thumb-btn img { width: 60px; height: 45px; object-fit: cover; }
.product-description { margin: 1rem 0; white-space: pre-wrap; }

/* Requisites */
.requisites-list { margin: 1rem 0; }
.requisites-list dt { font-weight: 600; margin-top: 0.75rem; }
.requisites-list dd { margin: 0.25rem 0 0; }

/* Error pages */
.error-page { text-align: center; padding: 4rem 0; }
.error-page h1 { font-size: 3rem; margin: 0 0 0.5rem; }
.error-page p { margin: 0 0 1rem; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.9);
}
.lightbox[hidden] { display: none; }
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.3); }
.lightbox-content { max-width: 90vw; max-height: 90vh; text-align: center; }
.lightbox-content img { max-width: 100%; max-height: 85vh; object-fit: contain; }
.lightbox-title { color: #fff; margin-top: 0.5rem; }

/* Animate in (Intersection Observer) */
.animate-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .animate-in { opacity: 1; transform: none; }
}

/* Footer */
.site-footer {
  background: var(--color-wood-dark);
  color: #fff;
  padding: 2rem 0 1rem;
  margin-top: 3rem;
}
.footer-grid { display: flex; flex-wrap: wrap; gap: 2rem; margin-bottom: 1rem; }
.footer-brand p, .footer-contacts { margin: 0; font-size: 0.95rem; opacity: 0.9; }
.footer-contacts a { color: #fff; }
.footer-contacts a:hover { text-decoration: underline; }
.footer-copy { margin: 0; font-size: 0.85rem; opacity: 0.8; }

.filter-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 1rem; }
.filter-tab {
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  background: var(--color-border);
  color: var(--color-text);
  font-size: 0.9rem;
}
.filter-tab.active { background: var(--color-wood); color: #fff; }
.filter-tab:hover:not(.active) { background: #ddd; }
