/* ============================================
   PYRAMID · Matrix Client
   Design tokens + global styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
  /* Type */
  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;

  /* Accent (tweakable) */
  --accent-h: 42;
  --accent-s: 95%;
  --accent-l: 58%;
  --accent: hsl(var(--accent-h) var(--accent-s) var(--accent-l));
  --accent-soft: hsl(var(--accent-h) var(--accent-s) var(--accent-l) / 0.14);
  --accent-glow: hsl(var(--accent-h) var(--accent-s) var(--accent-l) / 0.35);
  --accent-fg: #0b0b0d;

  /* Radius (tweakable) */
  --r-sm: calc(var(--r-base) * 0.6);
  --r-base: 12px;
  --r-lg: calc(var(--r-base) * 1.5);
  --r-xl: calc(var(--r-base) * 2);
  --r-pill: 999px;

  /* Density (tweakable) */
  --density: 1;
  --row-pad-y: calc(10px * var(--density));
  --row-pad-x: calc(12px * var(--density));
  --msg-gap: calc(16px * var(--density));

  /* Animations (tweakable 0..1) */
  --motion: 1;
  --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-soft: cubic-bezier(0.22, 1, 0.36, 1);

  /* Dark theme (default) */
  --bg-0: #0a0a0c;
  --bg-1: #111114;
  --bg-2: #17171c;
  --bg-3: #1e1e25;
  --bg-hover: #232330;
  --bg-active: #2a2a38;
  --border: #25252e;
  --border-strong: #32323d;
  --fg: #ececf0;
  --fg-muted: #a4a4b0;
  --fg-dim: #6f6f7d;
  --danger: #e5484d;
  --success: #30a46c;
  --online: #4ade80;
  --away: #facc15;
  --busy: #f87171;
  --shadow-lg: 0 12px 40px -8px rgba(0,0,0,0.6), 0 2px 8px -2px rgba(0,0,0,0.4);
  --shadow-pop: 0 20px 60px -10px rgba(0,0,0,0.7), 0 4px 12px -4px rgba(0,0,0,0.5);
}

[data-theme="light"] {
  --bg-0: #f5f4f0;
  --bg-1: #ffffff;
  --bg-2: #faf9f5;
  --bg-3: #f0eeea;
  --bg-hover: #e9e7e1;
  --bg-active: #dfdcd3;
  --border: #e5e2dc;
  --border-strong: #d3cfc6;
  --fg: #1a1a1f;
  --fg-muted: #54545e;
  --fg-dim: #8a8a92;
  --shadow-lg: 0 12px 40px -8px rgba(30,25,15,0.12), 0 2px 8px -2px rgba(30,25,15,0.06);
  --shadow-pop: 0 20px 60px -10px rgba(30,25,15,0.18), 0 4px 12px -4px rgba(30,25,15,0.08);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background 0.3s var(--spring-soft), color 0.3s var(--spring-soft);
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ==== App shell ==== */
.app {
  display: grid;
  grid-template-columns: 72px 260px 1fr;
  height: 100vh;
  background: var(--bg-0);
}

.app.right-open {
  grid-template-columns: 72px 260px 1fr 280px;
}

.app.rail-collapsed {
  grid-template-columns: 0 260px 1fr;
}
.app.rail-collapsed.right-open {
  grid-template-columns: 0 260px 1fr 280px;
}

.app.rooms-collapsed {
  grid-template-columns: 72px 0 1fr;
}

/* ==== Pyramid logo ==== */
.pyramid-logo {
  display: inline-block;
  position: relative;
}

/* ==== Keyframes ==== */
@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.85) translateY(4px); }
  70% { transform: scale(1.03) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-right {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 var(--accent-glow); }
  100% { box-shadow: 0 0 0 10px transparent; }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

@keyframes bounce-in {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.15); }
  80% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes voice-wave {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ==== Shared util ==== */
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  transition: all 0.18s var(--spring-soft);
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--fg);
  transform: scale(calc(1 + 0.05 * var(--motion)));
}
.icon-btn:active { transform: scale(calc(1 - 0.05 * var(--motion))); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-3);
  color: var(--fg-muted);
}

.avatar {
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  user-select: none;
}

.presence-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-1);
  position: absolute;
  bottom: -2px; right: -2px;
}
.presence-dot.online { background: var(--online); }
.presence-dot.away { background: var(--away); }
.presence-dot.busy { background: var(--busy); }
.presence-dot.offline { background: var(--fg-dim); }
