/* ============================================
   Blog Post Styles — Terminal Cartography
   Monochrome theme matching portfolio
   ============================================ */

/* --- Design Tokens --- */
.blog-post-page {
  --bp-bg: #060606;
  --bp-bg-card: rgba(255, 255, 255, 0.03);
  --bp-text: #f0f0f0;
  --bp-text-secondary: #777777;
  --bp-text-tertiary: #444444;
  --bp-accent: #00d4ff;
  --bp-accent-dim: rgba(0, 212, 255, 0.15);
  --bp-line: rgba(255, 255, 255, 0.12);
  --bp-line-strong: rgba(255, 255, 255, 0.25);
  --bp-code-bg: #0c0c0c;
  --bp-code-border: rgba(255, 255, 255, 0.08);
  --bp-font-display: "Darker Grotesque", sans-serif;
  --bp-font-mono: "IBM Plex Mono", "SF Mono", "Fira Code", monospace;
}

/* --- Base --- */
.blog-post-page {
  background-color: var(--bp-bg);
  margin: -30px;
  padding: 0 30px 60px;
  font-family: var(--bp-font-mono);
}

.page-content:has(.blog-post-page) {
  background-color: #060606;
}

body:has(.blog-post-page) {
  background-color: #060606;
}

body:has(.blog-post-page) .site-header {
  background-color: rgba(6, 6, 6, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

body:has(.blog-post-page) .site-header .site-title,
body:has(.blog-post-page) .site-header .site-title:visited {
  color: #f0f0f0;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 400;
}

body:has(.blog-post-page) .site-header .site-nav .page-link {
  color: #777777;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body:has(.blog-post-page) .site-header .site-nav .page-link:hover {
  color: #f0f0f0;
}

body:has(.blog-post-page) .site-footer {
  background-color: #060606;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #444444;
}

body:has(.blog-post-page) .site-footer a {
  color: #777777;
}

body:has(.blog-post-page) .site-footer a:hover {
  color: #00d4ff;
}

/* --- Entrance Animation --- */
@keyframes bp-fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bp-animate {
  opacity: 0;
  animation: bp-fadeInUp 500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* --- Back Navigation --- */
.bp-nav-back {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 0 0;
}

.bp-nav-back__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--bp-font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bp-text-tertiary);
  text-decoration: none;
  transition: color 200ms ease;
}

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

.bp-nav-back__link svg {
  transition: transform 200ms ease;
}

.bp-nav-back__link:hover svg {
  transform: translateX(-3px);
}

/* --- Article Container --- */
.bp-article {
  max-width: 720px;
  margin: 0 auto;
}

/* --- Article Header --- */
.bp-header {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--bp-line);
  margin-bottom: 48px;
}

.bp-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.bp-category {
  display: inline-block;
  font-family: var(--bp-font-mono);
  font-size: 0.625rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bp-accent);
  border: 1px solid rgba(0, 212, 255, 0.3);
  padding: 3px 10px;
}

.bp-title {
  font-family: var(--bp-font-display);
  font-size: 3rem;
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--bp-text);
  margin: 0 0 20px;
}

.bp-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  font-family: var(--bp-font-mono);
  font-size: 0.6875rem;
  color: var(--bp-text-tertiary);
  letter-spacing: 0.04em;
}

.bp-meta__sep {
  margin: 0 10px;
  color: rgba(255, 255, 255, 0.12);
}

.bp-meta__reading-time,
.bp-meta__author {
  color: var(--bp-text-tertiary);
}

/* --- Content Typography --- */
.bp-content {
  max-width: 720px;
  margin: 0 auto;
}

.bp-content p {
  font-family: var(--bp-font-mono);
  font-size: 0.9375rem;
  line-height: 1.85;
  color: var(--bp-text-secondary);
  margin-bottom: 1.5em;
}

.bp-content h2 {
  font-family: var(--bp-font-display);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--bp-text);
  margin-top: 2.5em;
  margin-bottom: 0.75em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--bp-line);
}

.bp-content h3 {
  font-family: var(--bp-font-display);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--bp-text);
  margin-top: 2em;
  margin-bottom: 0.6em;
}

.bp-content h4 {
  font-family: var(--bp-font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--bp-text);
  margin-top: 1.75em;
  margin-bottom: 0.5em;
}

.bp-content a {
  color: var(--bp-accent);
  text-decoration: underline;
  text-decoration-color: rgba(0, 212, 255, 0.3);
  text-underline-offset: 3px;
  transition:
    text-decoration-color 200ms ease,
    color 200ms ease;
}

.bp-content a:hover {
  color: #ffffff;
  text-decoration-color: var(--bp-accent);
}

/* Lists */
.bp-content ul,
.bp-content ol {
  font-family: var(--bp-font-mono);
  font-size: 0.9375rem;
  line-height: 1.85;
  color: var(--bp-text-secondary);
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

.bp-content li {
  margin-bottom: 0.4em;
}

.bp-content li::marker {
  color: var(--bp-text-tertiary);
}

.bp-content ul ul,
.bp-content ol ol,
.bp-content ul ol,
.bp-content ol ul {
  margin-bottom: 0.4em;
  margin-top: 0.4em;
}

/* Blockquotes */
.bp-content blockquote {
  margin: 1.75em 0;
  padding: 20px 24px;
  border-left: 1px solid var(--bp-accent);
  background: var(--bp-bg-card);
  font-style: italic;
}

.bp-content blockquote p {
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--bp-text-secondary);
  margin-bottom: 0;
}

.bp-content blockquote p + p {
  margin-top: 1em;
}

/* Images */
.bp-content img {
  max-width: 100%;
  height: auto;
  margin: 2em 0;
  display: block;
  border: 1px solid var(--bp-line);
}

/* Horizontal Rules */
.bp-content hr {
  border: none;
  height: 1px;
  background: var(--bp-line);
  margin: 3em auto;
  max-width: 120px;
}

/* Tables */
.bp-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75em 0;
  font-family: var(--bp-font-mono);
  font-size: 0.8125rem;
}

.bp-content thead th {
  background: var(--bp-bg-card);
  color: var(--bp-text);
  font-weight: 500;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bp-line-strong);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.6875rem;
}

.bp-content tbody td {
  padding: 10px 16px;
  color: var(--bp-text-secondary);
  border-bottom: 1px solid var(--bp-line);
}

.bp-content tbody tr:hover {
  background: var(--bp-bg-card);
}

/* --- Inline Code --- */
.bp-content code {
  font-family: var(--bp-font-mono);
  font-size: 0.875em;
  background: var(--bp-code-bg);
  color: var(--bp-accent);
  padding: 2px 7px;
  border: 1px solid var(--bp-code-border);
}

/* --- Code Blocks --- */
.bp-content figure.highlight {
  margin: 1.75em 0;
}

.bp-content pre {
  background: var(--bp-code-bg);
  border: 1px solid var(--bp-code-border);
  padding: 24px;
  margin: 1.75em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bp-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #abb2bf;
}

/* --- Syntax Highlighting --- */
.blog-post-page .highlight {
  background: var(--bp-code-bg);
  border: 1px solid var(--bp-code-border);
  overflow: hidden;
}

.blog-post-page .highlight pre {
  margin: 0;
  border: none;
}

.blog-post-page .highlight .c,
.blog-post-page .highlight .cm,
.blog-post-page .highlight .c1,
.blog-post-page .highlight .cs,
.blog-post-page .highlight .cp {
  color: #555555;
  font-style: italic;
}

.blog-post-page .highlight .k,
.blog-post-page .highlight .kd,
.blog-post-page .highlight .kn,
.blog-post-page .highlight .kp,
.blog-post-page .highlight .kr,
.blog-post-page .highlight .kt,
.blog-post-page .highlight .kc {
  color: #c678dd;
}

.blog-post-page .highlight .s,
.blog-post-page .highlight .s1,
.blog-post-page .highlight .s2,
.blog-post-page .highlight .sb,
.blog-post-page .highlight .sc,
.blog-post-page .highlight .sd,
.blog-post-page .highlight .se,
.blog-post-page .highlight .sh,
.blog-post-page .highlight .sx {
  color: #98c379;
}

.blog-post-page .highlight .si {
  color: #d19a66;
}

.blog-post-page .highlight .sr {
  color: #56b6c2;
}

.blog-post-page .highlight .nf,
.blog-post-page .highlight .nx {
  color: #61afef;
}

.blog-post-page .highlight .mi,
.blog-post-page .highlight .mf,
.blog-post-page .highlight .mh,
.blog-post-page .highlight .mo,
.blog-post-page .highlight .il {
  color: #d19a66;
}

.blog-post-page .highlight .o,
.blog-post-page .highlight .ow {
  color: #56b6c2;
}

.blog-post-page .highlight .n,
.blog-post-page .highlight .nb,
.blog-post-page .highlight .ni,
.blog-post-page .highlight .nl,
.blog-post-page .highlight .nn {
  color: #abb2bf;
}

.blog-post-page .highlight .bp {
  color: #e06c75;
}

.blog-post-page .highlight .nc,
.blog-post-page .highlight .no {
  color: #e5c07b;
}

.blog-post-page .highlight .nd {
  color: #61afef;
}

.blog-post-page .highlight .na {
  color: #d19a66;
}

.blog-post-page .highlight .nt {
  color: #e06c75;
}

.blog-post-page .highlight .nv,
.blog-post-page .highlight .vi,
.blog-post-page .highlight .vg,
.blog-post-page .highlight .vc {
  color: #e06c75;
}

.blog-post-page .highlight .gd {
  color: #e06c75;
  background: rgba(224, 108, 117, 0.08);
}

.blog-post-page .highlight .gi {
  color: #98c379;
  background: rgba(152, 195, 121, 0.08);
}

.blog-post-page .highlight .ge {
  font-style: italic;
}

.blog-post-page .highlight .gs {
  font-weight: bold;
}

.blog-post-page .highlight .p {
  color: #abb2bf;
}

.blog-post-page .highlight .w {
  color: #abb2bf;
}

.blog-post-page .highlight .err {
  color: #e06c75;
}

.blog-post-page .highlight .lineno {
  color: #333333;
  padding-right: 16px;
  user-select: none;
  -webkit-user-select: none;
}

/* --- Post Navigation --- */
.bp-post-nav {
  max-width: 720px;
  margin: 64px auto 0;
  display: flex;
  gap: 1px;
}

.bp-post-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  background: transparent;
  border: 1px solid var(--bp-line);
  text-decoration: none;
  transition:
    border-color 200ms ease,
    background 200ms ease;
}

.bp-post-nav__item:hover {
  border-color: var(--bp-line-strong);
  background: var(--bp-bg-card);
}

.bp-post-nav__label {
  font-family: var(--bp-font-mono);
  font-size: 0.625rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bp-text-tertiary);
}

.bp-post-nav__title {
  font-family: var(--bp-font-display);
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--bp-text);
  transition: color 200ms ease;
}

.bp-post-nav__item:hover .bp-post-nav__title {
  color: var(--bp-accent);
}

.bp-post-nav__next {
  text-align: right;
  margin-left: auto;
}

/* --- Footer Divider --- */
.bp-footer-divider {
  max-width: 720px;
  margin: 64px auto 0;
  text-align: center;
}

.bp-divider {
  width: 48px;
  height: 1px;
  background: var(--bp-line-strong);
  margin: 0 auto;
}

/* --- Responsive: Tablet --- */
@media (max-width: 860px) {
  .bp-title {
    font-size: 2.2rem;
  }

  .bp-content h2 {
    font-size: 1.6rem;
  }

  .bp-content h3 {
    font-size: 1.3rem;
  }
}

/* --- Responsive: Mobile --- */
@media (max-width: 600px) {
  .blog-post-page {
    margin: -15px;
    padding: 0 15px 40px;
  }

  .bp-nav-back {
    padding-top: 24px;
  }

  .bp-header {
    padding: 32px 0 28px;
    margin-bottom: 32px;
  }

  .bp-title {
    font-size: 1.8rem;
  }

  .bp-content p,
  .bp-content ul,
  .bp-content ol {
    font-size: 0.875rem;
    line-height: 1.8;
  }

  .bp-content h2 {
    font-size: 1.4rem;
    margin-top: 2em;
  }

  .bp-content h3 {
    font-size: 1.2rem;
  }

  .bp-content pre {
    padding: 16px;
    margin-left: -15px;
    margin-right: -15px;
    border-left: none;
    border-right: none;
  }

  .bp-content pre code {
    font-size: 0.75rem;
  }

  .bp-content blockquote {
    padding: 16px 18px;
    margin-left: 0;
    margin-right: 0;
  }

  .bp-post-nav {
    flex-direction: column;
    margin-top: 48px;
  }

  .bp-post-nav__next {
    text-align: left;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .bp-animate {
    opacity: 1;
    animation: none;
  }

  .bp-nav-back__link svg,
  .bp-post-nav__item,
  .bp-content a {
    transition: none;
  }
}
