/*
 * CrowdHum Design System — Concept B
 *
 * Shared stylesheet imported by all pages.
 * Load fonts in HTML before this file:
 *   <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap" rel="stylesheet">
 *   (IBM Plex Mono loaded separately where needed for code/data display)
 */

/* =========================================================
   1. Custom Properties
   ========================================================= */

:root {
  /* Backgrounds */
  --bg-abyss: #060a14;
  --bg-deep: #0a0e1a;
  --bg-midnight: #0f172a;
  --bg-surface: #131b2e;
  --bg-elevated: #1a2340;

  /* Accent colors */
  --cyan: #06b6d4;
  --cyan-bright: #22d3ee;
  --cyan-dim: #0891b2;
  --cyan-glow: rgba(6, 182, 212, 0.35);
  --cyan-subtle: rgba(6, 182, 212, 0.08);
  --magenta: #d946ef;
  --magenta-bright: #e879f9;
  --magenta-dim: #a855f7;
  --magenta-glow: rgba(217, 70, 239, 0.3);
  --amber: #f59e0b;
  --amber-bright: #fbbf24;
  --amber-dim: #d97706;
  --amber-glow: rgba(245, 158, 11, 0.25);
  --green: #10b981;
  --green-glow: rgba(16, 185, 129, 0.3);
  --danger: #ff6b8a;

  /* Text — tertiary is 0.50 (not 0.35) for WCAG AA */
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-tertiary: rgba(255, 255, 255, 0.50);
  --text-ghost: rgba(255, 255, 255, 0.20);

  /* Glass morphism */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-bg-hover: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-hover: rgba(255, 255, 255, 0.12);
  --glass-blur: 20px;

  /* Radii */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;

  /* Typography */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Fluid type scale */
  --fs-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.8rem);
  --fs-sm: clamp(0.8rem, 0.75rem + 0.3vw, 0.9rem);
  --fs-base: clamp(0.95rem, 0.9rem + 0.3vw, 1.1rem);
  --fs-md: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  --fs-lg: clamp(1.4rem, 1.1rem + 1vw, 2rem);
  --fs-xl: clamp(2rem, 1.5rem + 2vw, 3.2rem);
  --fs-2xl: clamp(2.5rem, 1.8rem + 3vw, 4.5rem);

  /* Spacing */
  --sp-xs: clamp(4px, 0.5vw, 8px);
  --sp-sm: clamp(8px, 1vw, 16px);
  --sp-md: clamp(16px, 2vw, 32px);
  --sp-lg: clamp(32px, 4vw, 64px);
  --sp-xl: clamp(48px, 6vw, 96px);

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration: 200ms;
}

/* =========================================================
   2. Base Reset & Body
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   3. Skip Link (a11y)
   ========================================================= */

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--cyan);
  color: var(--bg-deep);
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 8px;
}

/* =========================================================
   4. Focus Visible
   ========================================================= */

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* =========================================================
   5. Reduced Motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   6. Shared Components
   ========================================================= */

/* --- Glass Card --- */

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: border-color var(--duration), background var(--duration);
}

.glass-card:hover {
  border-color: var(--glass-border-hover);
  background: var(--glass-bg-hover);
}

/* --- Glass Input --- */

.glass-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  transition: border-color var(--duration), box-shadow var(--duration);
}

.glass-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-subtle);
  outline: none;
}

.glass-input::placeholder {
  color: var(--text-tertiary);
}

/* --- Buttons --- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--cyan);
  color: var(--bg-deep);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}

.btn-primary:hover {
  background: var(--cyan-bright);
  box-shadow: 0 0 24px var(--cyan-glow);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-sm);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}

.btn-ghost:hover {
  border-color: var(--glass-border-hover);
  color: var(--text-primary);
}

/* --- Nav Bar --- */

.nav {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  height: 60px;
}

.nav__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: -0.02em;
}

.nav__wordmark span {
  font-weight: 300;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav__link {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration);
}

.nav__link:hover {
  color: var(--text-primary);
}

@media (max-width: 700px) {
  .nav__links a:not(.nav__cta) {
    display: none;
  }
}

/* --- Auth CTA Bar --- */

.auth-cta-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: var(--fs-xs);
  transition: transform 0.3s var(--ease-out);
}

.auth-cta-bar--anon {
  background: rgba(245, 158, 11, 0.1);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  border-left: 3px solid var(--amber);
}

.auth-cta-bar--upsell {
  background: rgba(6, 182, 212, 0.08);
  border-bottom: 1px solid rgba(6, 182, 212, 0.15);
  border-left: 3px solid var(--cyan);
}

.auth-cta-bar__action {
  color: var(--cyan-bright);
  font-weight: 600;
}

.auth-cta-bar__close {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

.auth-cta-bar.dismissed {
  transform: translateY(-100%);
}

:fullscreen .auth-cta-bar {
  display: none;
}

/* --- Footer --- */

.footer {
  border-top: 1px solid var(--glass-border);
  padding: 24px 32px;
  text-align: center;
}

.footer__inner {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.footer a {
  transition: color var(--duration);
}

.footer a:hover {
  color: var(--text-secondary);
}

/* --- Status Badges --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
}

.badge--live {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
}

.badge--closed {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-tertiary);
}

.badge--draft {
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber);
}

.badge--expired {
  background: rgba(255, 107, 138, 0.1);
  color: var(--danger);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--live .badge-dot {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --- Promo Banner --- */

.promo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: var(--fs-xs);
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.15), rgba(217, 70, 239, 0.12)), #0a0e1a;
  border-bottom: 1px solid rgba(6, 182, 212, 0.15);
}

.promo-banner code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.promo-banner__cta {
  color: var(--cyan-bright);
  font-weight: 600;
}

.promo-banner__close {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
}

.promo-banner.dismissed {
  display: none;
}

/* =========================================================
   7. Utility Classes
   ========================================================= */

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-cyan { color: var(--cyan); }
.text-magenta { color: var(--magenta); }
.text-amber { color: var(--amber); }

.glow-text {
  background: linear-gradient(135deg, var(--cyan-bright), var(--magenta-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }
