/* Lightit mobile UX layer — loads after bundle + footer */

@media (max-width: 768px) {
  :root {
    --container-pad: 18px;
    --header-h: 60px;
    --logo-h: 38px;
    --touch: 48px;
  }

  html,
  body.lightit-page {
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overscroll-behavior-y: contain;
  }

  /* Header: logo left, lang + menu clustered right (no floating center gap) */
  .li-nav {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    column-gap: 6px;
    width: 100%;
    min-height: var(--header-h);
    padding-inline: max(10px, var(--safe-left, 0px)) max(6px, var(--safe-right, 0px));
  }

  .li-logo {
    grid-column: 1;
    grid-row: 1;
    margin: 0 !important;
    justify-self: start;
    z-index: 201;
  }

  .li-logo img {
    height: var(--logo-h);
    width: auto;
    max-width: min(148px, 42vw);
  }

  .li-lang-toggle {
    grid-column: 2;
    grid-row: 1;
    margin: 0 !important;
    z-index: 201;
    gap: 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(6, 6, 8, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 0 2px;
  }

  .li-lang-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    font-size: 12px;
  }

  .li-menu-toggle {
    grid-column: 3;
    grid-row: 1;
    margin: 0 !important;
    z-index: 201;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    gap: 5px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(6, 6, 8, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    flex-shrink: 0;
  }

  .li-menu-toggle span {
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  }

  .li-menu-toggle[aria-expanded="true"] {
    background: rgba(6, 6, 8, 0.9);
    border-color: rgba(255, 255, 255, 0.32);
  }

  .li-menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(3.5px) rotate(45deg);
  }

  .li-menu-toggle[aria-expanded="true"] span:nth-child(2) {
    transform: translateY(-3.5px) rotate(-45deg);
  }

  /*
   * Solid header on mobile — no backdrop-filter.
   * backdrop-filter on .li-header traps position:fixed menu links/overlay
   * inside the 56px header box (links then sit on top of the logo).
   */
  .li-header,
  .li-header.scrolled {
    background: rgba(6, 6, 8, 0.96) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  /*
   * Bundle minifies calc(+) without spaces → invalid CSS → top:auto.
   * Result: nav links use static position and collide with the logo.
   * Spaces around + / - are required in calc().
   */
  .li-nav-links {
    top: calc(var(--header-h) + var(--safe-top, 0px) + 16px) !important;
    bottom: auto !important;
    left: max(20px, var(--safe-left, 0px)) !important;
    right: max(20px, var(--safe-right, 0px)) !important;
    max-height: calc(100dvh - var(--header-h) - var(--safe-top, 0px) - 120px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 202 !important;
    /* Kill bundle entrance translate — it left links sitting inside the header/logo */
    transform: none !important;
  }

  .li-nav-cta {
    top: auto !important;
    bottom: max(24px, var(--safe-bottom, 0px)) !important;
    left: max(20px, var(--safe-left, 0px)) !important;
    right: max(20px, var(--safe-right, 0px)) !important;
    z-index: 202 !important;
    transform: none !important;
  }

  .li-nav.open::before {
    z-index: 198 !important;
    background: rgba(6, 6, 8, 0.98) !important;
  }

  body.menu-open .li-header {
    background: rgba(6, 6, 8, 0.98) !important;
  }

  /* Hero: brand + lead + CTAs — one composition */
  .li-hero--banner {
    min-height: 100svh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
  }

  .li-hero-banner-stage {
    padding-top: calc(var(--header-h) + var(--safe-top, 0px) + 8px) !important;
    padding-bottom: 8px !important;
    flex: 1 1 auto;
    align-items: center !important;
  }

  .li-hero-banner img {
    width: min(100%, 92%) !important;
    max-width: 100%;
    max-height: min(24vh, 148px);
    object-fit: contain;
  }

  .li-hero--banner .li-hero-overlay {
    background: linear-gradient(
      180deg,
      rgba(6, 6, 8, 0.5) 0%,
      rgba(6, 6, 8, 0.22) 36%,
      rgba(6, 6, 8, 0.62) 70%,
      rgba(6, 6, 8, 0.9) 100%
    ) !important;
  }

  .li-hero-inner {
    padding-bottom: 4px;
    padding-inline: 2px;
  }

  .li-hero .li-lead,
  .li-hero-inner .li-lead {
    font-size: 14.5px !important;
    line-height: 1.55 !important;
    margin-bottom: 18px !important;
    max-width: 34em;
    text-shadow: 0 1px 16px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.9);
  }

  .li-hero-cta {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    width: 100%;
    margin-top: 0 !important;
  }

  .li-hero-cta .li-btn--primary {
    width: 100%;
    min-height: 52px;
    justify-content: center;
    border-radius: 999px;
    font-size: 12px;
  }

  .li-hero-cta .li-btn--secondary {
    width: fit-content;
    min-height: 44px;
    align-self: flex-start;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 10px 2px !important;
  }

  /* Contact FAB — keep above header (201); under cookie (950) */
  .li-contact-chips {
    bottom: max(18px, calc(12px + env(safe-area-inset-bottom, 0px))) !important;
    right: max(14px, env(safe-area-inset-right, 0px)) !important;
    left: auto !important;
    z-index: 900;
  }

  .li-contact-chip {
    min-height: 48px;
    min-width: 48px;
    padding: 12px 18px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    border-radius: 999px;
    background: #fff;
    color: #060608;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
  }

  /* Compare: leftover dual-slider affordances (single composite has no handle) */
  .li-compare-slider:not(.li-compare-slider--single) .li-compare-handle::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -28px;
    width: 56px;
  }

  .li-compare-slider:not(.li-compare-slider--single) .li-compare-knob {
    width: 56px !important;
    height: 56px !important;
  }

  .li-compare-slider:not(.li-compare-slider--single) .li-compare-hint {
    bottom: 14px;
    font-size: 10px;
    padding: 8px 12px !important;
    border-radius: 2px !important;
    background: rgba(6, 6, 8, 0.78) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .li-compare-label {
    top: 12px;
    padding: 6px 10px;
    font-size: 10px;
  }

  .li-compare-label--live {
    left: 12px;
  }

  .li-compare-label--design {
    right: 12px;
  }

  /* Services */
  .li-service-panel {
    min-height: min(72vh, 520px);
  }

  .li-service-panel-inner {
    padding: 28px 0 36px;
    padding-left: 18px !important;
    max-width: 100%;
  }

  .li-service-panel h2 {
    font-size: clamp(2rem, 10vw, 2.75rem) !important;
    margin-bottom: 8px;
  }

  .li-service-link {
    margin-top: 1.25rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 0;
  }

  /* Process — hover titles on mobile */
  .li-process-title {
    min-height: 44px;
    padding: 8px 0;
  }

  .li-process-bodies {
    min-height: 5.5em;
  }

  .li-team-member {
    padding: 20px 4px 20px 0;
  }

  .li-team-index {
    font-size: 11px;
  }

  /* Work / team spacing owned by premium.css --section-y */

  .li-faq-item summary {
    min-height: var(--touch);
    padding: 14px 0;
    gap: 12px;
    font-size: 1rem;
  }

  .li-faq-item p {
    font-size: 14.5px;
    line-height: 1.55;
    padding-bottom: 16px;
  }

  /* Forms */
  .li-form input,
  .li-form textarea,
  .li-form select {
    font-size: 16px !important;
    min-height: 48px;
  }

  .li-form button[type="submit"],
  .li-form .li-btn {
    width: 100%;
    min-height: 52px;
    border-radius: 999px;
  }

  /* Contact FAB clearance — reinforced in premium.css */

  /* Footer meta — unified close */
  .li-footer-legal-inline a {
    min-height: 44px;
    font-size: 13px;
  }

  .li-footer .li-footer-social {
    gap: 2px;
  }

  .li-footer .li-social {
    width: 48px;
    height: 48px;
    min-height: 48px;
  }

  /* Cookie bar */
  .li-cookie {
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }

  .li-cookie-actions .li-btn {
    min-height: 44px;
  }

  /* Menu open: settle chrome */
  body.menu-open .li-contact-chips,
  body.menu-open .scroll-progress {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .li-nav.open .li-nav-links a {
    min-height: 48px;
    font-size: clamp(1.45rem, 6.5vw, 2rem);
    padding: 12px 0;
  }

  .li-nav.open .li-nav-cta {
    min-height: 54px;
    border-radius: 999px;
  }

  /* Keep logo + controls above the overlay panel */
  body.menu-open .li-logo,
  body.menu-open .li-lang-toggle,
  body.menu-open .li-menu-toggle {
    z-index: 203 !important;
  }
}

@media (max-width: 480px) {
  :root {
    --container-pad: 16px;
    --header-h: 56px;
    --logo-h: 34px;
  }

  .li-hero-banner img {
    max-height: min(20vh, 120px);
  }

  .li-hero .li-lead,
  .li-hero-inner .li-lead {
    font-size: 14px !important;
  }

  .li-stats::before {
    margin-bottom: 28px;
  }

  .li-stats-grid {
    gap: 12px 8px !important;
  }

  .li-stat:not(:last-child)::after {
    display: none;
  }

  .li-team-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 359px) {
  .li-team-grid {
    grid-template-columns: 1fr !important;
  }

  .li-logo img {
    max-width: 120px;
  }
}

/* Prefer fewer layout jumps on phones */
@media (max-width: 768px) {
  .li-clients,
  .li-compare,
  .li-services,
  .li-process,
  .li-reel,
  .li-work,
  .li-team,
  .li-faq {
    content-visibility: visible;
    contain-intrinsic-size: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .li-header,
  .li-contact-chip,
  .li-nav.open::before,
  .li-reel-item-img,
  .li-reel-item-video,
  .li-reel-item-play {
    transition: none !important;
    animation: none !important;
  }
}
