/* Client Portal sign-in scene (2026-11-03). Loaded only by portal/index.html, after css/falmera-portal-auth.css.
   An open door on the travertine terrace (assets/img/portal/door-*) sits behind the sign-in card while body.is-auth
   is set by js/portal.mjs. It never touches the forms: only the frame's placement and a sheen on the Login button.

   The picture lives in .fm-pa-art, a 16:9 box sized like object-fit: cover (container units of .fm-pa-scene), so the
   light layers can be pinned to the door in picture coordinates at every width.
   Phones and tablets: the picture is a band under the header and the card rises over its foot.
   1100px and up: the picture fills the screen; the welcome copy sits in the sky at the left, the door glows in the
   middle and the navy panel floats at the right.
   Motion (all widths, phones included): the picture settles in and breathes, light pulses in the doorway and on the
   steps, motes drift up through the light, the card and copy rise in, and a sheen crosses the Login button.
   Reduced motion: the finished still, no motes. */

.fm-pa-scene { display: none; }

.fm-pa-page.is-auth .fm-portal {
  --pa-band: clamp(19rem, 56svh, 32rem);
  position: relative; isolation: isolate; overflow: clip;
  margin-top: calc(-1 * var(--fm-header-h));
  padding-top: calc(var(--pa-band) - 7.5rem);
  background: linear-gradient(180deg, transparent 0, var(--fm-cream) calc(var(--pa-band) - 2rem));
}
.fm-pa-page.is-auth .fm-pa-scene {
  display: block; position: absolute; inset: 0 0 auto 0; z-index: -1;
  height: var(--pa-band); overflow: hidden; container-type: size; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
}
.fm-pa-art {
  position: absolute; left: 50%; top: 50%;
  width: max(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
}
.fm-pa-art__move { position: absolute; inset: 0; transform-origin: 51% 50%; }
.fm-pa-art img { display: block; width: 100%; height: 100%; }

/* Light pinned to the doorway (picture coordinates: opening 43% to 57% across, 20% to 71% down). */
.fm-pa-art__move > span { position: absolute; pointer-events: none; }
.fm-pa-glow {
  left: 41%; top: 16%; width: 20%; height: 62%; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 226 170 / 0.75), rgb(255 200 140 / 0.28) 55%, transparent);
  mix-blend-mode: screen; opacity: 0.6;
}
.fm-pa-slit {
  left: 50.6%; top: 23%; width: 0.7%; height: 47%; border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgb(255 248 225 / 0.95) 20%, rgb(255 248 225 / 0.95) 80%, transparent);
  filter: blur(2px); mix-blend-mode: screen; opacity: 0.55;
}
.fm-pa-spill {
  left: 36%; top: 70%; width: 28%; height: 28%; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 222 170 / 0.6), transparent);
  mix-blend-mode: screen; opacity: 0.5;
}
.fm-pa-motes { left: 42%; top: 24%; width: 18%; height: 56%; container-type: size; display: none; }
.fm-pa-motes i {
  position: absolute; bottom: 0; width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(circle, #FFF7E6 0, rgb(255 230 180 / 0.6) 45%, transparent 70%);
  opacity: 0;
}
.fm-pa-motes i:nth-child(1) { left: 12%; } .fm-pa-motes i:nth-child(2) { left: 28%; width: 4px; height: 4px; }
.fm-pa-motes i:nth-child(3) { left: 44%; } .fm-pa-motes i:nth-child(4) { left: 58%; width: 6px; height: 6px; }
.fm-pa-motes i:nth-child(5) { left: 70%; width: 4px; height: 4px; } .fm-pa-motes i:nth-child(6) { left: 84%; }
.fm-pa-motes i:nth-child(7) { left: 36%; width: 3px; height: 3px; } .fm-pa-motes i:nth-child(8) { left: 64%; width: 3px; height: 3px; }
.fm-pa-motes i:nth-child(9) { left: 50%; width: 4px; height: 4px; }

.fm-pa-page.is-auth .fm-auth__frame { position: relative; }
/* Until js/portal.mjs reveals the card, hold the section open so the footer stays below the fold and does not jump. */
.fm-pa-page.is-auth .fm-portal:has(#view-sign-in[hidden]) { min-height: 100svh; }

/* 900 to 1099px: the two-column frame floats over the full scene. */
@media (min-width: 900px) {
  .fm-pa-page.is-auth .fm-portal {
    min-height: 100svh; display: grid; align-content: center;
    padding-block: calc(var(--fm-header-h) + clamp(2rem, 1rem + 2vw, 3.5rem)) clamp(2.5rem, 1.5rem + 2vw, 4rem);
    background: var(--fm-cream);
  }
  .fm-pa-page.is-auth .fm-pa-scene { inset: 0; height: auto; -webkit-mask-image: none; mask-image: none; }
  .fm-pa-page.is-auth .fm-auth__frame { box-shadow: 0 1px 0 rgb(255 255 255 / 0.9) inset, 0 40px 90px -30px rgb(var(--fm-navy-rgb) / 0.45), 0 12px 28px -14px rgb(var(--fm-navy-rgb) / 0.22); }
}

/* 1100px and up: copy in the sky, the door in the middle, the panel at the right. */
@media (min-width: 1100px) {
  .fm-pa-page.is-auth .fm-pa-scene::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgb(252 246 242 / 0.86) 0%, rgb(252 246 242 / 0.62) 24%, rgb(252 246 242 / 0) 40%);
  }
  .fm-pa-page.is-auth .fm-auth__frame {
    width: 100%; padding: 0; border-radius: 0; background: none; box-shadow: none;
    grid-template-columns: minmax(0, 1fr) minmax(0, 27rem);
  }
  .fm-pa-page.is-auth .fm-auth__cap { padding: 0; align-self: center; }
  .fm-pa-page.is-auth .fm-auth__cap > * { max-width: 23rem; }
  .fm-pa-page.is-auth .fm-auth__title { text-shadow: 0 1px 24px rgb(252 246 242 / 0.8); }
  .fm-pa-page.is-auth .fm-auth__perks { margin-top: 2rem; padding: 1.25rem 1.35rem; border-radius: 24px; background: rgb(252 246 242 / 0.62); border: 1px solid rgb(255 255 255 / 0.7); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  .fm-pa-page.is-auth .fm-auth__foot { padding: 1.5rem 0 0; }
  .fm-pa-page.is-auth .fm-auth__panel {
    min-height: 36rem;
    box-shadow: 0 1px 0 rgb(255 255 255 / 0.12) inset, 0 44px 100px -34px rgb(var(--fm-navy-rgb) / 0.7), 0 14px 30px -16px rgb(var(--fm-navy-rgb) / 0.4);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .fm-pa-page.is-auth .fm-pa-art__move { animation: fm-pa-settle 1800ms var(--fm-ease) both, fm-pa-breathe 18s ease-in-out 1800ms infinite alternate; }
  .fm-pa-page.is-auth .fm-pa-glow { animation: fm-pa-pulse 5.5s ease-in-out infinite alternate; }
  .fm-pa-page.is-auth .fm-pa-spill { animation: fm-pa-pulse 5.5s ease-in-out 600ms infinite alternate; }
  .fm-pa-page.is-auth .fm-pa-slit { animation: fm-pa-flicker 3.4s ease-in-out infinite alternate; }
  .fm-pa-page.is-auth .fm-pa-motes { display: block; }
  .fm-pa-page.is-auth .fm-pa-motes i { animation: fm-pa-mote 9s linear infinite; }
  .fm-pa-motes i:nth-child(2) { animation-duration: 11s !important; animation-delay: -3s !important; }
  .fm-pa-motes i:nth-child(3) { animation-duration: 8s !important; animation-delay: -5s !important; }
  .fm-pa-motes i:nth-child(4) { animation-duration: 12s !important; animation-delay: -1s !important; }
  .fm-pa-motes i:nth-child(5) { animation-duration: 10s !important; animation-delay: -7s !important; }
  .fm-pa-motes i:nth-child(6) { animation-duration: 9.5s !important; animation-delay: -4s !important; }
  .fm-pa-motes i:nth-child(7) { animation-duration: 13s !important; animation-delay: -9s !important; }
  .fm-pa-motes i:nth-child(8) { animation-duration: 8.5s !important; animation-delay: -2s !important; }
  .fm-pa-motes i:nth-child(9) { animation-duration: 11.5s !important; animation-delay: -6s !important; }

  .fm-pa-page.is-auth .fm-auth__frame { animation: fm-auth-in 900ms var(--fm-ease) 300ms both; }
  .fm-pa-page.is-auth .fm-auth__cap > * { animation: fm-pa-rise 800ms var(--fm-ease) both; }
  .fm-pa-page.is-auth .fm-auth__cap > :nth-child(1) { animation-delay: 500ms; }
  .fm-pa-page.is-auth .fm-auth__cap > :nth-child(2) { animation-delay: 600ms; }
  .fm-pa-page.is-auth .fm-auth__cap > :nth-child(3) { animation-delay: 700ms; }
  .fm-pa-page.is-auth .fm-auth__cap > :nth-child(4) { animation-delay: 820ms; }

  .fm-pa-page.is-auth .fm-auth__submit { position: relative; overflow: hidden; isolation: isolate; }
  .fm-pa-page.is-auth .fm-auth__submit::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / 0.38) 50%, transparent 70%);
    transform: translateX(-120%); animation: fm-pa-sheen 6s ease-in-out 2.2s infinite;
  }
}

@keyframes fm-pa-settle { from { opacity: 0.35; transform: scale(1.09); } to { opacity: 1; transform: none; } }
@keyframes fm-pa-breathe { from { transform: none; } to { transform: scale(1.045) translate(-0.5%, -0.4%); } }
@keyframes fm-pa-pulse { from { opacity: 0.35; transform: scale(0.96); } to { opacity: 0.95; transform: scale(1.04); } }
@keyframes fm-pa-flicker { 0% { opacity: 0.4; } 45% { opacity: 0.9; } 60% { opacity: 0.7; } 100% { opacity: 1; } }
@keyframes fm-pa-mote {
  0% { opacity: 0; transform: translate(0, 0); }
  15% { opacity: 0.95; }
  50% { transform: translate(6cqw, -50cqh); }
  85% { opacity: 0.7; }
  100% { opacity: 0; transform: translate(-4cqw, -100cqh); }
}
@keyframes fm-pa-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fm-pa-sheen { 0% { transform: translateX(-120%); } 22%, 100% { transform: translateX(120%); } }
