/*
 * UFO Studios homepage mobile hotfixes.
 * Load after the legacy homepage CSS bundle and link-color-reset.css.
 */

html,
body,
#root {
  max-width: 100%;
  overflow-x: hidden;
}

/* Mobile Safari gives unstyled buttons a pale native fill unless appearance is reset. */
button[class*="fixed"][class*="bottom-6"][class*="left-6"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  left: max(0.875rem, env(safe-area-inset-left)) !important;
  bottom: max(0.875rem, env(safe-area-inset-bottom)) !important;
  z-index: 90 !important;
  background: rgba(5, 5, 5, 0.18) !important;
  background-color: rgba(5, 5, 5, 0.18) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  backdrop-filter: blur(8px) !important;
  box-shadow: none !important;
  color: rgba(255, 215, 0, 0.68) !important;
  border-color: rgba(255, 215, 0, 0.28) !important;
  opacity: 0.64 !important;
  transition:
    opacity 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    background-color 160ms ease !important;
}

button[class*="fixed"][class*="bottom-6"][class*="left-6"]:hover,
button[class*="fixed"][class*="bottom-6"][class*="left-6"]:focus-visible {
  background-color: rgba(5, 5, 5, 0.42) !important;
  border-color: rgba(255, 215, 0, 0.58) !important;
  color: rgba(255, 215, 0, 0.92) !important;
  opacity: 1 !important;
}

#services a,
#services a *,
#services span[class*="underline"],
#services p {
  text-decoration: none !important;
  -webkit-text-decoration-line: none !important;
  text-decoration-line: none !important;
}

#intelligence {
  display: none !important;
}

@media (max-width: 767px) {
  #mobile-menu button {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
  }

  #mobile-menu button:focus-visible {
    outline: 1px solid rgba(245, 196, 0, 0.5) !important;
    outline-offset: 6px !important;
  }

  #origin {
    min-height: auto !important;
    padding: 4rem 1rem 4.5rem !important;
    align-items: flex-start !important;
  }

  #origin > .container {
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 3.25rem !important;
    margin-inline: auto !important;
  }

  #origin > .container > * {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  #origin h2 {
    max-width: 100% !important;
    font-size: clamp(2.25rem, 13vw, 3.4rem) !important;
    line-height: 0.9 !important;
    overflow-wrap: anywhere !important;
  }

  #origin .font-mono.text-lg {
    max-width: 100% !important;
    padding-left: 1rem !important;
    font-size: clamp(1rem, 4.7vw, 1.125rem) !important;
    line-height: 1.55 !important;
  }

  #origin button[class*="border-black"] {
    color: rgba(0, 0, 0, 0.22) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    background: transparent !important;
  }

  #origin button[class*="border-black"]:hover,
  #origin button[class*="border-black"]:focus-visible {
    color: rgba(0, 0, 0, 0.42) !important;
    border-color: rgba(0, 0, 0, 0.16) !important;
  }

  #origin .relative.w-full.max-w-xs {
    width: min(100%, 20rem) !important;
    max-width: calc(100vw - 2rem) !important;
    margin-inline: auto !important;
  }

  #origin .aspect-square {
    width: 100% !important;
    max-width: calc(100vw - 2rem) !important;
  }

  /* Painting lightbox: keep artwork inside the phone viewport and replace the oversized controls. */
  div[class*="z-[10000]"][class*="bg-black/95"] {
    box-sizing: border-box !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 10000 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: max(0.75rem, env(safe-area-inset-top)) 0.625rem
      calc(5.75rem + env(safe-area-inset-bottom)) !important;
    background: rgba(0, 0, 0, 0.96) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    backdrop-filter: blur(12px) !important;
  }

  div[class*="z-[10000]"][class*="bg-black/95"] > .relative.w-full.h-full {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
  }

  div[class*="z-[10000]"] div[class*="bg-[#f0f0f0]"] {
    box-sizing: border-box !important;
    width: min(100%, calc(100vw - 1.25rem)) !important;
    max-width: calc(100vw - 1.25rem) !important;
    max-height: calc(100dvh - 7.25rem) !important;
    margin: 0 auto !important;
    padding: 0.375rem !important;
    overflow: hidden !important;
    background: #050505 !important;
    border: 1px solid rgba(255, 215, 0, 0.26) !important;
  }

  div[class*="z-[10000]"] div[class*="bg-[#f0f0f0]"] > div:first-child {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 12.75rem) !important;
    background: #050505 !important;
  }

  div[class*="z-[10000]"] div[class*="bg-[#f0f0f0]"] img[class*="object-contain"] {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 13.25rem) !important;
    object-fit: contain !important;
  }

  div[class*="z-[10000]"] div[class*="bg-[#f0f0f0]"] > div:last-child {
    min-height: 0 !important;
    padding: 0.55rem 0.125rem 0 !important;
    border-top-color: rgba(255, 255, 255, 0.12) !important;
    color: #f2e9d6 !important;
  }

  div[class*="z-[10000]"] div[class*="bg-[#f0f0f0]"] h3 {
    margin: 0 !important;
    font-size: 0.75rem !important;
    line-height: 1.15 !important;
    white-space: normal !important;
  }

  div[class*="z-[10000]"] div[class*="bg-[#f0f0f0]"] > div:last-child img {
    display: none !important;
  }

  div[class*="z-[10020]"] {
    left: 50% !important;
    bottom: calc(0.875rem + env(safe-area-inset-bottom)) !important;
    z-index: 10020 !important;
    width: auto !important;
    padding: 0 !important;
    gap: 0.5rem !important;
    transform: translateX(-50%) !important;
  }

  div[class*="z-[10020]"] button {
    -webkit-appearance: none !important;
    appearance: none !important;
    flex: 0 0 auto !important;
    width: 2.75rem !important;
    height: 2.75rem !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(242, 233, 214, 0.42) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f2e9d6 !important;
    font-size: 1rem !important;
  }

  div[class*="z-[10020]"] button:nth-child(2) {
    width: auto !important;
    min-width: 5.7rem !important;
    padding-inline: 0.9rem !important;
    background: rgba(255, 215, 0, 0.9) !important;
    color: #050505 !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
  }

  #timetruck {
    padding: 4.25rem 1rem 3.75rem !important;
  }

  #timetruck > .container {
    width: 100% !important;
    max-width: 100% !important;
  }

  #timetruck h2 {
    font-size: clamp(2.45rem, 13vw, 4rem) !important;
    line-height: 0.9 !important;
    overflow-wrap: anywhere !important;
  }

  #timetruck [class*="border-b"][class*="pb-8"] {
    gap: 1rem !important;
    margin-bottom: 1.25rem !important;
    padding-bottom: 1.25rem !important;
  }

  #timetruck [class*="grid-cols-1"] {
    gap: 1rem !important;
  }

  #timetruck .group.relative.border {
    max-width: 100% !important;
    background: rgba(0, 0, 0, 0.64) !important;
    box-shadow:
      inset 0 0 0 1px rgba(255, 215, 0, 0.04),
      0 18px 36px rgba(0, 0, 0, 0.2) !important;
  }

  #timetruck .group.relative.border [class*="aspect-video"] {
    max-height: 13.25rem !important;
    background: #050505 !important;
  }

  #timetruck .group.relative.border img {
    opacity: 0.9 !important;
    filter: saturate(0.88) contrast(1.04) !important;
  }

  #timetruck h3 {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  #timetruck::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5rem;
    pointer-events: none;
    background: linear-gradient(180deg, transparent, #0a0a0a);
  }

  #audio {
    position: relative !important;
    margin-top: -1px !important;
    padding-top: 4.25rem !important;
    padding-bottom: 4.5rem !important;
    background: linear-gradient(180deg, #0a0a0a 0, #050505 5rem, #050505 100%) !important;
    border-top-color: rgba(255, 215, 0, 0.14) !important;
  }

  #audio::before {
    content: "";
    position: absolute;
    top: 0;
    left: 1rem;
    right: 1rem;
    height: 1px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.42), transparent);
  }

  #audio .container {
    padding-inline: 1rem !important;
  }

  #audio [class*="overflow-x-auto"] {
    width: calc(100vw - 2rem) !important;
    margin-inline: 0 !important;
    padding-inline: 0 !important;
    padding-bottom: 0.5rem !important;
    scroll-padding-inline: 0 !important;
  }

  #audio [class*="w-[85vw]"] {
    width: min(82vw, 20rem) !important;
  }

  #contact {
    position: relative !important;
    padding: 4rem 1.25rem 5.5rem !important;
    background: linear-gradient(180deg, #ffdc3f 0%, #f5d22f 100%) !important;
  }

  #contact::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.72) 0 12px,
      transparent 12px 24px
    );
    opacity: 0.32;
  }

  #contact > .container {
    width: 100% !important;
    max-width: 100% !important;
    gap: 2rem !important;
    align-items: stretch !important;
  }

  #contact h2 {
    margin-bottom: 1.15rem !important;
    font-size: clamp(2rem, 10vw, 3.25rem) !important;
    line-height: 0.95 !important;
  }

  #contact a[href^="mailto:"] {
    display: inline-block !important;
    max-width: 100% !important;
    font-size: clamp(1rem, 5.6vw, 1.35rem) !important;
    overflow-wrap: anywhere !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 0.22em !important;
  }

  #contact .text-right {
    width: 100% !important;
    text-align: left !important;
  }

  #contact .ml-auto {
    margin-left: 0 !important;
  }

  #contact p {
    max-width: 27rem !important;
    font-size: clamp(0.74rem, 3.35vw, 0.92rem) !important;
    line-height: 1.5 !important;
  }

  #contact [class*="items-end"] {
    align-items: stretch !important;
  }

  #contact button {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 100% !important;
    max-width: 100% !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(0, 0, 0, 0.22) !important;
  }

  #contact button:last-child {
    align-self: flex-start !important;
    width: auto !important;
    background: transparent !important;
  }

  button[class*="fixed"][class*="bottom-6"][class*="left-6"] {
    max-width: 7.4rem !important;
    padding: 0.32rem 0.48rem !important;
    font-size: 0.62rem !important;
    letter-spacing: 0.1em !important;
    opacity: 0.5 !important;
  }
}
