:root {
  --key-bg: #f8fafc;
  --key-border: #cbd5e1;
  --key-active: #0ea5e9;
  --key-text: #0f172a;
  --brand-ink: #0f172a;
  --brand-muted: #475569;
  --brand-accent: #10b981;
  --brand-accent-dark: #047857;
  --brand-sky: #0284c7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border-soft: #e2e8f0;
}

body {
  font-family: "Poppins", "Segoe UI", sans-serif;
  color: var(--brand-ink);
  background: linear-gradient(180deg, #f8fbff 0%, #f2f6fb 100%);
}

/* Public shell */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid #1f2937;
  background: linear-gradient(90deg, #0b1220 0%, #111827 100%);
  box-shadow: 0 8px 30px rgba(2, 6, 23, 0.45);
}

.site-header-inner,
.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.site-header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  /*color: #ffffff;*/
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-brand-badge img {
  height: 54px;
  width: auto;
  display: block;
}

.site-nav {
  display: none;
  align-items: center;
  gap: 1.1rem;
}

.site-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
}

.site-nav a:hover {
  color: #ffffff;
}

/* Dropdown Navigation */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.5rem 0;
}

.nav-dropdown:hover {
  color: #ffffff;
}

.nav-dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 0.75rem;
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.nav-dropdown:hover .nav-dropdown-content {
  display: flex;
}

.nav-dropdown-content a {
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-dropdown-content a i {
  width: 16px;
  text-align: center;
  font-size: 0.9rem;
  color: #94a3b8;
}

.nav-dropdown-content a:hover {
  background: #1e293b;
  color: #ffffff;
}

.nav-dropdown-content a:hover i {
  color: #38bdf8;
}

.site-admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: #ffffff;
  border: 1px solid #16a34a;
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
}

.site-admin-link:hover {
  background: linear-gradient(180deg, #16a34a 0%, #166534 100%);
}

.site-footer {
  margin-top: 3.5rem;
  border-top: 1px solid #1f2937;
  background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
  color: #cbd5e1;
}

.site-footer-inner {
  padding-top: 2.2rem;
  padding-bottom: 2.2rem;
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.25rem;
}

.site-footer h4,
.site-footer .site-brand-name {
  color: #ffffff;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.site-footer a {
  color: #cbd5e1;
  text-decoration: none;
}

.site-footer a:hover {
  color: #86efac;
}

/* Shared modern cards */
.surface-card {
  border: 1px solid var(--border-soft);
  background: var(--surface);
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

.surface-card:hover {
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}

/* Home page */
.home-hero {
  border-radius: 1.5rem;
  border: 1px solid #1e293b;
  color: #ffffff;
  background: linear-gradient(135deg, #0b1220 0%, #164e63 52%, #065f46 100%);
  padding: 2.5rem 2rem;
}

.home-hero p {
  color: #d1fae5;
}

.home-premium-hero {
  border: 1px solid #1f2937;
  background:
    radial-gradient(circle at 12% 18%, rgba(14, 165, 233, 0.32), transparent 36%),
    radial-gradient(circle at 88% 82%, rgba(16, 185, 129, 0.25), transparent 34%),
    linear-gradient(130deg, #050b18 0%, #0f172a 42%, #0b3a4a 100%);
  box-shadow: 0 22px 65px rgba(2, 6, 23, 0.4);
}

.home-premium-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.8;
  pointer-events: none;
}

.home-premium-orb-a {
  width: 220px;
  height: 220px;
  top: -70px;
  left: -30px;
  background: rgba(56, 189, 248, 0.35);
}

.home-premium-orb-b {
  width: 240px;
  height: 240px;
  right: -60px;
  bottom: -90px;
  background: rgba(52, 211, 153, 0.34);
}

.home-glass-card {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1rem;
  padding: 0.95rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.62) 0%, rgba(15, 23, 42, 0.42) 100%);
  backdrop-filter: blur(4px);
}

.home-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.5);
}

.home-tools-grid,
.home-model-grid {
  display: grid;
  gap: 1rem;
}

.home-tools-grid {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.home-model-grid {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

/* Blog list */
.blog-hero {
  border-radius: 1.7rem;
  border: 1px solid #1f2937;
  background: linear-gradient(135deg, #0b1220 0%, #1e3a8a 50%, #065f46 100%);
  color: #ffffff;
  padding: 2.6rem 2rem;
  box-shadow: 0 16px 45px rgba(2, 6, 23, 0.35);
}

.blog-hero p {
  color: #dbeafe;
}

.blog-featured {
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.blog-featured-media {
  position: relative;
  min-height: 260px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #ffffff;
  padding: 1.4rem;
}

.blog-featured-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-featured-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.2) 0%, rgba(2, 6, 23, 0.55) 100%);
}

.blog-featured-media>* {
  position: relative;
  z-index: 1;
}

.blog-featured-body {
  padding: 1.4rem;
}

.blog-compact-list {
  display: grid;
  gap: 0.9rem;
}

.blog-compact-item {
  border: 1px solid var(--border-soft);
  background: #ffffff;
  border-radius: 0.95rem;
  padding: 1rem;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

.blog-card {
  border: 1px solid var(--border-soft);
  background: #ffffff;
  border-radius: 1rem;
  overflow: hidden;
}

.blog-card-cover {
  height: 160px;
  background: linear-gradient(135deg, #1e293b 0%, #0ea5e9 100%);
}

.blog-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Blog detail */
.post-hero {
  border-radius: 1.5rem;
  overflow: hidden;
  border: 1px solid #1f2937;
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 50%, #166534 100%);
  color: #ffffff;
  padding: 2.6rem 2rem;
  position: relative;
}

.post-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
}

.post-hero>* {
  position: relative;
  z-index: 1;
}

.post-layout {
  margin-top: 2rem;
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.post-content {
  border: 1px solid var(--border-soft);
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.35rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.article-content {
  color: #334155;
  line-height: 1.8;
}

.article-content h2,
.article-content h3 {
  color: #0f172a;
  margin-top: 1.4rem;
  margin-bottom: 0.6rem;
  font-weight: 700;
  line-height: 1.3;
}

.article-content h2 {
  font-size: 1.5rem;
}

.article-content h3 {
  font-size: 1.18rem;
}

.article-content p {
  margin-bottom: 0.9rem;
}

.article-content ul,
.article-content ol {
  margin: 0.85rem 0 0.95rem 1.2rem;
}

.article-content a {
  color: #0ea5e9;
  text-decoration: underline;
}

.article-content img {
  width: 100%;
  height: auto;
  margin: 1rem 0;
  border-radius: 0.8rem;
  border: 1px solid #e2e8f0;
}

.post-side {
  border: 1px solid var(--border-soft);
  background: #ffffff;
  border-radius: 1rem;
  padding: 1rem;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 4px;
  z-index: 70;
  background: linear-gradient(90deg, #10b981 0%, #0284c7 100%);
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.45);
}

.toc-link.active {
  background: #ecfeff;
  color: #0369a1;
  font-weight: 700;
}

.kb-row {
  display: flex;
  gap: 0.375rem;
  flex-wrap: nowrap;
}

.kb-spacer {
  min-width: 1.5rem;
  width: 1.5rem;
  height: 2.6rem;
  pointer-events: none;
}

.kb-key {
  min-width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--key-border);
  background: var(--key-bg);
  color: var(--key-text);
  border-radius: 0.625rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 120ms ease;
}

.kb-key.active {
  background: var(--key-active);
  border-color: var(--key-active);
  color: #ffffff;
  transform: translateY(-1px);
}

.kb-key.w2 {
  min-width: 4.8rem;
}

.kb-key.w3 {
  min-width: 6.8rem;
}

.kb-key.w4 {
  min-width: 9rem;
}

@media (max-width: 768px) {
  .kb-spacer {
    min-width: 0.5rem;
    width: 0.5rem;
    height: 2.2rem;
  }

  .kb-key {
    min-width: 2.1rem;
    height: 2.2rem;
    font-size: 0.65rem;
  }

  .kb-key.w2 {
    min-width: 3.6rem;
  }

  .kb-key.w3 {
    min-width: 5rem;
  }

  .kb-key.w4 {
    min-width: 6.4rem;
  }
}

/* Tailwind v3 color compatibility helpers */
.bg-slate-50 {
  background-color: #f8fafc !important;
}

.bg-slate-100 {
  background-color: #f1f5f9 !important;
}

.bg-slate-200 {
  background-color: #e2e8f0 !important;
}

.bg-slate-300 {
  background-color: #cbd5e1 !important;
}

.bg-slate-700 {
  background-color: #334155 !important;
}

.bg-slate-800 {
  background-color: #1e293b !important;
}

.bg-slate-900 {
  background-color: #0f172a !important;
}

.bg-slate-950 {
  background-color: #020617 !important;
}

.text-slate-50 {
  color: #f8fafc !important;
}

.text-slate-100 {
  color: #f1f5f9 !important;
}

.text-slate-200 {
  color: #e2e8f0 !important;
}

.text-slate-300 {
  color: #cbd5e1 !important;
}

.text-slate-400 {
  color: #94a3b8 !important;
}

.text-slate-500 {
  color: #64748b !important;
}

.text-slate-600 {
  color: #475569 !important;
}

.text-slate-700 {
  color: #334155 !important;
}

.text-slate-800 {
  color: #1e293b !important;
}

.text-slate-900 {
  color: #0f172a !important;
}

.border-slate-100 {
  border-color: #f1f5f9 !important;
}

.border-slate-200 {
  border-color: #e2e8f0 !important;
}

.border-slate-300 {
  border-color: #cbd5e1 !important;
}

.border-slate-700 {
  border-color: #334155 !important;
}

.bg-sky-50 {
  background-color: #f0f9ff !important;
}

.bg-sky-500 {
  background-color: #0ea5e9 !important;
}

.bg-sky-600 {
  background-color: #0284c7 !important;
}

.bg-sky-700 {
  background-color: #0369a1 !important;
}

.text-sky-100 {
  color: #e0f2fe !important;
}

.text-sky-200 {
  color: #bae6fd !important;
}

.text-sky-600 {
  color: #0284c7 !important;
}

.text-sky-700 {
  color: #0369a1 !important;
}

.border-sky-200 {
  border-color: #bae6fd !important;
}

.border-sky-300 {
  border-color: #7dd3fc !important;
}

.bg-cyan-50 {
  background-color: #ecfeff !important;
}

.bg-cyan-600 {
  background-color: #0891b2 !important;
}

.bg-cyan-900 {
  background-color: #164e63 !important;
}

.text-cyan-100 {
  color: #cffafe !important;
}

.text-cyan-200 {
  color: #a5f3fc !important;
}

.bg-emerald-50 {
  background-color: #ecfdf5 !important;
}

.bg-emerald-100 {
  background-color: #d1fae5 !important;
}

.bg-emerald-500 {
  background-color: #10b981 !important;
}

.bg-emerald-600 {
  background-color: #059669 !important;
}

.text-emerald-600 {
  color: #059669 !important;
}

.text-emerald-700 {
  color: #047857 !important;
}

.border-emerald-200 {
  border-color: #a7f3d0 !important;
}

.bg-amber-100 {
  background-color: #fef3c7 !important;
}

.text-amber-600 {
  color: #d97706 !important;
}

.text-amber-700 {
  color: #b45309 !important;
}

.bg-rose-50 {
  background-color: #fff1f2 !important;
}

.bg-rose-100 {
  background-color: #ffe4e6 !important;
}

.bg-rose-600 {
  background-color: #e11d48 !important;
}

.text-rose-600 {
  color: #e11d48 !important;
}

.text-rose-700 {
  color: #be123c !important;
}

.border-rose-200 {
  border-color: #fecdd3 !important;
}

.hover\:bg-slate-50:hover {
  background-color: #f8fafc !important;
}

.hover\:bg-slate-100:hover {
  background-color: #f1f5f9 !important;
}

.hover\:bg-slate-800:hover {
  background-color: #1e293b !important;
}

.hover\:bg-sky-700:hover {
  background-color: #0369a1 !important;
}

.hover\:text-sky-600:hover {
  color: #0284c7 !important;
}

/* Admin theme tuning */
.admin-theme {
  background: radial-gradient(circle at top right, #1e293b 0%, #0b1220 45%, #020617 100%);
}

.admin-theme main {
  color: #0f172a;
}

.admin-theme .admin-surface {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
}

.blog-hero-overlay {
  background:
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.35), transparent 45%),
    radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.30), transparent 40%);
}

@media (min-width: 768px) {
  .site-nav {
    display: inline-flex;
  }

  .site-footer-inner {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .home-tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-model-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-content {
    padding: 2rem;
  }
}

@media (min-width: 1024px) {
  .home-tools-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .home-model-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .blog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .post-layout {
    grid-template-columns: 1fr 320px;
  }
}