/* PWA Enforcement Overlay — FR-E9 */

/* HARD GATE (issue 13, 2026-08-18): while locked, the app behind the overlay
   is not merely covered — it is hidden. The About story's fullscreen stage was
   winning the paint over a z-200000 overlay; visibility removes the contest,
   and a member cannot tap play on a player they cannot see. */
html.pwa-locked body > :not(.pwa-overlay) { visibility: hidden !important; }
html.pwa-locked { overflow: hidden; }

.pwa-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  background: #0a2e2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: env(safe-area-inset-top, 0) 24px env(safe-area-inset-bottom, 0) 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pwa-overlay__inner {
  width: 100%;
  max-width: 420px;
  padding: 48px 0 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Logo / branding */
.pwa-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, #2a7575, #1a5555);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.pwa-logo__text {
  font-family: 'Playfair Display', serif;
  font-size: calc(28px * var(--type-scale, 1));
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.pwa-heading {
  font-family: 'Playfair Display', serif;
  font-size: calc(26px * var(--type-scale, 1));
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin: 0 0 12px;
  line-height: 1.2;
}

.pwa-subhead {
  font-family: 'Inter', sans-serif;
  font-size: calc(15px * var(--type-scale, 1));
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  margin: 0 0 40px;
  line-height: 1.5;
}

/* Step cards */
.pwa-steps {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 36px;
}

.pwa-step {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.pwa-step__num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2a7575;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: calc(13px * var(--type-scale, 1));
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.pwa-step__body {
  flex: 1;
}

.pwa-step__title {
  font-family: 'Inter', sans-serif;
  font-size: calc(15px * var(--type-scale, 1));
  font-weight: 600;
  color: #fff;
  margin: 0 0 4px;
}

.pwa-step__desc {
  font-family: 'Inter', sans-serif;
  font-size: calc(13px * var(--type-scale, 1));
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  line-height: 1.4;
}

/* The closing line of the simplified wall (landing-family-first S4).
   iOS step 3 — "Open from Home Screen" — used to be a third numbered card of
   equal weight to the two real actions. It is a consequence, not an
   instruction, so it reads as one quiet sentence under the steps: present for
   the member who wants to know what happens next, and never competing with the
   two taps Joe named. */
.pwa-then {
  font-family: 'Inter', sans-serif;
  font-size: calc(13px * var(--type-scale, 1));
  color: rgba(255, 255, 255, 0.45);
  margin: 2px 0 0;
  padding: 0 4px;
  line-height: 1.45;
  text-align: center;
}

/* Share icon illustration */
.pwa-share-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin: 0 2px;
}

/* Android install button */
.pwa-install-btn {
  width: 100%;
  padding: 16px;
  background: #2a7575;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: calc(17px * var(--type-scale, 1));
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.pwa-install-btn:active {
  background: #1a5555;
}

/* Dev/testing bypass */
.pwa-dismiss-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  font-family: 'Inter', sans-serif;
  font-size: calc(13px * var(--type-scale, 1));
  cursor: pointer;
  padding: 8px 16px;
  -webkit-tap-highlight-color: transparent;
  text-decoration: underline;
}

.pwa-dismiss-btn:active {
  color: rgba(255, 255, 255, 0.5);
}

/* Android-specific: hide iOS steps */
.pwa-overlay.pwa-android .pwa-ios-steps {
  display: none;
}
.pwa-overlay.pwa-android .pwa-install-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* iOS-specific: hide install button and Android steps */
.pwa-overlay.pwa-ios .pwa-install-btn,
.pwa-overlay.pwa-ios .pwa-android-steps {
  display: none;
}

/* Android fallback steps: hidden by default, shown when native prompt unavailable */
.pwa-android-steps {
  display: none;
}

/* ── Help + the trouble panel (securing-family-launch S3, 2026-08-19) ───────
   Under J-A the gate is HARD: no "continue in browser", nothing behind it. So
   these are not decorations — Help is the only door on the surface, and the
   trouble panel is what a stuck member gets instead of a dead end. Styled to
   read as calm and secondary while the steps are working, and to be
   unmistakable the moment the panel is revealed. */

.pwa-help-row {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 20px 0 4px;
}

.pwa-help-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.72);
  font-family: 'Inter', sans-serif;
  font-size: calc(15px * var(--type-scale, 1));
  cursor: pointer;
  /* 44px minimum target: the members most likely to need this door are the
     ones least able to hit a small one. */
  min-height: 44px;
  padding: 10px 18px;
  text-decoration: underline;
  -webkit-tap-highlight-color: transparent;
}

.pwa-help-btn:active {
  color: #fff;
}

/* `hidden` must win over the flex display below — an attribute that says the
   panel is not there has to actually keep it off the screen. */
.pwa-trouble[hidden] {
  display: none;
}

.pwa-trouble {
  width: 100%;
  margin-top: 20px;
  padding: 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pwa-trouble__title {
  margin: 0;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: calc(18px * var(--type-scale, 1));
  font-weight: 600;
}

.pwa-trouble__diagnosis {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-family: 'Inter', sans-serif;
  font-size: calc(15px * var(--type-scale, 1));
  line-height: 1.5;
}

.pwa-trouble__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-trouble__btn {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: calc(16px * var(--type-scale, 1));
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pwa-trouble__btn:active {
  background: rgba(255, 255, 255, 0.20);
}

.pwa-trouble__btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.pwa-trouble__status {
  margin: 0;
  min-height: 1.2em;
  color: #9fe0d6;
  font-family: 'Inter', sans-serif;
  font-size: calc(14px * var(--type-scale, 1));
  line-height: 1.5;
  /* The status can carry a full URL when the clipboard refuses. Wrap it rather
     than letting it push the gate sideways on a narrow phone. */
  word-break: break-word;
}

/* "Show me the steps again" — a scroll alone is easy to miss on a small
   screen, so the destination announces itself. */
.pwa-steps--flash {
  animation: pwa-steps-flash 0.6s ease-in-out 3;
  border-radius: 12px;
}

@keyframes pwa-steps-flash {
  0%, 100% { background: transparent; }
  50% { background: rgba(159, 224, 214, 0.16); }
}

@media (prefers-reduced-motion: reduce) {
  .pwa-steps--flash {
    animation: none;
    background: rgba(159, 224, 214, 0.16);
  }
}

/* ── LAUNCH WINDOW: the desktop-only wall (Joe directive 2026-08-19) ─────────
   The message that replaces the Add-to-Home-Screen gate on a handheld while
   the mobile interface is held back. It reuses .pwa-overlay / .pwa-logo /
   .pwa-heading / .pwa-help-btn deliberately — the door should look like the
   same door — and adds only what the gate has no equivalent for.

   The subhead is the INSTRUCTION here, not supporting text, so it is brighter
   and larger than the gate's: at 0.65 opacity the one sentence a member must
   act on read as a caption under the greeting. */
.pwa-desktop-only .pwa-subhead {
  color: rgba(255, 255, 255, 0.92);
  font-size: calc(17px * var(--type-scale, 1));
  margin-bottom: 32px;
}

.pwa-desktop-only .pwa-desktop-status {
  font-family: 'Inter', sans-serif;
  font-size: calc(14px * var(--type-scale, 1));
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  margin: 16px 0 0;
  line-height: 1.5;
  min-height: 1.2em;   /* reserve the line so the button does not jump */
}

/* The link, printed and selectable — the fallback for a browser that refuses
   clipboard access, and the reason the instruction is followable at all.
   `user-select: all` makes press-and-hold select the whole URL rather than a
   word of it, which on a token URL is the difference between a working link
   and a broken one. */
.pwa-desktop-only .pwa-desktop-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: calc(12px * var(--type-scale, 1));
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  margin: 20px 0 0;
  padding: 12px;
  width: 100%;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}

/* The Share pointer was REMOVED (Joe ruling 2026-10-01): the page cannot know where
   Safari puts Share (bottom, top, right, or under •••), so it must not point. See
   pwa-enforcement.js at the iOS steps. */
