/* ===========================================================
   Brand assets — 「お絵描き水族館」 loading banner + メル mascot.
   Used by: the shared loading overlay (scripts/loadingOverlay.js),
   the #loading element in the reveal view, the landing hero, and
   the reveal-scene backdrop.
   =========================================================== */

/* ---- Full-screen branded loading overlay -------------------------------
   Also applied to the reveal view's #loading (.ar__loading) so every wait
   state in the app shows the same art. The banner is a 4:3 card letterboxed
   on an ocean gradient; width is capped against BOTH the viewport width and
   height so it never overflows on landscape/short screens. */
.brand-loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: 32px;
  text-align: center;
  color: #fff;
  font-family: system-ui, sans-serif;
  background: linear-gradient(180deg, #2a86c8 0%, #0a3d62 78%, #072a44 100%);
  opacity: 1;
  transition: opacity 0.35s ease-out;
}

.brand-loading__banner {
  width: min(92vw, 480px, calc((100vh - 220px) * 4 / 3));
  min-width: 240px;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 4px rgba(255, 255, 255, 0.16);
  animation: brand-float 3.6s ease-in-out infinite;
}

.brand-loading__msg {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
}

.brand-loading__sub {
  margin: 0;
  font-size: 13px;
  opacity: 0.72;
  max-width: 300px;
  line-height: 1.5;
}

/* Three bouncing bubbles — the live "still working" cue (the progress bar
   inside the banner art is static decoration). */
.brand-loading__dots {
  display: flex;
  gap: 9px;
}
.brand-loading__dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  animation: brand-dot 1.15s ease-in-out infinite;
}
.brand-loading__dots span:nth-child(2) { animation-delay: 0.18s; }
.brand-loading__dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes brand-dot {
  0%, 100% { transform: translateY(0);    opacity: 0.55; }
  40%      { transform: translateY(-9px); opacity: 1; }
}

@keyframes brand-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* The reveal view's #loading reuses the same look (markup lives in
   index.html). Keep the element's own layout rules from ar.css working —
   we only restyle background + children here. */
.ar__loading.brand-loading { z-index: 20; }

/* ---- メル mascot ------------------------------------------------------- */

/* Landing hero: mascot replaces the fish-emoji logo. Reuses the hero float
   animation via .landing__logo on the wrapper. */
.landing__logo-img {
  width: clamp(88px, 26vw, 140px);
  height: auto;
  /* No outline / no shadow by client preference — a drop-shadow on the navy
     body smudges into the blue gradient and reads as a dirty halo. */
}

/* Reveal-scene backdrop: メル peeks from the lower-left, part of the painted
   background (z-index 0 layer, BEHIND the WebGL fish canvas). Sits above the
   mute button's corner so UI never overlaps it. */
.ar-scene-bg__mascot {
  position: absolute;
  left: max(env(safe-area-inset-left, 0), 10px);
  bottom: calc(max(env(safe-area-inset-bottom, 0), 28px) + 74px);
  width: clamp(60px, 13vmin, 104px);
  height: auto;
  opacity: 0.94;
  transform: rotate(-4deg);
  animation: brand-mascot-bob 4.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes brand-mascot-bob {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50%      { transform: rotate(-2deg) translateY(-7px); }
}

@media (prefers-reduced-motion: reduce) {
  .brand-loading__banner,
  .brand-loading__dots span,
  .ar-scene-bg__mascot { animation: none; }
}

/* ---- Portrait-only guard (QA bug #5) -----------------------------------
   Landing + scan assume a portrait phone; in landscape the CTA falls below
   the fold and the scan frame breaks. Shown via pure CSS only on SHORT
   landscape viewports (phones rotated) — desktop landscape windows are tall
   enough to escape the max-height cut. The reveal aquarium has no prompt:
   it genuinely supports landscape. */
.rotate-prompt {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(180deg, #2a86c8 0%, #0a3d62 100%);
  color: #fff;
  text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.6;
}
.rotate-prompt p { margin: 0; }
.rotate-prompt__icon {
  font-size: 56px;
  transform: rotate(90deg);
  animation: rotate-hint 1.8s ease-in-out infinite;
}
@keyframes rotate-hint {
  0%, 25%, 100% { transform: rotate(90deg); }
  55%, 75%      { transform: rotate(0deg); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .rotate-prompt { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  .rotate-prompt__icon { animation: none; }
}
