@charset "utf-8";

/* ═══════════════════════════════════════
   CSS VARIABLES & THEME
   ═══════════════════════════════════════ */
:root {
  --bg: #fafbff;
  --bg-alt: #f0f2fa;
  --text: #1e2030;
  --text-light: #6b7194;
  --primary: #6254e9;
  --primary-light: #a78bfa;
  --accent: #f472b6;
  --accent-warm: #fbbf24;
  --card-bg: #ffffff;
  --card-shadow: 0 8px 30px rgba(98, 84, 233, 0.08);
  --card-shadow-hover: 0 16px 48px rgba(98, 84, 233, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════
   BASE RESET & ROOT
   ═══════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text);
  line-height: 1.7;
  background-color: var(--bg);
  overflow-x: hidden;
}

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

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

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes spin-slow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes typewriter-blink {
  from,
  to {
    border-color: transparent;
  }
  50% {
    border-color: var(--primary);
  }
}

/* ═══════════════════════════════════════
   ANIMATED BACKGROUND PARTICLES (lightweight, CSS only)
   ═══════════════════════════════════════ */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(
      circle at 20% 20%,
      rgba(98, 84, 233, 0.04) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(244, 114, 182, 0.04) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 50% 10%,
      rgba(251, 191, 36, 0.03) 0%,
      transparent 50%
    );
  animation: float 15s ease-in-out infinite;
}

/* ═══════════════════════════════════════
   HERO HEADER
   ═══════════════════════════════════════ */
header {
  position: relative;
  z-index: 1;
  background: linear-gradient(
    135deg,
    #1a1040 0%,
    #1e1860 40%,
    #2d1566 70%,
    #1a1040 100%
  );
  background-size: 300% 300%;
  animation: gradientSlide 12s ease infinite;
  color: #fff;
  padding: 4rem 2rem 3rem;
  text-align: center;
  overflow: hidden;
}

/* Decorative dots pattern overlay */
header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.06) 1px,
    transparent 1px
  );
  background-size: 24px 24px;
  pointer-events: none;
}

/* Floating orbs */
header::after {
  content: "";
  position: absolute;
  top: 30%;
  left: 10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    rgba(167, 139, 250, 0.25) 0%,
    transparent 70%
  );
  border-radius: 50%;
  animation: spin-slow 30s linear infinite;
  pointer-events: none;
}

header h1 {
  position: relative;
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
  text-shadow: 0 0 40px rgba(167, 139, 250, 0.3);
  animation: fadeInUp 0.6s ease both;
}

header > p {
  position: relative;
  margin-top: 0.5rem;
  color: rgba(255, 255, 255, 0.65);
  font-size: 1.15rem;
  font-weight: 300;
  animation: fadeInUp 0.6s ease 0.15s both;
}

/* ═══════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════ */
nav {
  position: relative;
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  animation: fadeInUp 0.6s ease 0.3s both;
}

nav a {
  position: relative;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  transition: all var(--transition-fast);
}

nav a::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-light);
  border-radius: 2px;
  transition: all var(--transition-fast);
  transform: translateX(-50%);
}

nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

nav a:hover::after {
  width: 60%;
}

/* ═══════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════ */
section {
  position: relative;
  z-index: 1;
  padding: 4rem 12%;
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

section h2 {
  position: relative;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
  display: inline-block;
}

section h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 40px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  transition: width var(--transition-smooth);
}

section:hover h2::after {
  width: 80px;
}

/* Alternating alternate background for visual rhythm */
section:nth-of-type(even) {
  background-color: var(--bg-alt);
}

/* ═══════════════════════════════════════
   GRID
   ═══════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
}

/* ═══════════════════════════════════════
   CARDS — with hover animation
   ═══════════════════════════════════════ */
.card {
  position: relative;
  background: var(--card-bg);
  padding: 1.75rem;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(98, 84, 233, 0.06);
  transition: all var(--transition-smooth);
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
}

.card.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Top gradient accent bar */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--accent),
    var(--accent-warm)
  );
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--card-shadow-hover);
  border-color: rgba(98, 84, 233, 0.12);
}

.card:hover::before {
  opacity: 1;
  animation: shimmer 2s linear infinite;
}

.card img {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  transition: transform var(--transition-smooth);
}

.card:hover img {
  transform: scale(1.03);
}

.card h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.card h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.card a {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  position: relative;
  transition: color var(--transition-fast);
}

.card a::after {
  content: " →";
  opacity: 0;
  transform: translateX(-6px);
  transition: all var(--transition-fast);
  display: inline-block;
}

.card a:hover {
  color: var(--accent);
}

.card a:hover::after {
  opacity: 1;
  transform: translateX(2px);
}

/* Meta info inside blog cards */
.card .meta {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.card .date {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */
footer {
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, #1a1040, #1e1860);
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 2.5rem 2rem;
  font-size: 0.9rem;
}

footer a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

footer a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ═══════════════════════════════════════
   BLOG PAGE LAYOUT
   ═══════════════════════════════════════ */
main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 3rem 10%;
  background-color: var(--bg);
  min-height: 80vh;
}

/* Blog page content with unique themes */
#blog-content {
  flex: 1 1 70%;
  max-width: 78%;
  animation: fadeInLeft 0.5s ease both;
}

#blog-content h1,
#blog-title {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

#blog-content p {
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

#blog-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: rgba(98, 84, 233, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-light);
}

/* Sidebar */
aside {
  flex: 1 1 22%;
  min-width: 200px;
  animation: fadeInRight 0.5s ease 0.15s both;
}

aside h3 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

aside ul {
  list-style: none;
  padding: 0;
}

aside li {
  margin-bottom: 0.5rem;
}

aside li a,
aside a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.92rem;
  transition: all var(--transition-fast);
  display: inline-block;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
}

aside li a:hover,
aside a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  transform: translateX(4px);
}

/* ═══════════════════════════════════════
   BLOG-SPECIFIC THEMES (per-page)
   ═══════════════════════════════════════ */

/* Sleep theme — deep indigo / midnight */
body.theme-sleep {
  --primary: #818cf8;
  --primary-light: #a5b4fc;
  --accent: #e0d4ff;
}

body.theme-sleep header {
  background: linear-gradient(135deg, #1a1040 0%, #312e81 50%, #1e1b4b 100%);
}

body.theme-sleep section h2::after,
body.theme-sleep #blog-content blockquote {
  border-left-color: var(--primary);
  background: rgba(129, 140, 248, 0.06);
}

/* Investing theme — emerald / warm */
body.theme-investing {
  --primary: #10b981;
  --primary-light: #34d399;
  --accent: #a7f3d0;
}

body.theme-investing header {
  background: linear-gradient(135deg, #1a2920 0%, #065f46 50%, #064e3b 100%);
}

body.theme-investing section h2::after,
body.theme-investing #blog-content blockquote {
  border-left-color: var(--primary);
  background: rgba(16, 185, 129, 0.06);
}

/* Sample/Data Science theme — amber / warm */
body.theme-sample {
  --primary: #f59e0b;
  --primary-light: #fcd34d;
  --accent: #fef3c7;
}

body.theme-sample header {
  background: linear-gradient(135deg, #1a1505 0%, #78350f 50%, #451a03 100%);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }
  section {
    padding: 3rem 6%;
  }
  section h2 {
    font-size: 1.6rem;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  main {
    flex-direction: column;
    padding: 2rem 6%;
  }
  #blog-content {
    max-width: 100%;
  }
  aside {
    min-width: unset;
  }
}

/* ═══════════════════════════════════════
   REDUCED-MOTION ACCESSIBILITY
   ═══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  html {
    scroll-behavior: auto;
  }
}

code,
pre {
  background-color: #131417; /* Dark theme */
  color: #dfdfdf;
  padding: 1px;
  border-radius: 3px;
  overflow-x: auto; /* Adds scrollbar for long lines */
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.95em;
}
