/* ============================================================
   mobile.css — prostir. imagine
   Всі мобільні та планшетні стилі.
   Підключається на всіх сторінках після styles.css.
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   BURGER BUTTON + MENU OVERLAY
   Desktop: hidden. Mobile: shown via @media below.
   ════════════════════════════════════════════════════════════ */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 10px;
  background: none; border: none;
  cursor: pointer;
  z-index: 1002;
  flex-shrink: 0;
}
.nav-burger span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.2s;
  pointer-events: none;
}
.nav-light .nav-burger span { background: var(--black); }
.nav-burger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-burger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

#burger-menu {
  display: none;
  position: fixed; inset: 0;
  background: #000;
  z-index: 1001;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: calc(var(--nav-h) + 24px) 32px 60px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow: hidden;
}
#burger-menu.open { opacity: 1; pointer-events: all; }

/* ── Stagger анімація пунктів меню ── */
/* Базовий стан (приховані) */
#burger-menu .burger-nav a {
  opacity: 0;
  transform: translateY(22px);
  transition: none;
}
/* При відкритті + клас burger-anim — запускаємо входження */
#burger-menu.open.burger-anim .burger-nav a {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.45s cubic-bezier(0.16,1,0.3,1),
              transform 0.45s cubic-bezier(0.16,1,0.3,1);
}
#burger-menu.open.burger-anim .burger-nav a:nth-child(1) { transition-delay: 0.04s; }
#burger-menu.open.burger-anim .burger-nav a:nth-child(2) { transition-delay: 0.09s; }
#burger-menu.open.burger-anim .burger-nav a:nth-child(3) { transition-delay: 0.14s; }
#burger-menu.open.burger-anim .burger-nav a:nth-child(4) { transition-delay: 0.19s; }

/* Фонове відео/зображення всередині бургер-меню */
.burger-bg-vid {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.22;
  pointer-events: none;
}
#burger-menu .burger-label,
#burger-menu .burger-nav,
#burger-menu .burger-bottom { position: relative; z-index: 1; }

/* ── КНОПКА ЗАКРИТТЯ × ── */
.burger-close {
  position: absolute;
  /* Вирівнюємо по вертикалі з центром шапки: safe-area + половина nav-h */
  top: calc(env(safe-area-inset-top, 0px) + calc(var(--nav-h) / 2));
  right: 18px;
  transform: translateY(-50%);
  transform-origin: center center;
  font-size: clamp(52px, 14vw, 84px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  color: rgba(255,255,255,0.85);
  background: none; border: none;
  cursor: pointer;
  font-family: var(--font);
  padding: 0 6px;
  z-index: 2;
  -webkit-appearance: none;
}
.burger-close:active { color: rgba(255,255,255,0.4); }

.burger-nav {
  display: flex; flex-direction: column;
  gap: 0; width: 100%;
  margin-bottom: 40px;
}
.burger-nav a {
  font-size: clamp(40px, 13vw, 72px);
  font-weight: 800;
  color: rgba(255,255,255,0.85);
  text-transform: lowercase;
  letter-spacing: -0.04em;
  line-height: 1.08;
  display: block;
  padding: 5px 0;
}
.burger-nav a:active { color: var(--red); }
.burger-bottom { display: flex; gap: 24px; align-items: center; }
.burger-lang {
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.45);
  background: none; border: none;
  cursor: pointer; padding: 0;
  font-family: var(--font);
}

/* Mobile service blocks (hidden on desktop) */
.svc-mobile-block { display: none; }

/* Hero title line break — hidden on desktop, visible on mobile */
.hero-br { display: none; }


/* ════════════════════════════════════════════════════════════
   АНІМАЦІЇ — keyframes
   ════════════════════════════════════════════════════════════ */

/* Hero контент — входження при завантаженні */
@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Кнопка scroll — пульсуючий bounce (включає translateX(-50%) !) */
@keyframes heroScrollPulse {
  0%, 55%, 100% { opacity: 0.65; transform: translateX(-50%) translateY(0px); }
  78%            { opacity: 1;    transform: translateX(-50%) translateY(8px); }
}

/* ════════════════════════════════════════════════════════════
   @media — PHONES (≤ 768px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Глобальний плавний скрол для всієї сторінки */
  /* iOS overscroll: html bg-color заповнює область rubber-band (вище шапки) */
  html { scroll-behavior: smooth; background-color: #060606; }

  /* ── CURSOR ── */
  body { cursor: auto !important; }
  #cursor-dot, #cursor-ring { display: none !important; }
  button, .lang-toggle, .nav-burger,
  .hero-scroll-btn, .strip-next-btn,
  .filter-btn { cursor: pointer !important; }
  a, .svc-item, .svc-mobile-link,
  .service-cta-link, .service-next { cursor: pointer !important; }
  .strip-track { cursor: grab; }

  /* ── NAV — safe-area для вирізів / Dynamic Island ── */
  :root {
    --nav-h: 60px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bot: env(safe-area-inset-bottom, 0px);
  }
  #nav {
    padding: env(safe-area-inset-top, 0px) 20px 0;
    height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  }
  .nav-tagline { display: none; }
  .nav-right .nav-link { display: none; }
  .nav-right { gap: 0; }
  .nav-burger { display: flex; }
  #burger-menu { display: flex; }

  /* ── HERO ── */
  .hero-inner { padding: 0 20px; gap: 32px; } /* більше повітря між блоками */
  .hero-br { display: block; }
  .hero-title {
    font-size: calc((100vw - 40px) / 4.8);
    letter-spacing: -0.04em;
    line-height: 0.88;
    white-space: normal;
    overflow-wrap: break-word;
    /* Вхідна анімація */
    animation: heroFadeUp 0.9s cubic-bezier(0.16,1,0.3,1) 0.05s both;
  }
  .hero-info {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 20px;
    animation: heroFadeUp 0.8s cubic-bezier(0.16,1,0.3,1) 0.2s both;
  }
  .hero-block h3 { font-size: 12px; letter-spacing: 0.1em; margin-bottom: 10px; }
  .hero-block p  { font-size: 13px; line-height: 1.6; max-width: 100%; }

  /* Десктопні кнопки — ховаємо на мобільному */
  .hero-scroll-btn  { display: none !important; }
  .strip-next-btn   { display: none !important; }

  /* ── GALLERY STRIP / SPIN STACK на мобільному ── */
  #gallery-strip {
    background: var(--white) !important; /* override dark styles.css for mobile Spin Stack */
    padding: 40px 0 36px;
    overflow: hidden;
  }
  /* Desktop overlapping strip — hidden on mobile */
  #stripScene { display: none !important; }
  .strip-footer { padding: 14px 20px 0; }
  /* strip-gallery-link dark on white mobile background */
  .strip-gallery-link { color: rgba(0,0,0,0.35) !important; }
  .strip-gallery-link:hover { color: rgba(0,0,0,0.8) !important; }

  /* Spin Stack — широкі картки, але сусідні помітно пекують з країв */
  .spin-stage {
    height: clamp(304px, 80vw, 384px) !important;   /* -20% від 100vw / 480px */
    overflow: visible !important;
  }
  .spin-card {
    width:  clamp(184px, 52vw, 240px) !important;   /* -20% від 65vw — більше карток з країв */
    height: clamp(261px, 74vw, 341px) !important;   /* 52vw × 1.42 ≈ 74vw */
  }

  /* Стара мобільна карусель — більше не використовується */
  #m-carousel { display: none !important; }

  /* ── SERVICES — desktop елементи вимкнені ── */
  .svc-heading  { display: none !important; }
  .svc-panel    { display: none !important; }
  .svc-label    { display: none; }
  .svc-list-hint { display: none; }
  .svc-video    { display: none; }
  .svc-overlay  { display: none; }
  #svc-bg-wrap  { display: none; }

  #services {
    min-height: auto;
    display: block;
    padding-bottom: 0;
    overflow: visible;
  }
  .svc-inner {
    min-height: 100svh;
    min-height: 100dvh;
    padding: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 16px) 20px
             calc(48px + env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    position: relative; z-index: 2;
  }
  .svc-list {
    align-items: flex-start;
    gap: 0; max-width: 100%;
  }
  .svc-item {
    font-size: clamp(44px, 15vw, 80px);
    text-align: left;
    transform-origin: left center;
    padding: 2px 0;
    letter-spacing: -0.04em;
    color: rgba(255,255,255,0.9);
    -webkit-text-stroke: 0px transparent;
    transition: color 0.2s !important;
  }
  .svc-item:hover, .svc-item.is-active {
    color: rgba(255,255,255,0.9) !important;
    -webkit-text-stroke: 0px transparent !important;
    transform: none !important;
    letter-spacing: -0.04em !important;
  }
  .svc-list:hover .svc-item:not(:hover):not(.is-active) {
    opacity: 1 !important;
    color: rgba(255,255,255,0.9) !important;
  }
  .svc-item:active { color: var(--red) !important; }

  /* ── BURGER MENU LABEL ── */
  .burger-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: rgba(255,255,255,0.25);
    text-transform: uppercase;
    margin-bottom: 8px;
  }

  /* ── SERVICES SECTION LABEL — вгорі сторінки, тонкий білий ── */
  .svc-section-label {
    position: absolute;
    top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 20px);
    left: 20px;
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.25em;
    color: rgba(255,255,255,0.75);
    text-transform: uppercase;
    margin: 0;
    z-index: 3;
  }

  /* ── EXPLORE КНОПКА — внизу зліва, ідентично svc-mobile-next ── */
  .svc-section-next {
    position: absolute;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 20px;
    display: inline-flex;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: rgba(255,255,255,0.75);
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.25);
    padding-bottom: 4px;
    cursor: pointer;
    font-family: var(--font);
    -webkit-appearance: none;
    transition: color 0.2s;
    margin: 0;
    z-index: 3;
  }
  .svc-section-next:active { color: var(--red); }

  /* ── МОБІЛЬНІ БЛОКИ СЕРВІСІВ ── */
  .svc-mobile-block {
    display: flex;
    position: relative;
    min-height: 100svh;
    min-height: 100dvh;
    flex-direction: column;
    justify-content: flex-end;
    padding: 48px 20px 56px;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 30%, #222222 0%, #0e0e0e 55%, #080808 100%);
    border-top: 1px solid rgba(255,255,255,0.06);
  }
  .svc-mobile-bg {
    position: absolute; inset: 0; z-index: 0;
  }
  .svc-mobile-bg video,
  .svc-mobile-bg img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center center;
  }
  .svc-mobile-bg .vid-dark-overlay {
    background: rgba(0,0,0,var(--svc-page-overlay, var(--vid-overlay)));
  }
  .svc-mobile-content { position: relative; z-index: 2; }
  .svc-mobile-block h2 {
    font-size: clamp(48px, 14vw, 84px);
    font-weight: 800;
    color: var(--white);
    text-transform: lowercase;
    letter-spacing: -0.04em;
    line-height: 0.88;
    margin-bottom: 20px;
  }
  .svc-mobile-desc {
    font-size: 14px; font-weight: 400;
    color: rgba(255,255,255,0.8);
    line-height: 1.65; margin-bottom: 20px;
  }
  .svc-mobile-quote {
    font-size: 13px; font-weight: 400;
    color: rgba(255,255,255,0.35);
    line-height: 1.6;
    border-left: 1px solid rgba(255,255,255,0.15);
    padding-left: 14px;
    margin-bottom: 28px;
  }
  .svc-mobile-link {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 15px; font-weight: 700;
    color: rgba(255,255,255,0.85);
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 4px;
  }

  /* Кнопка "Далі ↓" / "Нагору ↑" */
  .svc-mobile-next {
    display: inline-flex; align-items: center;
    margin-top: 28px;
    font-size: 15px; font-weight: 700;
    letter-spacing: 0.02em;
    color: rgba(255,255,255,0.75);
    background: none; border: none;
    border-bottom: 1px solid rgba(255,255,255,0.25);
    padding-bottom: 4px;
    cursor: pointer;
    font-family: var(--font);
    -webkit-appearance: none;
    transition: color 0.2s;
  }
  .svc-mobile-next:active { color: var(--red); }

  /* Footer всередині #services */
  .site-footer.dark {
    position: relative;
    bottom: auto; z-index: 2;
  }

  /* ── СТОРІНКИ СЕРВІСІВ ── */
  .service-hero {
    padding: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 28px) 20px
             calc(44px + env(safe-area-inset-bottom, 0px));
    justify-content: flex-end;
    min-height: 100svh;
    min-height: 100dvh;
  }
  .service-content { max-width: 100%; }
  .service-title   { font-size: clamp(48px, 14vw, 96px); margin-bottom: 24px; }
  .service-desc    { font-size: 13px; margin-bottom: 24px; }
  .service-quote   { font-size: 12px; }
  .service-cta-link { margin-top: 28px; font-size: 14px; }
  .service-next { margin-top: 32px; gap: 12px; }
  .service-next-label { font-size: 14px; }
  .service-next-line, .service-next-copyright { display: none; }

  /* ── КОНТАКТИ ── */
  .contacts-page {
    padding: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 24px)
             20px
             calc(60px + env(safe-area-inset-bottom, 0px));
  }
  .contacts-inner { padding-top: 40px; margin: 0; }
  .contacts-title { font-size: clamp(38px, 12vw, 70px); margin-bottom: 40px; }
  .contacts-grid  { grid-template-columns: 1fr; gap: 28px; margin-bottom: 48px; }
  .contacts-block-value { font-size: 16px; }
  .contacts-socials { gap: 16px; padding-top: 28px; }

  /* ── ФУТЕР ── */
  .site-footer {
    padding: 20px;
    grid-template-columns: auto 1fr;
  }
  .site-footer > span:first-child:not(.logo) { display: none; }
  .site-footer .logo { justify-self: start; }
  .site-footer > span:last-child { text-align: right; }

  /* ── CONTACT WIDGET — червона кругла іконка ── */
  #cw-wrap {
    bottom: 28px !important;   /* !important — перебиває contact-widget.js (112px) */
    right: 20px !important;
  }
  #cw-btn {
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    justify-content: center !important;
    gap: 0 !important;
    /* Червоний брендовий колір */
    background: #E80000 !important;
    box-shadow: 0 4px 20px rgba(232,0,0,0.4) !important;
    color: #fff !important;
    border: none !important;
  }
  #cw-btn:hover, #cw-btn:active { background: #C70000 !important; }
  #cw-btn span[data-en] { display: none !important; }
  #cw-btn svg { width: 18px !important; height: 18px !important; }
  #cw-panel { min-width: 210px; }

  /* ── ГАЛЕРЕЯ ── */
  .gallery-page {
    padding: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 20px)
             12px
             calc(60px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .gallery-header {
    margin-bottom: 24px !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px !important;
  }
  .gallery-title { font-size: clamp(36px, 12vw, 70px) !important; }
  .gallery-filters {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    max-width: 100%;
  }
  .gallery-filters::-webkit-scrollbar { display: none; }
  .filter-btn {
    white-space: nowrap; flex-shrink: 0;
    font-size: 12px; padding: 7px 14px;
  }
}

/* ════════════════════════════════════════════════════════════
   @media — ПЛАНШЕТИ (769px – 1024px)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --nav-h: 72px; }
  #nav { padding: 0 32px; }
  .nav-right { gap: 28px; }
  .hero-inner { padding: 0 32px; }
  .svc-panel { left: 8%; width: 40%; }
  .service-hero { padding: calc(var(--nav-h) + 40px) 32px 60px; }
  .contacts-page { padding-left: 32px; padding-right: 32px; }
  .gallery-page { padding-left: 32px !important; padding-right: 32px !important; }
}

/* ════════════════════════════════════════════════════════════
   @media — DESKTOP (≥ 769px) — hero title: no mid-word breaks
   ════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  /* Заголовок герою — не переносити слова посередині */
  .hero-title {
    white-space: nowrap;
    overflow: visible;
  }
}
