/* ==========================================================================
   Avnit's Personal Blog — premium dark theme layered on Beautiful Jekyll
   ========================================================================== */

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

:root {
  --bg: #0b0f19;
  --bg-elevated: #111827;
  --card: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(122, 162, 255, 0.45);
  --text: #d7dce8;
  --text-muted: #8b94a9;
  --heading: #f4f6fb;
  --accent: #7aa2ff;
  --accent-2: #22d3ee;
  --gradient: linear-gradient(120deg, #7aa2ff 0%, #22d3ee 60%, #34d399 100%);
  --radius: 16px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

/* ---------- Base ---------- */

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient gradient glow behind the page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 40% at 15% -5%, rgba(122, 162, 255, 0.14), transparent 60%),
    radial-gradient(ellipse 50% 35% at 90% 0%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(ellipse 45% 30% at 50% 110%, rgba(52, 211, 153, 0.07), transparent 60%);
  pointer-events: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--heading);
  letter-spacing: -0.015em;
}

a { color: var(--accent); text-decoration: none; transition: color .18s ease; }
a:hover, a:focus { color: var(--accent-2); text-decoration: none; }

::selection { background: rgba(122, 162, 255, 0.35); color: #fff; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a3348; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3b4763; }

/* ---------- Navbar ---------- */

.navbar-custom {
  background: rgba(11, 15, 25, 0.72) !important;
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.navbar-custom .navbar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.navbar-custom .nav-link {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.83rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text) !important;
  position: relative;
}

.navbar-custom .nav-link::after {
  content: "";
  position: absolute;
  left: 1rem; right: 1rem; bottom: 0.35rem;
  height: 2px;
  background: var(--gradient);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}

.navbar-custom .nav-link:hover { color: var(--heading) !important; }
.navbar-custom .nav-link:hover::after { transform: scaleX(1); }

.navbar-custom .navbar-toggler { border-color: rgba(255,255,255,0.2); }
.navbar-custom .dropdown-menu {
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}
.navbar-custom .dropdown-item { color: var(--text); }
.navbar-custom .dropdown-item:hover { background: rgba(122,162,255,0.12); color: var(--heading); }

.navbar-custom .avatar-container .avatar-img {
  border: 2px solid rgba(122, 162, 255, 0.6);
  box-shadow: 0 0 18px rgba(122, 162, 255, 0.35);
}

/* ---------- Page / post headers ---------- */

.intro-header .page-heading h1,
.intro-header .post-heading h1 {
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-bottom: 0.1em;
}

.intro-header .page-subheading,
.intro-header .post-subheading {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.05rem;
}

.intro-header hr.small {
  border-color: transparent;
  border-top: 2px solid;
  border-image: var(--gradient) 1;
  width: 64px;
}

.intro-header .post-meta { color: var(--text-muted); }

/* ---------- Home feed: widen the column, lay posts out as a card grid ---------- */

.container-md:has(.posts-list) { max-width: 1200px; }

div[class*="col-"]:has(> .posts-list),
div[class*="col-"]:has(.posts-list) {
  flex: 0 0 100%;
  max-width: 100%;
  margin-left: 0;
}

.posts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.4rem;
  margin-top: 1.2rem;
}

.posts-list .post-preview {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 1.5rem 1.6rem;
  background: var(--card);
  border: 1px solid var(--card-border) !important;
  border-radius: var(--radius);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease, background .22s ease;
}

.posts-list .post-preview:hover {
  transform: translateY(-4px);
  border-color: var(--card-hover-border) !important;
  background: rgba(122, 162, 255, 0.05);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(122, 162, 255, 0.12);
}

.posts-list .post-preview article { display: flex; flex-direction: column; height: 100%; }

.posts-list .post-title {
  font-size: 1.22rem;
  font-weight: 600;
  color: var(--heading);
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

.posts-list .post-preview a:hover .post-title { color: var(--accent); }

.posts-list .post-subtitle {
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
  line-height: 1.45;
}

.posts-list .post-meta {
  order: -1;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 0.75rem;
}

.posts-list .post-entry {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  opacity: 0.85;
}

.post-read-more {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.posts-list .post-image img { border-radius: 12px; }

/* Tag pills */

.blog-tags { margin-top: auto; padding-top: 0.9rem; font-size: 0.75rem; color: var(--text-muted); }
.blog-tags > span { display: none; }

.blog-tags a {
  display: inline-block;
  padding: 0.22rem 0.7rem;
  margin: 0.15rem 0.2rem 0 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: rgba(122, 162, 255, 0.10);
  border: 1px solid rgba(122, 162, 255, 0.25);
  border-radius: 999px;
  transition: all .18s ease;
}

.blog-tags a:hover {
  background: rgba(34, 211, 238, 0.15);
  border-color: rgba(34, 211, 238, 0.5);
  color: var(--accent-2);
}

/* ---------- Post pages ---------- */

article.blog-post { font-size: 1.02rem; line-height: 1.75; }

article.blog-post h1, article.blog-post h2, article.blog-post h3 { margin-top: 2rem; }

article.blog-post blockquote {
  border-left: 3px solid;
  border-image: var(--gradient) 1;
  background: var(--card);
  color: var(--text-muted);
  padding: 0.8rem 1.2rem;
  border-radius: 0 12px 12px 0;
}

article.blog-post img { border-radius: 12px; max-width: 100%; }

.box-success, .box-warning, .box-error, .box-note { border-radius: 12px; }

/* Code — dark, readable */

code, pre, .highlight {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

code {
  background: rgba(122, 162, 255, 0.12);
  color: #a5c0ff;
  padding: 0.15em 0.45em;
  border-radius: 6px;
}

pre, .highlight, .highlight pre {
  background: #0d1322 !important;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: #d7dce8;
}

pre { padding: 1.1rem 1.3rem; overflow-x: auto; }
pre code { background: transparent; color: inherit; padding: 0; }

/* Minimal dark syntax palette for Rouge */
.highlight .c, .highlight .c1, .highlight .cm { color: #64748b; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr { color: #c4b5fd; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb { color: #86efac; }
.highlight .mi, .highlight .mf, .highlight .m { color: #fbbf24; }
.highlight .nf, .highlight .nc, .highlight .nn { color: #7aa2ff; }
.highlight .o, .highlight .p { color: #94a3b8; }
.highlight .n, .highlight .na, .highlight .nb { color: #d7dce8; }
.highlight .err { color: #f87171; background: transparent; }

/* Tables */

table { border-collapse: collapse; }
table th, table td { border: 1px solid var(--card-border) !important; padding: 0.5rem 0.9rem; }
table th { background: var(--bg-elevated); color: var(--heading); }
table tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }

/* ---------- Pagination ---------- */

.pagination .page-link {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
}

.pagination .page-link:hover {
  background: rgba(122, 162, 255, 0.12);
  border-color: var(--card-hover-border);
  color: var(--heading);
}

/* ---------- Search ---------- */

#nav-search-input {
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 999px;
}

#search-results-container li a { color: var(--text); }

/* ---------- Footer ---------- */

footer {
  background: transparent !important;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

footer .footer-links a { color: var(--text-muted); }
footer .footer-links a:hover { color: var(--accent-2); }
footer p.copyright, footer .theme-by { color: var(--text-muted) !important; }

/* ---------- Small screens ---------- */

@media (max-width: 576px) {
  .posts-list { grid-template-columns: 1fr; }
  .navbar-custom { background: rgba(11, 15, 25, 0.95) !important; }
}
