/* ============================================================
   benjoco.com blog styles
   Uses the same fonts (/fonts/...) and palette as the main site.
   Independent of base.css/main.css so the blog can't break the home page.
   ============================================================ */
@font-face { font-family: "montserrat-regular"; src: url("/fonts/montserrat/montserrat-regular-webfont.woff2") format("woff2"), url("/fonts/montserrat/montserrat-regular-webfont.woff") format("woff"); font-display: swap; }
@font-face { font-family: "montserrat-bold"; src: url("/fonts/montserrat/montserrat-bold-webfont.woff2") format("woff2"), url("/fonts/montserrat/montserrat-bold-webfont.woff") format("woff"); font-display: swap; }
@font-face { font-family: "librebaskerville-regular"; src: url("/fonts/librebaskerville/librebaskerville-regular-webfont.woff2") format("woff2"), url("/fonts/librebaskerville/librebaskerville-regular-webfont.woff") format("woff"); font-display: swap; }
@font-face { font-family: "librebaskerville-bold"; src: url("/fonts/librebaskerville/librebaskerville-bold-webfont.woff2") format("woff2"), url("/fonts/librebaskerville/librebaskerville-bold-webfont.woff") format("woff"); font-display: swap; }

:root {
  --bc-black: #151515;
  --bc-ink: #161616;
  --bc-muted: #5b5b5b;
  --bc-line: #e1e1e1;
  --bc-paper: #ffffff;
  --bc-soft: #ebebeb;
  --bc-brown: #4c2405;
  --bc-rust: #7c3b08;
  --bc-amber: #f0a359;

  --f-sans: "montserrat-regular", "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --f-sans-bold: "montserrat-bold", "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --f-serif: "librebaskerville-regular", "Libre Baskerville", Georgia, serif;
  --f-serif-bold: "librebaskerville-bold", "Libre Baskerville", Georgia, serif;
  --f-code: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --measure: 70ch;
}

/* ---------- base ---------- */
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
.blog-page {
  margin: 0;
  background: var(--bc-paper);
  color: var(--bc-ink);
  font-family: var(--f-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
.blog-page *, .blog-page *::before, .blog-page *::after { box-sizing: border-box; }
.blog-page a { color: var(--bc-rust); text-underline-offset: 0.2em; }
.blog-page a:hover { color: var(--bc-brown); }
.blog-page a:focus-visible, .blog-page button:focus-visible { outline: 2px solid var(--bc-amber); outline-offset: 3px; }
.blog-wrap { width: min(100% - 3rem, 68rem); margin-inline: auto; }
main:focus { outline: none; }

/* ---------- skip link: hidden until keyboard focus ---------- */
.skip-link {
  position: absolute; top: 0.75rem; left: 0.75rem; z-index: 100;
  padding: 0.75rem 1.1rem; background: #fff; color: var(--bc-black);
  font-family: var(--f-sans-bold); font-size: 0.8rem; letter-spacing: 0.08em; text-decoration: none;
  border-radius: 3px; transform: translateY(-200%); transition: transform 0.15s;
}
.blog-page .skip-link:focus { transform: none; color: var(--bc-black); outline: 2px solid var(--bc-amber); outline-offset: 2px; }

/* ---------- header: logo top-left, quiet uppercase links like the home page menu ---------- */
.blog-bar {
  position: absolute; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(26px + env(safe-area-inset-top, 0px)) 26px 0;
}
.blog-bar__logo {
  display: block; width: 60px; height: 60px;
  background: url("/images/logo.png") no-repeat center / 60px 60px;
}
.blog-bar nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; justify-content: flex-end; }
.blog-page .blog-bar nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--f-sans); font-size: 0.8rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55); text-decoration: none; transition: color 0.3s;
}
.blog-page .blog-bar nav a:hover, .blog-page .blog-bar nav a[aria-current="page"] { color: #fff; }

/* ---------- dark hero band, same treatment as #home ---------- */
.blog-hero {
  position: relative;
  background: var(--bc-black) url("/images/new-bg.jpg") no-repeat center / cover;
  color: #fff;
  padding: calc(9rem + env(safe-area-inset-top, 0px)) 0 5rem;
}
.blog-hero::before { content: ""; position: absolute; inset: 0; background: rgba(5, 5, 5, 0.72); }
.blog-hero > * { position: relative; }
.blog-hero .blog-kicker, .blog-hero .post-category {
  font-family: var(--f-sans-bold); font-size: 0.95rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--bc-amber); margin: 0 0 1rem; line-height: 1.4;
}
.blog-hero .post-category a { color: inherit; text-decoration: none; }
.blog-hero h1 {
  font-family: var(--f-serif-bold); font-weight: 400;
  font-size: clamp(2rem, 4.6vw, 3.1rem); line-height: 1.18; letter-spacing: -0.02em;
  margin: 0 0 1.25rem; max-width: 24ch; text-wrap: balance;
}
.blog-hero p { font-family: var(--f-serif); color: rgba(255, 255, 255, 0.75); font-size: 1.15rem; line-height: 1.7; margin: 0; max-width: 40rem; }
.blog-hero .post-meta { font-family: var(--f-sans); font-size: 0.85rem; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.5); margin-top: 1.5rem; }

.blog-main { padding-top: 3.5rem; }

/* ---------- index ---------- */
.blog-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 2.5rem; padding: 0; list-style: none; }
.blog-page .blog-filters a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--f-sans-bold); font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase;
  padding: 0.6rem 1rem; border: 1px solid var(--bc-line); border-radius: 3px;
  background: var(--bc-paper); color: var(--bc-ink); text-decoration: none;
}
.blog-page .blog-filters a:hover { border-color: var(--bc-black); color: var(--bc-ink); }
.blog-page .blog-filters a[aria-current="page"] { background: var(--bc-black); border-color: var(--bc-black); color: #fff; }


/* ---------- blog call to action, same dark card as the author box ---------- */
.blog-cta {
  margin: 0 0 6rem; padding: 2.5rem 2rem;
  background: var(--bc-black) url("/images/skills-bg.jpg") no-repeat center / cover;
  position: relative; color: #fff; border-radius: 4px; overflow: hidden;
}
.blog-cta::before { content: ""; position: absolute; inset: 0; background: rgba(21, 21, 21, 0.86); }
.blog-cta > * { position: relative; }
.blog-cta h2 { font-family: var(--f-serif-bold); font-weight: 400; font-size: 1.6rem; line-height: 1.3; margin: 0 0 0.6rem; }
.blog-cta p { color: rgba(255, 255, 255, 0.78); margin: 0 0 1.5rem; max-width: var(--measure); }
.blog-empty { padding: 3rem 0; color: var(--bc-muted); }
@media (max-width: 40rem) {

  /* keep the four links on one row at 390px: smaller logo, tighter spacing, 44px touch targets */
  .blog-bar { padding-inline: 18px; gap: 0.75rem; }
  .blog-bar__logo { width: 48px; height: 48px; background-size: 48px 48px; flex-shrink: 0; }
  .blog-bar nav { gap: 0 1rem; }
  .blog-page .blog-bar nav a { font-size: 0.72rem; letter-spacing: 0.12em; }

  /* less empty space above the articles on phones */
  .blog-hero { padding: calc(7rem + env(safe-area-inset-top, 0px)) 0 3rem; }
  .blog-main { padding-top: 2.5rem; }
  .blog-cta { padding: 2rem 1.5rem; }
}

/* ---------- article body ---------- */
.post-body { max-width: var(--measure); min-width: 0; font-size: 1.08rem; line-height: 1.85; padding-bottom: 3rem; }
.post-body h2 { font-family: var(--f-serif-bold); font-weight: 400; font-size: 1.65rem; line-height: 1.3; margin: 2.6em 0 0.7em; }
.post-body h3 { font-family: var(--f-sans-bold); font-size: 1.15rem; line-height: 1.4; margin: 2em 0 0.6em; }
.post-body > :first-child { margin-top: 0; }
.post-body p, .post-body ul, .post-body ol { margin: 0 0 1.3em; }
.post-body li { margin-bottom: 0.45em; }
.post-body strong { font-family: var(--f-sans-bold); font-weight: 400; }
.post-body blockquote {
  margin: 1.8em 0; padding: 1rem 1.25rem; background: #faf6f2;
  border-left: 3px solid var(--bc-rust); font-family: var(--f-serif); color: #3a2a1d;
}
.post-body blockquote p:last-child { margin: 0; }
.post-body :not(pre) > code { font-family: var(--f-code); font-size: 0.86em; background: #f3f0ec; padding: 0.12em 0.4em; border-radius: 3px; color: var(--bc-brown); }
.post-body pre {
  position: relative;
  font-family: var(--f-code); font-size: 0.88rem; line-height: 1.65;
  background: var(--bc-black); padding: 1.25rem 1.4rem; border-radius: 4px;
  overflow-x: auto; margin: 1.8em 0; border-top: 3px solid var(--bc-rust);
}
.post-body pre code.hljs { background: none; padding: 0; font-size: inherit; }
.post-body pre code:not(.hljs) { background: none; padding: 0; color: #ececec; font-size: inherit; }
.table-scroll { overflow-x: auto; margin: 1.8em 0; }
.table-scroll:focus-visible { outline: 2px solid var(--bc-amber); outline-offset: 2px; }
.post-body table { border-collapse: collapse; font-size: 0.95rem; line-height: 1.55; min-width: 34rem; width: 100%; }
.post-body th, .post-body td { border: 1px solid var(--bc-line); padding: 0.6rem 0.8rem; text-align: left; }
.post-body th { font-family: var(--f-sans-bold); font-weight: 400; background: var(--bc-soft); }
.post-body img { max-width: 100%; height: auto; }

/* ---------- author / hire card ---------- */
.post-author {
  max-width: var(--measure); margin: 0 0 4.5rem; padding: 2rem;
  background: var(--bc-black) url("/images/skills-bg.jpg") no-repeat center / cover;
  position: relative; color: #fff; border-radius: 4px; overflow: hidden;
}
.post-author::before { content: ""; position: absolute; inset: 0; background: rgba(21, 21, 21, 0.86); }
.post-author > * { position: relative; }
.post-author h2 { font-family: var(--f-serif-bold); font-weight: 400; font-size: 1.5rem; margin: 0 0 0.25rem; }
.post-author__title { font-family: var(--f-sans-bold); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bc-amber); margin: 0 0 1rem; }
.post-author p { color: rgba(255, 255, 255, 0.78); margin: 0 0 1.25rem; }
.post-skills { display: flex; flex-wrap: wrap; gap: 0.45rem; list-style: none; padding: 0; margin: 0 0 1.5rem; }
.post-skills li { font-size: 0.8rem; padding: 0.25rem 0.65rem; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 3px; color: rgba(255, 255, 255, 0.85); }
.post-author__actions { display: flex; flex-wrap: wrap; gap: 0.9rem 1.5rem; align-items: center; }
.blog-page .post-author__actions a:not(.blog-btn) { color: #fff; }
.blog-page .blog-btn {
  display: inline-block; padding: 0.95rem 1.6rem; background: #fff; color: var(--bc-black);
  font-family: var(--f-sans-bold); font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase;
  text-decoration: none; border-radius: 3px; transition: background 0.2s, color 0.2s;
}
.blog-page .blog-btn:hover { background: var(--bc-amber); color: var(--bc-black); }

.post-nav { display: flex; justify-content: space-between; gap: 1.5rem; max-width: var(--measure); margin-bottom: 5rem; font-size: 0.95rem; }

/* ---------- footer, matches home page footer ---------- */
.blog-foot { background: #111; color: rgba(255, 255, 255, 0.5); text-align: center; padding: 4rem 1.5rem calc(4rem + env(safe-area-inset-bottom, 0px)); font-size: 0.9rem; }
.blog-foot__social { list-style: none; display: flex; justify-content: center; gap: 1.5rem; margin: 0 0 1rem; padding: 0; font-size: 1.4rem; }
.blog-page .blog-foot a { color: #fff; }
.blog-page .blog-foot a:hover { color: var(--bc-amber); }
.blog-foot p { margin: 0; }

/* ---------- article cards (index, categories, related) ---------- */
.post-grid { list-style: none; margin: 0 0 3rem; padding: 0; display: grid; gap: 2rem 1.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.post-card { margin: 0; }
.blog-page .post-card a { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; border: 1px solid var(--bc-line); border-radius: 4px; overflow: hidden; background: #fff; transition: border-color 0.2s, box-shadow 0.2s; }
.blog-page .post-card a:hover { border-color: #bdbdbd; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07); }
.post-card__img { aspect-ratio: 1200 / 630; background: var(--bc-black); }
.post-card__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.post-card__ph { display: flex; height: 100%; align-items: flex-end; padding: 1rem 1.25rem; color: var(--bc-amber); font-family: var(--f-sans-bold); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; border-bottom: 3px solid var(--bc-rust); }
.post-card__body { padding: 1.25rem 1.35rem 1.5rem; }
.post-card__meta { margin: 0 0 0.6rem; font-size: 0.78rem; color: var(--bc-muted); }
.post-card__meta span { font-family: var(--f-sans-bold); letter-spacing: 0.1em; text-transform: uppercase; color: var(--bc-brown); }
.post-card h2, .post-card h3 { font-family: var(--f-serif-bold); font-weight: 400; font-size: 1.2rem; line-height: 1.4; margin: 0 0 0.6rem; transition: color 0.2s; }
.blog-page .post-card a:hover h2, .blog-page .post-card a:hover h3 { color: var(--bc-rust); }
.post-card p:last-child { margin: 0; font-size: 0.95rem; line-height: 1.6; color: var(--bc-muted); }

.blog-pager { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: -1rem 0 4rem; }
.blog-pager a, .blog-pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 0.9rem; border: 1px solid var(--bc-line); border-radius: 3px; font-size: 0.9rem; text-decoration: none; }
.blog-pager span[aria-current] { background: var(--bc-black); border-color: var(--bc-black); color: #fff; }

/* ---------- article layout: body + table of contents ---------- */
.post-crumbs { font-size: 0.82rem; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.55); margin: 0 0 1.25rem; }
.blog-page .post-crumbs a { color: var(--bc-amber); text-decoration: none; }
.blog-page .post-crumbs a:hover { color: #fff; }
.blog-page .post-meta a { color: inherit; }
.post-toc { margin: 0 0 2.5rem; border: 1px solid var(--bc-line); border-radius: 4px; background: #fbfaf8; font-size: 0.92rem; }
.post-toc summary { cursor: pointer; padding: 0.9rem 1.1rem; min-height: 44px; font-family: var(--f-sans-bold); font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase; }
.post-toc ol { margin: 0; padding: 0 1.1rem 1rem 2.4rem; line-height: 1.5; }
.post-toc li { margin: 0.45rem 0; }
.blog-page .post-toc a { color: var(--bc-ink); text-decoration: none; }
.blog-page .post-toc a:hover { color: var(--bc-rust); text-decoration: underline; }
@media (min-width: 64rem) {
  .post-layout { display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(14rem, 1fr); column-gap: 3.5rem; align-items: start; }
  .post-layout .post-body { grid-column: 1; grid-row: 1; }
  .post-toc { grid-column: 2; grid-row: 1; position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; }
  .post-toc summary { pointer-events: none; list-style: none; }
  .post-toc summary::-webkit-details-marker { display: none; }
}
html { scroll-behavior: smooth; }
.post-body h2, .post-body h3 { scroll-margin-top: 1.5rem; }

/* ---------- figures, CTA, copy buttons ---------- */
.post-figure { margin: 2.2em 0; }
.post-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--bc-line); border-radius: 4px; background: var(--bc-soft); }
.post-figure--narrow img { max-width: 20rem; margin-inline: auto; }
.post-figure figcaption { margin-top: 0.6rem; font-size: 0.85rem; line-height: 1.5; color: var(--bc-muted); text-align: center; }
.post-cta {
  margin: 2.8em 0; padding: 1.75rem 1.75rem 2rem; border-radius: 4px; color: #fff;
  background: var(--bc-black); border-left: 4px solid var(--bc-amber);
}
.post-body .post-cta h2 { margin: 0 0 0.6rem; font-size: 1.45rem; color: #fff; }
.post-cta p { color: rgba(255, 255, 255, 0.8); margin: 0 0 1.4rem; }
.code-wrap { position: relative; margin: 1.8em 0; }
.code-wrap pre { margin: 0; padding-top: 2.75rem; }
.post-body pre code.language-text, .post-body pre code.language-plaintext { white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-btn {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 1; min-height: 32px; padding: 0.25rem 0.7rem;
  font-family: var(--f-sans-bold); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: #fff; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 3px; cursor: pointer;
}
.copy-btn:hover { background: var(--bc-rust); }
.post-related { margin: 0 0 5rem; }
.post-related > h2 { font-family: var(--f-serif-bold); font-weight: 400; font-size: 1.6rem; margin: 0 0 1.5rem; }
.preview-bar { margin: 0; padding: 0.6rem 1rem; background: var(--bc-amber); color: var(--bc-black); font-size: 0.85rem; text-align: center; position: relative; z-index: 20; }
.preview-status { margin-top: 1rem !important; color: var(--bc-amber) !important; font-family: var(--f-sans) !important; font-size: 0.85rem !important; }
@media (max-width: 40rem) {
  .code-wrap { margin-inline: -1rem; }
  .post-body pre { border-radius: 0; }
  .post-cta { padding: 1.5rem 1.25rem; }
  /* category links scroll sideways instead of stacking */
  .blog-filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: -1.5rem; padding: 0 1.5rem 0.25rem; scrollbar-width: none; }
  .blog-filters li { flex: 0 0 auto; }
  .blog-page .blog-filters a { padding: 0.5rem 0.85rem; letter-spacing: 0.1em; }
}

@media (prefers-reduced-motion: reduce) { .blog-page * { transition: none !important; } html { scroll-behavior: auto; } }
.preview-bar ~ .blog-bar { top: 38px; }
.post-body { overflow-wrap: break-word; }
.post-body :not(pre) > code, .post-body a { overflow-wrap: anywhere; }
