/* ==========================================================================
   Blog — public styles
   Colors are tokens; the light theme (html.light) only swaps their values.
   All classes are prefixed so they don't clash with an included site header.
   ========================================================================== */

:root {
  --b-measure:   47.5rem;   /* width of the post text column */
  --b-wide:      64rem;     /* listing and cover image width */
  --b-list-min-height: 50vh; /* minimum height of the post list, even when empty */

  --b-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --b-sans:  'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --b-mono:  ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --b-bg:        #121211;
  --b-surface:   #1b1b19;
  --b-text:      #ecebe6;
  --b-body:      #cfcdc6;
  --b-muted:     #9a978f;
  --b-faint:     #6c6962;
  --b-border:    #2b2a27;
  --b-accent:    #e0b35a;
  --b-accent-2:  #f0cd85;
}

html.light {
  --b-bg:        #fbfaf7;
  --b-surface:   #f1efe9;
  --b-text:      #1c1b18;
  --b-body:      #34322d;
  --b-muted:     #6b675f;
  --b-faint:     #9b978e;
  --b-border:    #e2dfd7;
  --b-accent:    #8a5a0b;
  --b-accent-2:  #5f3d05;
}

body {
  background: var(--b-bg);
  color: var(--b-body);
  -webkit-font-smoothing: antialiased;
}

.blog {
  width: 100%;
  max-width: var(--b-wide);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 6rem;
  font-family: var(--b-sans);
  font-size: 1rem;
  line-height: 1.6;
}

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

/* ---- Shared bits ------------------------------------------------------- */

.blog-crumbs {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  color: var(--b-muted);
}
.blog-crumbs a { color: var(--b-muted); border-bottom: 1px solid var(--b-border); transition: color .15s, border-color .15s; }
.blog-crumbs a:hover { color: var(--b-text); border-color: var(--b-muted); }
.blog-crumbs span { margin: 0 .4rem; color: var(--b-faint); }

.blog-meta {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--b-muted);
}
.blog-meta .sep { margin: 0 .45rem; color: var(--b-faint); }

.blog-tags { margin: 0; font-size: 0.9375rem; color: var(--b-muted); }
.blog-tags a { color: var(--b-accent); transition: color .15s; position: relative; z-index: 1; }
.blog-tags a:hover { color: var(--b-accent-2); text-decoration: underline; text-underline-offset: 3px; }

.blog-link {
  color: var(--b-accent) !important;
  border-bottom: 1px solid currentColor;
  transition: color .15s;
}
.blog-link:hover { color: var(--b-accent-2) !important; }

/* ---- Listing header ---------------------------------------------------- */

.blog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem 3rem;
  padding-bottom: 2.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--b-border);
}
.blog-head__text { flex: 1 1 26rem; min-width: 0; }
.blog-head__title {
  margin: 0;
  font-family: var(--b-serif);
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--b-text);
  overflow-wrap: anywhere;
}
.blog-head__count { font-weight: 400; color: var(--b-faint); }
.blog-head__desc {
  margin: 1rem 0 0;
  max-width: 36rem;
  font-size: 1.125rem;
  color: var(--b-muted);
}

.blog-search { display: flex; flex: 0 1 22rem; gap: .5rem; }
.blog-search input {
  flex: 1;
  min-width: 0;
  padding: .6rem .85rem;
  font: inherit;
  font-size: .9375rem;
  color: var(--b-text);
  background: var(--b-surface);
  border: 1px solid var(--b-border);
  border-radius: 4px;
  outline: none;
  transition: border-color .15s;
}
.blog-search input::placeholder { color: var(--b-faint); }
.blog-search input:focus { border-color: var(--b-muted); }
.blog-search button {
  padding: .6rem 1rem;
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--b-bg);
  background: var(--b-text);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity .15s;
}
.blog-search button:hover { opacity: .85; }

/* ---- Post list ---------------------------------------------------------- */

/* The post area keeps its height with few or no posts, so the site footer stays low */
.post-list,
.blog-empty { min-height: var(--b-list-min-height); }
.post-list { margin: 0; }

.post-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--b-border);
}
.post-item--image { grid-template-columns: minmax(0, 1fr) 15rem; gap: 2.5rem; }

.post-item__title {
  margin: .5rem 0 0;
  font-family: var(--b-serif);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--b-text);
}
.post-item__title a { transition: color .15s; }
.post-item__title a::after { content: ''; position: absolute; inset: 0; }   /* whole item is clickable */
.post-item:hover .post-item__title a { color: var(--b-accent); }

.post-item__excerpt {
  margin: .75rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--b-muted);
}
.post-item .blog-tags { margin-top: .9rem; }

.post-item__image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 4px;
  background: var(--b-surface);
  align-self: start;
  margin-top: .35rem;
}
.post-item__image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.blog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 0;
  text-align: center;
  color: var(--b-muted);
  font-size: 1.125rem;
}
.blog-empty p { margin: 0 0 1rem; }

.blog-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding-top: 2.5rem;
  font-size: .9375rem;
  color: var(--b-faint);
}
.blog-pager > :last-child { justify-self: end; }
.blog-pager a { color: var(--b-text); font-weight: 600; border-bottom: 1px solid var(--b-border); transition: border-color .15s; }
.blog-pager a:hover { border-color: var(--b-text); }

@media (max-width: 720px) {
  .blog { padding-top: 3rem; }
  .post-item--image { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .post-item--image .post-item__image { order: -1; margin-top: 0; }
  .post-item__title { font-size: 1.5rem; }
  .blog-search { flex-basis: 100%; }
}

/* ---- Single post -------------------------------------------------------- */

.post-header,
.post-footer,
.prose {
  max-width: var(--b-measure);
  margin-left: auto;
  margin-right: auto;
}

.post-title {
  margin: 0;
  font-family: var(--b-serif);
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--b-text);
  overflow-wrap: break-word;
}
.post-lead {
  margin: 1.5rem 0 0;
  font-family: var(--b-serif);
  font-size: 1.375rem;
  line-height: 1.55;
  color: var(--b-muted);
}
.post-header .blog-meta { margin-top: 1.75rem; }

.post-cover {
  max-width: var(--b-wide);
  margin: 3rem auto 0;
}
.post-cover img { width: 100%; max-height: 34rem; object-fit: cover; border-radius: 4px; display: block; }

.post-header + .prose,
.post-cover + .prose { margin-top: 3rem; }

.post-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--b-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  font-size: .9375rem;
}

/* ---- Post content (Markdown output) ------------------------------------- */

.prose {
  font-family: var(--b-serif);
  font-size: 1.1875rem;
  line-height: 1.75;
  color: var(--b-body);
  overflow-wrap: break-word;
}
.prose > :first-child { margin-top: 0; }
.prose p          { margin: 0 0 1.5em; }
.prose h2         { margin: 2.2em 0 .7em; font-size: 1.75rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; color: var(--b-text); }
.prose h3         { margin: 1.9em 0 .6em; font-size: 1.375rem; font-weight: 600; line-height: 1.3; color: var(--b-text); }
.prose h4         { margin: 1.7em 0 .5em; font-family: var(--b-sans); font-size: 1.0625rem; font-weight: 600; color: var(--b-text); }
.prose ul,
.prose ol         { margin: 0 0 1.5em; padding-left: 1.4em; }
.prose ul         { list-style: disc; }
.prose ol         { list-style: decimal; }
.prose li         { margin: 0 0 .5em; padding-left: .25em; }
.prose li::marker { color: var(--b-faint); }
.prose hr         { margin: 3em auto; width: 8rem; border: 0; border-top: 1px solid var(--b-border); }
.prose blockquote { margin: 2em 0; padding: .1em 0 .1em 1.25em; border-left: 3px solid var(--b-accent); font-style: italic; color: var(--b-muted); }
.prose a          { color: var(--b-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover    { color: var(--b-accent-2); }
.prose strong     { font-weight: 600; color: var(--b-text); }
.prose em         { font-style: italic; }
.prose img        { width: 100%; height: auto; margin: 2em 0; border-radius: 4px; }
.prose code       { font-family: var(--b-mono); font-size: .85em; padding: .12em .35em; background: var(--b-surface); border: 1px solid var(--b-border); border-radius: 3px; }
.prose pre        { margin: 1.75em 0; padding: 1.1rem 1.25rem; overflow-x: auto; background: var(--b-surface); border: 1px solid var(--b-border); border-radius: 4px; line-height: 1.55; }
.prose pre code   { padding: 0; font-size: .8125rem; background: none; border: 0; }

@media (max-width: 720px) {
  .prose     { font-size: 1.125rem; }
  .prose h2  { font-size: 1.5rem; }
  .post-lead { font-size: 1.1875rem; }
  .post-cover { margin-left: -1.5rem; margin-right: -1.5rem; }
  .post-cover img { border-radius: 0; }
}

/* ---- 404 ----------------------------------------------------------------- */

.blog-404 { padding: 7rem 0; text-align: center; }
.blog-404__code { margin: 0; font-family: var(--b-serif); font-size: 5rem; font-weight: 600; line-height: 1; color: var(--b-faint); }
.blog-404__text { margin: 1.25rem 0 1.5rem; font-size: 1.125rem; color: var(--b-muted); }

/* ---- Share links ---------------------------------------------------------- */

.post-share {
  max-width: var(--b-measure);
  margin: 3.5rem auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem 1.1rem;
  font-size: .9375rem;
}
.post-share__label { color: var(--b-muted); }
.post-share a,
.post-share button {
  padding: 0;
  font: inherit;
  color: var(--b-text);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--b-border);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.post-share a:hover,
.post-share button:hover { color: var(--b-accent); border-color: currentColor; }
.post-share + .post-footer { margin-top: 1.5rem; }
