/* Blog: editorial "how-to" layout in the portfolio's dark palette. */

.blog {
  --b-bg: #121212;
  --b-surface: #1b1b1b;
  --b-surface-2: #222;
  --b-border: #2c2c2c;
  --b-text: #e8e8e8;
  --b-muted: #9aa0a6;
  --b-accent: #42a5f5;
  --b-accent-strong: #1e88e5;
  --b-radius: 12px;
  --b-max: 1200px;
  background: var(--b-bg);
  color: var(--b-text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body:has(.blog) {
  background: #121212;
}

.blog a {
  color: inherit;
  text-decoration: none;
}

.blog img {
  max-width: 100%;
  display: block;
}

.blog-container {
  width: 100%;
  max-width: var(--b-max);
  margin: 0 auto;
  padding: 0 20px;
}

.blog-main {
  flex: 1;
  padding-bottom: 48px;
}

/* ── Header ───────────────────────────────────────── */
.blog-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--b-border);
}

.blog-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.blog-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.blog-logo__name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.blog-logo__badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  background: var(--b-accent-strong);
  border-radius: 6px;
  padding: 3px 8px;
}

.blog-header__nav {
  display: flex;
  gap: 4px;
}

.blog-header__nav a {
  font-size: 14px;
  font-weight: 600;
  color: var(--b-muted);
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.blog-header__nav a:hover,
.blog-header__nav a.is-active {
  color: #fff;
  background: var(--b-surface-2);
}

.blog-cats {
  border-top: 1px solid var(--b-border);
  background: var(--b-surface);
}

.blog-cats__inner {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.blog-cats__inner::-webkit-scrollbar {
  display: none;
}

.blog-cats a {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--b-muted);
  padding: 12px 14px;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.blog-cats a:hover {
  color: #fff;
}

.blog-cats a.is-active {
  color: #fff;
  border-bottom-color: var(--b-accent);
}

/* ── Shared bits ──────────────────────────────────── */
.post-cat {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--b-accent) !important;
  margin-bottom: 8px;
}

.post-cat:hover {
  text-decoration: underline !important;
}

.post-meta {
  font-size: 13px;
  color: var(--b-muted);
  margin: 0;
}

.block-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--b-border);
  position: relative;
}

.block-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 48px;
  height: 2px;
  background: var(--b-accent);
}

.blog-section {
  margin-top: 56px;
}

/* ── Hero (featured + side list) ──────────────────── */
.blog-hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 32px;
  margin-top: 32px;
}

.hero-post {
  background: var(--b-surface);
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
  overflow: hidden;
}

.hero-post__thumb img {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  transition: transform 0.4s;
}

.hero-post__thumb {
  display: block;
  overflow: hidden;
}

.hero-post:hover .hero-post__thumb img {
  transform: scale(1.03);
}

.hero-post__body {
  padding: 24px 28px 28px;
}

.hero-post__label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: #fff;
  color: #121212;
  border-radius: 4px;
  padding: 3px 8px;
  margin-right: 10px;
}

.hero-post__title {
  font-size: 32px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 4px 0 12px;
  color: #fff;
}

.hero-post__title a:hover,
.post-card__title a:hover,
.post-row__title a:hover {
  color: var(--b-accent);
}

.hero-post__excerpt {
  font-size: 17px;
  line-height: 1.6;
  color: #c4c7ca;
  margin-bottom: 14px;
}

.hero-side .post-row + .post-row {
  border-top: 1px solid var(--b-border);
}

/* ── Compact row card ─────────────────────────────── */
.post-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
}

.post-row__thumb img {
  width: 120px;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 8px;
}

.post-row .post-cat {
  font-size: 11px;
  margin-bottom: 4px;
}

.post-row__title {
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
  margin: 0 0 6px;
  color: #fff;
}

/* ── Topic cards ──────────────────────────────────── */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.topic-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--b-surface);
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
}

.topic-card:hover {
  border-color: var(--b-accent);
  transform: translateY(-3px);
}

.topic-card i {
  font-size: 24px;
  color: var(--b-accent);
  margin-bottom: 6px;
}

.topic-card__name {
  font-weight: 700;
  color: #fff;
}

.topic-card__count {
  font-size: 13px;
  color: var(--b-muted);
}

/* ── Grid card ────────────────────────────────────── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--b-surface);
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.post-card:hover {
  border-color: #3a3a3a;
  transform: translateY(-4px);
}

.post-card__thumb img {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

.post-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 20px 20px;
}

.post-card__title {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 800;
  margin: 0 0 10px;
  color: #fff;
}

.post-card__excerpt {
  font-size: 15px;
  line-height: 1.6;
  color: #b9bcbf;
  flex: 1;
}

/* ── Category page ────────────────────────────────── */
.category-head {
  margin-top: 36px;
}

.category-head h1 {
  font-size: 40px;
  font-weight: 800;
  color: #fff;
  margin: 8px 0;
}

.category-head h1 i {
  color: var(--b-accent);
  font-size: 32px;
  margin-right: 8px;
}

.category-head p {
  color: var(--b-muted);
  font-size: 17px;
}

.blog-empty {
  text-align: center;
  padding: 120px 20px;
}

/* ── Article ──────────────────────────────────────── */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--b-muted);
}

.breadcrumb-nav a {
  color: var(--b-accent) !important;
}

.article-head {
  max-width: 820px;
  margin: 36px auto 0;
}

.article-title {
  font-size: 42px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: #fff;
  margin: 14px 0 14px;
}

.article-dek {
  font-size: 20px;
  line-height: 1.55;
  color: #c4c7ca;
  margin-bottom: 24px;
}

.byline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--b-border);
  border-bottom: 1px solid var(--b-border);
}

.byline__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.byline__name {
  margin: 0 0 2px;
  font-weight: 600;
}

.byline__name a {
  color: #fff !important;
  border-bottom: 1px solid var(--b-accent);
}

.byline .share {
  margin-left: auto;
}

.share {
  display: flex;
  gap: 8px;
}

.share__btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--b-border);
  background: var(--b-surface);
  color: var(--b-text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.share__btn:hover {
  background: var(--b-accent-strong);
  border-color: var(--b-accent-strong);
  color: #fff;
}

.article-cover {
  max-width: 1000px;
  margin: 28px auto 0;
}

.article-cover img {
  width: 100%;
  height: auto;
  border-radius: var(--b-radius);
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 720px) 260px;
  justify-content: center;
  gap: 48px;
  margin-top: 36px;
}

.article-aside {
  position: relative;
}

.toc {
  position: sticky;
  top: 140px;
  background: var(--b-surface);
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
  padding: 18px 18px 12px;
}

.toc__title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 10px;
}

.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
}

.toc a {
  display: flex;
  gap: 8px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--b-muted) !important;
  padding: 7px 0 7px 10px;
  border-left: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.toc a::before {
  content: counter(toc) ".";
  color: #6b7075;
  font-variant-numeric: tabular-nums;
}

.toc a:hover,
.toc a.is-active {
  color: #fff !important;
  border-left-color: var(--b-accent);
}

/* ── Article body typography ─────────────────────── */
.article-body {
  font-size: 18px;
  line-height: 1.75;
  color: #dcdcdc;
  min-width: 0;
}

.article-body > * + * {
  margin-top: 1.1em;
}

.article-body p {
  margin-bottom: 0;
}

.article-body h2 {
  font-size: 28px;
  line-height: 1.25;
  font-weight: 800;
  color: #fff;
  margin-top: 2em;
  margin-bottom: 0;
  scroll-margin-top: 130px;
  position: relative;
}

.article-body h3 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-top: 1.6em;
  margin-bottom: 0;
  scroll-margin-top: 130px;
  position: relative;
}

.heading-anchor {
  position: absolute;
  left: -1.1em;
  color: var(--b-accent) !important;
  opacity: 0;
  transition: opacity 0.2s;
}

.article-body h2:hover .heading-anchor,
.article-body h3:hover .heading-anchor {
  opacity: 1;
}

.article-body a {
  color: var(--b-accent) !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}

.article-body strong {
  color: #fff;
}

.article-body ul,
.article-body ol {
  padding-left: 1.4em;
  margin-bottom: 0;
}

.article-body li + li {
  margin-top: 0.4em;
}

.article-body :not(pre) > code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.85em;
  color: #ffcb8b;
  background: #262626;
  border: 1px solid #333;
  border-radius: 5px;
  padding: 2px 6px;
}

.article-body pre {
  position: relative;
  background: #0d1117;
  border: 1px solid #2b3137;
  border-radius: 10px;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 14.5px;
  line-height: 1.6;
}

.article-body pre code.hljs {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  background: transparent;
  padding: 0;
}

.copy-code {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #c9d1d9;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.article-body pre:hover .copy-code {
  opacity: 1;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--b-border);
  border-radius: 10px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.article-body th,
.article-body td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--b-border);
}

.article-body th {
  background: var(--b-surface-2);
  color: #fff;
  font-weight: 700;
}

.article-body tr:last-child td {
  border-bottom: 0;
}

/* Callouts */
.callout {
  border-radius: 10px;
  padding: 16px 20px;
  border-left: 4px solid;
  background: var(--b-surface);
}

.callout p {
  margin: 0;
}

.callout p + p {
  margin-top: 0.6em;
}

.callout__title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 4px !important;
}

.callout__title::before {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  margin-right: 8px;
}

.callout--tip {
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.08);
}

.callout--tip .callout__title {
  color: #3fb950;
}

.callout--tip .callout__title::before {
  content: "\f0eb"; /* lightbulb */
}

.callout--note {
  border-color: var(--b-accent);
  background: rgba(66, 165, 245, 0.08);
}

.callout--note .callout__title {
  color: var(--b-accent);
}

.callout--note .callout__title::before {
  content: "\f05a"; /* info-circle */
}

.callout--warning {
  border-color: #f0b429;
  background: rgba(240, 180, 41, 0.08);
}

.callout--warning .callout__title {
  color: #f0b429;
}

.callout--warning .callout__title::before {
  content: "\f071"; /* exclamation-triangle */
}

/* ── Article footer ───────────────────────────────── */
.article-foot {
  max-width: 1028px;
  margin: 48px auto 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-size: 13px;
  font-weight: 600;
  color: #90caf9;
  background: rgba(66, 165, 245, 0.1);
  border: 1px solid rgba(66, 165, 245, 0.3);
  border-radius: 999px;
  padding: 5px 12px;
}

.author-box {
  display: flex;
  gap: 20px;
  margin-top: 32px;
  padding: 24px;
  background: var(--b-surface);
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
}

.author-box__photo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-box__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--b-accent);
  margin: 0 0 4px;
}

.author-box__name {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 8px;
}

.author-box__bio {
  color: #c4c7ca;
  line-height: 1.6;
  margin-bottom: 12px;
}

.author-box__links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  font-weight: 600;
}

.author-box__links a {
  color: var(--b-accent) !important;
}

/* ── Footer ───────────────────────────────────────── */
.blog-footer {
  border-top: 1px solid var(--b-border);
  background: var(--b-surface);
  padding: 36px 0 20px;
}

.blog-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.blog-footer__tagline {
  color: var(--b-muted);
  max-width: 420px;
  margin: 10px 0 0;
}

.blog-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  font-size: 14px;
  font-weight: 600;
  color: var(--b-muted);
}

.blog-footer__links a:hover {
  color: #fff;
}

.blog-footer__copy {
  margin-top: 28px;
  font-size: 13px;
  color: #6b7075;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1080px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-aside {
    display: none;
  }
}

@media (max-width: 900px) {
  .blog-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-title {
    font-size: 32px;
  }

  .hero-post__title {
    font-size: 26px;
  }
}

@media (max-width: 600px) {
  .blog-header__nav a {
    padding: 6px 8px;
    font-size: 13px;
  }

  .blog-logo__name {
    font-size: 19px;
  }

  .article-dek {
    font-size: 18px;
  }

  .article-body {
    font-size: 17px;
  }

  .byline .share {
    margin-left: 0;
  }

  .author-box {
    flex-direction: column;
  }

  .heading-anchor {
    display: none;
  }
}

@media (max-width: 420px) {
  .blog-header__nav a[href="/#contact"] {
    display: none;
  }
}

/* Plain quotes (e.g. example review comments) */
.article-body blockquote {
  margin: 0;
  padding: 14px 20px;
  border-left: 4px solid #444;
  background: var(--b-surface);
  border-radius: 0 10px 10px 0;
  color: #cfd2d4;
  font-style: italic;
}

.article-body blockquote p {
  margin: 0;
}

/* In-article images and diagrams */
.article-body img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--b-border);
}

.article-figure {
  margin: 0;
}

.article-figure + * {
  margin-top: 1.4em;
}

.article-figure figcaption {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--b-muted);
  text-align: center;
}

.article-figure a {
  display: block;
  cursor: zoom-in;
  text-decoration: none !important;
}
