/* RLB shared theme: Linear / Modern.
   Tokens live here once. Pages only add `theme.css` + `theme.js`. */

:root {
  --bg-deep: #020203;
  --bg-base: #050506;
  --bg-elevated: #0a0a0c;
  --fg: #EDEDEF;
  --fg-muted: #8A8F98;
  --accent: #5E6AD2;
  --accent-bright: #6872D9;
  --accent-glow: rgba(94, 106, 210, 0.3);
  --border-default: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.10);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

html { color-scheme: dark; }

body {
  background-color: var(--bg-base) !important;
  background-image: radial-gradient(ellipse at top, #0a0a0f 0%, #050506 50%, #020203 100%) !important;
  background-attachment: fixed !important;
  color: var(--fg) !important;
  font-family: "Inter", "Geist Sans", system-ui, sans-serif;
}

/* ---------- Ambient background: grid + noise + floating light pools ---------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.ambient .grid {
  position: absolute;
  inset: 0;
  opacity: 0.02;
  background-image:
    linear-gradient(#fff 1px, transparent 1px),
    linear-gradient(90deg, #fff 1px, transparent 1px);
  background-size: 64px 64px;
}
.ambient .noise {
  position: absolute;
  inset: 0;
  opacity: 0.015;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
/* Radial gradients stand in for the heavy blur filter: same look, far cheaper to paint. */
.ambient .blob {
  position: absolute;
  border-radius: 9999px;
  will-change: transform;
  animation: float 9s ease-in-out infinite;
}
.ambient .b1 {
  top: -35%; left: 50%;
  width: 900px; height: 1400px; margin-left: -450px;
  background: radial-gradient(closest-side, rgba(94, 106, 210, 0.25), transparent);
}
.ambient .b2 {
  top: 10%; left: -12%;
  width: 600px; height: 800px;
  background: radial-gradient(closest-side, rgba(120, 108, 228, 0.15), transparent);
  animation-duration: 10s; animation-delay: -3s;
}
.ambient .b3 {
  top: 25%; right: -10%;
  width: 500px; height: 700px;
  background: radial-gradient(closest-side, rgba(79, 130, 246, 0.12), transparent);
  animation-duration: 8s; animation-delay: -5s;
}
.ambient .b4 {
  bottom: -25%; left: 50%;
  width: 800px; height: 500px; margin-left: -400px;
  background: radial-gradient(closest-side, rgba(94, 106, 210, 0.10), transparent);
  animation: pulse-glow 7s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-20px) rotate(1deg); }
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

/* ---------- Cards: glass, 3-layer shadow, mouse-tracking spotlight ---------- */
.glass-card {
  position: relative;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)) !important;
  border-color: var(--border-default);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 20px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(0, 0, 0, 0.2);
  transition: box-shadow 300ms var(--ease-out-expo), border-color 300ms var(--ease-out-expo), transform 300ms var(--ease-out-expo);
}
.glass-card:hover {
  border-color: var(--border-hover);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.10),
    0 8px 40px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(94, 106, 210, 0.10);
}
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms var(--ease-out-expo);
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), rgba(94, 106, 210, 0.15), transparent 70%);
}
.glass-card:hover::before { opacity: 1; }

/* Every member banner uses the same accent wash: one colour profile across the page. */
.glass-card > .bg-gradient-to-r {
  background-image: linear-gradient(to right, rgba(94, 106, 210, 0.34), rgba(94, 106, 210, 0.07)) !important;
  background-color: transparent;
}

/* Modals sit on their own dark overlay: keep them solid so text stays crisp. */
#edit-modal .glass-card,
#discord-import-modal .glass-card {
  background: var(--bg-elevated) !important;
}

/* ---------- Buttons and focus ---------- */
button, [role="button"], a {
  transition:
    transform 200ms var(--ease-out-expo),
    background-color 200ms var(--ease-out-expo),
    color 200ms var(--ease-out-expo),
    box-shadow 200ms var(--ease-out-expo),
    border-color 200ms var(--ease-out-expo);
}
button:active { transform: scale(0.98); }

/* Accent buttons get the soft light-emission glow. */
.bg-rose-600 {
  box-shadow:
    0 0 0 1px rgba(94, 106, 210, 0.5),
    0 4px 12px rgba(94, 106, 210, 0.3),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(94, 106, 210, 0.5);
}
input:focus, textarea:focus, select:focus {
  box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.2);
}

/* Tab rows scroll sideways on phones instead of squashing the labels. */
.nav-tab { white-space: nowrap; flex-shrink: 0; }

/* ---------- Shell nav tabs ---------- */
.tab-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--fg-muted);
}
.tab-btn:hover { color: var(--fg); background: rgba(255, 255, 255, 0.05); }
.tab-btn.is-active {
  color: #fff;
  background: var(--accent);
  box-shadow:
    0 0 0 1px rgba(94, 106, 210, 0.5),
    0 4px 12px rgba(94, 106, 210, 0.3),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}
.tab-btn.is-active:hover { background: var(--accent-bright); }

/* ---------- Type helpers ---------- */
.text-shimmer {
  background-size: 200% auto;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }

/* `backwards` (not `both`) so no leftover transform stays on the element afterwards. */
.rise { animation: rise 600ms var(--ease-out-expo) var(--d, 0ms) backwards; }
@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Cinematic hero pieces (Home) ---------- */
.hero-glow {
  position: absolute;
  left: 50%; top: 42%;
  width: 1000px; height: 650px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(94, 106, 210, 0.24), transparent);
  pointer-events: none;
  animation: pulse-glow 7s ease-in-out infinite;
}
.hero-content { will-change: transform, opacity; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #c9ccf5;
  background: rgba(94, 106, 210, 0.10);
  border: 1px solid rgba(94, 106, 210, 0.30);
  box-shadow: 0 0 24px rgba(94, 106, 210, 0.15);
}
.badge .dot {
  width: 6px; height: 6px;
  border-radius: 9999px;
  background: #8e97e8;
  box-shadow: 0 0 10px #5E6AD2;
  animation: pulse-glow 2s ease-in-out infinite;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
}
.btn-primary {
  color: #fff;
  background: var(--accent);
  box-shadow:
    0 0 0 1px rgba(94, 106, 210, 0.5),
    0 4px 12px rgba(94, 106, 210, 0.3),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}
.btn-primary:hover {
  background: var(--accent-bright);
  box-shadow:
    0 0 0 1px rgba(94, 106, 210, 0.6),
    0 6px 20px rgba(94, 106, 210, 0.45),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
}
.btn-primary::after {           /* shine sweep */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.28) 50%, transparent 65%);
  transform: translateX(-120%);
}
.btn-primary:hover::after { transform: translateX(120%); transition: transform 700ms var(--ease-out-expo); }
.btn-secondary {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 30px rgba(94, 106, 210, 0.12);
}

/* Scroll fade: theme.js drives opacity + translate on .reveal / [data-fade] / `main .glass-card`
   from each element's position, so things fade in as they enter and out as they leave.
   `.is-in` is only used to fill the bars. */
.bar { height: 6px; border-radius: 9999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.bar > i {
  display: block; height: 100%; width: 0;
  border-radius: inherit;
  background: linear-gradient(to right, #5E6AD2, #9aa2ee);
  box-shadow: 0 0 12px rgba(94, 106, 210, 0.5);
  transition: width 1100ms var(--ease-out-expo) 250ms;
}
.is-in .bar > i, .bar.is-in > i { width: var(--w); }

.avatar {
  width: 38px; height: 38px;
  margin-left: -10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px;
  font-size: 0.75rem; font-weight: 800; color: #0a0a0c;
  background: linear-gradient(135deg, var(--mc, #5E6AD2), rgba(var(--mc-rgb, 94, 106, 210), 0.6));
  border: 2px solid var(--bg-base);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.avatar:first-child { margin-left: 0; }

.view-in { animation: rise 450ms var(--ease-out-expo) backwards; }

/* ---------- People: one identity colour + monogram per person ---------- */
/* Set on any element with style="--mc:#hex;--mc-rgb:r,g,b". Used for people only;
   everything else stays in the indigo accent. */
.member-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 9999px;
  font-weight: 800;
  line-height: 1;
  color: #0a0a0c;
  background: linear-gradient(135deg, var(--mc), rgba(var(--mc-rgb), 0.6));
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 3px rgba(var(--mc-rgb), 0.6), 0 0 16px rgba(var(--mc-rgb), 0.35);
}
.member-avatar.sm { width: 22px; height: 22px; font-size: 0.65rem; }
.member-avatar.md { width: 30px; height: 30px; font-size: 0.8rem; }
.member-avatar.lg { width: 42px; height: 42px; font-size: 1.05rem; }

.member-dot {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 6px;
  border-radius: 9999px;
  vertical-align: middle;
  background: var(--mc);
  box-shadow: 0 0 8px var(--mc);
}
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 1px 2px 1px 0;
  padding: 1px 8px 1px 6px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--mc);
  background: rgba(var(--mc-rgb), 0.12);
  border: 1px solid rgba(var(--mc-rgb), 0.35);
}
.member-chip::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 9999px;
  background: var(--mc);
  box-shadow: 0 0 6px var(--mc);
}

/* Emoji reactions */
.react-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 13px;
  line-height: 1.5;
  color: #b4b8c0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}
.react-btn b { font-size: 11px; font-weight: 700; }
.react-btn:hover { background: rgba(255, 255, 255, 0.10); }
.react-btn.on {
  color: #fff;
  background: rgba(94, 106, 210, 0.22);
  border-color: rgba(94, 106, 210, 0.55);
}
.member-avatar[data-edit-avatar] { transition: transform 200ms var(--ease-out-expo), box-shadow 200ms var(--ease-out-expo); }
.member-avatar[data-edit-avatar]:hover { transform: scale(1.08); }

/* Cards that belong to one person: glowing top edge, tinted banner, colour-matched hover. */
.member-card { overflow: hidden; }
.member-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(to right, var(--mc), rgba(var(--mc-rgb), 0.15));
  box-shadow: 0 0 18px rgba(var(--mc-rgb), 0.55);
}
.member-card > .bg-gradient-to-r {
  background-image: linear-gradient(to right, rgba(var(--mc-rgb), 0.30), rgba(var(--mc-rgb), 0.05)) !important;
}
.member-card:hover {
  border-color: rgba(var(--mc-rgb), 0.35);
  box-shadow:
    0 0 0 1px rgba(var(--mc-rgb), 0.30),
    0 8px 40px rgba(0, 0, 0, 0.5),
    0 0 70px rgba(var(--mc-rgb), 0.14);
}
.member-card::before {
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--mc-rgb), 0.14), transparent 70%);
}

/* ---------- NBA page: staggered entrance + tab fade-up ---------- */
header .max-w-7xl > div:first-child > div:first-child { animation: rise 700ms var(--ease-out-expo) backwards; }
header .max-w-7xl > div:first-child > div:nth-child(2) { animation: rise 700ms var(--ease-out-expo) 120ms backwards; }
header .max-w-7xl > div:nth-child(2) { animation: rise 700ms var(--ease-out-expo) 240ms backwards; }
.tab-view:not(.hidden) { animation: rise 500ms var(--ease-out-expo) backwards; }

/* ---------- Scrollbars match the palette ---------- */
.custom-scrollbar::-webkit-scrollbar-track { background: var(--bg-elevated) !important; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #2a2a31 !important; }

/* ---------- Small screens: calmer background ---------- */
@media (max-width: 768px) {
  .ambient .b1 { width: 560px; height: 900px; margin-left: -280px; }
  .ambient .b2, .ambient .b3 { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ambient .blob, .text-shimmer, .rise, .view-in, .hero-glow, .badge .dot,
  .tab-view, header .max-w-7xl > div { animation: none !important; }
  .bar > i { transition: none; width: var(--w) !important; }
  * { transition-duration: 0.01ms !important; }
}
