:root {
  --s99-dark:    #0d1117;
  --s99-accent:  #3fb950;
  --s99-card-bg: #ffffff;
}

body {
  background: #f0f2f5;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #1a1a2e;
}

/* ── Navbar ── */
.navbar { background: var(--s99-dark) !important; }
.navbar-brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -.5px;
  color: #fff !important;
}
.navbar-brand .accent { color: var(--s99-accent); }
.navbar .nav-link { color: rgba(255,255,255,.8) !important; font-size: .9rem; }
.navbar .nav-link:hover,
.navbar .nav-link.active { color: var(--s99-accent) !important; }
.dropdown-menu { background: #161b22; border: 1px solid #30363d; }
.dropdown-item { color: rgba(255,255,255,.75); font-size: .875rem; }
.dropdown-item:hover { background: #21262d; color: #fff; }

/* ── Post cards ── */
.post-card {
  background: var(--s99-card-bg);
  border: 1px solid #dee2e6;
  border-radius: .75rem;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
  /* Required so Bootstrap's stretched-link ::after is contained inside
     the card and cannot bleed over the sidebar or adjacent elements. */
  position: relative;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.12);
}
/* Lift every link inside a card above the stretched-link ::after overlay
   (z-index:1), so category badges, tag pills, and image links remain
   independently clickable. */
.post-card a:not(.stretched-link) {
  position: relative;
  z-index: 2;
}
.post-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.post-card-img-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #0d1117 0%, #1a2035 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--s99-accent);
}

/* ── Post detail ── */
.post-featured-img {
  width: 100%;
  height: auto;
  border-radius: .75rem;
  display: block;
}
article.post-content {
  font-size: 1.05rem;
  line-height: 1.8;
}
article.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: .5rem;
  margin: 1rem 0;
}
article.post-content h1 { font-size: 1.2rem; }
article.post-content h2 { font-size: 1.15rem; }
article.post-content h3 { font-size: 1.1rem; }
article.post-content h4,
article.post-content h5,
article.post-content h6 { font-size: 1rem; }
article.post-content h1,
article.post-content h2,
article.post-content h3,
article.post-content h4,
article.post-content h5,
article.post-content h6 {
  margin-top: 1.5rem;
  margin-bottom: .5rem;
  font-weight: 700;
  line-height: 1.5;
}
article.post-content pre {
  background: var(--s99-dark);
  color: #e6edf3;   /* always light text — pre bg is always dark */
  border-radius: .5rem;
  overflow-x: auto;
  border: 1px solid #30363d;
}
article.post-content code:not(pre code) {
  background: #f0f2f5;
  color: #d63384;
  padding: .15em .4em;
  border-radius: .3rem;
  font-size: .9em;
}
article.post-content blockquote {
  border-left: 4px solid var(--s99-accent);
  padding: .75rem 1.25rem;
  background: #f8f9fa;
  border-radius: 0 .375rem .375rem 0;
  color: #555;
}
article.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
article.post-content th,
article.post-content td {
  border: 1px solid #dee2e6;
  padding: .5rem .75rem;
}
article.post-content th { background: #f0f2f5; font-weight: 600; }

/* ── Sidebar ── */
.sidebar-widget {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: .75rem;
}
.sidebar-widget .widget-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6c757d;
}
.tag-badge {
  font-size: .72rem;
  font-weight: 500;
  padding: .3em .65em;
  border-radius: 2rem;
  background: #f0f2f5;
  color: #1a1a2e;
  border: 1px solid #dee2e6;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.tag-badge:hover {
  background: var(--s99-accent);
  color: #fff;
  border-color: var(--s99-accent);
}

/* ── Category badge ── */
.cat-badge {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: rgba(63,185,80,.15);
  color: #1a7f37;
  border-radius: 2rem;
  padding: .25em .75em;
  text-decoration: none;
}
.cat-badge:hover { background: var(--s99-accent); color: #fff; }

/* ── Pagination ── */
.page-link { color: var(--s99-dark); border-radius: .375rem !important; margin: 0 .15rem; }
.page-item.active .page-link { background: var(--s99-dark); border-color: var(--s99-dark); }
.page-link:hover { background: #e9ecef; color: var(--s99-dark); }

/* ── Footer ── */
footer { background: var(--s99-dark); }
footer a { color: rgba(255,255,255,.6); text-decoration: none; }
footer a:hover { color: var(--s99-accent); }

/* ── Skill badges (hero / about section) ── */
.skill-badge {
  background: rgba(63,185,80,.12);
  color: #1a7f37;
  border: 1px solid rgba(63,185,80,.28);
  font-weight: 500;
}
[data-bs-theme="dark"] .skill-badge { color: var(--s99-accent); }

/* ── Hero code block ── */
.hero-code {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: .5rem;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: .78rem;
  line-height: 1.7;
  color: #e6edf3;
  min-width: 230px;
}

/* ── Category card hover ── */
.category-card { transition: transform .15s ease, box-shadow .15s ease; }
.category-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 .35rem 1rem rgba(0,0,0,.1);
}

/* ── Theme toggle button ── */
#theme-toggle { color: rgba(255,255,255,.75); font-size: 1rem; line-height: 1; }
#theme-toggle:hover { color: var(--s99-accent) !important; }

/* ── Category strip — always dark background, always light links ── */
.cat-strip .nav-link { color: rgba(255,255,255,.75) !important; }
.cat-strip .nav-link:hover { color: var(--s99-accent) !important; }

/* ── Dark mode overrides ── */
[data-bs-theme="dark"] body {
  background: #0d1117;
  color: #e6edf3;
}
[data-bs-theme="dark"] .post-card {
  background: #161b22;
  border-color: #30363d;
}
[data-bs-theme="dark"] .post-card:hover {
  box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.45);
}
[data-bs-theme="dark"] .sidebar-widget {
  background: #161b22;
  border-color: #30363d;
}
[data-bs-theme="dark"] .sidebar-widget .widget-title { color: #8b949e; }
[data-bs-theme="dark"] .tag-badge {
  background: #21262d;
  color: #c9d1d9;
  border-color: #30363d;
}
[data-bs-theme="dark"] .tag-badge:hover {
  background: var(--s99-accent);
  color: #000;
  border-color: var(--s99-accent);
}
[data-bs-theme="dark"] .cat-badge { color: var(--s99-accent); }
[data-bs-theme="dark"] .page-link {
  background: #161b22;
  border-color: #30363d;
  color: #c9d1d9;
}
[data-bs-theme="dark"] .page-item.active .page-link {
  background: var(--s99-accent);
  border-color: var(--s99-accent);
  color: #000;
}
[data-bs-theme="dark"] .page-link:hover { background: #21262d; color: #e6edf3; }
[data-bs-theme="dark"] article.post-content code:not(pre code) {
  background: #21262d;
  color: #ff7b72;
}
[data-bs-theme="dark"] article.post-content blockquote {
  background: #161b22;
  color: #8b949e;
}
[data-bs-theme="dark"] article.post-content th { background: #21262d; }
[data-bs-theme="dark"] article.post-content th,
[data-bs-theme="dark"] article.post-content td { border-color: #30363d; }

/* ── Cookie consent banner ── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0d1117;
  border-top: 2px solid var(--s99-accent);
  z-index: 1055;
  box-shadow: 0 -4px 24px rgba(0,0,0,.45);
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.cookie-banner.show { transform: translateY(0); }
.cookie-banner a { color: var(--s99-accent); }
.cookie-banner a:hover { opacity: .85; }
#cookie-accept {
  background: var(--s99-accent);
  color: #000;
  border: none;
  min-width: 110px;
  font-weight: 600;
}
#cookie-accept:hover { opacity: .88; }

/* Bootstrap utility classes that don't auto-adapt in dark mode */
[data-bs-theme="dark"] .text-dark { color: #c9d1d9 !important; }
[data-bs-theme="dark"] .bg-white { background-color: #161b22 !important; }
[data-bs-theme="dark"] .bg-light { background-color: #21262d !important; color: #c9d1d9 !important; }
[data-bs-theme="dark"] .btn-outline-secondary { color: #8b949e; border-color: #30363d; }
[data-bs-theme="dark"] .btn-outline-secondary:hover { background-color: #21262d; color: #e6edf3; border-color: #8b949e; }
