/* ============================================
   HD580 Landing — ПРИОРИТИ
   Mobile-First, WCAG 2.1 AA
   ============================================ */

:root {
  --color-primary: #b58835;
  --color-primary-dark: #996f1a;
  --color-gray: #b4b4b4;
  --color-white: #ffffff;
  --color-text: #333333;
  --color-text-muted: #666666;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-base: 1rem;
  --line-height: 1.5;
  --touch-min: 44px;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --radius: 4px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-white);
}

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

a {
  color: var(--color-primary-dark);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary);
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ========== Header ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
  padding: 15px var(--space-md);
  background-color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: var(--space-sm);
}

.site-header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.site-header__logo img {
  width: clamp(150px, 18vw, 210px);
  height: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: nowrap;
  flex-shrink: 0;
  min-width: 0;
}

.site-header__contacts {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: nowrap;
}

.site-header__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: var(--color-primary-dark);
  transition: color 0.2s;
}

.site-header__link:hover {
  color: var(--color-primary);
}

.site-header__link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.site-header__link .site-header__icon {
  flex-shrink: 0;
  color: currentColor;
}

.site-header__phone {
  font-weight: 600;
  white-space: nowrap;
}

.site-header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  min-height: var(--touch-min);
  padding: 0 var(--space-md);
  background: var(--color-primary);
  color: var(--color-white) !important;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.site-header__cta-text-short {
  display: none;
}

.site-header__cta:hover {
  background: var(--color-primary-dark);
}

.site-header__cta:focus-visible {
  outline: 2px solid var(--color-primary-dark);
  outline-offset: 2px;
}

@media (min-width: 769px) {
  .site-header,
  .site-header__nav {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 10px 12px;
    flex-wrap: nowrap;
  }

  .site-header__nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .site-header__contacts {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .site-header__link-text {
    display: none;
  }

  .site-header__link {
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }

  .site-header__icon {
    width: 24px !important;
    height: 24px !important;
  }

  .site-header__cta {
    min-width: auto;
    padding: 6px 10px;
    font-size: 12px;
    min-height: auto;
    white-space: nowrap;
  }

  .site-header__logo {
    flex-shrink: 1;
    min-width: 0;
  }

  .site-header__logo img {
    width: clamp(96px, 28vw, 132px);
    height: auto;
    max-width: 100%;
  }
}

/* Экстра-узкие экраны (iPhone SE и т.п.) */
@media (max-width: 400px) {
  .site-header {
    padding: 8px 10px;
  }

  .site-header__nav {
    gap: 6px;
  }

  .site-header__logo img {
    width: clamp(84px, 30vw, 104px);
    height: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
  }

  .site-header__contacts {
    gap: 6px;
  }

  .site-header__link {
    min-width: 36px;
    min-height: 36px;
  }

  .site-header__icon {
    width: 20px !important;
    height: 20px !important;
  }

  .site-header__cta {
    padding: 6px 8px;
    font-size: 11px;
  }

  .site-header__cta-text-long {
    display: none;
  }

  .site-header__cta-text-short {
    display: inline;
  }
}

/* ========== Hero ========== */
.hero {
  position: relative;
  min-height: 100vh;
  padding: var(--space-xl) var(--space-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.hero__video-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

.hero__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.hero__content {
  position: relative;
  z-index: 1;
}

/* ========== Sections ========== */
.section {
  padding: var(--space-xl) var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
}

.section__title {
  margin: 0 0 var(--space-lg);
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--color-primary-dark);
  text-align: center;
}

/* ========== Specs (карточки на мобиле, таблица на десктопе) ========== */
.specs-grid {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .specs-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.spec-card {
  padding: var(--space-md);
  background: var(--color-white);
  border: 1px solid #e8e4dc;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.spec-card__title {
  margin: 0 0 var(--space-sm);
  font-size: 1rem;
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spec-card__title svg {
  flex-shrink: 0;
  color: var(--color-primary);
}

.spec-card__content {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--color-text);
  line-height: 1.6;
}

.spec-lines {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.25rem;
}

/* Таблица на десктопе (скрыта на мобиле) */
.specs-table-wrap {
  overflow-x: auto;
  margin: var(--space-lg) 0;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
}

.specs-table th,
.specs-table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid #e8e4dc;
}

.specs-table th {
  background: rgba(181, 136, 53, 0.1);
  color: var(--color-primary-dark);
  font-weight: 600;
}

.specs-table td {
  color: var(--color-text);
}

@media (max-width: 767px) {
  .specs-table-wrap {
    display: none;
  }
}

@media (min-width: 768px) {
  .specs-grid {
    display: none;
  }

  .specs-table-wrap {
    display: block;
  }
}

/* ========== Video ========== */
.video-section {
  background: #f8f6f2;
}

.video-wrapper {
  max-width: 100%;
  width: 100%;
  margin: 2.5rem auto 2.5rem;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.video-wrapper iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

.video-section__text {
  margin-top: 1rem;
}

.video-rutube-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  color: var(--color-primary-dark);
  font-weight: 600;
}

.video-rutube-link:hover {
  color: var(--color-primary);
}

.video-rutube-link img {
  height: 28px;
  width: auto;
}

/* ========== Pre-footer (форма) ========== */
.prefooter {
  background: linear-gradient(135deg, #2d2a26 0%, #1a1816 100%);
  color: var(--color-white);
  padding: var(--space-xl) var(--space-md);
}

.prefooter__header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 2.5rem;
}

.prefooter__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.375rem, 3.5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
}

.prefooter__subtitle {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
}

.prefooter__grid {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .prefooter__grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
  }
}

.prefooter__card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 1.75rem;
}

.prefooter-form .form-group {
  margin-bottom: 1.25rem;
}

.prefooter-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
}

.prefooter-form input {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0 1rem;
  font-size: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.prefooter-form input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.prefooter-form input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(181, 136, 53, 0.25);
}

.prefooter-form__submit {
  min-height: var(--touch-min);
  min-width: 180px;
  padding: 0 1.5rem;
  background: var(--color-primary);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.prefooter-form__submit:hover {
  background: #c49a3d;
}

.prefooter-form__privacy {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.55);
}

.prefooter-form__privacy a {
  color: var(--color-primary);
}

.prefooter__card--contacts {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

@media (min-width: 768px) {
  .prefooter__card--contacts {
    text-align: left;
  }
}

.prefooter__phone-title {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
}

.prefooter__phone {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}

.prefooter__telegram-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--touch-min);
  padding: 0 1.5rem;
  background: transparent;
  color: var(--color-primary) !important;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.prefooter__telegram-btn:hover {
  background: rgba(181, 136, 53, 0.15);
}

.prefooter__telegram-icon {
  flex-shrink: 0;
}

/* Success message */
.form-success {
  display: none;
  padding: 1.25rem;
  background: rgba(76, 175, 80, 0.12);
  border: 1px solid rgba(76, 175, 80, 0.3);
  border-radius: 8px;
  color: #81c784;
  font-weight: 500;
  font-size: 0.9375rem;
}

.form-success.is-visible {
  display: block;
}

.form-wrap.is-hidden {
  display: none;
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal-overlay.is-open {
  display: flex;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: var(--space-lg);
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius);
}

.modal__close:hover {
  color: var(--color-text);
  background: #f0f0f0;
}

.modal__title {
  margin: 0 0 var(--space-md);
  font-size: 1.25rem;
  color: var(--color-primary-dark);
}

.modal .form-group {
  margin-bottom: var(--space-md);
}

.modal label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 0.875rem;
  font-weight: 500;
}

.modal input {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0 var(--space-sm);
  font-size: 1rem;
  border: 1px solid var(--color-gray);
  border-radius: var(--radius);
}

.modal input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 0;
}

.modal__submit {
  width: 100%;
  min-height: var(--touch-min);
  margin-top: var(--space-sm);
  background: var(--color-primary);
  color: var(--color-white) !important;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.modal__submit:hover {
  background: var(--color-primary-dark);
}

.modal__privacy {
  margin-top: var(--space-sm);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.modal__privacy a {
  color: var(--color-primary);
}

/* ========== Media Gallery Bento ========== */
.media-gallery {
  padding: var(--space-xl) var(--space-md);
  background: linear-gradient(180deg, #1a1816 0%, #242220 100%);
}

.media-gallery .section__title {
  color: rgba(255, 255, 255, 0.95);
}

.media-gallery__container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.media-bento {
  column-count: 4;
  column-gap: 1rem;
  column-fill: balance;
}

@media (max-width: 1280px) {
  .media-bento {
    column-count: 3;
  }
}

@media (max-width: 900px) {
  .media-bento {
    column-count: 2;
  }
}

.media-bento[data-count="1"] {
  column-count: 1;
  max-width: 760px;
  margin: 0 auto;
}

.media-card {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 1rem;
  border-radius: 16px;
  overflow: hidden;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  background: #2d2a26;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.4s ease;
}

.media-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.media-card--big {
  --media-ratio: 1.08;
}

.media-card--wide {
  --media-ratio: 1.65;
}

.media-card--auto-feature {
  --media-ratio: 1.18;
}

.media-card--auto-wide {
  --media-ratio: 1.75;
}

.media-card--auto-tall {
  --media-ratio: 0.75;
}

.gallery-expand-btn {
  display: none;
}

@media (max-width: 768px) {
  .media-bento {
    column-count: 1;
  }

  .media-card--hidden-mobile {
    display: none;
  }

  /* Видео автопроигрываются, иконка Play не нужна */
  .media-card[data-type="video"] .media-card__play-icon,
  .media-card[data-type="video"] [class*="play-overlay"] {
    display: none !important;
  }

  .gallery-expand-btn {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }

  .gallery-expand-btn:hover {
    background: rgba(181, 136, 53, 0.15);
  }

  .gallery-expand-btn.is-hidden {
    display: none;
  }
}

.media-card__inner {
  position: relative;
  width: 100%;
  aspect-ratio: var(--media-ratio, 1.35);
  min-height: 180px;
  overflow: hidden;
  background: #2d2a26;
}

.gallery-item {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 16px;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.fact-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 20px 15px;
  margin: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
  color: #ffffff;
  font-weight: 700;
  transform: translateY(101%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fact-overlay span {
  display: block;
}

@media (hover: hover) {
  .gallery-item:hover .fact-overlay {
    transform: translateY(0);
  }
  .gallery-item:hover img,
  .gallery-item:hover video {
    transform: scale(1.05);
  }
}

.gallery-item.is-focused .fact-overlay {
  transform: translateY(0);
}

.media-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* ========== Footer ========== */
.site-footer {
  padding: var(--space-xl) var(--space-md);
  background: #1a1816;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
}

.site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.site-footer__logo {
  margin-bottom: var(--space-md);
}

.site-footer__logo img {
  width: clamp(150px, 24vw, 210px);
  height: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.site-footer__legal {
  margin: var(--space-md) 0;
  line-height: 1.7;
}

.site-footer__links {
  margin-top: var(--space-md);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.site-footer__links a {
  color: rgba(255, 255, 255, 0.8);
}

.site-footer__links a:hover {
  color: var(--color-primary);
}

body.admin-bar .site-header {
  top: 32px;
}

@media (max-width: 782px) {
  body.admin-bar .site-header {
    top: 46px;
  }
}

.content-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(181, 136, 53, 0.16), transparent 28%),
    linear-gradient(180deg, #f7efe2 0%, #ffffff 28%, #f8f8f5 100%);
}

.content-page__container {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.content-page__hero {
  padding: 8.5rem 0 2.5rem;
}

.content-page__title {
  margin: 0;
  color: #1d1d1b;
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  line-height: 1.08;
  font-weight: 800;
}

.content-page__lead {
  max-width: 42rem;
  margin: 1rem 0 0;
  color: rgba(29, 29, 27, 0.72);
  font-size: 1.125rem;
  line-height: 1.7;
}

.content-page__body {
  padding: 0 0 4.5rem;
}

.error-page__hero {
  min-height: calc(100vh - 240px);
  display: flex;
  align-items: center;
}

.error-page__container {
  max-width: 760px;
}

.error-page__code {
  margin: 0 0 12px;
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #b58835;
}

.error-page__title {
  max-width: 12ch;
}

.error-page__lead {
  max-width: 56ch;
}

.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
}

.error-page__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 14px 24px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.error-page__button:hover {
  transform: translateY(-1px);
}

.error-page__button--primary {
  background: #b58835;
  color: #fff;
  box-shadow: 0 12px 28px rgba(181, 136, 53, 0.22);
}

.error-page__button--primary:hover {
  background: #996f1a;
}

.error-page__button--secondary {
  background: transparent;
  color: #1f1f1f;
  border: 1px solid rgba(31, 31, 31, 0.14);
}

.error-page__button--secondary:hover {
  border-color: rgba(31, 31, 31, 0.28);
  box-shadow: 0 10px 24px rgba(31, 31, 31, 0.08);
}

.editor-content {
  padding: 2rem;
  border: 1px solid rgba(153, 111, 26, 0.12);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.06);
}

.editor-content > *:first-child {
  margin-top: 0;
}

.editor-content > *:last-child {
  margin-bottom: 0;
}

.editor-content p,
.editor-content li,
.editor-content blockquote {
  color: rgba(29, 29, 27, 0.78);
  line-height: 1.75;
}

.editor-content h2,
.editor-content h3,
.editor-content h4 {
  margin: 2rem 0 0.85rem;
  color: #1d1d1b;
  line-height: 1.2;
}

.editor-content a {
  color: var(--color-primary);
}

.editor-content ul,
.editor-content ol {
  padding-left: 1.25rem;
}

@media (max-width: 768px) {
  .error-page__hero {
    min-height: auto;
  }

  .error-page__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .error-page__button {
    width: 100%;
  }

  .content-page__hero {
    padding-top: 7rem;
  }

  .editor-content {
    padding: 1.25rem;
    border-radius: 1rem;
  }
}
