/**
 * Mobile-first premium layout (≤767px). Loaded after main styles.
 * Apple-style: compact header, drawer nav, tap targets, spacing, reduced motion load.
 */

.site-header__menu-toggle,
.site-header__overlay {
  display: none;
}

@media (max-width: 767px) {
  :root {
    --header-h: 3.5rem;
    --section-pad-x: clamp(16px, 4.5vw, 20px);
    --section-pad-y: clamp(2.25rem, 7vw, 3rem);
    --glass-radius: 18px;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    overflow-x: clip;
    -webkit-overflow-scrolling: touch;
  }

  body.site-header-nav-open {
    overflow: hidden;
    touch-action: none;
  }

  /* ——— Compact header + hamburger ——— */
  .site-header {
    flex-wrap: nowrap;
    align-items: center;
    min-height: var(--header-h);
    padding: max(0.3rem, env(safe-area-inset-top, 0px)) var(--section-pad-x) 0.45rem;
    gap: 0.5rem;
  }

  .site-header .logo img {
    max-width: min(132px, 42vw);
    height: clamp(1.75rem, 8vw, 2.25rem);
  }

  .site-header__nav-wrap {
    flex: 1;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    min-width: 0;
  }

  .lang-switcher {
    margin-left: 0;
    gap: 0.2rem;
  }

  .lang-switcher__btn {
    min-width: 2.5rem;
    min-height: 2.25rem;
    padding: 0.3rem 0.45rem;
    font-size: 0.625rem;
    border-radius: 9px;
  }

  .site-header__menu-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
      background 0.25s cubic-bezier(0.22, 1, 0.36, 1),
      border-color 0.25s cubic-bezier(0.22, 1, 0.36, 1),
      transform 0.2s ease;
  }

  .site-header__menu-toggle:active {
    transform: scale(0.96);
    background: rgba(77, 166, 255, 0.14);
  }

  .site-header__menu-toggle-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 20px;
    height: 14px;
  }

  .site-header__menu-bar {
    display: block;
    height: 2px;
    width: 100%;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.92);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  }

  .site-header--nav-open .site-header__menu-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .site-header--nav-open .site-header__menu-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .site-header--nav-open .site-header__menu-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .site-header__overlay {
    display: none;
  }

  .site-header--nav-open .site-header__overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10000;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(2, 10, 22, 0.52);
    backdrop-filter: blur(8px) saturate(1.05);
    -webkit-backdrop-filter: blur(8px) saturate(1.05);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .site-header__nav-block {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(20.5rem, 90vw);
    max-width: 100%;
    margin: 0;
    padding: calc(env(safe-area-inset-top, 0px) + var(--header-h) + 0.5rem) 1.15rem
      calc(1.25rem + env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    background: linear-gradient(195deg, rgba(10, 28, 48, 0.98) 0%, rgba(4, 14, 28, 0.99) 100%);
    border-left: 1px solid rgba(77, 166, 255, 0.16);
    box-shadow: -28px 0 60px rgba(0, 0, 0, 0.5);
    transform: translate3d(100%, 0, 0);
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 10001;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .site-header--nav-open .site-header__nav-block {
    transform: translate3d(0, 0, 0);
  }

  .site-header__brand {
    text-align: left;
    padding-bottom: 0.35rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.6875rem;
    letter-spacing: 0.26em;
  }

  .nav {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.2rem;
    font-size: 0.8125rem;
  }

  .nav a {
    padding: 0.9rem 1rem;
    min-height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    touch-action: manipulation;
    transition:
      background 0.25s ease,
      transform 0.2s ease,
      border-color 0.25s ease;
  }

  .nav a:active {
    transform: scale(0.98);
    background: rgba(77, 166, 255, 0.12);
  }

  .nav a::after {
    display: none;
  }

  /* ——— Homepage hero ——— */
  .hero {
    min-height: auto;
    min-height: min(92dvh, 44rem);
    padding: calc(var(--header-h) + 0.85rem) var(--section-pad-x) clamp(1.75rem, 5vw, 2.5rem);
  }

  .hero-content {
    padding: 1rem 1.05rem;
    border-radius: 18px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .hero-badge {
    font-size: 0.5625rem;
    letter-spacing: 0.14em;
    padding: 0.4rem 0.95rem;
    line-height: 1.45;
  }

  .hero-logo-heading {
    margin-top: 1rem;
  }

  .hero-logo-heading img.hero-logo {
    height: clamp(3.75rem, 26vw, 5.25rem);
    max-width: 100%;
    transform: scale(1);
    animation: none;
  }

  .hero-headline {
    font-size: clamp(1.45rem, 6.2vw, 1.85rem);
    line-height: 1.18;
    letter-spacing: -0.028em;
    padding: 0 0.25rem;
  }

  .hero-lead {
    font-size: 0.9375rem;
    line-height: 1.55;
    padding: 0 0.35rem;
  }

  .hero-features {
    grid-template-columns: 1fr;
    gap: 0.7rem;
    margin-top: 1.35rem;
    max-width: 100%;
  }

  .hero-feature {
    padding: 1rem 1.1rem;
    border-radius: 16px;
  }

  .hero-feature__title {
    font-size: 0.75rem;
  }

  .hero-feature__text {
    font-size: 0.8125rem;
    line-height: 1.55;
  }

  .hero-feature:hover {
    transform: none;
  }

  .hero-cta {
    flex-direction: column;
    width: 100%;
    max-width: 22rem;
    margin-left: auto;
    margin-right: auto;
    gap: 0.65rem;
    margin-top: 1.5rem;
  }

  .hero-cta .btn {
    width: 100%;
    min-height: 52px;
    border-radius: 16px;
    box-shadow:
      0 2px 16px rgba(0, 0, 0, 0.22),
      0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  }

  .hero-cta .btn.primary:hover,
  .hero-cta .btn.secondary:hover {
    transform: none;
    filter: brightness(1.04);
  }

  .hero-scroll {
    margin-top: 0.35rem;
    min-height: 44px;
    align-items: center;
    padding: 0.5rem 0.75rem;
  }

  /* ——— Sections & type ——— */
  .section {
    padding: var(--section-pad-y) var(--section-pad-x);
  }

  .section-head {
    margin-bottom: clamp(1.35rem, 4vw, 2rem);
  }

  .section-head h2 {
    font-size: clamp(1.5rem, 5.5vw, 2rem);
    line-height: 1.12;
  }

  .section-head p,
  .trust-strip {
    font-size: 0.9375rem;
    line-height: 1.55;
  }

  .service-tile {
    border-radius: 18px;
  }

  .service-tile:hover {
    transform: none;
  }

  .service-tile .body {
    padding: 1rem 1.05rem 1.2rem;
  }

  .service-tile h3 {
    font-size: 1rem;
  }

  .service-tile p {
    font-size: 0.875rem;
    line-height: 1.55;
  }

  .service-tile:hover .img-wrap img {
    transform: none;
  }

  .service-cta-row,
  .price-calc-cta-row {
    flex-direction: column;
    width: 100%;
    max-width: 22rem;
    margin-left: auto;
    margin-right: auto;
    gap: 0.65rem;
  }

  .service-cta-row .btn,
  .price-calc-cta-row .btn {
    width: 100%;
    min-height: 52px;
    border-radius: 16px;
  }

  .why-card {
    border-radius: 18px;
  }

  .why-card:hover {
    transform: none;
  }

  .why-card__body {
    padding: 1rem 1.05rem 1.1rem;
  }

  .why-card__text {
    font-size: 0.9375rem;
    line-height: 1.5;
  }

  .why-cta-buttons {
    flex-direction: column;
    max-width: 22rem;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .why-cta-buttons .btn {
    width: 100%;
    min-height: 52px;
    border-radius: 16px;
  }

  .review-chip {
    font-size: 0.8125rem;
    line-height: 1.55;
    padding: 0.85rem 1rem;
    border-radius: 16px;
  }

  /* ——— Buttons global ——— */
  .btn {
    min-height: 52px;
    border-radius: 16px;
    font-size: 0.9375rem;
    box-shadow:
      0 3px 18px rgba(0, 0, 0, 0.2),
      0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  }

  .btn.primary:hover,
  .btn.secondary:hover {
    transform: none;
    filter: brightness(1.05);
  }

  .btn.primary:active,
  .btn.secondary:active {
    transform: scale(0.98);
  }

  .primary:active,
  .secondary:active {
    transform: scale(0.98);
  }

  /* ——— Calculator ——— */
  .price-calc-card {
    border-radius: 18px;
    padding: clamp(1rem, 3vw, 1.15rem);
  }

  .price-calc-btn {
    min-height: 52px;
    border-radius: 14px;
    width: 100%;
  }

  .price-calc-actions {
    flex-direction: column;
  }

  .price-calc-actions .price-calc-btn {
    width: 100%;
  }

  /* ——— Reveal / tiles: lighter motion ——— */
  .reveal-on-scroll {
    transition-duration: 0.55s;
  }

  #sherbime.is-revealed .service-tile {
    animation-duration: 0.42s !important;
    animation-delay: 0.03s !important;
  }

  /* ——— Ambient: slower, subtler on small screens ——— */
  body::before {
    animation-duration: 42s;
  }

  .hero::before {
    animation-duration: 18s;
  }

  /* ——— Floats: avoid overlap, compact ——— */
  .whatsapp-float {
    bottom: max(5.5rem, calc(env(safe-area-inset-bottom, 0px) + 4.75rem));
    left: max(16px, env(safe-area-inset-left, 0px));
    z-index: 10040;
  }

  .whatsapp-float__content {
    padding: 8px 12px;
    border-radius: 999px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
  }

  .whatsapp-float__icon svg {
    width: 22px;
    height: 22px;
  }

  .whatsapp-float__label {
    font-size: 13px;
  }

  .whatsapp-float__bob {
    animation: none;
  }

  .bajer-chat {
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    z-index: 10045;
  }

  .bajer-chat-toggle {
    width: 56px;
    height: 56px;
  }

  .bajer-chat-toggle__glow {
    inset: -10px;
  }

  .bajer-chat-toggle__layer--back,
  .bajer-chat-toggle__layer--front {
    animation-duration: 3.2s;
  }

  .bajer-chat-panel {
    width: min(100vw - var(--section-pad-x) * 2, 22rem);
    max-height: min(72dvh, 540px);
    border-radius: 18px;
  }

  /* ——— Subpage heroes (ALUPLAST / SPECTRUM / ROLETNA) ——— */
  .aluplast-page > .section.aluplast-hero:first-of-type {
    padding-top: calc(var(--header-h) + clamp(1rem, 3vw, 1.5rem));
    padding-bottom: clamp(1.5rem, 4vw, 2.25rem);
  }

  .spectrum-page > .section:first-of-type {
    padding-top: calc(var(--header-h) + clamp(1rem, 3vw, 1.35rem));
  }

  .aluplast-hero {
    min-height: min(58vh, 28rem);
  }

  .aluplast-hero__inner {
    padding-left: var(--section-pad-x);
    padding-right: var(--section-pad-x);
  }

  .aluplast-hero__card {
    padding: 1.15rem 1.05rem;
    border-radius: 18px;
  }

  .aluplast-hero__title {
    font-size: clamp(1.4rem, 5.2vw, 1.75rem);
    line-height: 1.15;
  }

  .aluplast-hero__lead {
    font-size: 0.9375rem;
    line-height: 1.55;
  }

  .spectrum-main .section-head h2 {
    font-size: clamp(1.35rem, 5.2vw, 1.8rem);
    line-height: 1.15;
  }

  .spectrum-hero-card {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.1rem 1rem;
    border-radius: 18px;
  }

  .spectrum-hero-card__img-wrap {
    min-height: min(220px, 42vw);
    border-radius: 16px;
  }

  .spectrum-hero-card__cta {
    width: 100%;
    min-height: 52px;
    justify-content: center;
    border-radius: 16px;
  }

  .roletna-hero {
    padding: clamp(1.5rem, 4vw, 2rem) var(--section-pad-x) clamp(1.5rem, 4vw, 2.25rem);
  }

  .roletna-hero__card {
    padding: 1.1rem 1rem;
    border-radius: 18px;
  }

  .roletna-hero__title {
    font-size: clamp(1.35rem, 5vw, 1.75rem);
  }

  .roletna-hero__tagline {
    font-size: 0.9375rem;
    line-height: 1.55;
  }

  .bajer-chat--subpage .bajer-chat-toggle {
    width: 54px;
    height: 54px;
  }

  a.btn,
  .price-calc-btn,
  .site-header__menu-toggle {
    touch-action: manipulation;
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .site-header__nav-block {
    transition-duration: 0.01ms;
  }

  .site-header__menu-bar {
    transition-duration: 0.01ms;
  }

  #sherbime.is-revealed .service-tile {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  body::before,
  .hero::before {
    animation: none !important;
  }
}
