/*
 * blog_detail.css — layout for the Blog Detail v2 (simplified) design.
 * Two-column body: sticky share rail on the left, article body on the right.
 * The old right-rail widgets (Follow Us / The Latest) were removed to
 * reclaim reading width; a floating Back-to-top replaces them.
 * Stacks to single-column below --bp-md (900px).
 */

/* ---------- Hero ---------- */

.blog-hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  color: var(--color-paper);
  background-color: #2a3a45;
  /* Placeholder gradient until real hero images exist. Image-id consumption
     arrives in Sprint 3; for now, --hue from blog.id keeps each blog's hero
     visually unique. */
  background-image: linear-gradient(
      135deg,
      hsl(var(--hue, 210deg) 45% 30%) 0%,
      hsl(calc(var(--hue, 210deg) + 40deg) 55% 50%) 100%);
  background-size: cover;
  background-position: center;
}

.blog-hero__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.55));
  pointer-events: none;
}

.blog-hero__inner {
  position: relative;
  padding-block: var(--space-8) var(--space-7);
  max-width: 900px;
}

.blog-hero__crumbs {
  font-size: var(--type-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-4);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.blog-hero__crumbs a { color: rgba(255, 255, 255, 0.8); }
.blog-hero__crumbs a:hover { color: var(--color-paper); }
.blog-hero__crumbs .current { opacity: .75; }

.blog-hero__title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.5vw, var(--type-5xl));
  text-transform: uppercase;
  color: var(--color-paper);
  margin: 0 0 var(--space-3);
  letter-spacing: .01em;
}
.blog-hero__subtitle {
  font-size: var(--type-lg);
  color: rgba(255, 255, 255, 0.9);
  font-style: italic;
  margin: 0 0 var(--space-4);
}
.blog-hero__meta {
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--type-sm);
  display: inline-flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}
.blog-hero__meta .sep { opacity: .6; }
.blog-hero__tags a { color: inherit; text-decoration: underline; }

/* ---------- Two-column body (share rail | article) ---------- */

.blog-body {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: var(--space-6);
  padding-block: var(--space-8);
  /* Widened ~20% (was 980px) so the article column tracks the width of
     static pages like /privacy and /terms, which use the full container. */
  max-width: 1176px;
}

/* Share rail (sticky on desktop) */
.blog-share {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: sticky;
  top: calc(var(--space-8) + 60px);
  align-self: start;
  height: max-content;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--color-paper);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  font-weight: 700;
  font-size: var(--type-sm);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06),
              0 4px 10px rgba(15, 23, 42, 0.08);
  transition: background var(--transition-base),
              color var(--transition-base),
              border-color var(--transition-base),
              box-shadow var(--transition-base),
              transform var(--transition-base);
}
.share-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
.share-btn:hover {
  background: var(--color-brand);
  color: var(--color-paper);
  border-color: var(--color-brand);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08),
              0 10px 22px rgba(15, 23, 42, 0.18);
}
.share-btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* Per-network brand hover colors (rail only — text bar overrides below) */
.blog-share .share-btn[data-network="twitter"]:hover {
  background: #000; border-color: #000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 10px 22px rgba(0, 0, 0, 0.25);
}
.blog-share .share-btn[data-network="facebook"]:hover {
  background: #1877F2; border-color: #1877F2;
  box-shadow: 0 2px 4px rgba(24, 119, 242, 0.2), 0 10px 22px rgba(24, 119, 242, 0.35);
}
.blog-share .share-btn[data-network="linkedin"]:hover {
  background: #0A66C2; border-color: #0A66C2;
  box-shadow: 0 2px 4px rgba(10, 102, 194, 0.2), 0 10px 22px rgba(10, 102, 194, 0.35);
}
.blog-share .share-btn[data-network="pinterest"]:hover {
  background: #E60023; border-color: #E60023;
  box-shadow: 0 2px 4px rgba(230, 0, 35, 0.2), 0 10px 22px rgba(230, 0, 35, 0.35);
}

/* Article body — wider now that the right rail is gone. */
.blog-article {
  width: 100%;
  /* min-width:0 so grid tracks don't force overflow when a wide child
     (e.g. <pre>, <table>) tries to push the column out. */
  min-width: 0;
}

/* ---------- Prose — styles for every common element the author may
   paste into .blog-article__content. Goal: no distortion regardless of
   what HTML they include. ---------------------------------------------- */

.blog-article__content {
  font-size: var(--type-lg);
  line-height: var(--leading-body);
  color: var(--color-ink);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* First/last element margins — kill extra vertical space at edges. */
.blog-article__content > *:first-child { margin-top: 0; }
.blog-article__content > *:last-child  { margin-bottom: 0; }

/* Headings ------------------------------------------------------------- */
.blog-article__content h1,
.blog-article__content h2,
.blog-article__content h3,
.blog-article__content h4,
.blog-article__content h5,
.blog-article__content h6 {
  font-family: var(--font-serif);
  line-height: var(--leading-tight);
  color: var(--color-ink);
  margin: var(--space-7) 0 var(--space-3);
}
.blog-article__content h1 { font-size: var(--type-3xl); }
.blog-article__content h2 { font-size: var(--type-2xl); text-transform: uppercase; }
.blog-article__content h3 { font-size: var(--type-xl); margin-top: var(--space-6); }
.blog-article__content h4 { font-size: var(--type-lg); margin-top: var(--space-5); }
.blog-article__content h5,
.blog-article__content h6 {
  font-size: var(--type-base);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-top: var(--space-5);
}

/* Paragraphs / inline emphasis ---------------------------------------- */
.blog-article__content p { margin: 0 0 var(--space-4); }
.blog-article__content strong, .blog-article__content b  { font-weight: 700; }
.blog-article__content em,     .blog-article__content i  { font-style: italic; }
.blog-article__content u                                  { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.blog-article__content s,      .blog-article__content del { text-decoration: line-through; color: var(--color-ink-muted); }
.blog-article__content small                              { font-size: var(--type-sm); color: var(--color-ink-muted); }
.blog-article__content sub, .blog-article__content sup   { font-size: 0.75em; line-height: 0; position: relative; }
.blog-article__content sup { top: -0.5em; }
.blog-article__content sub { bottom: -0.25em; }
.blog-article__content mark { background: #fef3c7; padding: 0 3px; border-radius: 2px; }

/* Links ---------------------------------------------------------------- */
.blog-article__content a {
  color: var(--color-brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.blog-article__content a:hover { text-decoration-thickness: 2px; }

/* Abbreviation / cite / definitions ----------------------------------- */
.blog-article__content abbr[title]  { text-decoration: underline dotted; cursor: help; }
.blog-article__content cite          { font-style: italic; color: var(--color-ink-muted); }
.blog-article__content dfn           { font-style: italic; }
.blog-article__content q::before     { content: "\201C"; }
.blog-article__content q::after      { content: "\201D"; }

/* Quotes --------------------------------------------------------------- */
.blog-article__content blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-5);
  border-left: 3px solid var(--color-brand);
  background: var(--color-surface);
  font-family: var(--font-serif);
  font-size: var(--type-xl);
  line-height: var(--leading-snug);
  color: var(--color-ink);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.blog-article__content blockquote p:last-child { margin-bottom: 0; }
.blog-article__content blockquote footer,
.blog-article__content blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--type-sm);
  font-style: normal;
  color: var(--color-ink-muted);
}

/* Lists ---------------------------------------------------------------- */
.blog-article__content ul,
.blog-article__content ol {
  padding-left: var(--space-5);
  margin: 0 0 var(--space-4);
}
.blog-article__content li { margin-bottom: var(--space-2); }
.blog-article__content li > ul,
.blog-article__content li > ol { margin-top: var(--space-2); margin-bottom: 0; }

/* Description lists --------------------------------------------------- */
.blog-article__content dl  { margin: 0 0 var(--space-4); }
.blog-article__content dt  { font-weight: 600; margin-top: var(--space-3); }
.blog-article__content dd  { margin: 0 0 var(--space-2) var(--space-5); color: var(--color-ink); }

/* Horizontal rules ----------------------------------------------------- */
.blog-article__content hr {
  border: 0;
  height: 1px;
  background: var(--color-border);
  margin: var(--space-7) 0;
}

/* Images & figures ----------------------------------------------------- */
.blog-article__content img {
  max-width: 100%;
  height: auto;
  margin: var(--space-5) 0;
  border-radius: var(--radius-md);
}
.blog-article__content figure {
  margin: var(--space-6) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.blog-article__content figure img,
.blog-article__content figure video,
.blog-article__content figure iframe { margin: 0; width: 100%; }
.blog-article__content figcaption {
  margin-top: var(--space-2);
  font-size: var(--type-sm);
  color: var(--color-ink-muted);
  text-align: center;
}

/* Media embeds (YouTube etc.) ----------------------------------------- */
.blog-article__content iframe,
.blog-article__content video,
.blog-article__content audio,
.blog-article__content embed,
.blog-article__content object {
  max-width: 100%;
  display: block;
  margin: var(--space-5) 0;
  border: 0;
  border-radius: var(--radius-md);
}
.blog-article__content iframe,
.blog-article__content video {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
}
.blog-article__content audio { width: 100%; height: auto; aspect-ratio: auto; }

/* Tables --------------------------------------------------------------- */
.blog-article__content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-5) 0;
  font-size: var(--type-base);
  display: block;                     /* allow horizontal scroll on overflow */
  overflow-x: auto;
  max-width: 100%;
}
.blog-article__content table caption {
  caption-side: bottom;
  padding: var(--space-2) 0;
  font-size: var(--type-sm);
  color: var(--color-ink-muted);
}
.blog-article__content th,
.blog-article__content td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.blog-article__content thead th {
  background: var(--color-surface);
  font-size: var(--type-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border-bottom: 2px solid var(--color-border);
}
.blog-article__content tbody tr:last-child td { border-bottom: 0; }

/* Code ----------------------------------------------------------------- */
.blog-article__content code,
.blog-article__content kbd,
.blog-article__content samp,
.blog-article__content var {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.blog-article__content :not(pre) > code {
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.blog-article__content kbd {
  background: #fff;
  color: var(--color-ink);
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: 0.85em;
}
.blog-article__content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: var(--type-sm);
  line-height: 1.55;
  margin: var(--space-5) 0;
  max-width: 100%;
}
.blog-article__content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: 0;
}

/* Details / summary --------------------------------------------------- */
.blog-article__content details {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.blog-article__content details[open] summary { margin-bottom: var(--space-3); }
.blog-article__content summary {
  cursor: pointer;
  font-weight: 600;
  list-style: revert;
}

/* Address, time ------------------------------------------------------- */
.blog-article__content address { font-style: normal; color: var(--color-ink-muted); }
.blog-article__content time    { color: inherit; }

/* Form elements (rare in posts but shouldn't shatter the layout) ------ */
.blog-article__content input,
.blog-article__content textarea,
.blog-article__content select,
.blog-article__content button {
  font: inherit;
  max-width: 100%;
}

/* SVG & canvas -------------------------------------------------------- */
.blog-article__content svg,
.blog-article__content canvas { max-width: 100%; height: auto; }

/* Share bar under the article */
.blog-share-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-7);
  font-size: var(--type-sm);
}
.blog-share-bar span { color: var(--color-ink-muted); }
.blog-share-bar .share-btn {
  width: auto; height: auto;
  border-radius: var(--radius-md);
  padding: 6px var(--space-3);
  font-size: var(--type-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  box-shadow: none;
  transform: none;
}
.blog-share-bar .share-btn:hover {
  transform: none;
  box-shadow: none;
}

/* ---------- Related grid ---------- */

.blog-related {
  padding-block: var(--space-8);
  border-top: 1px solid var(--color-border);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .blog-body { grid-template-columns: 1fr; }
  .blog-share {
    position: static;
    flex-direction: row;
    justify-content: center;
    margin-bottom: var(--space-4);
  }
}

/* ---------- Back-to-top button ---------- */

.back-to-top {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 12px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--color-brand);
  color: var(--color-paper);
  font: inherit;
  font-size: var(--type-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25),
              0 2px 6px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity var(--transition-base),
              transform var(--transition-base),
              background var(--transition-base);
}
.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--color-ink);
  outline: none;
}
.back-to-top span[aria-hidden] {
  font-size: var(--type-base);
  line-height: 1;
}
@media (max-width: 600px) {
  .back-to-top__label { display: none; }
  .back-to-top {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: opacity 0s, transform 0s; }
}

/* ---------- About-the-Author band -----------------------------------
 *
 * Mirrored verbatim from about.css so the shared partials/about_author.html
 * renders identically on the blog detail page even when the page template
 * hasn't been reloaded to pick up the about.css <link>. Keep in sync with
 * about.css — both definitions must match exactly so the home and blog
 * detail pages show zero visual drift.
 */

.home-about {
  padding-block: var(--space-8);
  border-bottom: 1px solid var(--color-border);
}

.home-about__inner {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-7);
  align-items: center;
}
@media (max-width: 800px) {
  .home-about__inner {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
}

.home-about__photo {
  position: relative;
  padding: 10px;
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  max-width: 280px;
  justify-self: start;
}
.home-about__photo::before {
  content: "";
  position: absolute;
  inset: 18px -18px -18px 18px;
  background: var(--color-brand);
  border-radius: var(--radius-md);
  z-index: 0;
  opacity: .85;
}
.home-about__photo img,
.home-about__photo-placeholder {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.home-about__photo-placeholder {
  background: var(--color-brand);
  color: var(--color-brand-ink);
  font-family: var(--font-serif);
  font-size: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-about__eyebrow {
  font-size: var(--type-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-ink-muted);
  margin: 0 0 var(--space-2);
}
.home-about__name {
  font-family: var(--font-serif);
  font-size: var(--type-3xl);
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-2);
}
.home-about__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-lg);
  color: var(--color-ink-muted);
  margin: 0 0 var(--space-4);
}
.home-about__bio {
  font-size: var(--type-lg);
  line-height: var(--leading-body);
  margin: 0 0 var(--space-5);
  max-width: 620px;
}
.home-about__cta {
  margin-top: var(--space-2);
}

.about-highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.about-highlight {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  background: var(--color-paper);
  border-radius: 999px;
  font-size: var(--type-sm);
  color: var(--color-ink);
}
.about-highlight::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--color-brand);
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

/* "Share this post" bar removed from the article. Hiding here covers the
   window where a cached server template still renders the old markup;
   safe to keep — the rule matches nothing once the template reloads. */
.blog-share-bar { display: none; }

/* Line separator between the article and the About-the-Author band.
   Scoped to .page-blog so the home page's band is unaffected. */
.page-blog .home-about { border-top: 1px solid var(--color-border); }
