/* ==================== CORE VARIABLES & BASE ==================== */
:root {
  --bg: #fff;
  --text: #0b1220;
  --muted: #556070;
  --stroke: #e3e7ef;
  --card: #f6f7fb;
  --shadow: 0 10px 24px rgba(0,0,0,.1);
  --shadow-lg: 0 16px 36px rgba(0,0,0,.15);
  --radius: 8px;
}

html[data-theme="dark"], :root[data-theme="dark"] {
  --bg:#161b22;
  --text:#e8eef7;
  --muted:#a9b4c8;
  --stroke:#29313b;
  --card:#0f141a;
  --shadow:0 10px 24px rgba(0,0,0,.55);
  --shadow-lg:0 16px 36px rgba(0,0,0,.65);
}

html, body {
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==================== LAYOUT ==================== */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  padding: 48px 0 24px;
}

.section-title {
  font-size: 32px;
  line-height: 1.2;
  margin: 0 0 18px;
}

/* ==================== NAVBAR ==================== */
.navbar {
  background: linear-gradient(90deg, #0a1931 0%, #102a55 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 2000;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  min-height: 56px;
}

@media (max-width:768px){
  .navbar { position: relative; }
}

.brand, .site-title {
  font-weight: 800;
  font-size: 22px;
  color: #fff;
}

.nav-menu { display: flex; gap: 24px; }

.nav-link {
  color: #e4ebfa;
  font-weight: 600;
}

/* ==================== HERO ==================== */
.hero {
  padding: 56px 0 24px;
  display: grid;
  place-items: center;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 520px);
  gap: 1.5rem;
  align-items: center;
}

.hero-copy h1 {
  font-size: 42px;
  line-height: 1.1;
  margin: 0 0 12px;
}

.hero-lead {
  color: var(--muted);
  font-size: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  background: #e8f0ff;
  color: #1d6ef2;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.hero-media {
  justify-self: end;
  inline-size: min(520px, 40vw);
  aspect-ratio: 2/1;
}

.hero-media img {
  width: 80%;
  height: 100%;
  object-fit: contain;
}

@media (max-width:768px){
  .hero-grid { grid-template-columns: 1fr; }
  .hero-media { display: none !important; }
}

/* ==================== BUTTONS ==================== */
.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 12px;
  font-weight: 700;
}

.btn-primary {
  background: #2d7cff;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 40px 0;
}

/* ==================== TOPICS GRID ==================== */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  padding: 20px 0;
}

.topic-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(45,124,255,.08);
}

.topic-title {
  font-size: 18px;
  font-weight: 600;
}

.topic-description {
  font-size: 14px;
  color: #64748b;
}

/* ==================== ADS (HOME ONLY) ==================== */
.ad-header {
  min-height: 90px;
  margin: 16px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

@media (max-width:768px){
  .ad-header { min-height: 60px; }
}


/* ==================== TOPICS GRID ==================== */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  padding: 20px 0;
}

.topic-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
  border: 1px solid #e8edff;
  border-radius: 20px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(45, 124, 255, 0.08);
  text-decoration: none;
}

.topic-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #2d7cff, #6c8eff);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.topic-card:hover {
  transform: translateY(-6px);
  border-color: #2d7cff;
  box-shadow: 0 12px 32px rgba(45, 124, 255, 0.15);
}

.topic-card:hover::before { transform: scaleX(1); }

.topic-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2d7cff 0%, #6c8eff 100%);
  color: white; font-size: 24px; flex-shrink: 0;
}

.topic-title { font-size: 18px; font-weight: 600; color: #1a2b4c; margin-bottom: 4px; color:var(--text); text-decoration: none;}
.topic-description { font-size: 14px; color: #64748b; line-height: 1.5; text-decoration: none;}

/* Meta & Stats (from old.css) */
.topic-meta {
  display: flex; align-items: center; gap: 16px;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid #f1f5f9;
}
.topic-stat { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #64748b; }


.category-icon {
  font-size: 1.6rem; width: 3.2rem; height: 3.2rem;
  border-radius: 0.75rem; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; color: white;
}


html[data-theme="dark"] .topic-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
  text-decoration: none;
}


/* ==================== MODERN THEORY GRID ==================== */
.section-theory {
  padding: 60px 0;
  background: linear-gradient(to bottom, var(--bg), var(--card)); /* Subtle fade */
}

.theory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 32px; /* Breathing room */
}

.theory-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--stroke);
  border-radius: 24px; /* More rounded = more modern */
  padding: 32px;
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
  height: 100%;
}

/* Hover Effect: Lift & Shadow */
.theory-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  border-color: #2d7cff;
}

/* The Decorative Number (Watermark style) */
.theory-number {
  font-size: 80px;
  font-weight: 900;
  line-height: 1;
  position: absolute;
  top: -10px;
  right: -10px;
  opacity: 0.06; /* Very subtle */
  color: var(--text);
  z-index: 0;
  transition: all 0.4s ease;
}

.theory-card:hover .theory-number {
  opacity: 0.1;
  transform: scale(1.1);
  color: #2d7cff;
}

.theory-content {
  position: relative; /* Stays above the number */
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.theory-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #2d7cff;
  margin-bottom: 12px;
}

.theory-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
  color: var(--text);
}

.theory-excerpt {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 24px;
  flex-grow: 1;
}

/* The "Read More" Link */
.theory-link {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  color: #2d7cff;
  text-decoration: none;
  margin-top: auto; /* Pushes to bottom */
  font-size: 15px;
}

.theory-link i {
  margin-left: 6px;
  transition: transform 0.3s ease;
}

.theory-card:hover .theory-link i {
  transform: translateX(6px); /* Arrow slides right on hover */
}

/* Full card clickable area hack */
.theory-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* Dark Mode Adjustments */
html[data-theme="dark"] .theory-card {
  background: var(--card); /* Slightly lighter than bg */
  border-color: var(--stroke);
}



/* ==================== MODERN VIDEO GRID ==================== */
.section-videos {
  padding: 60px 0;
  background: var(--bg); /* Keeps the background clean */
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Responsive grid */
  gap: 32px;
}

.video-card {
  background: var(--bg);
  border: 1px solid var(--stroke);
  border-radius: 24px; /* Matches Theory cards */
  overflow: hidden; /* Ensures video corners are rounded */
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.video-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  border-color: #2d7cff;
}

/* The Video Container (Top Half) */
.video-frame {
  position: relative;
  border-bottom: 1px solid var(--stroke);
  background: #000; /* Fallback color */
}

/* The Text Content (Bottom Half) */
.video-content {
  padding: 24px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.video-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 16px;
  color: var(--text);
}

.video-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--card);
  padding: 6px 12px;
  border-radius: 50px;
}

.video-action {
  font-size: 14px;
  font-weight: 700;
  color: #2d7cff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-card:hover .video-action i {
  transform: translateX(4px);
  transition: transform 0.3s ease;
}