/* ============================================
   MAIN.CSS - Shared styles across all pages
   ============================================ */

/* CSS Custom Properties / Theme Variables */
:root{
  --bg: #070a12;
  --bg2: #0d1117;
  --card: rgba(255,255,255,.04);
  --card2: rgba(255,255,255,.08);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.70);
  --faint: rgba(255,255,255,.52);
  --border: rgba(255,255,255,.10);
  --shadow: 0 25px 80px rgba(0,0,0,.55);
  --accent: #7c5cff;
  --accent2: #20e3b2;
  --accent3: #ff6b9d;
  --danger: #ff4d6d;
  --radius: 20px;
  --radius-lg: 28px;
  --max: 1120px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"]{
  --bg: #f8fafc;
  --bg2: #ffffff;
  --card: rgba(0,0,0,.03);
  --card2: rgba(0,0,0,.06);
  --text: rgba(0,0,0,.90);
  --muted: rgba(0,0,0,.66);
  --faint: rgba(0,0,0,.52);
  --border: rgba(0,0,0,.08);
  --shadow: 0 25px 80px rgba(0,0,0,.08);
  --accent: #6c4cff;
  --accent2: #00d4a4;
}

/* Reset and Base Styles */
*{ box-sizing: border-box; margin: 0; padding: 0; }
html{ scroll-behavior: smooth; }
html, body{ height: 100%; }

body{
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
}

a{ color: inherit; text-decoration: none; transition: var(--transition-fast); }
a:hover{ color: var(--accent); }

/* Scroll margin for anchor targets */
[id] {
  scroll-margin-top: 100px;
}

.wrap{ max-width: var(--max); margin: 0 auto; padding: 24px; }

/* Animated Background */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 20% -20%, rgba(124,92,255,.25), transparent),
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(32,227,178,.20), transparent),
    radial-gradient(ellipse 50% 50% at 50% 100%, rgba(255,107,157,.12), transparent),
    var(--bg);
}

.bg-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
}

/* Topbar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(7,10,18,.75);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
[data-theme="light"] .topbar{
  background: rgba(248,250,252,.80);
}
.topbar-inner{
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.3px;
}
.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(124,92,255,.4);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.logo-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,.3));
}
.logo-icon:hover {
  transform: rotate(-5deg) scale(1.05);
  box-shadow: 0 6px 30px rgba(124,92,255,.5);
}
.logo-icon svg { color: white; }

.nav{ display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nav a{
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  transition: var(--transition-fast);
  position: relative;
}
.nav a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 999px;
  transition: var(--transition-fast);
  transform: translateX(-50%);
}
.nav a:hover {
  color: var(--text);
  background: var(--card);
}
.nav a:hover::after {
  width: 20px;
}

/* Buttons */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: var(--transition);
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(124,92,255,.2);
  border-color: var(--accent);
}
.btn:hover::before { opacity: 0.1; }
.btn:active { transform: translateY(0); }

.btn.primary{
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0b0f19;
  box-shadow: 0 4px 20px rgba(124,92,255,.4);
}
.btn.primary:hover {
  box-shadow: 0 8px 40px rgba(124,92,255,.5);
  transform: translateY(-3px);
}
.btn.primary::before {
  background: linear-gradient(135deg, rgba(255,255,255,.3), transparent);
  opacity: 1;
}

.btn.small{ padding: 10px 14px; font-size: 13px; }
.btn svg { width: 18px; height: 18px; }

/* Cards */
.card{
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124,92,255,.05), transparent 50%);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 100px rgba(0,0,0,.3);
  border-color: rgba(124,92,255,.3);
}
.pad{ padding: 28px; }

/* Tags */
.tags{ display: flex; flex-wrap: wrap; gap: 8px; }
.tag{
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  background: var(--card);
  transition: var(--transition-fast);
  cursor: default;
}
.tag:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(124,92,255,.15);
}

/* Section styles */
.section{ padding: 20px 0; }
.section-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
  flex-wrap: wrap;
}

h2{
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}
h2 svg { width: 24px; height: 24px; color: var(--accent); }

.section-subtitle {
  color: var(--faint);
  font-size: 14px;
  font-weight: 500;
}

/* Keyboard shortcut badge */
.kbd{
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-bottom-width: 3px;
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-weight: 700;
}

/* Screen reader only */
.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}
.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

/* Stagger children animation */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.stagger-children.active > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.active > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.active > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.active > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.active > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.active > *:nth-child(6) { transition-delay: 0.6s; }
.stagger-children.active > * {
  opacity: 1;
  transform: translateY(0);
}

/* Glow effect on mouse move */
.glow-card {
  position: relative;
}
.glow-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(124,92,255,.15), transparent 40%);
  pointer-events: none;
}
.glow-card:hover::after {
  opacity: 1;
}

/* Loading spinner animation */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Visitor counter */
.visitor-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 13px;
  font-family: var(--mono);
}
.visitor-counter svg { width: 14px; height: 14px; }

/* Curated Posts */
.curated-posts {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}
.curated-post {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  cursor: pointer;
}
.curated-post:hover {
  transform: translateX(8px);
  border-color: rgba(29, 161, 242, 0.3);
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.curated-post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.curated-post-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.curated-post-date {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.curated-post-snippet {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* Live feed container */
.live-feed-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.live-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card2);
}
.live-feed-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}
.live-feed-title svg {
  width: 18px;
  height: 18px;
  color: #1DA1F2;
}

/* Tweets loading state */
.tweets-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--muted);
  font-weight: 600;
}

.tweets-fallback {
  text-align: center;
  padding: 20px;
}
