/* VARIABLES */

:root {
  --bg: #090c10;

  --surface: #151b23;
  --surface-hover: #1b2430;

  --text: #e6edf3;
  --text-secondary: #8b949e;

  --border: #2d333b;

  --accent: #58a6ff;
  --accent-hover: #79c0ff;

  --shadow:
    0 2px 8px rgba(0,0,0,.2),
    0 20px 40px rgba(0,0,0,.35);
}

/* BASE */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;

  font-family:
    Inter,
    system-ui,
    sans-serif;

  background:
    radial-gradient(
      circle at top,
      rgba(88,166,255,.08),
      transparent 40%
    ),
    var(--bg);

  color: var(--text);

  line-height: 1.7;
}

/* TYPOGRAPHY */

h1, h2, h3, h4, h5, h6 {
  color: white;
  font-weight: 700;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

p {
  color: var(--text);
}

/* LAYOUT */

main {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

@media (max-width: 768px) {
  main {
    padding: 2rem 1rem 4rem;
  }
}

/* NAVBAR */

.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;

  background: rgba(9, 12, 16, 0.85);
  backdrop-filter: blur(16px);

  border-bottom: 1px solid var(--border);
}

.nav-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;

  display: flex;
  align-items: center;

  padding: .9rem 1.5rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .5rem;

  color: white;
  font-weight: 700;
  text-decoration: none;
}

.brand-icon {
  color: var(--accent);
}

.nav-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--accent);
}

.nav-spacer {
  flex: 1;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

.nav-icon {
  width: 34px;
  height: 34px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;

  background: var(--surface);
  border: 1px solid var(--border);

  color: var(--text);
  text-decoration: none;

  font-weight: 700;

  transition: transform .15s ease, background .15s ease;
}

.nav-icon:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
  color: var(--accent);
}

@media (max-width: 768px) {
  .nav-right {
    gap: .75rem;
  }
}

/* HERO */

.hero {
  margin-bottom: 3rem;
}

.hero-subtitle {
  color: var(--text-secondary);
  max-width: 700px;
  font-size: 1.1rem;
}

/* POST CARDS */

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);

  border-radius: 16px;

  box-shadow: var(--shadow);

  transition: transform .15s ease, background .15s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  background: var(--surface-hover);
}

.card-body {
  padding: 1.5rem;
}

.post-date {
  color: var(--text-secondary);
  font-size: .85rem;
  margin-bottom: .5rem;
}

.post-title {
  margin: 0 0 .75rem;
  font-size: 1.35rem;
}

.post-title a {
  color: white;
}

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

.post-excerpt {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* TAGS */

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.tag {
  background: rgba(88,166,255,.12);
  border: 1px solid rgba(88,166,255,.25);

  color: #a8d1ff;

  padding: .35rem .7rem;
  border-radius: 999px;

  font-size: .75rem;
  font-weight: 600;
}

/* SEARCH */

.search-form {
  display: flex;
  align-items: center;
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);

  padding: .5rem .75rem;
  border-radius: 10px;

  outline: none;

  transition: border-color .15s ease, background .15s ease;
}

.search-input:focus {
  border-color: var(--accent);
  background: var(--surface-hover);
}

/* FOOTER */

.footer {
  border-top: 1px solid var(--border);
  margin-top: 5rem;
  padding: 2rem 0;
  color: var(--text-secondary);
}

.footer-inner {
  max-width: 1050px;
  margin: 0 auto;

  display: flex;
  justify-content: space-between;

  padding: 0 1.5rem;
}

.footer-desc {
  color: var(--text-secondary);
  font-size: .9rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 1rem;
}

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

.footer-copy {
  margin-top: .75rem;
  font-size: .8rem;
}

/* CONTENT */

img {
  max-width: 100%;
  border-radius: 14px;
}

.custom-figure {
  margin: 1.5rem auto;
  max-width: 100%;
  display: block;
}

.custom-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto; /* Keeps the actual image centered inside the figure */
}

.custom-figure figcaption {
  font-size: 0.85em;
  color: #666;
  margin-top: 0.5rem;
}

.custom-figure.align-center { text-align: center; }
.custom-figure.align-left   { text-align: left; }
.custom-figure.align-right  { text-align: right; }

.custom-figure.wrap-left {
  float: left;
  margin: 0.5rem 1.5rem 1rem 0;
  max-width: 40%; /* Prevents the image from swallowing the paragraph */
}

.custom-figure.wrap-right {
  float: right;
  margin: 0.5rem 0 1rem 1.5rem;
  max-width: 40%;
}

.custom-figure.wrap-left, .custom-figure.wrap-right {
  clear: both;
}

/* Style the file header tab */
.code-file {
  display: inline-block;
  background: #2d3139;       /* Match this to your syntax theme background */
  color: #abb2bf;            /* Soft text color */
  font-family: monospace;    /* Keeps text matching the code font */
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  border-radius: 4px 4px 0 0; /* Rounded top corners only */
  margin-bottom: -10px;       /* Pulls the code block up to meet the tab */
  position: relative;
  z-index: 1;                /* Keeps it layered perfectly on top */
  border: 1px solid #1e222b;  /* Optional: subtle border */
  border-bottom: none;
}

/* Ensure the code block below it flushes perfectly against the tab */
.code-file + .highlighter-rouge,
.code-file + div[class^="language-"] {
  margin-top: 0 !important;
}

.code-file + .highlighter-rouge pre,
.code-file + div[class^="language-"] pre {
  border-top-left-radius: 0 !important; /* Flattens the top left corner under the tab */
}

code,
pre {
  font-family: "JetBrains Mono", Consolas, monospace !important;
}

p code,
li code {
  display: inline !important;
  float: none !important;
  clear: none !important;
  position: static !important;
  
  background: #1d2633 !important;
  color: #ff7b72 !important;
  padding: 2px 6px !important;
  border-radius: 6px !important;
}

p {
  display: block !important;
}

.highlighter-rouge pre,
.highlighter-rouge code,
figure.highlight pre,
figure.highlight code {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.highlighter-rouge,
figure.highlight {
  position: relative;
  background: #0d1117 !important;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  display: block;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #212529;
  color: #c9d1d9;
  border: 1px solid #495057;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: system-ui, sans-serif;
  cursor: pointer;
  z-index: 100;
  opacity: 0.8;
  transition: opacity 0.2s, background 0.2s;
}

.code-copy-btn:hover {
  opacity: 1;
  background: #343a40;
  color: #fff;
}

/* CODE HIGHLIGHTING */

.highlighter-rouge,
figure.highlight,
.highlight code {
  color: #9cdcfe !important;
}

.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .ow {
  color: #569cd6;
  font-weight: normal;
}

.highlight .kt,
.highlight .nc,
.highlight .no,
.highlight .nn {
  color: #4ec9b0;
}

.highlight .s,
.highlight .s2,
.highlight .s1,
.highlight .sc,
.highlight .dl {
  color: #ce9178;
}

.highlight .c,
.highlight .c1,
.highlight .cm {
  color: #6a9955;
  font-style: italic;
}

.highlight .nf,
.highlight .na,
.highlight .nx {
  color: #dcdcaa;
}

.highlight .nt,
.highlight .nv,
.highlight .bp {
  color: #569cd6;
}

.highlight .py,
.highlight .nd {
  color: #9cdcfe;
}

.highlight .m,
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo {
  color: #b5cea8;
}

.highlight .o,
.highlight .p {
  color: #d4d4d4;
}

.highlight .sr {
  color: #d16969;
}

/* HOMEPAGE LAYOUT */

.home-layout {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .home-layout {
    grid-template-columns: 1fr;
  }
}

/* BLOG PAGE */

.blogs-controls {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1.5fr;
  gap: 1rem;

  background: var(--surface);
  border: 1px solid var(--border);

  padding: 1rem;
  border-radius: 14px;

  margin-bottom: 2rem;
}

.control-group label {
  display: block;
  font-size: .85rem;
  color: var(--text-secondary);
  margin-bottom: .5rem;
}

.control-group select {
  width: 100%;

  background: var(--surface);
  color: var(--text);

  border: 1px solid var(--border);
  border-radius: 10px;

  padding: .5rem .75rem;

  outline: none;

  appearance: none;
  cursor: pointer;
}

.control-group select:focus {
  border-color: var(--accent);
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.filter-tag {
  border: 1px solid var(--border);
  padding: .3rem .6rem;
  border-radius: 999px;

  cursor: pointer;
  color: var(--text-secondary);

  user-select: none;
}

.filter-tag.active {
  border-color: var(--accent);
  color: var(--accent);
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);

  padding: .5rem .75rem;
  border-radius: 10px;

  outline: none;
}

/* BLOG META */

.blog-meta {
  display: flex;
  gap: .5rem;
  margin-top: .3rem;
  flex-wrap: wrap;
}

.mini-tag,
.mini-category {
  font-size: .75rem;
  color: var(--text-secondary);
}

.category-block,
.tag-block {
  margin-bottom: 2rem;
}

/* TAGS PAGE */

.tags-layout {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 2rem;
}

.tag-index {
  list-style: none;
  padding: 0;
}

.tag-index a {
  color: var(--text-secondary);
}

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

/* SEARCH RESULTS */

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;

  margin-top: .5rem;

  overflow: hidden;

  z-index: 999;
}

.search-item {
  display: block;
  padding: .75rem;

  border-bottom: 1px solid var(--border);

  color: var(--text);
  text-decoration: none;
}

.search-item:hover {
  background: var(--surface-hover);
}