/* ================= ROOT THEME ================= */
:root {
  --bg-main: #f4f7fb;
  --bg-card: #ffffff;
  --bg-header: #0a2540;

  --text-main: #0f172a;
  --text-muted: #64748b;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;

  --success: #16a34a;
  --danger: #dc2626;

  --radius: 14px;
  --shadow: 0 12px 30px rgba(0,0,0,0.08);

  --grid-color: rgba(37,99,235,0.14);
  --glass: rgba(255,255,255,0.6);
}

/* ================= DARK MODE ================= */
html[data-theme="dark"] {
  --bg-main: #0b1220;
  --bg-card: #020617;
  --bg-header: #020617;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;

  --shadow: 0 20px 50px rgba(0,0,0,0.45);
  --glass: rgba(2,6,23,0.6);

  --grid-color: rgba(56,189,248,0.18);
}

/* ================= RESET ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Inter, system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* ================= ANIMATED GRID BACKGROUND ================= */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridMove 40s linear infinite;
  opacity: 0.55;
}

body::after {
  background-image:
    linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridPulse 6s ease-in-out infinite;
  opacity: 0.2;
}

@keyframes gridMove {
  from { background-position: 0 0; }
  to { background-position: 600px 600px; }
}

@keyframes gridPulse {
  0%,100% { opacity: 0.12; }
  50% { opacity: 0.35; }
}

/* ================= LAYER FIX ================= */
header, main, .container, footer { position: relative; z-index: 1; }

/* ================= HEADER ================= */
header {
  background: var(--bg-header);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.navbar {
  max-width: 1200px;
  margin: auto;
  padding: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

.logo span { color: #38bdf8; }

/* ================= NAV ================= */
.nav-links button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.nav-links button:hover { transform: scale(1.15); }

/* ================= HERO ================= */
.hero {
  text-align: center;
  padding: 6rem 1rem;
  background:
    radial-gradient(circle at top, rgba(56,189,248,0.25), transparent 40%),
    linear-gradient(rgba(10,37,64,0.9), rgba(10,37,64,0.95)),
    url("https://images.unsplash.com/photo-1559526324-593bc073d938") center/cover;
  color: white;
}

.hero h1 { font-size: clamp(2.4rem, 5vw, 3.5rem); }

.hero p {
  max-width: 640px;
  margin: 1rem auto;
  opacity: 0.9;
}

/* ================= CTA ================= */
.cta {
  margin-top: 1.5rem;
  padding: 0.9rem 2rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cta:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px rgba(37,99,235,0.4);
}

/* ================= LAYOUT ================= */
.container {
  max-width: 1200px;
  margin: auto;
  padding: 3rem 1rem;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .container { grid-template-columns: 1fr; }
}

/* ================= POSTS ================= */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
  gap: 1.6rem;
}

.post,
.widget,
.create-post {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post:hover { transform: translateY(-8px); }

.post img {
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.post-content { padding: 1.2rem; }

/* ================= BADGES ================= */
.badge {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.ai { background:#e0f2fe; color:#0369a1; }
.badge.market { background:#ede9fe; color:#5b21b6; }
.badge.fintech { background:#ecfeff; color:#155e75; }
.badge.gold { background:#fff7ed; color:#92400e; }

/* ================= FILTERS ================= */
.filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-btn {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid #c7d2fe;
  background: transparent;
  cursor: pointer;
  transition: all 0.25s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  color: white;
}

/* ================= TRADINGVIEW ================= */
.tv-mini,
.tv-block {
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  position: relative;
  margin-bottom: 1rem;
}

.tv-title {
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  color: var(--text-muted);
}

/* ================= WORLD DEBT ================= */
.debt-ribbon {
  padding: 3rem 1rem;
  text-align: center;
}

.debt-frame {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: auto;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 35px 90px rgba(37,99,235,0.3);
}

.debt-frame iframe {
  width: 1110px;
  height: 2450px;
  border: none;
  transform: scale(0.75);
  transform-origin: top left;
}

/* ================= FOOTER ================= */
footer {
  text-align: center;
  padding: 2rem;
  background: var(--bg-header);
  color: white;
  font-size: 0.9rem;
}

/* ================= CURSOR GLOW ================= */
.cursor-glow {
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(37,99,235,0.15), transparent 60%);
  transform: translate(-50%, -50%);
  z-index: -1;
}

/* ================= MOBILE ================= */
button, .filter-btn {
  min-height: 42px;
  min-width: 42px;
}

iframe { max-width: 100%; }
/* ================= ACCESSIBILITY ================= */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ================= LOADING STATES ================= */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(226,232,240,0.6) 25%,
    rgba(226,232,240,0.9) 37%,
    rgba(226,232,240,0.6) 63%
  );
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: var(--radius);
}

@keyframes skeleton {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* ================= NEWS TICKER ================= */
.news-ticker {
  position: sticky;
  top: 64px;
  z-index: 900;
  background: linear-gradient(
    90deg,
    rgba(37,99,235,0.95),
    rgba(14,165,233,0.95)
  );
  color: white;
  overflow: hidden;
}

.news-track {
  display: flex;
  gap: 3rem;
  white-space: nowrap;
  animation: ticker 40s linear infinite;
  padding: 0.6rem 0;
}

.news-track span {
  font-weight: 500;
  opacity: 0.95;
}

@keyframes ticker {
  from { transform: translateX(100%); }
  to { transform: translateX(-100%); }
}

/* ================= COMMUNITY INSIGHTS ================= */
.community {
  display: grid;
  gap: 1.5rem;
}

.insight {
  padding: 1.4rem;
  background: linear-gradient(
    145deg,
    var(--bg-card),
    rgba(37,99,235,0.03)
  );
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}

.insight:hover { transform: translateY(-6px); }

.insight h4 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.insight p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ================= PREMIUM GLASS ================= */
.glass {
  background: var(--glass);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.25);
}

/* ================= ANIMATED METRICS ================= */
.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  background: rgba(37,99,235,0.04);
  font-size: 0.95rem;
}

.metric strong { font-size: 1.05rem; }

.metric.up { color: var(--success); }
.metric.down { color: var(--danger); }

/* ================= FLOATING ACTION ================= */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  box-shadow: 0 20px 40px rgba(37,99,235,0.45);
  cursor: pointer;
  transition: transform 0.25s ease;
  z-index: 1000;
}

.fab:hover { transform: scale(1.1); }

/* ================= SCROLLBAR ================= */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    var(--accent),
    #38bdf8
  );
  border-radius: 999px;
}

/* ================= PRINT ================= */
@media print {
  body::before,
  body::after,
  .cursor-glow,
  .fab,
  .news-ticker {
    display: none !important;
  }

  header, footer {
    background: white !important;
    color: black !important;
  }
}

/* ================= HEADER SUBSCRIBE BUTTON ================= */
.subscribe-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #022c22;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.subscribe-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

/* ================= NEWSLETTER SECTION ================= */
.newsletter-section {
  padding: 4rem 1rem;
  background: linear-gradient(135deg, #020617, #0f172a);
  color: #fff;
  text-align: center;
}

.newsletter-box {
  max-width: 500px;
  margin: auto;
  background: rgba(15, 23, 42, 0.9);
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.newsletter-box input {
  width: 100%;
  padding: 0.9rem;
  border-radius: 10px;
  border: none;
  margin-top: 1rem;
}

.newsletter-box button {
  margin-top: 1rem;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #22c55e, #4ade80);
  color: #022c22;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
}

.email-feedback {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

.email-feedback.error {
  color: #f87171;
}

.email-feedback.success {
  color: #4ade80;
}

/* ================= THANK YOU ================= */
.thank-you {
  display: none;
  margin-top: 1.5rem;
  font-size: 1.1rem;
  animation: fadeUp 0.6s ease;
}

.thank-you span {
  display: block;
  font-size: 0.9rem;
  opacity: 0.8;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================= EXIT POPUP ================= */
.exit-popup {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.exit-box {
  background: #020617;
  color: #fff;
  padding: 2rem;
  border-radius: 18px;
  max-width: 360px;
  text-align: center;
  position: relative;
}

.exit-cta {
  margin-top: 1rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  background: #22c55e;
  font-weight: bold;
}

.exit-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
}
