/* ==========================================================
   hadir. — Phase G1 Guest App Design Foundation
   Release: 6.19.1-phase-g1-1-splash-motion-identity-v1

   Scope:
   - Guest-only visual tokens and component primitives.
   - Bright Gen Z premium splash treatment.
   - Shared accessibility, motion, and safe-area foundations.

   Protected:
   - Camera acquisition and lifecycle.
   - Film Engine and FXN R 1 / FXN R 2.
   - Upload queue, IndexedDB, Supabase, and gallery data logic.
========================================================== */

:root {
  /* Guest brand colors */
  --guest-canvas: #faf9ff;
  --guest-canvas-tint: #f5f2ff;
  --guest-surface: #ffffff;
  --guest-surface-soft: #f1edff;
  --guest-surface-muted: #f7f5fc;
  --guest-ink: #17151f;
  --guest-ink-soft: #403c4c;
  --guest-muted: #777283;
  --guest-line: #ddd8ed;
  --guest-line-strong: #c8c0e3;
  --guest-primary: #6c4cff;
  --guest-primary-strong: #5935f5;
  --guest-primary-soft: #ede8ff;
  --guest-coral: #ff727d;
  --guest-success: #20b7a3;
  --guest-success-soft: #dcf7f1;
  --guest-danger: #e95363;
  --guest-camera: #0c0d12;
  --guest-camera-raised: #161820;

  /* Guest typography */
  --guest-font-brand: "Manrope", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --guest-font-ui: "Manrope", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --guest-text-xs: 0.6875rem;
  --guest-text-sm: 0.8125rem;
  --guest-text-md: 0.9375rem;
  --guest-text-lg: 1.125rem;
  --guest-text-xl: clamp(1.75rem, 8vw, 2.35rem);

  /* Guest geometry */
  --guest-radius-xs: 10px;
  --guest-radius-sm: 14px;
  --guest-radius-md: 18px;
  --guest-radius-lg: 24px;
  --guest-radius-pill: 999px;
  --guest-space-1: 4px;
  --guest-space-2: 8px;
  --guest-space-3: 12px;
  --guest-space-4: 16px;
  --guest-space-5: 20px;
  --guest-space-6: 24px;
  --guest-space-8: 32px;
  --guest-space-10: 40px;

  /* Guest elevation and motion */
  --guest-shadow-soft: 0 10px 30px rgba(62, 46, 115, 0.08);
  --guest-shadow-float: 0 18px 44px rgba(62, 46, 115, 0.13);
  --guest-focus-ring: 0 0 0 4px rgba(108, 76, 255, 0.2);
  --guest-ease-out: cubic-bezier(.22, 1, .36, 1);
  --guest-motion-fast: 160ms;
  --guest-motion-base: 260ms;
}

/* Canonical primitives for Phase G2–G4. They are intentionally opt-in. */
.hadir-ui-button {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--guest-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font: 700 var(--guest-text-sm)/1 var(--guest-font-ui);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition:
    transform var(--guest-motion-fast) var(--guest-ease-out),
    background-color var(--guest-motion-fast) ease,
    border-color var(--guest-motion-fast) ease,
    box-shadow var(--guest-motion-fast) ease;
}

.hadir-ui-button:active { transform: scale(.985); }
.hadir-ui-button-primary {
  background: linear-gradient(135deg, var(--guest-primary), var(--guest-primary-strong));
  color: #fff;
  box-shadow: 0 10px 26px rgba(89, 53, 245, .22);
}
.hadir-ui-button-secondary {
  border-color: var(--guest-line);
  background: rgba(255, 255, 255, .78);
  color: var(--guest-ink);
}

.hadir-ui-field {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--guest-line);
  border-radius: var(--guest-radius-sm);
  background: rgba(255, 255, 255, .86);
  color: var(--guest-ink);
  font: 600 var(--guest-text-md)/1.4 var(--guest-font-ui);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .88);
  transition: border-color var(--guest-motion-fast) ease, box-shadow var(--guest-motion-fast) ease;
}

.hadir-ui-card {
  border: 1px solid rgba(202, 194, 227, .68);
  border-radius: var(--guest-radius-lg);
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--guest-shadow-soft);
}

.hadir-ui-pill {
  min-height: 30px;
  padding: 0 11px;
  border-radius: var(--guest-radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--guest-primary-soft);
  color: var(--guest-primary-strong);
  font: 750 var(--guest-text-xs)/1 var(--guest-font-ui);
}

.hadir-ui-status-success {
  background: var(--guest-success-soft);
  color: #087f71;
}

/* Shared Guest focus treatment. No layout or behavior is changed. */
body > :is(#welcome-screen, #loading-screen, #event-ended-screen, #camera-view, #gallery-view) {
  font-family: var(--guest-font-ui);
}

body > :is(#welcome-screen, #loading-screen, #event-ended-screen, #camera-view, #gallery-view)
:is(button, input, textarea, select, [role="button"], [tabindex]):focus-visible,
.hadir-ui-button:focus-visible,
.hadir-ui-field:focus-visible {
  outline: 2px solid var(--guest-primary);
  outline-offset: 3px;
  box-shadow: var(--guest-focus-ring);
}

/* ==========================================================
   Phase G1.1 — Splash Motion Identity
   Locked copy:
   “dari mata mereka yang hadir”
   “powered by hadir.”

   Motion principles:
   - Ambient movement is transform-only.
   - Blur is applied to decorative gradient layers, not page content.
   - Text reveals left-to-right with one soft light sweep.
   - Reduced-motion and forced-colors remain supported.
========================================================== */
#splash-screen {
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(145deg, #ffffff 0%, #fbf9ff 40%, #f1ebff 100%);
  color: var(--guest-ink);
  font-family: var(--guest-font-ui);
  opacity: 1;
  transition: opacity 680ms var(--guest-ease-out), visibility 680ms linear;
  contain: paint;
}

#splash-screen.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Moving, softly blurred ambient light. */
#splash-screen::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: -24%;
  background:
    radial-gradient(circle at 20% 24%, rgba(255, 255, 255, .98) 0 8%, rgba(231, 222, 255, .88) 24%, transparent 45%),
    radial-gradient(circle at 82% 28%, rgba(200, 183, 255, .70), transparent 36%),
    radial-gradient(circle at 34% 84%, rgba(241, 225, 255, .84), transparent 40%),
    radial-gradient(circle at 72% 78%, rgba(255, 255, 255, .76), transparent 34%);
  filter: blur(38px) saturate(108%);
  transform: translate3d(-1.5%, -1%, 0) scale(1.06) rotate(-1deg);
  transform-origin: 50% 50%;
  will-change: transform;
  animation: g11AmbientDrift 18s cubic-bezier(.45, 0, .2, 1) infinite alternate;
  pointer-events: none;
}

/* A second translucent light field adds depth without backdrop-filter. */
#splash-screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -12%;
  background:
    linear-gradient(118deg, transparent 24%, rgba(255, 255, 255, .68) 44%, rgba(211, 197, 255, .30) 55%, transparent 72%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, .32), transparent 58%);
  filter: blur(22px);
  opacity: .82;
  transform: translate3d(-7%, 2%, 0) scale(1.05);
  will-change: transform;
  animation: g11AmbientSheen 13s ease-in-out infinite alternate;
  pointer-events: none;
}

#splash-screen .splash-content {
  position: relative;
  z-index: 2;
  width: min(90vw, 360px);
  padding: 0 22px;
  display: block;
  text-align: center;
  transform: translateY(-7px);
  animation: g11ContentSettle 900ms cubic-bezier(.22, 1, .36, 1) both;
}

.splash-brand-line {
  position: relative;
  isolation: isolate;
  margin: 0;
  color: #282331;
  font-family: var(--guest-font-brand);
  font-size: clamp(11.5px, 3.15vw, 13.5px);
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: -0.015em;
  text-wrap: balance;
  text-shadow: none;
}

.splash-brand-line .brand-reveal {
  display: block;
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  background:
    linear-gradient(100deg,
      #282331 0%,
      #282331 37%,
      #7658ff 46%,
      #ffffff 50%,
      #7658ff 54%,
      #282331 63%,
      #282331 100%);
  background-size: 260% 100%;
  background-position: 118% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transform: translate3d(-5px, 0, 0);
  will-change: clip-path, opacity, transform, background-position;
  animation:
    g11TextReveal 1.15s cubic-bezier(.22, 1, .36, 1) .35s forwards,
    g11TextHighlight 1.55s cubic-bezier(.3, .7, .2, 1) .58s forwards;
}

/* Soft “lamp” passing behind the line while the text is revealed. */
.splash-brand-line::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: -30%;
  width: 42%;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .92), rgba(205, 190, 255, .60), transparent);
  filter: blur(9px);
  opacity: 0;
  transform: translate3d(-120%, -50%, 0) skewX(-14deg);
  will-change: transform, opacity;
  pointer-events: none;
  animation: g11LampSweep 1.7s ease-out .50s 1 forwards;
}

.splash-product-line { display: none !important; }

.splash-footer {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: calc(50% + 27px);
  bottom: auto;
  width: max-content;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  color: var(--guest-muted);
}

.splash-powered-label,
.splash-powered-brand {
  font-family: var(--guest-font-ui);
  font-size: clamp(8.5px, 2.35vw, 9.5px);
  line-height: 1.4;
  letter-spacing: -0.005em;
  text-transform: none;
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  transform: translate3d(-3px, 0, 0);
  will-change: clip-path, opacity, transform;
  animation: g11FooterReveal 760ms cubic-bezier(.22, 1, .36, 1) forwards;
}

.splash-powered-label {
  color: #8a8299;
  font-weight: 500;
  animation-delay: 1.42s;
}

.splash-powered-brand {
  color: var(--guest-primary);
  font-weight: 800;
  animation-delay: 1.58s;
}

@keyframes g11AmbientDrift {
  0% { transform: translate3d(-1.5%, -1%, 0) scale(1.06) rotate(-1deg); }
  48% { transform: translate3d(2.2%, 1.2%, 0) scale(1.10) rotate(.8deg); }
  100% { transform: translate3d(-.4%, 2.1%, 0) scale(1.08) rotate(-.35deg); }
}

@keyframes g11AmbientSheen {
  from { transform: translate3d(-7%, 2%, 0) scale(1.05); opacity: .72; }
  to { transform: translate3d(7%, -2%, 0) scale(1.11); opacity: .92; }
}

@keyframes g11ContentSettle {
  from { opacity: 0; transform: translate3d(0, -2px, 0); }
  to { opacity: 1; transform: translate3d(0, -7px, 0); }
}

@keyframes g11TextReveal {
  0% { opacity: 0; clip-path: inset(0 100% 0 0); transform: translate3d(-5px, 0, 0); }
  18% { opacity: 1; }
  100% { opacity: 1; clip-path: inset(0 0 0 0); transform: translate3d(0, 0, 0); }
}

@keyframes g11TextHighlight {
  0% { background-position: 118% 0; }
  100% { background-position: -28% 0; }
}

@keyframes g11LampSweep {
  0% { opacity: 0; transform: translate3d(-120%, -50%, 0) skewX(-14deg); }
  18% { opacity: .86; }
  72% { opacity: .58; }
  100% { opacity: 0; transform: translate3d(360%, -50%, 0) skewX(-14deg); }
}

@keyframes g11FooterReveal {
  from { opacity: 0; clip-path: inset(0 100% 0 0); transform: translate3d(-3px, 0, 0); }
  to { opacity: 1; clip-path: inset(0 0 0 0); transform: translate3d(0, 0, 0); }
}

@media (max-width: 359px) {
  #splash-screen::before { filter: blur(28px) saturate(106%); }
  #splash-screen::after { filter: blur(16px); }
  #splash-screen .splash-content { width: 94vw; }
  .splash-brand-line { font-size: 11.5px; }
  .splash-footer { top: calc(50% + 25px); }
}

@media (min-width: 768px) {
  #splash-screen .splash-content { transform: translateY(-10px); }
  .splash-footer { top: calc(50% + 29px); }
}

@media (prefers-reduced-motion: reduce) {
  #splash-screen::before,
  #splash-screen::after,
  #splash-screen .splash-content,
  .splash-brand-line .brand-reveal,
  .splash-brand-line::after,
  .splash-powered-label,
  .splash-powered-brand {
    animation: none !important;
    transition: none !important;
  }

  #splash-screen::before {
    transform: scale(1.06);
  }

  #splash-screen::after {
    transform: none;
  }

  .splash-brand-line .brand-reveal,
  .splash-powered-label,
  .splash-powered-brand {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: none;
  }

  .splash-brand-line .brand-reveal {
    background: none;
    color: #282331;
    -webkit-text-fill-color: #282331;
  }
}

@media (forced-colors: active) {
  #splash-screen { background: Canvas; color: CanvasText; }
  #splash-screen::before,
  #splash-screen::after,
  .splash-brand-line::after { display: none; }
  .splash-brand-line .brand-reveal {
    opacity: 1;
    clip-path: none;
    background: none;
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
  }
  .splash-powered-label,
  .splash-powered-brand {
    opacity: 1;
    clip-path: none;
    transform: none;
  }
  .splash-powered-label { color: CanvasText; }
  .splash-powered-brand { color: LinkText; }
}

