/* ============================================================
   JustOut Hub — Cosmic Constellation Styles
   The personal universe portal
   ============================================================ */

/* --- Design Tokens (shared with dashboard) --- */
:root {
  --bg: #050a18;
  --bg-deep: #020510;
  --card: #0f1729;
  --accent: #38bdf8;
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #f87171;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #1e293b;
  --purple: #a78bfa;
  --orange: #fb923c;
  --pink: #f472b6;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}


/* ============================================================
   AUTH GATE — Cosmic Sign-In
   ============================================================ */

#authGate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-cosmos {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, #0a1628 0%, #020510 70%);
}
.auth-cosmos canvas {
  width: 100%;
  height: 100%;
}

.auth-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 48px;
}

.auth-logo {
  font-size: 72px;
  margin-bottom: 8px;
  animation: auth-float 3s ease-in-out infinite;
}

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

.auth-title {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #38bdf8 0%, #a78bfa 40%, #f472b6 70%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.auth-sub {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 36px;
  letter-spacing: 0.5px;
}

.g-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border: 2px solid #1e293b;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s;
  backdrop-filter: blur(8px);
}
.g-btn:hover {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.15);
  transform: translateY(-1px);
}
.g-btn svg {
  width: 22px;
  height: 22px;
}

.auth-err {
  color: var(--red);
  font-size: 13px;
  margin-top: 16px;
  min-height: 20px;
}
.auth-loading {
  color: var(--muted);
  font-size: 14px;
  margin-top: 12px;
}


/* ============================================================
   COSMOS CANVAS — Particle Background
   ============================================================ */

#cosmosCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}


/* ============================================================
   HUB HEADER
   ============================================================ */

.hub-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: linear-gradient(180deg, rgba(5, 10, 24, 0.95) 0%, rgba(5, 10, 24, 0) 100%);
  pointer-events: none;
}
.hub-header > * { pointer-events: auto; }

.hub-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hub-logo {
  font-size: 24px;
}
.hub-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #38bdf8, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hub-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.hub-user img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.hub-user-name {
  font-weight: 600;
  color: var(--text);
}
.hub-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.hub-logout:hover {
  color: var(--red);
  border-color: var(--red);
}


/* ============================================================
   CONSTELLATION — Orb Grid
   ============================================================ */

.constellation {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 100px 40px 80px;
  max-width: 1200px;
  margin: 0 auto;
}


/* ============================================================
   ORB — The Jeweled Celestial Object
   ============================================================ */

.orb-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.3s ease;
  padding: 20px;
  /* Each orb floats gently */
  animation: orb-drift var(--drift-dur, 6s) ease-in-out infinite;
  animation-delay: var(--drift-delay, 0s);
}
.orb-container:hover {
  animation-play-state: paused;
  transform: scale(1.08) translateY(-4px);
  z-index: 10;
}

/* Drift animation with unique timing per orb */
@keyframes orb-drift {
  0%, 100% { transform: translateY(0) translateX(0); }
  25% { transform: translateY(calc(var(--drift-y, -6px))) translateX(calc(var(--drift-x, 3px))); }
  50% { transform: translateY(calc(var(--drift-y, -6px) * -0.5)) translateX(calc(var(--drift-x, 3px) * -1)); }
  75% { transform: translateY(calc(var(--drift-y, -6px) * 0.3)) translateX(calc(var(--drift-x, 3px) * 0.5)); }
}

.orb {
  position: relative;
  width: var(--orb-size, 100px);
  height: var(--orb-size, 100px);
  border-radius: 50%;
  transition: all 0.35s ease;
}

/* Core glow layer */
.orb::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,
    var(--orb-color, #38bdf8) 0%,
    transparent 70%
  );
  opacity: 0.3;
  filter: blur(8px);
  transition: all 0.35s;
}

/* Inner jewel face */
.orb::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.35) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, var(--orb-deep, #0c4a6e) 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, var(--orb-color, #38bdf8) 0%, var(--orb-deep, #0c4a6e) 100%);
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.35s;
}

/* Hover: amp up the glow */
.orb-container:hover .orb::before {
  opacity: 0.6;
  filter: blur(14px);
  inset: -10px;
}
.orb-container:hover .orb::after {
  border-color: rgba(255,255,255,0.25);
  box-shadow: inset 0 0 20px rgba(255,255,255,0.1);
}

/* Pulse ring on hover */
.orb-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid var(--orb-color, #38bdf8);
  opacity: 0;
  transition: all 0.4s ease;
}
.orb-container:hover .orb-ring {
  opacity: 0.3;
  inset: -20px;
  animation: ring-pulse 1.5s ease-in-out infinite;
}
@keyframes ring-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.1; transform: scale(1.08); }
}

/* Idle glow animation */
.orb-glow {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--orb-color, #38bdf8), transparent 70%);
  opacity: 0.15;
  animation: glow-pulse var(--pulse-dur, 4s) ease-in-out infinite;
  animation-delay: var(--pulse-delay, 0s);
  pointer-events: none;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.1; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(1.05); }
}

/* Orb icon */
.orb-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: calc(var(--orb-size, 100px) * 0.36);
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  transition: transform 0.3s;
}
.orb-container:hover .orb-icon {
  transform: translate(-50%, -50%) scale(1.1);
}


/* --- Orb Type Variants --- */

/* Star: spiky outer glow */
.orb-type-star .orb::before {
  background:
    radial-gradient(circle at 35% 35%, var(--orb-color) 0%, transparent 50%),
    conic-gradient(from 0deg, transparent 0deg, var(--orb-color) 2deg, transparent 4deg,
      transparent 30deg, var(--orb-color) 32deg, transparent 34deg,
      transparent 60deg, var(--orb-color) 62deg, transparent 64deg,
      transparent 90deg, var(--orb-color) 92deg, transparent 94deg,
      transparent 120deg, var(--orb-color) 122deg, transparent 124deg,
      transparent 150deg, var(--orb-color) 152deg, transparent 154deg,
      transparent 180deg, var(--orb-color) 182deg, transparent 184deg,
      transparent 210deg, var(--orb-color) 212deg, transparent 214deg,
      transparent 240deg, var(--orb-color) 242deg, transparent 244deg,
      transparent 270deg, var(--orb-color) 272deg, transparent 274deg,
      transparent 300deg, var(--orb-color) 302deg, transparent 304deg,
      transparent 330deg, var(--orb-color) 332deg, transparent 334deg
    );
  opacity: 0.2;
  filter: blur(4px);
  inset: -8px;
}

/* Gem: faceted look with sharp reflections */
.orb-type-gem .orb::after {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 30%),
    linear-gradient(225deg, rgba(255,255,255,0.15) 0%, transparent 40%),
    linear-gradient(315deg, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, var(--orb-color) 0%, var(--orb-deep) 100%);
}

/* Crystal: prismatic rainbow edge */
.orb-type-crystal .orb-ring {
  border: 2px solid transparent;
  background: conic-gradient(from 0deg, #f87171, #fbbf24, #4ade80, #38bdf8, #a78bfa, #f472b6, #f87171) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask-composite: subtract;
  opacity: 0.4;
  inset: -8px;
}
.orb-container:hover .orb-type-crystal .orb-ring {
  opacity: 0.7;
}

/* Prism: geometric angular feel */
.orb-type-prism .orb {
  border-radius: 30%;
  transform: rotate(15deg);
}
.orb-type-prism .orb::before,
.orb-type-prism .orb::after {
  border-radius: 30%;
}
.orb-type-prism .orb-ring {
  border-radius: 30%;
}
.orb-type-prism .orb-glow {
  border-radius: 30%;
}
.orb-type-prism .orb-icon {
  transform: translate(-50%, -50%) rotate(-15deg);
}
.orb-container:hover .orb-type-prism .orb-icon {
  transform: translate(-50%, -50%) rotate(-15deg) scale(1.1);
}

/* Nebula: soft swirling organic */
.orb-type-nebula .orb::after {
  background:
    radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 60%, var(--orb-color) 0%, transparent 60%),
    radial-gradient(ellipse at 40% 70%, var(--orb-deep) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, var(--orb-color) 0%, var(--orb-deep) 100%);
  animation: nebula-swirl 8s linear infinite;
}
@keyframes nebula-swirl {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}


/* --- Orb Label --- */

.orb-label {
  margin-top: 14px;
  text-align: center;
  transition: all 0.3s;
}
.orb-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
  transition: color 0.3s;
}
.orb-container:hover .orb-name {
  color: var(--orb-color, var(--accent));
}
.orb-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.3s;
  max-width: 140px;
}
.orb-container:hover .orb-desc {
  opacity: 1;
  transform: translateY(0);
}

/* Status badges */
.orb-status {
  position: absolute;
  top: 12px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 4px;
  z-index: 5;
}
.orb-status-live {
  background: rgba(74, 222, 128, 0.2);
  color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.3);
}
.orb-status-planned {
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.15);
  display: none; /* hide for clean look, show on hover */
}
.orb-container:hover .orb-status-planned {
  display: block;
}

/* Planned orbs: slightly dimmed */
.orb-planned {
  opacity: 0.55;
  transition: opacity 0.3s;
}
.orb-planned:hover {
  opacity: 0.85;
}


/* ============================================================
   ZOOM OVERLAY — Channel Entry Transition
   ============================================================ */

.zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg-deep);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s, visibility 0.3s;
}
.zoom-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.zoom-orb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  animation: zoom-expand 1.2s ease-in-out forwards;
}
@keyframes zoom-expand {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(3); opacity: 0.8; }
  100% { transform: scale(20); opacity: 0; }
}

.zoom-label {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-top: 24px;
  animation: zoom-fade-in 0.4s ease-out 0.2s both;
}
.zoom-status {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
  animation: zoom-fade-in 0.4s ease-out 0.4s both;
}
@keyframes zoom-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Toast animation (used by showComingSoon in hub.js) */
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}


/* ============================================================
   FOOTER
   ============================================================ */

.hub-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  color: #334155;
  font-size: 12px;
  letter-spacing: 0.5px;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .constellation {
    padding: 80px 16px 60px;
    gap: 0;
  }
  .orb-container {
    padding: 12px;
  }
  .auth-title {
    font-size: 36px;
  }
  .auth-logo {
    font-size: 56px;
  }
  .hub-header {
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .constellation {
    flex-direction: column;
    align-items: center;
  }
  .orb-container {
    width: 100%;
    max-width: 200px;
  }
  .auth-title {
    font-size: 28px;
  }
}
