/* ════════════════════════════════════════════════
   HERO — ГОЛОВНА СТОРІНКА
   ════════════════════════════════════════════════ */
.hero {
  position: relative;
  /* меню (навбар) + hero = один екран. Топбар прихований на мобільному. */
  min-height: calc(100vh - var(--navbar-h));
  min-height: calc(100svh - var(--navbar-h));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  background: var(--bg-dark);
}
@media (min-width: 768px) {
  .hero {
    min-height: calc(100vh - var(--navbar-h) - var(--topbar-h));
    min-height: calc(100svh - var(--navbar-h) - var(--topbar-h));
  }
}

/* ── Медіа фон ── */
.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.hero__video.loaded { opacity: 0.62; }

/* Ember particles — 3-level nesting for conflict-free transforms */
.hero__embers {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

/* Level 1 — підйом + центральний дрейф */
.ember-outer {
  position: absolute;
  bottom: 0;
  will-change: transform;
}

/* Level 2 — синусоїдне покачування */
.ember-mid {
  display: block;
  will-change: transform;
}

/* Level 3 — видима іскра: поява, затухання, масштаб */
.ember-inner {
  display: block;
  border-radius: 50%;
  will-change: transform, opacity;
}

@keyframes ember-rise {
  from { transform: translate(0, 0); }
  to   { transform: translate(var(--dx, 0%), var(--dy, -80vh)); }
}

@keyframes ember-wobble {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(var(--amp, 10px)); }
  50%  { transform: translateX(0); }
  75%  { transform: translateX(calc(var(--amp, 10px) * -1)); }
  100% { transform: translateX(0); }
}

/* Нормальне затухання: гасне на ~30–40% кінця */
@keyframes ember-fade {
  0%   { opacity: 0;              transform: scale(1); }
  8%   { opacity: var(--fade, .65); }
  62%  { opacity: var(--fade, .65); transform: scale(1); }
  100% { opacity: 0;              transform: scale(.5); }
}

/* Раннє вигорання: гасне на ~50–70% шляху */
@keyframes ember-fade-early {
  0%   { opacity: 0;              transform: scale(1); }
  8%   { opacity: var(--fade, .65); }
  48%  { opacity: var(--fade, .65); transform: scale(.85); }
  68%  { opacity: 0;              transform: scale(.42); }
  100% { opacity: 0;              transform: scale(.38); }
}

/* Мерехтіння через brightness — не конфліктує з opacity/transform */
@keyframes ember-flicker {
  0%, 100% { filter: brightness(1); }
  30%      { filter: brightness(.18); }
  55%      { filter: brightness(1.5); }
  80%      { filter: brightness(.4); }
}

@media (prefers-reduced-motion: reduce) {
  .ember-outer { animation: none !important; opacity: 0 !important; }
}

/* ── Overlay ── */
.hero__overlay {
  position: absolute;
  inset: 0;
  /* Легше затемнення — відео видно навіть на тьмяних екранах;
     читабельність тексту тримає text-shadow на контенті */
  background:
    linear-gradient(180deg,
      rgba(8,8,8,0.42) 0%,
      rgba(8,8,8,0.48) 50%,
      rgba(8,8,8,0.58) 100%
    );
  z-index: 2;
}
/* Gradient знизу — плавний перехід до наступної секції */
.hero__overlay::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 220px;
  background: linear-gradient(to top, rgba(12,12,12,1) 0%, transparent 100%);
}

/* ── Entrance animations ── */
@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0);    }
}
@keyframes hero-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes hero-line-grow {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

/* ── Content — по центру горизонтально (ПК і мобільний) ── */
.hero__content {
  position: relative;
  z-index: 3;
  padding-top: 40px;
  padding-bottom: 48px;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}
.hero__lead { margin-left: auto; margin-right: auto; }

/* ── Лід-рядок: породи + ціна + умови ── */
.hero__lead {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: rgba(245,245,245,0.85);
  max-width: 540px;
  margin-bottom: 28px;
  animation: hero-fade-up 0.8s cubic-bezier(.16,1,.3,1) 0.7s both;
}

.hero__lead-link {
  color: var(--accent);
  font-weight: 500;
  border-bottom: 1px solid rgba(224,90,51,0.4);
  transition: color var(--transition), border-color var(--transition);
}
.hero__lead-link:hover {
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.hero__lead-price {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
}

/* ── Види дров: рівний грід з трьох плиток ── */
.hero__formats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 540px;
  margin-bottom: 36px;
  animation: hero-fade-up 0.8s cubic-bezier(.16,1,.3,1) 0.85s both;
}

.hero__format {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  background: rgba(18,18,18,0.55);
  text-align: center;
  transition: var(--transition);
}
.hero__format:hover {
  border-color: var(--accent);
  background: rgba(18,18,18,0.8);
}

.hero__format-name {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.hero__format-size {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Title ── */
.hero__title {
  font-family: var(--font-head);
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 24px;
  max-width: none;
  animation: hero-fade-up 0.85s cubic-bezier(.16,1,.3,1) 0.45s both;
}

/* Другий рядок — трохи менший, щоб влазив одним рядком */
.hero__title-sub {
  display: inline-block;
  font-size: 0.62em;
  letter-spacing: 0.03em;
  margin-top: 0.1em;
}

/* Акцент слово */
.hero__title-accent {
  color: var(--accent);
  font-style: normal;
  text-shadow:
    0 0 40px rgba(224,90,51,0.35),
    0 0 80px rgba(224,90,51,0.12);
}

/* ── CTA ── */
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-bottom: 0;
  animation: hero-fade-up 0.7s cubic-bezier(.16,1,.3,1) 0.85s both;
}

.hero__cta .btn--accent {
  box-shadow: 0 0 24px rgba(224,90,51,0.35);
}
.hero__cta .btn--accent:hover {
  box-shadow: 0 0 40px rgba(224,90,51,0.6), 0 0 80px rgba(224,90,51,0.2);
}

/* Кнопка калькулятора — тільки на мобільному (на ПК є «Замовити») */
.hero__cta-calc { display: none; }

/* ── Scroll-індикатор ── */
.hero__scroll {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: hero-fade-in 1s ease 1.3s both;
  background: none;
  border: none;
  padding: 8px;
  appearance: none;
  cursor: pointer;
}
.hero__scroll:hover .hero__scroll-line,
.hero__scroll:focus-visible .hero__scroll-line {
  background: linear-gradient(to bottom, var(--accent), transparent);
  opacity: 1;
}
.hero__scroll:hover .hero__scroll-text,
.hero__scroll:focus-visible .hero__scroll-text {
  color: var(--text);
}
.hero__scroll-line {
  display: block;
  width: 2px;
  height: 44px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scroll-pulse 2s ease-in-out 2s infinite;
}
@keyframes scroll-pulse {
  0%, 100% { opacity: 0.8; transform: scaleY(1);   }
  50%       { opacity: 1;   transform: scaleY(0.85); }
}
.hero__scroll-text {
  font-family: var(--font-head);
  font-size: 8px;
  letter-spacing: 0.28em;
  color: var(--text-muted);
  text-transform: uppercase;
}


/* ── Bottom wave ── */
.hero__divider {
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  z-index: 4;
  line-height: 0;
  pointer-events: none;
}
.hero__divider svg {
  display: block;
  width: 100%;
  height: 60px;
}
@media (min-width: 768px) {
  .hero__divider svg { height: 90px; }
}

/* ── Responsive ── */
@media (min-width: 768px) {
  .hero__title   { font-size: clamp(2.8rem, 6vw, 4.5rem); margin-bottom: 32px; }
  .hero__content { padding-top: 48px; padding-bottom: 48px; }
}

@media (min-width: 1200px) {
  .hero__title   { font-size: clamp(3.4rem, 4.4vw, 5rem); }
  .hero__content { padding-top: 56px; padding-bottom: 56px; }
}

@media (max-width: 640px) {
  /* Мобільний: все по центру, замість «Замовити» — калькулятор
     (дзвінок закриває закріплена кнопка знизу) */
  .hero__content { align-items: center; text-align: center; }
  .hero__title {
    font-size: clamp(2rem, 10vw, 2.6rem);
    line-height: 1.0;
    letter-spacing: -0.01em;
    margin-bottom: 20px;
  }
  .hero__lead { font-size: 15px; margin-bottom: 24px; }
  .hero__lead-price { font-size: 16px; }
  .hero__formats { gap: 6px; margin-bottom: 28px; }
  .hero__format { padding: 12px 4px; gap: 4px; }
  .hero__format-name { font-size: 12px; letter-spacing: 0.05em; }
  .hero__format-size { font-size: 9.5px; }
  .hero__cta { flex-direction: column; align-items: stretch; gap: 16px; width: 100%; }
  .hero__cta-order { display: none; }
  .hero__cta-calc { display: inline-flex; justify-content: center; width: 100%; }
}

@media (max-width: 480px) {
  .hero__scroll { display: none; }
}

/* ════════════════════════════════════════════════
   PAGE HERO — внутрішні сторінки
   ════════════════════════════════════════════════ */
.page-hero {
  position: relative;
  min-height: 48vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--bg-dark);
  padding-bottom: 60px;
}

.page-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.page-hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
}

.page-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(8,8,8,0.4) 0%, rgba(8,8,8,0.92) 100%);
}

.page-hero__content {
  position: relative;
  z-index: 1;
  padding-top: 120px;
}

.page-hero__eyebrow { margin-bottom: 12px; }

.page-hero__title {
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin-bottom: 16px;
  max-width: 700px;
}

.page-hero__subtitle {
  font-family: var(--font-body);
  font-size: 15px;
  color: rgba(245,245,245,0.6);
  max-width: 500px;
  margin-bottom: 28px;
  line-height: 1.65;
}

.page-hero--short {
  min-height: 36vh;
  padding-bottom: 40px;
}
