@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #7c3aed;
  --accent-light: #f5f3ff;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --header-bg: #0f172a;
  --header-height: 64px;
  --online: #22c55e;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
  --shadow-md: 0 10px 15px rgba(0,0,0,.07), 0 4px 6px rgba(0,0,0,.05);
  --radius: 12px;
  --radius-sm: 8px;
  --t: .2s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p  { margin-bottom: 1em; }

/* ── Layout ────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  padding: 32px 0 56px;
}
@media (max-width: 1024px) { .layout { grid-template-columns: 1fr; } }

/* ── Read Progress ─────────────────────────────────────────── */
#read-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 9999; transition: width .1s linear;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  background: var(--header-bg);
  position: sticky; top: 0; z-index: 100;
  height: var(--header-height);
  box-shadow: 0 2px 20px rgba(0,0,0,.35);
}
.header-inner {
  display: flex; align-items: center;
  justify-content: space-between;
  height: 100%; gap: 24px;
}
.site-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.logo-icon svg { width: 20px; height: 20px; fill: white; }
.logo-text { font-size: 1.2rem; font-weight: 700; color: white; letter-spacing: -.5px; }
.logo-text span { color: #60a5fa; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  color: #94a3b8; font-size: .875rem; font-weight: 500;
  padding: 6px 14px; border-radius: 6px; transition: var(--t);
}
.site-nav a:hover, .site-nav a.active { color: white; background: rgba(255,255,255,.1); }
.header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.online-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.25);
  color: #4ade80; font-size: .78rem; font-weight: 600;
  padding: 5px 12px; border-radius: 20px; white-space: nowrap;
}
.online-dot {
  width: 7px; height: 7px; background: var(--online);
  border-radius: 50%; animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(.85); }
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; transition: var(--t);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover {
  background: var(--primary-dark); transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
}
.btn-ghost {
  background: rgba(255,255,255,.1); color: white;
  border: 1px solid rgba(255,255,255,.15);
}
.btn-ghost:hover { background: rgba(255,255,255,.18); }
.btn svg { width: 16px; height: 16px; }

/* ── Hero (index) ──────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  padding: 60px 0; overflow: hidden; position: relative;
}
.hero::before {
  content: ''; position: absolute; top: -50%; right: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(37,99,235,.3) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner {
  display: grid; grid-template-columns: 1fr auto;
  gap: 40px; align-items: center; position: relative; z-index: 1;
}
@media (max-width: 768px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-illustration { display: none; }
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(37,99,235,.3); border: 1px solid rgba(96,165,250,.4);
  color: #93c5fd; font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 4px 12px; border-radius: 20px; margin-bottom: 16px;
}
.hero-title {
  color: white; font-size: clamp(1.5rem, 3vw, 2.3rem);
  margin-bottom: 16px; line-height: 1.2;
}
.hero-title span { color: #60a5fa; }
.hero-excerpt { color: #94a3b8; font-size: .95rem; line-height: 1.7; margin-bottom: 26px; max-width: 540px; }
.hero-meta { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.hero-meta-item { display: flex; align-items: center; gap: 6px; color: #94a3b8; font-size: .8rem; }
.hero-meta-item svg { width: 14px; height: 14px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.hero-author { display: flex; align-items: center; gap: 10px; }
.hero-author .avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); }
.hero-author-name { color: white; font-size: .875rem; font-weight: 600; }
.hero-author-role { color: #64748b; font-size: .75rem; }
.hero-illustration { width: 260px; flex-shrink: 0; }

/* ── Section Headers ───────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px;
}
.section-title {
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: ''; display: block; width: 4px; height: 20px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px;
}
.section-link {
  color: var(--primary); font-size: .8rem; font-weight: 500;
  display: flex; align-items: center; gap: 4px; transition: var(--t);
}
.section-link:hover { gap: 8px; }
.section-link svg { width: 14px; height: 14px; }

/* ── Tags (shared) ─────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: #eff6ff; color: #2563eb;
  font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 3px 9px; border-radius: 20px;
}
.tag-purple  { background: #f5f3ff; color: #7c3aed; }
.tag-green   { background: #f0fdf4; color: #16a34a; }
.tag-orange  { background: #fff7ed; color: #c2410c; }
.tag-red     { background: #fef2f2; color: #dc2626; }
.tag-teal    { background: #f0fdfa; color: #0d9488; }

/* ── Avatar helpers ────────────────────────────────────────── */
.avatar { display: block; border-radius: 50%; object-fit: cover; }
.av-init {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700; color: white; flex-shrink: 0;
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--header-bg); color: #64748b;
  padding: 48px 0 24px; margin-top: 0;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px;
}
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand .logo-text { font-size: 1.1rem; margin-bottom: 12px; display: block; }
.footer-brand p { font-size: .82rem; line-height: 1.65; color: #475569; max-width: 240px; }
.footer-col h4 { color: #94a3b8; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; }
.footer-col a {
  display: block; color: #475569; font-size: .82rem; padding: 4px 0;
  transition: var(--t);
}
.footer-col a:hover { color: #94a3b8; }
.footer-bottom {
  border-top: 1px solid #1e293b; padding-top: 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .78rem; color: #334155; flex-wrap: wrap; gap: 8px;
}
.footer-bottom a { color: #475569; transition: var(--t); }
.footer-bottom a:hover { color: #64748b; }
