/**
 * Avatar Page Styles
 * 3D avatar rendering page
 */

body {
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#avatar-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
}

/* UI Controls */
#ui {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
}

#ui button {
  margin: 5px;
  padding: 10px 15px;
  font-size: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#ui button:hover {
  background: rgba(255, 255, 255, 1);
}

#ui h3 {
  color: white;
  font-family: monospace;
  margin: 10px 5px 5px 5px;
}

#ui pre {
  color: rgb(15, 15, 15);
  font-family: monospace;
  /* background: rgba(0, 0, 0, 0.7); */
  padding: 5px;
  border-radius: 5px;
  margin: 2px;
}

canvas {
  display: block;
  transform: rotate(90deg) scaleX(1.4) scaleY(1.3) translateX(-20px) translateY(-30px);
  filter: brightness(1.3);
}

body.justin canvas {
  transform: rotate(90deg) scaleX(1.4) scaleY(1.3) translateX(-35px) translateY(-20px);
}

body.neon canvas {
  transform: rotate(90deg) scaleX(1.2) scaleY(1.0) translateX(-15px) translateY(-20px);
}

#debug {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px;
  font-family: monospace;
  font-size: 12px;
}

/* Loading Screen */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 35%, #14306E 0%, #0A1A40 55%, #060F2A 100%);
  z-index: 9999;
  transition: opacity 0.8s ease-out;
  overflow: hidden;
}

#loadingOverlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #F4F6FB;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  transform: rotate(90deg);
  overflow: hidden;
}

/* Faint scrolling grid */
.loading-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(120, 160, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 255, 0.07) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: rb-hf-grid 6s ease-in-out infinite;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

@keyframes rb-hf-grid {
  0%   { transform: translateY(0);     opacity: 0.18; }
  50%  {                               opacity: 0.28; }
  100% { transform: translateY(-40px); opacity: 0.18; }
}

/* Logo area: glow + arc + facets */
.loading-logo-area {
  position: relative;
  width: 320px;
  height: 320px;
  display: grid;
  place-items: center;
}

.loading-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(80, 140, 255, 0.45) 0%, transparent 65%);
  animation: rb-hf-glow 3s ease-in-out infinite;
}

@keyframes rb-hf-glow {
  0%, 100% { opacity: 0.5;  transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 0.85; transform: translate(-50%, -50%) scale(1.08); }
}

.loading-arc {
  position: absolute;
  inset: 0;
  animation: rb-hf-spin 3.6s linear infinite;
}

@keyframes rb-hf-spin {
  to { transform: rotate(360deg); }
}

/* Facet tile grid */
.loading-facets {
  position: relative;
  width: 240px;
  height: 240px;
  filter: brightness(1.7) drop-shadow(0 0 22px rgba(120, 160, 255, 0.5));
}

.loading-facet {
  position: absolute;
  overflow: hidden;
  width: 25%;
  height: 25%;
  animation: rb-hf-facet 3.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loading-facet img {
  position: absolute;
  width: 400%;
  height: 400%;
  object-fit: contain;
}

@keyframes rb-hf-facet {
  0%   { opacity: 0; transform: translateY(10px)  scale(0.9);  filter: blur(3px); }
  22%  { opacity: 1; transform: translateY(0)      scale(1);    filter: blur(0); }
  78%  { opacity: 1; transform: translateY(0)      scale(1);    filter: blur(0); }
  100% { opacity: 0; transform: translateY(-10px)  scale(1.05); filter: blur(3px); }
}

/* Percentage counter */
.loading-pct {
  margin-top: 36px;
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.loading-percentage {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(220, 230, 250, 0.85);
}

.loading-pct-symbol {
  font-size: 14px;
  font-weight: 400;
  color: rgba(180, 200, 240, 0.55);
}

/* Brand label */
.loading-brand {
  margin-top: 22px;
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0.55;
}

/* Rotating status text */
.loading-text {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 400;
  color: rgba(220, 230, 250, 0.8);
  min-height: 22px;
  animation: rb-hf-msg-in 0.4s ease-out;
}

@keyframes rb-hf-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Debug info */
.debug-info {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  display: none;
}

.debug-info.visible {
  display: block;
}

/* Video Overlay for MP4 playback */
#videoOverlay {
  position: fixed;
  inset: 0;
  background-color: white;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

#videoOverlay video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
