/* ==========================================================================
   BULLETPROOF PERFORMANCE — blog (listing and single post)
   Loaded after ../style.css and written against the same tokens, so the
   blog inherits the site's palette, type, spacing and breakpoints rather
   than restating them. Components the site already has are reused as they
   are: the post cards are .tcard, the YouTube facade is .video, buttons are
   .btn. Only what the blog needs on top of those lives here.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DRAFT AND PREVIEW NOTICES
   Amber on purpose: it is not a brand colour, so nobody mistakes the bar for
   part of the design. A draft post carries it in its HTML (deleted on
   publish); the listing shows it only in ?preview mode.
   -------------------------------------------------------------------------- */
.draft-bar {
  margin: 0;
  padding: 10px var(--gutter);
  background: #f5c451;
  color: #1d1600;                    /* 12.9:1 on the amber */
  font: 600 .85rem/1.45 var(--font-body);
  text-align: center;
}

/* --------------------------------------------------------------------------
   2. PAGE HERO — the dark band each blog page opens with
   Pulled up under the header exactly as the homepage hero is, so the
   transparent header sits on the band's own ground instead of a seam.
   -------------------------------------------------------------------------- */
.page-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: calc(var(--header-h) * -1);
  padding: calc(var(--header-h) + 56px) 0 var(--section-y);
  background: var(--page-bg-2);
}
.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 80% at 85% 0%, rgba(25, 111, 163, .32) 0%, rgba(25, 111, 163, 0) 70%),
    radial-gradient(50% 60% at 0% 100%, rgba(25, 111, 163, .14) 0%, rgba(25, 111, 163, 0) 72%);
  pointer-events: none;
}
.page-hero h1 {
  font-size: clamp(2.4rem, 4.8vw, 3.75rem);
  max-width: 18ch;
  margin-bottom: var(--space-lg);
}
.page-hero__lede {
  max-width: 40rem;
  margin: 0;
  font-size: clamp(1rem, 1.25vw, 1.12rem);
  color: rgba(255, 255, 255, .78);
}

/* Breadcrumb trail */
.crumbs { margin: 0 0 var(--space-lg); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.crumbs li { display: flex; align-items: center; gap: 10px; font-size: .84rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; opacity: .55; }
.crumbs a {
  color: rgba(255, 255, 255, .78);
  text-decoration: none;
  /* 24px tall tap target without changing the line */
  padding-block: 4px;
}
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs [aria-current] { color: #fff; }

/* The dark category pill doubles as a link to that category's listing */
a.pill { text-decoration: none; transition: background-color .22s var(--ease), border-color .22s var(--ease); }
a.pill:hover { background: rgba(128, 192, 224, .34); border-color: var(--brand-300); }

/* --------------------------------------------------------------------------
   3. LISTING — topic filter and empty state
   The post cards themselves (.post-grid, .post-card, .tag) are in
   ../style.css, because the homepage shows them too.
   -------------------------------------------------------------------------- */
/* The filter only works with JS, so without it there is nothing to show:
   every published post is listed anyway. */
.blog-tools { display: none; }
.js .blog-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md) var(--space-xl);
  margin-bottom: var(--space-2xl);
}
.chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--heading);
  font: 600 .88rem/1 var(--font-body);
  text-decoration: none;
  transition: background-color .22s var(--ease), border-color .22s var(--ease), color .22s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-current="true"] {
  background: var(--brand-600);       /* white label 5.46:1 */
  border-color: var(--brand-600);
  color: #fff;
}
.blog-count { margin: 0; font-size: .9rem; color: var(--muted); }

.blog-empty {
  padding: var(--space-2xl) var(--card-pad);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}
.blog-empty h2 { font-size: clamp(1.25rem, 2vw, 1.55rem); margin-bottom: var(--space-xs); }
.blog-empty p { color: var(--muted); }
.blog-empty .link-arrow { margin-top: var(--space-md); }

/* Closing call to action under the listing */
.blog-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: var(--section-y);
  text-align: center;
}
.blog-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 70% at 50% 0%, rgba(26, 114, 168, .28) 0%, transparent 62%),
    var(--page-bg-2);
}
.blog-cta h2 { max-width: 20ch; margin-inline: auto; }
.blog-cta p:not(.eyebrow) { max-width: 46rem; margin-inline: auto; color: var(--text); }
.blog-cta .section-cta { justify-content: center; }

/* --------------------------------------------------------------------------
   4. SINGLE POST
   Editorial layout: the title block and the article share one centred
   reading column, and the video breaks out wider than both.
   -------------------------------------------------------------------------- */
.measure {
  width: 100%;
  max-width: calc(700px + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.measure--hero { max-width: calc(880px + var(--gutter) * 2); }
.measure--wide { max-width: calc(1040px + var(--gutter) * 2); }

/* The video straddles the dark band and the light article under it. The
   band's own background paints the light strip it lands on; the strip is the
   .band-light ground (#f3f7fa), so the join below it is invisible. */
.post-hero {
  --overlap: clamp(72px, 11vw, 170px);
  /* The band runs on a little past the video so its shadow has light ground
     to fall on; ending flush with the video would cut the shadow off at the
     band's edge. The article below starts with no padding of its own. */
  --tail: var(--space-2xl);
  padding-bottom: var(--tail);
  text-align: center;
  background: linear-gradient(to top,
    #f3f7fa 0, #f3f7fa calc(var(--overlap) + var(--tail)),
    var(--page-bg-2) calc(var(--overlap) + var(--tail)));
}
/* Only the upper wash: the lower one would tint the light strip */
.post-hero::after {
  background: radial-gradient(60% 45% at 85% 0%, rgba(25, 111, 163, .32) 0%, rgba(25, 111, 163, 0) 70%);
}
.post-hero .crumbs ol { justify-content: center; }
/* One pill per category; a post can sit in more than one */
.post-hero__tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
  margin: 0 0 var(--space-lg);
}
.post-hero h1 {
  max-width: 24ch;
  margin-inline: auto;
  font-size: clamp(2.1rem, 4.2vw, 3.3rem);
  line-height: 1.06;
}
.post-hero__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  margin: 0;
  font-size: .92rem;
  color: rgba(255, 255, 255, .66);
}
.post-hero__meta strong { color: #fff; font-weight: 600; }
.post-hero__media { margin-top: var(--space-2xl); }

/* YouTube facade: the site's .video, as a link to the video on YouTube so it
   still works with JS off. blog.js swaps in the player on click. */
a.video { color: #fff; text-decoration: none; }
.video--yt { max-width: none; box-shadow: 0 30px 60px -30px rgba(7, 18, 30, .55); }
/* Only a light dim: the posters are Charles's own YouTube thumbnails, designed
   to be seen as they are, and the play button reads over them regardless */
.video--yt .video__poster { filter: brightness(.9); }
/* The post hero centres its text; the label should sit where it does on
   every other facade on the site */
.video--yt .video__label { text-align: left; }
.video--yt iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video--yt.is-loaded { cursor: default; }
/* .video:hover's shadow is built for dark grounds and reads as a black slab
   on the light strip this one sits over */
.video--yt:hover { box-shadow: 0 36px 70px -30px rgba(7, 18, 30, .65); }
.video--yt.is-loaded:hover { transform: none; box-shadow: 0 30px 60px -30px rgba(7, 18, 30, .55); }

.post-body { padding-top: 0; }

/* Article typography. Sized for reading rather than for a landing page: the
   site's section h2 is a 46px display line, which is far too loud for every
   subheading in a post. */
.prose {
  font-size: 1.06rem;
  line-height: 1.78;
  color: var(--text);
}
.prose p { margin: 0 0 1.15em; }
.prose__lead {
  font-size: clamp(1.12rem, 1.5vw, 1.24rem);
  line-height: 1.65;
  color: var(--heading);
}
.prose h2 {
  margin: 2em 0 .55em;
  font-size: clamp(1.45rem, 2.5vw, 1.9rem);
  line-height: 1.16;
}
.prose h3 {
  margin: 1.7em 0 .45em;
  font-size: clamp(1.15rem, 1.7vw, 1.32rem);
}
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: .4em 0; padding-left: .2em; }
.prose li::marker { color: var(--accent); font-weight: 700; }
/* Not .btn: the closing call to action sits inside the article, and its
   buttons keep their own label colour and no underline */
.prose a:not(.btn) { color: var(--accent); text-decoration: underline; }
.prose blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--brand-600);
  color: var(--heading);
  font-size: 1.12rem;
}
.prose figure { margin: 1.8em 0; }
.prose figure img { width: 100%; border-radius: var(--radius); }
.prose figcaption { margin-top: var(--space-xs); font-size: .85rem; color: var(--muted); }

/* Content still to come. Loud on purpose, so it cannot be published unseen. */
.prose .placeholder-note {
  margin: 1.4em 0;
  padding: 14px 18px;
  border: 2px dashed #c99400;
  border-radius: var(--radius-sm);
  background: #fff6dc;
  color: #3f3000;                    /* 11.6:1 on the cream */
  font-size: .95rem;
  font-weight: 600;
}

/* End of post call to action. A dark island in the light band, the same
   treatment as the homepage case study card: re-declaring the tokens flips
   everything inside it, buttons included. */
.post-cta {
  --heading: #ffffff;
  --text: rgba(255, 255, 255, .74);
  --muted: rgba(255, 255, 255, .56);
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(128, 192, 224, .24);
  --accent: var(--brand-300);
  --cta-ring: var(--brand-350);

  margin-top: var(--space-2xl);
  padding: clamp(28px, 4vw, 44px);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(72% 62% at 88% 0%, rgba(26, 114, 168, .3), transparent 62%),
    #0c131b;
  color: var(--text);
}
.prose .post-cta h2 { margin-top: 0; }
.post-cta :focus-visible { outline-color: var(--brand-300); }
.post-cta .section-cta { margin-top: var(--space-lg); }

.post-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
}
.link-arrow--back svg { transform: scaleX(-1); }
.link-arrow--back:hover svg { transform: scaleX(-1) translateX(4px); }

/* --------------------------------------------------------------------------
   5. RESPONSIVE — the site's own breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .page-hero { padding-top: calc(var(--header-h) + 48px); }
}

@media (max-width: 767px) {
  .page-hero { padding-top: calc(var(--header-h) + 28px); }
  .page-hero h1 { font-size: clamp(2.1rem, 8.6vw, 2.7rem); }
  .post-hero h1 { font-size: clamp(1.8rem, 7.4vw, 2.3rem); }
  .post-hero__media { margin-top: var(--space-xl); }
  /* A phone's facade is only ~200px tall, so the straddle is scaled to it */
  .post-hero { --overlap: 64px; }
  .js .blog-tools { margin-bottom: var(--space-xl); }
  .prose { font-size: 1.02rem; }
}

@media (max-width: 480px) {
  .chip { padding: 0 16px; }
}

@media print {
  .draft-bar, .blog-tools, .post-cta .section-cta { display: none !important; }
  .page-hero, .post-hero { background: #fff !important; margin-top: 0; padding-top: 0; }
}

/* Newsletter call-to-action inside posts (opens #newsletter) */
.post-newsletter{margin:2rem 0;padding:1.5rem;border:1px solid #d6e2ee;border-left:4px solid #1d6fb8;border-radius:8px;background:#eef4fa}
.post-newsletter__title{font-weight:700;font-size:1.15rem;margin:0 0 .5rem}
.post-newsletter p{margin:0 0 1rem}
.post-newsletter .btn{display:inline-flex}
