/* Big-screen mode (/?man-hinh=1): QR invite card + its corner toggle, built by src/screen/qr-invite.js.
   Wide screens: bottom-left over the lantern sky (the tree stands at 60 % of the width), bottom aligned
   with the wish plaque and always clear of it. Portrait: a compact strip just above the plaque and
   its status note. Loaded after resonance-theme.css and reuses its variables. */
.qr-invite {
  /* The QR drives the whole card. 3rd term: card (≈1.25 × QR + gutter) stays left of the 460px plaque */
  --qr: min(28vh, 19vw, calc(37.9vw - 197px));
  --qr-pad: calc(var(--qr) * 0.045);
  --card-pad: calc(var(--qr) * 0.08);
  position: absolute;
  z-index: 3;
  left: calc(env(safe-area-inset-left, 0px) + max(14px, 2.6vw));
  bottom: calc(var(--safe-bottom, 0px) + 34px);
  display: grid;
  grid-template-areas: 'heading' 'code' 'address';
  justify-items: center;
  row-gap: calc(var(--qr) * 0.06);
  width: calc(var(--qr) + 2 * var(--qr-pad) + 2 * var(--card-pad));
  padding: var(--card-pad);
  border-radius: calc(var(--qr) * 0.1);
  background: rgb(var(--event-deep-rgb) / 0.84); /* lanterns drift behind it: keep the text crisp */
  box-shadow: inset 0 0 0 1px rgb(var(--event-gold-rgb) / 0.5), 0 3vh 6vh -3vh rgba(0, 0, 0, 0.85);
  text-align: center;
  pointer-events: none; /* taps still reach the tree */
  transition: opacity 0.6s ease, visibility 0s linear 0s;
  animation: qr-invite-in 1s ease 0.6s backwards;
}

/* Inner hairline: the same double gold border as the wish plaque */
.qr-invite::before {
  content: '';
  position: absolute;
  inset: calc(var(--qr) * 0.018);
  border: 1px solid rgb(var(--event-gold-rgb) / 0.2);
  border-radius: calc(var(--qr) * 0.085);
}

.qr-invite.is-off,
.is-story-open .qr-invite {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}

.qr-invite p { margin: 0; }

.qr-invite__heading {
  grid-area: heading;
  font-family: var(--heading-font, 'Cormorant Garamond', Georgia, serif);
  font-weight: 700;
  font-size: max(15px, calc(var(--qr) * 0.13));
  line-height: 1.12;
  color: var(--title-color, #ebcb88);
  text-shadow: var(--title-shadow, none);
  text-wrap: balance;
}

/* Black modules on white with their own quiet zone: scans from the back row of a projected room */
.qr-invite__code {
  grid-area: code;
  padding: var(--qr-pad);
  border-radius: calc(var(--qr) * 0.06);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgb(var(--event-gold-rgb) / 0.65), 0 0 calc(var(--qr) * 0.16) rgb(var(--event-gold-rgb) / 0.22);
}

.qr-invite__code img { display: block; width: var(--qr); height: var(--qr); }

.qr-invite__address {
  grid-area: address;
  font-weight: 600;
  font-size: max(12px, calc(var(--qr) * 0.095));
  line-height: 1.2;
  letter-spacing: 0.03em;
  color: var(--ink, #f1e3c2);
  white-space: nowrap;
}

@keyframes qr-invite-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Toggle: a corner chip under the music button ---------- */
.qr-toggle { top: calc(var(--safe-top, 0px) + 62px); }
.qr-toggle[aria-pressed='true'] { box-shadow: inset 0 0 0 1px var(--accent, #d9b56e), 0 8px 18px -12px rgba(0, 0, 0, 0.5); }
.qr-toggle__slash { display: none; }
.story-chip { top: calc(var(--safe-top, 0px) + 110px); } /* under the QR toggle */
.qr-toggle[aria-pressed='false'] .qr-toggle__slash { display: inline; }

/* ---------- Portrait: compact strip above the plaque (34px + ~70px) and its status note ---------- */
@media (max-aspect-ratio: 9/10) {
  .qr-invite {
    --qr: min(12vh, 24vw);
    right: 0;
    left: 0;
    bottom: calc(var(--safe-bottom, 0px) + 154px);
    grid-template-areas: 'code heading' 'code address';
    grid-template-columns: auto auto;
    justify-items: start;
    column-gap: calc(var(--qr) * 0.14);
    row-gap: calc(var(--qr) * 0.05);
    width: fit-content;
    max-width: calc(100% - 28px);
    margin: 0 auto;
    text-align: left;
  }

  .qr-invite__heading { align-self: end; max-width: 10em; font-size: max(15px, calc(var(--qr) * 0.16)); }
  .qr-invite__address { align-self: start; font-size: max(12px, calc(var(--qr) * 0.11)); }
}

@media (prefers-reduced-motion: reduce) {
  .qr-invite { animation: none; transition-duration: 0.01s; }
}

/* The QR card moves the tree: dip the scene while it is laid out again (see moon-page-entry.js) */
.stage.is-reframing .stage__layer { opacity: 0.12; transition-duration: 0.3s; }

/* Nobody writes on the projector — guests write on their phones (the QR card invites them). The
   panel keeps its place, so the tree stands exactly where it does on the home page. */
.is-big-screen .wish-panel { visibility: hidden; }

/* Guests' phones are silent (only the big screen plays music): no music button there, from first paint.
   Nor a way off to the older versions (one of them plays music, and it is not the shared live tree). */
body:not(.is-big-screen) :is(.sound-toggle, [data-versions-link]) { display: none; }

/* The projector is read from across the room: the credit grows with the screen (about twice the phone
   size on a 1080p projector) and sits clear of the bottom edge, where the guest panel would be */
.is-big-screen .credit {
  bottom: calc(var(--safe-bottom) + 3vh);
  gap: 0.9vh;
  font-size: clamp(10px, 1.7vh, 26px);
}
.is-big-screen .credit__logo {
  height: clamp(12px, 2.4vh, 36px);
  padding: 0.35vh 1vh;
}
