/* Copyright 2025-2026 Renofy Ltd. All rights reserved. */
/* iOS App Install Promo Bar (RENO-920)
   Mobile-only banner shown on iOS devices to promote the native app.
   Visibility gated by `html.app-install-bar-active` class set in base.html. */

.app-install-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-index-header) + 1);
  height: calc(var(--height-app-install-bar) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 0.5rem 0 0.5rem;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-white);
  border-bottom: 0.5px solid var(--color-border);
  box-shadow: var(--shadow-subtle);
}

.app-install-bar__dismiss {
  flex-shrink: 0;
  position: relative;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition-fast);
}

/* Extend the tap target to ~44×44 per Apple HIG without enlarging the
   visual circle. The pseudo-element's pointer events bubble to the button. */
.app-install-bar__dismiss::before {
  content: "";
  position: absolute;
  inset: -6px;
}

.app-install-bar__dismiss:hover,
.app-install-bar__dismiss:focus {
  background: var(--color-bg-light);
}

.app-install-bar__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  object-fit: cover;
}

.app-install-bar__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
  overflow: hidden;
}

.app-install-bar__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-install-bar__subtitle {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-install-bar__cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: transform var(--transition-fast);
}

.app-install-bar__cta:active {
  transform: scale(0.96);
}

/* Apple guidelines: badge minimum 40px height, preserve aspect ratio,
   do not modify the badge artwork, maintain clear space around it. */
.app-install-bar__badge {
  height: 40px;
  width: auto;
  display: block;
}

/* === Activation: only show on mobile when JS has detected iOS + not dismissed === */
@media (max-width: 820px) {
  html.app-install-bar-active .app-install-bar {
    display: flex;
  }

  /* Push the fixed mobile header below the promo bar */
  html.app-install-bar-active .header__mobile-top {
    top: var(--height-app-install-bar);
  }

  /* Push main content below promo bar + header. The existing
     `.section--bleed-under-header` rule (margin-top: -var(--height-header))
     still works correctly — it pulls the hero up under the header but not
     under the opaque promo bar, which is the desired behaviour. */
  html.app-install-bar-active main {
    margin-top: calc(var(--height-header) + var(--height-app-install-bar) + env(safe-area-inset-top, 0px));
  }
}
