/* ============================================================
   PORTAL SCENE — design sandbox
   Stage = viewport. Two videos crossfade between each other so
   the loop point is invisible. Decorative particles drift on top
   to keep the scene feeling alive.
   ============================================================ */

/* ---------- Non Bureau font family (same as apps/web landing) ---------- */
@font-face {
  font-family: 'Non Bureau';
  src: url('assets/fonts/NonBureau-Light.woff2')    format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Non Bureau';
  src: url('assets/fonts/NonBureau-Regular.woff2')  format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Non Bureau';
  src: url('assets/fonts/NonBureau-Medium.woff2')   format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Non Bureau';
  src: url('assets/fonts/NonBureau-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Non Bureau';
  src: url('assets/fonts/NonBureau-Bold.woff2')     format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg-deep:           #05020B;

  /* Where the portal sits in the source video frame. */
  --portal-cx:         50%;
  --portal-cy:         85%;

  --ship-pct:          5.5%;
  --ship-min:          38px;
  --ship-max:          110px;

  --crossfade-duration: 0.6s;

  --ease-soft:         cubic-bezier(.45, .05, .55, .95);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Scene container ---------- */
.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg-deep);
  isolation: isolate;
}

/* ---------- Stage = viewport ---------- */
.scene__stage {
  position: absolute;
  inset: 0;
  will-change: transform;
}

/* ---------- Two videos, A on top initially, B hidden ---------- */
.scene__video {
  position: absolute;
  inset: 0;
  width:  100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  pointer-events: none;
  transition: opacity var(--crossfade-duration) linear;
}
.scene__video--a { opacity: 1; z-index: 1; }
.scene__video--b { opacity: 0; z-index: 1; }

/* ---------- Particles ---------- */
.scene__particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.particle {
  position: absolute;
  left: var(--p-left);
  top:  var(--p-top);
  width:  var(--p-size, 2px);
  height: var(--p-size, 2px);
  background: #C084FC;
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 4px 1px rgba(192, 132, 252, 0.55);
  animation: particle-drift var(--p-dur) linear var(--p-delay) infinite;
}

@keyframes particle-drift {
  0%   { transform: translate(0, 0)        scale(0.5); opacity: 0;   }
  10%  {                                                opacity: 0.85; }
  50%  { transform: translate(-14px, -50px) scale(1);                 }
  90%  {                                                opacity: 0.85; }
  100% { transform: translate(-28px, -110px) scale(0.4); opacity: 0;  }
}

/* ---------- Ship ---------- */
.scene__ship {
  position: absolute;
  left: var(--portal-cx);
  top:  var(--portal-cy);
  width:     var(--ship-pct);
  min-width: var(--ship-min);
  max-width: var(--ship-max);
  transform: translate(-50%, -50%);
  will-change: transform;
  z-index: 4;
}

.scene__ship picture,
.scene__ship img {
  display: block;
  width: 100%;
  height: auto;
}

.scene__ship img {
  filter: drop-shadow(0 4px 20px rgba(168, 85, 247, 0.55));
  animation:
    ship-float 3.6s var(--ease-soft) infinite,
    ship-glow  2.8s var(--ease-soft) infinite;
}

@keyframes ship-float {
  0%, 100% { transform: translateY(0)    rotate(-0.6deg); }
  50%      { transform: translateY(-7px) rotate( 0.6deg); }
}

@keyframes ship-glow {
  0%, 100% { filter: drop-shadow(0 4px 16px rgba(168, 85, 247, 0.45)); }
  50%      { filter: drop-shadow(0 6px 24px rgba(192, 132, 252, 0.70)); }
}

/* ---------- Vignette overlay ---------- */
.scene__overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(5, 2, 11, 0.45) 100%),
    linear-gradient(to bottom, rgba(5, 2, 11, 0.30) 0%, transparent 18%, transparent 82%, rgba(5, 2, 11, 0.45) 100%);
}

/* ---------- JS-controlled layers (mouse parallax) ---------- */
[data-layer] {
  transition: transform 0.6s var(--ease-soft);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1199px) {
  :root {
    --ship-pct: 6.5%;
    --ship-min: 36px;
    --ship-max: 90px;
  }
}

@media (max-width: 640px) {
  :root {
    --ship-pct: 8%;
    --ship-min: 32px;
    --ship-max: 64px;
  }
}

@media (min-aspect-ratio: 2/1) {
  .scene__video {
    object-position: center 80%;
  }
  :root {
    --portal-cy: 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene__ship img,
  .particle {
    animation: none;
  }
}

/* ============================================================
   HERO COPY — title + subtitle (Non Bureau, gradient text)
   Matches the apps/web Hero exactly: same font, same vertical
   gradient stops, same clamp-based responsive font-sizing.
   Sits above the ship/portal, centered horizontally near the top.
   ============================================================ */
.scene__hero {
  position: absolute;
  left: 50%;
  /* Base offset 6% + a fixed 10px nudge — designer wanted the whole hero
     copy a touch lower on every device. Per-breakpoint overrides below
     each carry their own `+ 10px` so the shift is uniform 320px → 4K. */
  top: calc(6% + 10px);
  transform: translateX(-50%);
  z-index: 5;
  text-align: center;
  pointer-events: none;
  width: 92%;
  max-width: 1200px;
}
.scene__title {
  font-family: 'Non Bureau', sans-serif;
  font-weight: 500;
  font-size: clamp(64px, 11vw, 160px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  background: linear-gradient(180deg,
    #FDE5FF 30%,
    #FBFBFB 53.97%,
    #B2B2B2 67.01%,
    rgba(178, 178, 178, 0.71) 74.98%,
    rgba(178, 178, 178, 0.14) 81.86%,
    rgba(178, 178, 178, 0)    89.82%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
}
.scene__subtitle {
  margin: -28px auto 0;
  font-family: 'Non Bureau', sans-serif;
  font-weight: 400;
  font-size: clamp(18px, 1.9vw, 28px);
  line-height: 1.25;
  background: linear-gradient(180deg, #FFFFFF 40.86%, #999999 79.07%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
  opacity: 0.8;
}

/* ============================================================
   PANEL — wallet input + photo upload
   Glassmorphism card centered between hero and ship. Submits to
   ../scene-2/?wallet=… on enter or button click.
   The hint sits just above the panel and tells the user what to drop.
   ============================================================ */
.scene__panel-hint {
  position: absolute;
  left: 50%;
  top: 41%;
  transform: translate(-50%, -50%);
  z-index: 6;
  margin: 0;
  padding: 0 12px;
  text-align: center;
  font-family: 'Non Bureau', sans-serif;
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.scene__panel {
  position: absolute;
  left: 50%;
  top: 49%;
  transform: translate(-50%, -50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(13, 6, 28, 0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(192, 132, 252, 0.22);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 60px rgba(174, 0, 255, 0.12);
  font-family: 'Non Bureau', sans-serif;
  width: min(560px, 90vw);
  pointer-events: auto;
}

/* ---------- Photo slot ---------- */
.scene__avatar-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.scene__avatar-input { display: none; }
.scene__avatar-preview {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  background-size: cover;
  background-position: center;
  transition: border-color 0.2s, background-color 0.2s;
}
.scene__avatar-preview[data-loaded="1"] { border: 1px solid rgba(192, 132, 252, 0.5); }
.scene__avatar-preview[data-loaded="1"] svg { display: none; }
.scene__avatar-slot:hover .scene__avatar-preview { border-color: rgba(192, 132, 252, 0.55); background-color: rgba(192, 132, 252, 0.06); }
.scene__avatar-label {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.02em;
}

/* ---------- Wallet field ---------- */
.scene__field {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.scene__wallet-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-family: 'Non Bureau', sans-serif;
  font-size: 15px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}
.scene__wallet-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 300;
}
.scene__wallet-input:hover { background: rgba(255, 255, 255, 0.06); }
.scene__wallet-input:focus { border-color: rgba(192, 132, 252, 0.55); background: rgba(192, 132, 252, 0.06); }
.scene__wallet-input[data-error="1"] { border-color: rgba(255, 80, 100, 0.6); }
.scene__field-error {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 100, 120, 0.85);
  padding-left: 4px;
}

/* Photo preprocessor error — sits below the panel, only shown when an
   unsupported format was uploaded or decoding failed. */
.scene__photo-error {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(120, 0, 24, 0.4);
  border: 1px solid rgba(255, 100, 120, 0.45);
  font-family: 'Non Bureau', sans-serif;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: rgba(255, 200, 210, 0.95);
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

/* ---------- Submit button (image-based, matches apps/web Hero) ---------- */
.scene__submit {
  position: relative;
  flex-shrink: 0;
  width: 168px;
  height: 50px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: filter 0.25s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.scene__submit:hover { filter: brightness(1.12); }
.scene__submit:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }
.scene__submit-bloom {
  position: absolute;
  left: 50%;
  top: -26px;
  transform: translateX(-50%);
  width: 200px;
  height: 84px;
  pointer-events: none;
  user-select: none;
}
.scene__submit-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.scene__submit-text {
  position: relative;
  z-index: 1;
  font-family: 'Non Bureau', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 19px;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #E6BAFF 23.68%, #FFFFFF 43.78%, #999999 105.26%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
}

/* ============================================================
   RESPONSIVE  — hero + panel adapt across all viewports
   The hero stays centered up top; on narrow widths it ungroups
   from the panel so the subtitle never collides with the title
   bottom edge or the panel top edge.
   ============================================================ */

/* Tablet portrait (≤900px) */
@media (max-width: 900px) {
  /* Mobile: hero gets a bigger 30px nudge (was 10px on desktop). The
     panel-hint above the wallet box gets pulled UP 10px so it stays in the
     viewport above the keyboard / panel on small screens. */
  .scene__hero { top: calc(4% + 100px); max-width: 96%; }
  .scene__title { font-size: clamp(50px, 12vw, 110px); line-height: 1.0; }
  .scene__subtitle { font-size: clamp(16px, 2.6vw, 22px); margin-top: -16px; }
  .scene__panel-hint { top: calc(43% - 10px); font-size: 13px; }
  .scene__panel { top: 51%; padding: 12px 14px; gap: 12px; width: min(520px, 92vw); }
}

/* Phone landscape / small tablets (≤700px) */
@media (max-width: 700px) {
  .scene__hero { top: calc(3% + 100px); }
  .scene__title { font-size: clamp(44px, 13vw, 80px); }
  .scene__subtitle { font-size: clamp(14px, 3.2vw, 18px); margin-top: -10px; }
  .scene__panel-hint { top: calc(44% - 10px); font-size: 12px; white-space: normal; max-width: 88vw; }
  .scene__photo-error { top: 64%; max-width: 92vw; white-space: normal; text-align: center; }
  .scene__panel {
    flex-wrap: wrap;
    justify-content: center;
    top: 53%;
    padding: 12px;
    gap: 10px;
  }
  .scene__field { flex-basis: 100%; order: 2; }
  .scene__avatar-slot { order: 1; }
  .scene__submit { order: 3; flex: 1 1 auto; }
}

/* Phone portrait (≤480px) */
@media (max-width: 480px) {
  .scene__hero { top: calc(2% + 100px); }
  .scene__title { font-size: clamp(36px, 14vw, 60px); }
  .scene__subtitle { font-size: clamp(13px, 3.6vw, 16px); margin-top: -8px; padding: 0 8px; }
  .scene__panel-hint { top: calc(42% - 10px); font-size: 11px; letter-spacing: 0.05em; }
  .scene__panel { top: 52%; width: 92vw; padding: 10px; gap: 8px; border-radius: 18px; }
  .scene__avatar-preview { width: 48px; height: 48px; }
  .scene__wallet-input { height: 40px; font-size: 14px; }
  .scene__submit { width: 124px; height: 40px; }
  .scene__submit-text { font-size: 13px; }
  .scene__submit-bloom { width: 156px; height: 64px; top: -20px; }
}

/* Very short (landscape phone) — pull hero up + panel up */
@media (max-height: 600px) {
  .scene__hero { top: calc(2% + 100px); }
  .scene__title { font-size: clamp(34px, 8vh, 70px); }
  .scene__subtitle { font-size: clamp(13px, 2.5vh, 17px); margin-top: -8px; }
  .scene__panel-hint { top: calc(50% - 10px); }
  .scene__panel { top: 58%; }
}
