/* ══════════════════════════════════════════════════════════════════════
   AMERICAL PATROL — PREMIUM SLATE · BLOG
   Restyles the Python-generated blog (index + post) in the approved
   Premium Slate system. Loaded ALONGSIDE premium.css — every value below
   resolves to a premium.css token (slate + gold, Sora display / DM Sans
   body). No navy. No token redefinition. .reveal / .nav / .footer untouched.

   Targets the FIXED class names emitted by build_blog.py:
     INDEX  .ap-blog.blog-index > .container > .page-header + .blog-grid
            .blog-card[.blog-card-featured] > .card-img[.card-img-placeholder]
            + .card-body(.card-category/.card-title/.card-excerpt/.card-meta
            (.card-date/.card-read(.card-arrow)))
     POST   .ap-blog-post.blog-post.ap-blog-body
              > .post-header > .container (.post-category/h1/.post-dek/.post-meta…)
              > figure.post-hero-img
              > .container > .post-body  (rendered markdown article)
              > .container > aside.cta-box.inline (.btn-group/.btn-primary/.btn-outline)
              > section.related-posts > .container > .related-grid > .related-card …

   This file fully OWNS .post-body typography (premium.css ships none, and the
   old blog-styles.css body rules are Navy + not loaded on Premium pages).

   Premium-only design tokens used (defined in premium.css):
     --slate-950..50 --white --gold-600/500/400 --font-display --font-body
     --r-sm/md/lg/xl/pill --shadow-sm/md/lg --max-w --gutter --ring
   ══════════════════════════════════════════════════════════════════════ */


/* ──────────────────────────────────────────────────────────────────────
   0. SHARED — width containers + reusable placeholder gradient
   premium.css has no generic `.container` rule, so we scope the measure
   to the blog wrappers here. The placeholder gradient is the single
   source of the "no per-post photo" look (slate base, gold light-leak).
   ────────────────────────────────────────────────────────────────────── */
.ap-blog,
.ap-blog-post {
  font-family: var(--font-body);
  color: var(--slate-700);
}

/* Constrain the builder's bare `.container` wrappers within blog scopes only,
   so we never touch a global `.container` used elsewhere on the site. */
.ap-blog > .container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Tasteful slate→gold gradient placeholder. Used by both index + related
   cards when a post has no real hero photo. A soft gold light-leak in the
   upper-left + a faint engraved monogram keep it from reading as a flat fill. */
.card-img-placeholder,
.related-card-img-placeholder {
  position: relative;
  background:
    radial-gradient(115% 115% at 16% 10%, rgba(212,168,67,0.26) 0%, transparent 44%),
    radial-gradient(80% 90% at 92% 96%, rgba(202,138,4,0.10) 0%, transparent 50%),
    linear-gradient(135deg, var(--slate-700) 0%, var(--slate-800) 52%, var(--slate-900) 100%);
  overflow: hidden;
}
.card-img-placeholder::before,
.related-card-img-placeholder::before {
  content: "AP";
  position: absolute; right: 16px; bottom: 10px;
  font-family: var(--font-display);
  font-weight: 800; letter-spacing: -2px;
  font-size: 44px; line-height: 1;
  color: rgba(226,191,101,0.18);
  pointer-events: none;
}
/* hairline gold rule along the top — a small premium signature */
.card-img-placeholder::after,
.related-card-img-placeholder::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--gold-600), var(--gold-400) 60%, transparent);
  pointer-events: none;
}


/* ══════════════════════════════════════════════════════════════════════
   1. INDEX — page header + responsive card grid
   ══════════════════════════════════════════════════════════════════════ */
.ap-blog.blog-index {
  background: var(--white);
  padding: 72px 0 88px;
}
@media (min-width: 768px)  { .ap-blog.blog-index { padding: 96px 0 104px; } }
@media (min-width: 1024px) { .ap-blog.blog-index { padding: 120px 0 128px; } }

/* ── header — editorial, left-aligned, gold eyebrow rule over the H1 ── */
.ap-blog .page-header {
  max-width: 720px;
  margin: 0 0 48px;
}
@media (min-width: 768px) { .ap-blog .page-header { margin-bottom: 64px; } }

.ap-blog .page-header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 6vw, 52px);
  letter-spacing: -1.4px;
  line-height: 1.04;
  color: var(--slate-900);
  text-wrap: balance;
  position: relative;
  padding-top: 28px;
}
/* eyebrow rule — mirrors premium.css .eyebrow::before without the text slot */
.ap-blog .page-header h1::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 48px; height: 3px; border-radius: 2px;
  background: var(--gold-500);
}
.ap-blog .page-header p {
  font-size: 17px;
  color: var(--slate-600);
  line-height: 1.7;
  max-width: 60ch;
  margin-top: 18px;
}

/* ── grid: 1 col → 2 @ 640 → 3 @ 1024 ── */
.ap-blog .blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 640px) {
  .ap-blog .blog-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}
@media (min-width: 1024px) {
  .ap-blog .blog-grid { grid-template-columns: repeat(3, 1fr); gap: 28px; }
}

/* empty state (no posts yet) */
.ap-blog .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--slate-500);
  font-size: 16px;
  padding: 48px 0;
}

/* ── card — mirrors .t-card: white, slate-200 border, lift + shadow ── */
.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .35s cubic-bezier(.16,1,.3,1),
              box-shadow .35s cubic-bezier(.16,1,.3,1),
              border-color .35s ease;
}
.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--slate-300);
}
.blog-card:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--gold-500);
}

/* 16:10 media — real <img> and the placeholder share the ratio */
.blog-card .card-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--slate-100);
}
.blog-card .card-img-placeholder { aspect-ratio: 16 / 10; }
/* subtle zoom on the real photo to match the homepage svc/ind hover language */
.blog-card .card-img:not(.card-img-placeholder) {
  transition: transform 4s cubic-bezier(.16,1,.3,1);
}
.blog-card:hover .card-img:not(.card-img-placeholder) { transform: scale(1.05); }

.blog-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 26px 24px 24px;
}

.card-category {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold-600);
  margin-bottom: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.4px;
  line-height: 1.28;
  color: var(--slate-900);
  margin-bottom: 10px;
  text-wrap: balance;
}
.card-excerpt {
  font-size: 14.5px;
  color: var(--slate-600);
  line-height: 1.65;
  /* clamp to 3 lines so cards keep a tidy baseline across the row */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* meta row pinned to the bottom of the card body */
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--slate-100);
}
.card-date {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
}
.card-read {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--slate-900);
  white-space: nowrap;
}
.card-arrow {
  display: inline-block;
  color: var(--gold-600);
  transition: transform .25s ease;
}
.blog-card:hover .card-read { color: var(--gold-600); }
.blog-card:hover .card-arrow { transform: translateX(4px); }

/* ── featured card — spans full width (mobile/tablet) then 2 cols @1024,
      larger media + display type. First card or any featured:true. ── */
@media (min-width: 640px) {
  .blog-card.blog-card-featured { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
  /* span 2 of the 3 tracks and lay out as a side-by-side editorial unit */
  .blog-card.blog-card-featured {
    grid-column: span 2;
    flex-direction: row;
    align-items: stretch;
  }
  .blog-card.blog-card-featured .card-img,
  .blog-card.blog-card-featured .card-img-placeholder {
    width: 55%;
    aspect-ratio: auto;
    min-height: 100%;
  }
  .blog-card.blog-card-featured .card-body {
    width: 45%;
    justify-content: center;
    padding: 44px 44px 42px;
  }
  .blog-card.blog-card-featured .card-title { font-size: 27px; letter-spacing: -0.7px; }
  .blog-card.blog-card-featured .card-excerpt {
    font-size: 15.5px; -webkit-line-clamp: 4;
  }
  .blog-card.blog-card-featured .card-img-placeholder::before { font-size: 60px; }
}


/* ══════════════════════════════════════════════════════════════════════
   2. POST — header / hero / article body / inline CTA / related
   ══════════════════════════════════════════════════════════════════════ */
.ap-blog-post {
  background: var(--white);
}

/* all three bare `.container` wrappers in the post share a narrow measure;
   the hero figure widens its own below. */
.ap-blog-post > .container,
.ap-blog-post .post-header > .container {
  max-width: 760px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ── header — narrow column, gold pill, clamp display H1, slate dek ── */
.ap-blog-post .post-header {
  background: var(--white);
  padding: 64px 0 28px;
}
@media (min-width: 768px) { .ap-blog-post .post-header { padding: 88px 0 32px; } }

.post-category {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-600);
  background: rgba(212,168,67,0.10);
  border: 1px solid rgba(212,168,67,0.30);
  border-radius: var(--r-pill);
  padding: 6px 16px;
  margin-bottom: 22px;
}
.ap-blog-post .post-header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 5.2vw, 48px);
  line-height: 1.08;
  letter-spacing: -1.2px;
  color: var(--slate-900);
  margin: 0 0 18px;
  text-wrap: balance;
}
.post-dek {
  font-family: var(--font-body);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.6;
  color: var(--slate-600);
  margin: 0 0 30px;
  max-width: 62ch;
}

/* meta row — author bolded slate-900, gold dot separators */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--slate-500);
}
.post-author { color: var(--slate-900); font-weight: 600; }
.post-meta-sep { color: var(--gold-500); font-weight: 700; }
.post-date time { font-variant-numeric: tabular-nums; }
.post-reading-time { font-variant-numeric: tabular-nums; }

/* ── hero image — wider than the text column, rounded, capped height ── */
.ap-blog-post .post-hero-img {
  max-width: 1100px;
  margin: 12px auto 0;
  padding: 0 var(--gutter);
}
.ap-blog-post .post-hero-img img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: block;
}

/* ── ARTICLE BODY — owned here in full (premium.css ships no prose) ──
   ~760px measure inherited from .ap-blog-post > .container. DM Sans body,
   Sora headings, gold links, slate-50 blockquote with gold rule. ── */
.ap-blog-post .post-body {
  padding: 44px 0 8px;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.8;
  color: var(--slate-700);
}
/* thin engraved divider between hero and body (Medium-style) */
.ap-blog-post .post-hero-img + .container .post-body {
  border-top: 1px solid var(--slate-200);
  margin-top: 44px;
}

.ap-blog-post .post-body > :first-child { margin-top: 0; }

.ap-blog-post .post-body h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 3.4vw, 31px);
  letter-spacing: -0.8px;
  line-height: 1.2;
  color: var(--slate-900);
  margin: 52px 0 16px;
  text-wrap: balance;
}
.ap-blog-post .post-body h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 2.6vw, 24px);
  letter-spacing: -0.5px;
  line-height: 1.25;
  color: var(--slate-900);
  margin: 38px 0 12px;
}
.ap-blog-post .post-body h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.2px;
  line-height: 1.3;
  color: var(--slate-800);
  margin: 30px 0 10px;
}
.ap-blog-post .post-body p { margin: 0 0 22px; }

.ap-blog-post .post-body a {
  color: var(--gold-600);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(202,138,4,0.45);
  transition: color .2s ease, text-decoration-color .2s ease;
}
.ap-blog-post .post-body a:hover {
  color: var(--gold-500);
  text-decoration-color: var(--gold-500);
}

.ap-blog-post .post-body strong { color: var(--slate-900); font-weight: 700; }
.ap-blog-post .post-body em { font-style: italic; }

/* lists — gold marker for ul, slate counter for ol */
.ap-blog-post .post-body ul,
.ap-blog-post .post-body ol {
  margin: 0 0 24px;
  padding-left: 4px;
  list-style: none;
}
.ap-blog-post .post-body li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
  line-height: 1.75;
}
.ap-blog-post .post-body ul > li::before {
  content: "";
  position: absolute; left: 4px; top: 12px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold-500);
}
.ap-blog-post .post-body ol { counter-reset: ap-ol; }
.ap-blog-post .post-body ol > li { counter-increment: ap-ol; }
.ap-blog-post .post-body ol > li::before {
  content: counter(ap-ol);
  position: absolute; left: 0; top: 2px;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  color: var(--gold-600);
  font-variant-numeric: tabular-nums;
}
/* nested lists keep a little air */
.ap-blog-post .post-body li > ul,
.ap-blog-post .post-body li > ol { margin: 12px 0 0; }

/* blockquote — gold left rule, slate-50 panel */
.ap-blog-post .post-body blockquote {
  margin: 32px 0;
  padding: 22px 26px;
  background: var(--slate-50);
  border-left: 4px solid var(--gold-500);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--slate-700);
}
.ap-blog-post .post-body blockquote p {
  font-size: 17px;
  font-style: italic;
  line-height: 1.7;
  margin: 0;
}
.ap-blog-post .post-body blockquote p:last-child { margin-bottom: 0; }

/* inline + block code */
.ap-blog-post .post-body code {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  color: var(--slate-900);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  padding: 2px 6px;
}
.ap-blog-post .post-body pre {
  margin: 0 0 24px;
  padding: 20px 22px;
  background: var(--slate-900);
  border-radius: var(--r-md);
  overflow-x: auto;
}
.ap-blog-post .post-body pre code {
  color: var(--slate-100);
  background: none;
  border: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.7;
}

/* images embedded in body */
.ap-blog-post .post-body img {
  width: 100%;
  height: auto;
  border-radius: var(--r-lg);
  margin: 28px 0;
  box-shadow: var(--shadow-md);
}

/* tables (markdown "extra") */
.ap-blog-post .post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 26px;
  font-size: 15px;
}
.ap-blog-post .post-body th {
  background: var(--slate-900);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  text-align: left;
  padding: 12px 16px;
}
.ap-blog-post .post-body td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-200);
  color: var(--slate-700);
}
.ap-blog-post .post-body tr:nth-child(even) td { background: var(--slate-50); }

/* horizontal rule between sections */
.ap-blog-post .post-body hr {
  border: 0;
  height: 1px;
  background: var(--slate-200);
  margin: 40px 0;
}

/* ── INLINE CTA — dark slate-900 band, white head, slate-300 copy ── */
.ap-blog-post .cta-box.inline {
  background: var(--slate-900);
  border-radius: var(--r-lg);
  padding: 40px 32px;
  margin: 24px 0 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* gold radial light-leak matching the homepage dark CTA bands */
.ap-blog-post .cta-box.inline::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 460px 300px at 80% 0%, rgba(212,168,67,0.12), transparent 60%);
  pointer-events: none;
}
.ap-blog-post .cta-box.inline > * { position: relative; z-index: 1; }
.ap-blog-post .cta-box.inline h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 3vw, 26px);
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: var(--white);
  margin: 0 0 10px;
  text-wrap: balance;
}
.ap-blog-post .cta-box.inline p {
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--slate-300);
  margin: 0 auto 26px;
  max-width: 48ch;
}
.ap-blog-post .cta-box.inline .btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}
@media (min-width: 480px) {
  .ap-blog-post .cta-box.inline .btn-group {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* primary = gold (mirrors .btn-gold); outline = light-on-dark (mirrors .btn-outline-w) */
.ap-blog-post .cta-box.inline .btn-primary,
.ap-blog-post .cta-box.inline .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase;
  padding: 15px 28px;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background .25s ease, color .25s ease,
              border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.ap-blog-post .cta-box.inline .btn-primary {
  background: var(--gold-500);
  color: var(--slate-950);
  box-shadow: var(--shadow-gold);
}
.ap-blog-post .cta-box.inline .btn-primary:hover {
  background: var(--gold-400);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(212,168,67,0.40);
}
.ap-blog-post .cta-box.inline .btn-primary:active { transform: translateY(0); transition-duration: .08s; }
.ap-blog-post .cta-box.inline .btn-outline {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.22);
  font-weight: 600;
}
.ap-blog-post .cta-box.inline .btn-outline:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.40);
}
.ap-blog-post .cta-box.inline .btn-primary:focus-visible,
.ap-blog-post .cta-box.inline .btn-outline:focus-visible { outline: none; box-shadow: var(--ring); }


/* ══════════════════════════════════════════════════════════════════════
   3. RELATED POSTS — slate-50 section, auto-fit premium cards
   ══════════════════════════════════════════════════════════════════════ */
.related-posts {
  background: var(--slate-50);
  padding: 72px 0;
  border-top: 1px solid var(--slate-200);
}
@media (min-width: 768px) { .related-posts { padding: 96px 0; } }

.related-posts > .container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.related-posts h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: -0.8px;
  line-height: 1.15;
  color: var(--slate-900);
  margin: 0 0 32px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.related-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .35s cubic-bezier(.16,1,.3,1),
              box-shadow .35s cubic-bezier(.16,1,.3,1),
              border-color .35s ease;
}
.related-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--slate-300);
}
.related-card:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--gold-500);
}
.related-card img,
.related-card .related-card-img-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--slate-100);
}
.related-card .related-card-img-placeholder::before { font-size: 38px; }

.related-card-body { padding: 20px 20px 22px; }
.related-card-category {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-600);
  margin-bottom: 10px;
}
.related-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: -0.2px;
  color: var(--slate-900);
  margin-bottom: 8px;
}
.related-card-date {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
}


/* ══════════════════════════════════════════════════════════════════════
   4. SMALL-SCREEN TUNING (≤520px)
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 520px) {
  .ap-blog-post .post-header { padding-top: 56px; }
  .ap-blog-post .post-body { font-size: 16px; }
  .ap-blog-post .post-body h2 { margin-top: 40px; }
  .ap-blog-post .cta-box.inline { padding: 32px 24px; margin-bottom: 56px; }
  .ap-blog-post .post-hero-img img { border-radius: var(--r-md); }
  .blog-card .card-body { padding: 22px 20px 20px; }
}
