/* ============================================================
   app-promo.css — Optics Lab iPhone app promotion (website only)
   ============================================================ */

.app-promo {
  --app-glow: rgba(234, 201, 135, 0.18);
}

.app-promo-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.app-store-badge {
  display: inline-block;
  line-height: 0;
  border-radius: 9px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.app-store-badge img {
  height: 46px;
  width: auto;
}

.app-store-badge:hover,
.app-store-badge:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.app-store-badge-lg img { height: 54px; }
.app-store-badge-sm img { height: 40px; }

.app-promo-note {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Feature section (Optics Lab page) ---------------------- */
.app-promo-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: 2.5rem;
  margin: 3.5rem 0 1rem;
  padding: 2.75rem 2.75rem 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 85% 100%, rgba(168, 85, 247, 0.22), transparent 60%),
    radial-gradient(80% 70% at 0% 0%, var(--app-glow), transparent 60%),
    linear-gradient(160deg, var(--bg-2), #2c241f);
  overflow: hidden;
  scroll-margin-top: calc(var(--nav-height) + 1rem);
}

.app-feature-copy { padding-bottom: 2.75rem; }

.app-feature-title {
  font-family: var(--font-serif);
  font-weight: normal;
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  line-height: 1.15;
  color: var(--white);
  margin-bottom: 0.8rem;
}

.app-feature-lead {
  color: var(--text-muted);
  margin-bottom: 1.3rem;
  max-width: 34rem;
}

.app-feature-points {
  list-style: none;
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.8rem;
}

.app-feature-points li {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  color: var(--text);
}

.app-feature-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.app-promo-qr {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 13rem;
}

.app-promo-qr img {
  width: 84px;
  height: 84px;
  padding: 4px;
  background: #fff;
  border-radius: 10px;
  flex-shrink: 0;
}

.app-feature-phones {
  position: relative;
  height: 430px;
  align-self: end;
}

.app-phone {
  position: absolute;
  bottom: -40px;
  width: 190px;
  border-radius: 26px;
  border: 5px solid #15110e;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
}

.app-phone-center {
  left: 50%;
  width: 215px;
  bottom: -20px;
  transform: translateX(-50%);
  z-index: 2;
}

.app-phone-left {
  left: 50%;
  transform: translateX(-118%) rotate(-7deg);
  opacity: 0.85;
}

.app-phone-right {
  left: 50%;
  transform: translateX(18%) rotate(7deg);
  opacity: 0.85;
}

/* --- Hero chip (Optics Lab page) ---------------------------- */
.app-promo-chip {
  display: flex;
  justify-content: center;
  margin-top: 1.1rem;
}

.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.95rem 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-size: 0.85rem;
}

.app-chip img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.app-chip:hover,
.app-chip:focus-visible {
  border-color: var(--accent);
  color: var(--white);
}

/* --- Home page card ----------------------------------------- */
.app-promo-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 190px;
  align-items: center;
  gap: 2rem;
  max-width: 1100px;
  margin: 3rem auto;
  padding: 2.25rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(90% 120% at 100% 50%, rgba(168, 85, 247, 0.2), transparent 60%),
    linear-gradient(150deg, var(--bg-2), #2c241f);
  overflow: hidden;
}

.app-card-icon {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.app-card-title {
  font-family: var(--font-serif);
  font-weight: normal;
  font-size: 1.9rem;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.app-card-text {
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  max-width: 36rem;
}

.app-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.app-card-web {
  font-size: 0.92rem;
  white-space: nowrap;
}

.app-card-shot {
  width: 190px;
  margin: -2.25rem 0 -9rem;
  border-radius: 24px;
  border: 5px solid #15110e;
  transform: rotate(6deg);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.5);
}

/* --- Slim strip (workshops, trips) -------------------------- */
.app-promo-strip {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 1rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(120deg, var(--bg-2), rgba(168, 85, 247, 0.12));
}

.app-strip-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  flex-shrink: 0;
}

.app-strip-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.45;
}

.app-strip-title {
  color: var(--white);
  font-weight: 600;
}

.app-strip-copy span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.app-promo-strip .app-store-badge img { height: 42px; }

/* --- Contextual nudge toast --------------------------------- */
.app-nudge {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: min(560px, calc(100vw - 2rem));
  padding: 0.9rem 2.4rem 0.9rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(36, 29, 25, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 24px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.app-nudge.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.app-nudge-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  flex-shrink: 0;
}

.app-nudge-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.4;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.app-nudge-copy strong {
  color: var(--white);
  font-size: 0.95rem;
}

.app-nudge-more {
  font-size: 0.86rem;
  white-space: nowrap;
}

.app-nudge-close {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.app-nudge-close:hover,
.app-nudge-close:focus-visible { color: var(--white); }

/* --- Advanced mode paywall (website only) ------------------- */
#mode-btn-advanced.app-locked .optics-mode-badge::after {
  content: " \1F512";
  font-size: 0.8em;
}

.app-paywall {
  width: min(460px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: transparent;
  color: var(--text);
}

.app-paywall::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.app-paywall-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 2rem 1.75rem 1.5rem;
  text-align: center;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(234, 201, 135, 0.18), transparent 60%),
    linear-gradient(160deg, var(--bg-2), #2c241f);
}

.app-paywall-icon {
  width: 72px;
  height: 72px;
  border-radius: 17px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.app-paywall-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--white);
}

.app-paywall-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.app-paywall-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.6rem;
}

.app-paywall-stay {
  min-height: 44px;
  margin-top: 0.2rem;
  padding: 0.4rem 0.8rem;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}

.app-paywall-close {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.app-paywall-stay:hover,
.app-paywall-stay:focus-visible,
.app-paywall-close:hover,
.app-paywall-close:focus-visible { color: var(--white); }

/* --- RTL ---------------------------------------------------- */
[dir="rtl"] .app-paywall-close { right: auto; left: 0.25rem; }
[dir="rtl"] .app-nudge { padding: 0.9rem 0.9rem 0.9rem 2.4rem; }
[dir="rtl"] .app-nudge-close { right: auto; left: 0.5rem; }

/* --- Responsive --------------------------------------------- */
@media (max-width: 900px) {
  .app-promo-feature {
    grid-template-columns: 1fr;
    padding: 2rem 1.5rem 0;
    gap: 0;
  }
  .app-feature-copy { padding-bottom: 1.5rem; }
  .app-feature-phones { height: 330px; }
  .app-phone { width: 140px; border-radius: 20px; }
  .app-phone-center { width: 160px; }

  .app-promo-card {
    grid-template-columns: auto minmax(0, 1fr);
    margin: 2rem 1rem;
    padding: 1.75rem 1.5rem;
  }
  .app-card-shot { display: none; }
}

@media (max-width: 600px) {
  .app-promo-card { grid-template-columns: 1fr; gap: 1rem; }
  .app-card-icon { width: 72px; height: 72px; border-radius: 17px; }

  .app-promo-strip {
    flex-wrap: wrap;
    margin: 2rem 1rem;
  }
  .app-strip-copy { flex-basis: calc(100% - 70px); }

  .app-promo-qr { display: none; }
}

/* Short screens (iPhone SE, phones in landscape): keep the App Store button within reach */
@media (max-height: 740px) {
  .app-paywall-panel { gap: 0.45rem; padding: 1.5rem 1.25rem 0.75rem; }
  .app-paywall-icon { width: 52px; height: 52px; border-radius: 12px; }
  .app-paywall-title { font-size: 1.3rem; }
  .app-paywall-text { font-size: 0.875rem; line-height: 1.45; }
  .app-paywall-cta { margin-top: 0.25rem; }
}

@media (max-height: 500px) {
  .app-paywall { width: min(640px, calc(100vw - 2rem)); }
  .app-paywall-icon { display: none; }
  .app-paywall-panel { gap: 0.35rem; padding: 1rem 2.5rem 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .app-store-badge,
  .app-nudge { transition: none; }
}
