/* =====================================================
   AI Concepts Playground — Custom Styles
   ===================================================== */

/* Base font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* =====================================================
   CSS Custom Properties
   ===================================================== */

:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  /* Brand */
  --color-primary:       #6366f1;
  --color-primary-light: #818cf8;
  --color-primary-dark:  #4f46e5;

  /* Card accent colors + RGB equivalents */
  --card-violet-hex: #7c3aed; --card-violet-rgb: 124,58,237;
  --card-blue-hex:   #2563eb; --card-blue-rgb:   37,99,235;
  --card-yellow-hex: #d97706; --card-yellow-rgb: 217,119,6;
  --card-green-hex:  #059669; --card-green-rgb:  5,150,105;
  --card-teal-hex:   #0d9488; --card-teal-rgb:   13,148,136;
  --card-orange-hex: #ea580c; --card-orange-rgb: 234,88,12;
  --card-red-hex:    #dc2626; --card-red-rgb:    220,38,38;
  --card-pink-hex:   #db2777; --card-pink-rgb:   219,39,119;
}

/* =====================================================
   Global Reset & Base
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
html.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* =====================================================
   Navigation
   ===================================================== */

#navbar {
  background: transparent;
  transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

#navbar.nav-scrolled {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.07);
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

html.dark #navbar.nav-scrolled {
  background: rgba(15,23,42,0.88);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}

/* Nav link colour shift when scrolled */
#navbar.nav-scrolled .nav-link       { color: #475569; }
#navbar.nav-scrolled .nav-logo-text  { color: #1e293b; }
#navbar.nav-scrolled .nav-dark-btn   { color: #64748b; }

html.dark #navbar.nav-scrolled .nav-link      { color: #94a3b8; }
html.dark #navbar.nav-scrolled .nav-logo-text { color: #f1f5f9; }
html.dark #navbar.nav-scrolled .nav-dark-btn  { color: #94a3b8; }

/* =====================================================
   Hero Section
   ===================================================== */

.bg-hero {
  background: linear-gradient(145deg, #0d0d1a 0%, #130f2e 40%, #0a1628 70%, #0d0d1a 100%);
}
html:not(.dark) .bg-hero {
  background: linear-gradient(145deg, #f0f4ff 0%, #ede9fe 40%, #e0f2fe 70%, #f0fdf4 100%);
}
html:not(.dark) .hero-blob { opacity: 0.18; }
html:not(.dark) .hero-gradient-text {
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 35%, #0ea5e9 65%, #059669 100%);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
html:not(.dark) #heroSubtitle { color: rgba(15,23,42,0.55); }
html:not(.dark) .hero-pill {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.2);
  color: #4f46e5;
}
html:not(.dark) .hero-tag {
  background: rgba(99,102,241,0.06);
  border-color: rgba(99,102,241,0.15);
  color: #6366f1;
}
html:not(.dark) .hero-cursor { color: #6366f1; }
html:not(.dark) .absolute.bottom-0 { background: linear-gradient(to top, rgba(240,244,255,0.8), transparent); }

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  animation: blobFloat 8s ease-in-out infinite;
}
.hero-blob-1 { width: 520px; height: 520px; background: radial-gradient(circle, #7c3aed, #4f46e5); top: -120px; left: -100px; animation-delay: 0s; }
.hero-blob-2 { width: 400px; height: 400px; background: radial-gradient(circle, #0ea5e9, #6366f1); top: 40px; right: -80px; animation-delay: -3s; }
.hero-blob-3 { width: 300px; height: 300px; background: radial-gradient(circle, #10b981, #0ea5e9); bottom: -60px; left: 40%; animation-delay: -5s; }

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -30px) scale(1.05); }
  66%       { transform: translate(-15px, 20px) scale(0.97); }
}

/* Animated gradient headline */
.hero-gradient-text {
  background: linear-gradient(135deg, #c084fc 0%, #818cf8 35%, #38bdf8 65%, #34d399 100%);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 5s ease-in-out infinite;
}

@keyframes gradientShift {
  0%,100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.hero-brain-spin { display: inline-block; animation: brainPop 3s ease-in-out infinite; }
@keyframes brainPop {
  0%,100% { transform: scale(1) rotate(0deg); }
  30%      { transform: scale(1.25) rotate(-8deg); }
  60%      { transform: scale(1.1) rotate(6deg); }
}

.hero-cursor {
  display: inline-block;
  color: #818cf8;
  animation: cursorBlink 0.9s step-end infinite;
  font-weight: 100;
}
@keyframes cursorBlink { 0%,100%{opacity:1} 50%{opacity:0} }

.hero-tag-pop {
  animation: tagPop 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes tagPop {
  0%   { transform: scale(0.7); opacity: 0; }
  70%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.hero-pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 1rem; border-radius: 9999px;
  font-size: 0.8rem; font-weight: 600;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.07);
}

.hero-tag {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.75rem; border-radius: 9999px;
  font-size: 0.75rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.05);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  cursor: default;
}
.hero-tag:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); transform: translateY(-2px); }


/* =====================================================
   Section Utilities
   ===================================================== */

.gradient-text {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 1rem;
  background: linear-gradient(135deg,
    rgba(99,102,241,0.1),
    rgba(139,92,246,0.1));
  border: 1px solid rgba(99,102,241,0.22);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #6366f1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html.dark .section-badge {
  background: linear-gradient(135deg,
    rgba(99,102,241,0.16),
    rgba(139,92,246,0.16));
  border-color: rgba(99,102,241,0.32);
  color: #a78bfa;
}

/* =====================================================
   Topic Cards
   ===================================================== */

/* Per-colour CSS variables (set on .card-* class) */
.card-violet { --accent: var(--card-violet-hex); --accent-rgb: var(--card-violet-rgb); }
.card-blue   { --accent: var(--card-blue-hex);   --accent-rgb: var(--card-blue-rgb); }
.card-yellow { --accent: var(--card-yellow-hex); --accent-rgb: var(--card-yellow-rgb); }
.card-green  { --accent: var(--card-green-hex);  --accent-rgb: var(--card-green-rgb); }
.card-teal   { --accent: var(--card-teal-hex);   --accent-rgb: var(--card-teal-rgb); }
.card-orange { --accent: var(--card-orange-hex); --accent-rgb: var(--card-orange-rgb); }
.card-red    { --accent: var(--card-red-hex);    --accent-rgb: var(--card-red-rgb); }
.card-pink   { --accent: var(--card-pink-hex);   --accent-rgb: var(--card-pink-rgb); }

.topic-card {
  background: #ffffff;
  border-radius: 1.25rem;
  padding: 1.5rem;
  border: 1px solid rgba(0,0,0,0.06);
  border-left: 4px solid var(--accent, #6366f1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05), 0 4px 18px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease;
}

/* Top-edge shimmer on hover */
.topic-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent, #6366f1), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.topic-card:hover { transform: translateY(-8px) scale(1.01); }
.topic-card:hover { box-shadow: 0 20px 60px rgba(0,0,0,0.11), 0 6px 22px rgba(0,0,0,0.06); }
.topic-card:hover::before { opacity: 1; }

html.dark .topic-card {
  background: #1e293b;
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3), 0 4px 18px rgba(0,0,0,0.2);
}

html.dark .topic-card:hover {
  box-shadow: 0 20px 60px rgba(0,0,0,0.45), 0 6px 22px rgba(0,0,0,0.3);
}

/* Card Icon */
.card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.875rem;
  background: rgba(var(--accent-rgb, 99,102,241), 0.1);
  color: var(--accent, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.3s ease, background 0.25s ease;
}

.topic-card:hover .card-icon {
  background: rgba(var(--accent-rgb, 99,102,241), 0.18);
}

/* Card text */
.card-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

html.dark .card-title { color: #f1f5f9; }

.card-description {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.65;
}

html.dark .card-description { color: #94a3b8; }

/* Meta row */
.card-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

/* =====================================================
   Badges
   ===================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-beginner     { background: #dcfce7; color: #15803d; }
.badge-intermediate { background: #fef9c3; color: #a16207; }
.badge-advanced     { background: #fee2e2; color: #b91c1c; }

html.dark .badge-beginner     { background: rgba(21,128,61,0.18);  color: #4ade80; }
html.dark .badge-intermediate { background: rgba(161,98,7,0.18);   color: #facc15; }
html.dark .badge-advanced     { background: rgba(185,28,28,0.18);  color: #f87171; }

.badge-soon {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  background: rgba(99,102,241,0.08);
  color: #6366f1;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 0.375rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html.dark .badge-soon {
  background: rgba(99,102,241,0.14);
  color: #a78bfa;
  border-color: rgba(99,102,241,0.28);
}

.badge-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.6rem;
  font-weight: 600;
  background: rgba(148,163,184,0.08);
  color: #94a3b8;
  border: 1px dashed rgba(148,163,184,0.3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =====================================================
   Card Button
   ===================================================== */

.card-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  transition: all 0.25s ease;
}

.card-btn-active {
  background: var(--accent, #6366f1);
  color: #ffffff;
}

.card-btn-active:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(var(--accent-rgb, 99,102,241), 0.4);
}

.card-btn-disabled {
  background: rgba(148,163,184,0.1);
  color: #94a3b8;
  cursor: default;
}

html.dark .card-btn-disabled {
  background: rgba(148,163,184,0.07);
  color: #475569;
}

/* =====================================================
   Global Buttons
   ===================================================== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(99,102,241,0.38);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.48);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: rgba(99,102,241,0.08);
  color: #6366f1;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: 9999px;
  border: 1px solid rgba(99,102,241,0.22);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  background: rgba(99,102,241,0.14);
  transform: translateY(-2px);
}

/* =====================================================
   Glassmorphism
   ===================================================== */

.glass {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.14);
}

html.dark .glass {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(255,255,255,0.06);
}

/* =====================================================
   Scroll Indicator
   ===================================================== */

.scroll-dot {
  animation: scrollBounce 2.2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%,100% { transform: translateY(0);   opacity: 1; }
  50%      { transform: translateY(13px); opacity: 0.25; }
}

/* =====================================================
   Misc Animations
   ===================================================== */

@keyframes float {
  0%,100% { transform: translateY(0px); }
  50%      { transform: translateY(-10px); }
}

@keyframes pulseGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.45); }
  50%      { box-shadow: 0 0 0 14px rgba(99,102,241,0); }
}

.animate-float     { animation: float 6s ease-in-out infinite; }
.animate-pulse-glow { animation: pulseGlow 2s cubic-bezier(0,0,0.2,1) infinite; }

/* =====================================================
   Module Page — 2-column layout
   ===================================================== */

/* Playground (left) + Visualization/Stats (right) */
.pg-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  align-items: start;
}

@media (min-width: 900px) {
  .pg-grid {
    grid-template-columns: minmax(0, 56%) 1fr;
  }
}

.pg-grid-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Remove bottom margin from cards inside the grid (gap handles spacing) */
.pg-grid > section,
.pg-grid-right > section {
  margin-bottom: 0 !important;
}

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 640px) {
  .topic-card:hover { transform: translateY(-4px) scale(1.005); }
}

/* =====================================================
   Tooltip System
   ===================================================== */

.aip-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.aip-tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(99,102,241,0.1);
  color: #6366f1;
  font-size: 10px; font-weight: 800;
  cursor: help;
  transition: background 0.18s;
  border: 1.5px solid rgba(99,102,241,0.22);
  flex-shrink: 0;
  user-select: none;
}
.aip-tooltip-trigger:hover { background: rgba(99,102,241,0.22); }

.aip-tooltip-box {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px; max-width: 250px;
  padding: 0.6rem 0.875rem;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.8rem; font-weight: 400;
  line-height: 1.55;
  border-radius: 0.75rem;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 200;
  white-space: normal;
  text-align: left;
}
.aip-tooltip-box::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
}
.aip-tooltip-wrap:hover .aip-tooltip-box,
.aip-tooltip-wrap:focus-within .aip-tooltip-box {
  opacity: 1;
  transform: translateX(-50%) translateY(-3px);
}
html.dark .aip-tooltip-box { background: #334155; }
html.dark .aip-tooltip-box::after { border-top-color: #334155; }

/* =====================================================
   "Try This" Suggestion Chips
   ===================================================== */

.try-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.try-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  background: rgba(99,102,241,0.07);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 9999px;
  font-size: 0.78rem; font-weight: 600;
  color: #6366f1;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  white-space: nowrap;
}
.try-chip:hover {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.38);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(99,102,241,0.18);
}
.try-chip:active { transform: scale(0.95); }
html.dark .try-chip {
  color: #a78bfa;
  border-color: rgba(167,139,250,0.25);
  background: rgba(99,102,241,0.1);
}
html.dark .try-chip:hover {
  background: rgba(99,102,241,0.22);
  border-color: rgba(167,139,250,0.45);
}

/* =====================================================
   Beginner Tips Panel
   ===================================================== */

.tips-panel {
  border-radius: 1.25rem;
  border: 1.5px solid rgba(99,102,241,0.15);
  background: rgba(99,102,241,0.03);
  overflow: hidden;
  transition: border-color 0.25s;
}
html.dark .tips-panel {
  border-color: rgba(99,102,241,0.2);
  background: rgba(99,102,241,0.05);
}
.tips-panel.open { border-color: rgba(99,102,241,0.28); }

.tips-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
}
.tips-panel-header:hover { background: rgba(99,102,241,0.04); }

.tips-panel-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1);
  padding: 0 1.25rem;
}
.tips-panel.open .tips-panel-body {
  max-height: 500px;
  padding-bottom: 1.25rem;
}

.tips-panel-chevron { transition: transform 0.3s ease; }
.tips-panel.open .tips-panel-chevron { transform: rotate(180deg); }

.tip-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(99,102,241,0.08);
  font-size: 0.875rem;
  line-height: 1.6;
  color: #475569;
}
html.dark .tip-item { color: #94a3b8; }
.tip-item:last-child { border-bottom: none; }

.tip-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
  margin-top: 7px;
}

/* =====================================================
   Typewriter cursor
   ===================================================== */

.aip-cursor::after {
  content: '|';
  margin-left: 1px;
  animation: aip-blink 0.75s step-end infinite;
}
@keyframes aip-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* =====================================================
   Shimmer skeleton
   ===================================================== */

@keyframes aip-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.aip-shimmer {
  background: linear-gradient(90deg,
    rgba(148,163,184,0.1) 25%,
    rgba(148,163,184,0.25) 50%,
    rgba(148,163,184,0.1) 75%
  );
  background-size: 200% auto;
  animation: aip-shimmer 1.4s linear infinite;
}

