/*
  LoveFlix — Mobile-only stylesheet
  Loaded after styles.css so desktop/base rules remain untouched.
  Focus: compact mobile composition, touch targets, centered copy and iPhone Safari.
*/

@media (max-width: 900px) {
  /* Keep cinematic overlays behind the entire mobile interface.
     Safari/iOS can otherwise composite fixed blend/filter layers above content. */
  .noise,
  .vignette {
    z-index: 1 !important;
    pointer-events: none !important;
  }

  .scene {
    z-index: 0 !important;
  }

  .page-shell {
    position: relative;
    z-index: 2 !important;
  }

  .modal {
    z-index: 20 !important;
  }

  :root {
    --mobile-gutter: clamp(18px, 6vw, 30px);
  }

  html,
  body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  body {
    min-height: 100svh;
    min-height: 100dvh;
    overscroll-behavior-x: none;
  }

  .page-shell {
    width: min(100% - (var(--mobile-gutter) * 2), 620px);
  }

  /* iPhone notch / Dynamic Island safe-area support */
  .topbar {
    position: relative;
    min-height: 76px;
    padding-top: max(8px, env(safe-area-inset-top));
  }

  /* Mobile only: keep the logo perfectly centered in the top menu. */
  .brand {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(170px, 52vw);
    margin: 0;
    transform: translate(-50%, -50%);
  }

  .status-pill {
    display: none;
  }

  .hero {
    min-height: calc(100svh - 76px);
    min-height: calc(100dvh - 76px);
    grid-template-columns: 1fr;
    gap: clamp(28px, 6vh, 46px);
    padding: clamp(38px, 7vh, 60px) 0 max(38px, env(safe-area-inset-bottom));
    text-align: center;
    align-items: center;
  }

  .hero-copy {
    width: 100%;
    min-width: 0;
  }

  .eyebrow {
    max-width: 34rem;
    margin: 0 auto 14px;
    color: #b9b4b0;
    font-size: clamp(9px, 2.7vw, 11px);
    line-height: 1.55;
    letter-spacing: .16em;
  }

  h1 {
    align-items: center;
    font-size: clamp(56px, 18vw, 92px);
    line-height: .84;
    letter-spacing: -.045em;
  }

  h1 span:last-child {
    margin-left: 0;
  }

  .lead {
    max-width: 34rem;
    margin: 21px auto 22px;
    font-size: clamp(14px, 3.9vw, 16px);
    line-height: 1.72;
    text-wrap: balance;
  }

  .mini-line {
    width: min(100%, 360px);
    margin: 0 auto;
    justify-content: center;
    gap: 8px;
    font-size: 8px;
    line-height: 1.2;
    letter-spacing: .18em;
  }

  .actions {
    width: min(100%, 390px);
    margin: 24px auto 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .button {
    width: 100%;
    min-height: 52px;
    padding: 0 18px;
    border-radius: 14px;
    font-size: 11px;
    letter-spacing: .12em;
    justify-content: center;
    touch-action: manipulation;
  }

  .poster-wrap {
    width: min(78vw, 320px);
    justify-self: center;
  }

  .poster-card {
    padding: 18px;
    border-radius: 20px;
    transform: none;
  }

  .heart {
    font-size: clamp(58px, 16vw, 70px);
  }

  .poster-sub {
    font-size: 9px;
    letter-spacing: .18em;
  }

  /* The content exists for desktop, but mobile uses the project modal. */
  .feature-row {
    display: none;
  }

  .footer {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 0 max(24px, env(safe-area-inset-bottom));
    text-align: center;
    justify-items: center;
  }

  .footer-center,
  .footer > :last-child {
    justify-self: center;
  }

  /* Modal optimized for one-handed mobile use */
  .modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100svh;
    height: 100dvh;
    padding: max(14px, env(safe-area-inset-top))
             max(14px, env(safe-area-inset-right))
             max(14px, env(safe-area-inset-bottom))
             max(14px, env(safe-area-inset-left));
    display: grid;
    place-items: center;
  }

  .modal-backdrop {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .modal-card {
    width: min(100%, 430px);
    max-width: 100%;
    max-height: calc(100svh - 28px);
    max-height: calc(100dvh - 28px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 42px 22px 24px;
    border-radius: 22px;
    text-align: center;
  }

  .modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    touch-action: manipulation;
  }

  .modal-overline {
    font-size: 9px;
    letter-spacing: .2em;
  }

  .modal-card h3 {
    margin: 12px auto;
    max-width: 15em;
    font-size: clamp(27px, 8vw, 34px);
    line-height: 1.08;
    text-wrap: balance;
  }

  .modal-card p {
    max-width: 34em;
    margin: 0 auto;
    color: #a19d99;
    font-size: 13px;
    line-height: 1.75;
    text-wrap: pretty;
  }

  .progress {
    margin: 25px 0 14px;
  }

  .modal-note {
    font-size: 8px;
    line-height: 1.5;
  }
}

@media (max-width: 600px) {
  .page-shell {
    width: min(100% - 24px, 540px);
  }

  .hero {
    min-height: calc(100svh - 76px);
    min-height: calc(100dvh - 76px);
    padding-top: 34px;
  }

  .poster-wrap {
    width: min(78vw, 306px);
  }

  .footer {
    font-size: 8px;
    letter-spacing: .13em;
  }
}

@media (max-width: 380px) {
  .page-shell {
    width: min(100% - 20px, 360px);
  }

  .hero {
    gap: 28px;
    padding-top: 28px;
  }

  h1 {
    font-size: clamp(50px, 17vw, 72px);
  }

  .lead {
    font-size: 13px;
  }

  .poster-wrap {
    width: min(74vw, 270px);
  }
}

@media (max-width: 600px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    grid-template-columns: minmax(0, 1fr) minmax(220px, .72fr);
    gap: 28px;
    padding: 30px 0 max(30px, env(safe-area-inset-bottom));
    text-align: center;
  }

  .poster-wrap {
    width: min(42vw, 250px);
  }

  .lead {
    margin-top: 16px;
  }

  .actions {
    flex-direction: row;
  }

  .button {
    width: auto;
    flex: 1;
  }
}

@media (hover: none) and (pointer: coarse) {
  .brand:hover,
  .button:hover,
  .poster-wrap:hover .poster-card,
  .button-primary:hover,
  .button-ghost:hover {
    transform: none;
    box-shadow: inherit;
  }

  .button,
  .modal-close,
  .brand {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}

/* iOS Safari-specific viewport + rendering hardening */
@supports (-webkit-touch-callout: none) {
  .hero {
    min-height: calc(100svh - 76px);
  }

  .modal-card {
    max-height: calc(100svh - 28px);
  }

  .button,
  .modal-close {
    -webkit-appearance: none;
    appearance: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .beam,
  .dust,
  .status-dot,
  .heart,
  .progress span {
    animation: none !important;
  }
}
