/* Styles for server-rendered blog pages (see BlogRenderer). Loaded ONLY on blog pages, so it
   may safely override the site header for the no-JS (stripped-hydration) case.

   Home = "Command Deck": a dark ops-console treatment on the site's brand navy, with frosted-
   glass cards on a faint monitoring grid, a live "signal" pulse, and a cursor-tracked spotlight.
   Post page keeps the lighter reading treatment (restyled separately). */

.blog-tiles,
.blog-list,
.blog-all-title,
.blog-more-wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 24px;
}

/* ============================ HOME ============================ */

/* Shared brand tokens (blog.css only loads on blog pages) + the pale-blue light ground. */
:root {
  --d-teal: #36c2c9;
  --d-blue: #2f6fed;
  --d-ink: #edf2fb;
  --d-mut: #a7b8d6;
  --d-line: rgba(255, 255, 255, 0.11);
  --d-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --blog-light: linear-gradient(180deg, #eef4fe 0%, #e5edfb 100%);
}
/* Faint monitoring grid used by the dark hero + post header. */
.blog-deck-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(122, 165, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 165, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(130% 72% at 50% 0%, #000 34%, transparent 100%);
  mask-image: radial-gradient(130% 72% at 50% 0%, #000 34%, transparent 100%);
}

/* Dark hero (navy + monitoring grid); the search bar lives here. Everything below is light. */
.blog-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #223055 0%, #18223c 100%);
  color: var(--d-ink);
  padding: 54px 24px 40px;
}
.blog-hero .blog-deck-grid {
  z-index: 0;
}
.blog-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin-inline: auto;
  text-align: left;
}

/* Light section below the search bar (pale blue). */
.blog-home-main {
  background: var(--blog-light);
  padding-bottom: 4px;
}
.blog-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--d-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--d-teal);
}
.blog-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--d-teal);
  box-shadow: 0 0 0 0 rgba(54, 194, 201, 0.55);
  animation: blog-pulse 2.4s ease-out infinite;
}
@keyframes blog-pulse {
  0% { box-shadow: 0 0 0 0 rgba(54, 194, 201, 0.55); }
  70% { box-shadow: 0 0 0 12px rgba(54, 194, 201, 0); }
  100% { box-shadow: 0 0 0 0 rgba(54, 194, 201, 0); }
}
.blog-hero h1 {
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 16px 0 12px;
  color: #fff;
  text-wrap: balance;
}
.blog-hero-sub {
  color: var(--d-mut);
  font-size: 16px;
  margin: 0 0 22px;
  max-width: 56ch;
}
.blog-search-wrap {
  position: relative;
  max-width: 480px;
}
.blog-search-ic {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  color: var(--d-mut);
  pointer-events: none;
}
#blog-search {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px 14px 46px;
  font-size: 15px;
  color: var(--d-ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--d-line);
  border-radius: 12px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
#blog-search::placeholder {
  color: var(--d-mut);
}
#blog-search:focus {
  outline: 2px solid var(--d-teal);
  outline-offset: 2px;
}

/* Recent-post tiles: photo-backed, hover motion. */
.blog-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding-block: 28px 40px;
}
.blog-tile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  background: #0f1830;
  border: 1px solid var(--d-line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  isolation: isolate;
  transition:
    transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.32s ease;
}
.blog-tile-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #0f1830 center / cover no-repeat;
  transform: scale(1.03);
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.blog-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(9, 16, 38, 0.12) 0%, rgba(9, 16, 38, 0.5) 52%, rgba(9, 16, 38, 0.9) 100%);
  transition: background 0.32s ease;
}
.blog-tile-body {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
}
.blog-tile-body::before {
  content: '';
  width: 32px;
  height: 3px;
  margin-bottom: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--d-blue), var(--d-teal));
  transition: width 0.32s ease;
}
.blog-tile-title {
  font-weight: 800;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}
.blog-tile-date {
  margin-top: 6px;
  font-family: var(--d-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #cfe0ff;
  opacity: 0.9;
}
.blog-tile:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45);
}
.blog-tile:hover .blog-tile-img {
  transform: scale(1.12);
}
.blog-tile:hover::after {
  background: linear-gradient(180deg, rgba(9, 16, 38, 0.05) 0%, rgba(19, 44, 96, 0.5) 48%, rgba(9, 16, 38, 0.92) 100%);
}
.blog-tile:hover .blog-tile-body::before {
  width: 68px;
}
.blog-tile:focus-visible {
  outline: 3px solid var(--d-teal);
  outline-offset: 3px;
}

/* "All posts" — a mono section label on the light ground. */
.blog-all-title {
  font-family: var(--d-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5a6b8c;
  margin: 24px auto 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.blog-all-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #d5e0f2;
}

/* Full crawlable list — browsable + paginated by the inline script. Light cards. */
.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding-block: 18px 10px;
}
.blog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f2;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: #fff;
  transition:
    transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}
/* Faint cursor-tracked teal glow (JS sets --mx/--my on hover). */
.blog-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(54, 194, 201, 0.12), transparent 60%);
}
.blog-card > * {
  position: relative;
  z-index: 1;
}
.blog-card:hover {
  transform: translateY(-5px);
  border-color: #bcd3ff;
  box-shadow: 0 18px 40px -22px rgba(20, 40, 90, 0.35);
}
.blog-card:hover::before {
  opacity: 1;
}
.blog-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #16203c center / cover no-repeat;
  transition: transform 0.4s ease;
}
.blog-card:hover .blog-card-thumb {
  transform: scale(1.05);
}
/* "VIDEO" signal badge on posts that carry an embed. */
.blog-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  font-family: var(--d-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--d-teal);
  background: rgba(6, 14, 30, 0.72);
  border: 1px solid var(--d-line);
  border-radius: 6px;
  padding: 3px 8px;
}
/* Stack the text fields as a flex column; fixed line counts so cards align. */
.blog-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px;
}
.blog-card-date {
  font-family: var(--d-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: #159fb2;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.blog-card-title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.32;
  color: #16203c;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.64em;
}
.blog-card-summary {
  margin-top: 8px;
  color: #5a6b8c;
  font-size: 13.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-empty {
  text-align: center;
  color: #6b7c9c;
  padding: 40px;
}

/* Infinite-scroll "Load more" fallback button. */
.blog-more-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 24px 52px;
}
.blog-load-more {
  font-family: var(--d-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #2f6fed;
  background: #fff;
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  padding: 12px 26px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.blog-load-more:hover {
  background: #f2f7ff;
  border-color: #a9c8ff;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(47, 111, 237, 0.15);
}
.blog-scroll-sentinel {
  height: 1px;
}

/* ===================== POST PAGE — dark header → light reading column ======= */

/* Reading-progress bar (pure CSS scroll-driven; invisible where unsupported). */
.blog-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, #2f6fed, #36c2c9);
}
@supports (animation-timeline: scroll()) {
  .blog-progress {
    animation: blog-progress linear both;
    animation-timeline: scroll(root block);
  }
  @keyframes blog-progress {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
  }
}

.blog-post {
  --d-teal: #36c2c9;
  --d-mut: #a7b8d6;
  --d-line: rgba(255, 255, 255, 0.12);
  --d-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

/* Immersive dark header. */
.blog-post-head {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  min-height: clamp(280px, 32vw, 380px);
  background: linear-gradient(180deg, #223055 0%, #18223c 100%);
  color: #edf2fb;
  padding: 30px 24px 34px;
}
/* Hero photo fills the header; a left→right navy scrim keeps the title legible on the left and
   reveals the image on the right. A bottom scrim guarantees legibility on narrow screens. */
.blog-post-head-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #16203c center / cover no-repeat;
}
.blog-post-head-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, #18223c 0%, rgba(24, 34, 60, 0.92) 34%, rgba(24, 34, 60, 0.2) 76%, rgba(24, 34, 60, 0) 100%),
    linear-gradient(0deg, rgba(16, 22, 40, 0.55) 0%, transparent 46%);
}
.blog-post-head .blog-deck-grid {
  z-index: 1;
  opacity: 0.35;
}
.blog-post-head-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
}
.blog-crumbs {
  font-family: var(--d-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--d-mut);
}
.blog-crumbs a {
  color: var(--d-teal);
  text-decoration: none;
}
.blog-crumbs a:hover {
  text-decoration: underline;
}
.blog-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: 20px 0 14px;
  font-family: var(--d-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--d-mut);
}
.blog-post-meta .sep {
  color: #4a5c82;
}
.blog-post-meta .vid {
  color: var(--d-teal);
  border: 1px solid var(--d-line);
  border-radius: 6px;
  padding: 2px 8px;
  letter-spacing: 0.08em;
}
.blog-post h1 {
  font-size: clamp(30px, 4.6vw, 50px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0;
  color: #fff;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

/* Light reading column (the hero now lives in the header). */
.blog-post-body-wrap {
  background: #fff;
  padding: 44px 24px 8px;
}
.blog-body {
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.78;
  font-size: 18px;
  color: #253248;
}
.blog-body > *:first-child {
  margin-top: 0;
}
/* Emphasized lead paragraph. */
.blog-body > p:first-of-type {
  font-size: 20.5px;
  line-height: 1.6;
  color: #1a2740;
}
.blog-body h2 {
  font-size: 25px;
  letter-spacing: -0.01em;
  margin: 40px 0 12px;
  color: #14203c;
}
.blog-body h3 {
  font-size: 20px;
  margin: 30px 0 10px;
  color: #14203c;
}
.blog-body p {
  margin: 0 0 20px;
}
.blog-body a {
  color: #2f6fed;
  text-underline-offset: 2px;
}
.blog-body ul,
.blog-body ol {
  margin: 0 0 20px;
  padding-left: 24px;
}
.blog-body li {
  margin-bottom: 8px;
}
.blog-body blockquote {
  margin: 24px 0;
  padding: 6px 22px;
  border-left: 3px solid #36c2c9;
  color: #3c4c66;
  font-size: 20px;
  font-style: italic;
}
.blog-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 8px 0 20px;
}
.blog-body figure {
  margin: 0 0 20px;
}
.blog-body figcaption {
  font-size: 14px;
  color: #7386a6;
  margin-top: 8px;
}
/* Responsive 16:9 iframe embeds + self-hosted <video> players. */
.blog-body iframe,
.blog-body video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 14px;
  margin: 12px 0 24px;
  background: #0f1830;
}

/* Read-next: a light pale-blue band of recent posts at the foot of the article. */
.blog-readnext {
  background: var(--blog-light);
  padding: 40px 24px 60px;
}
.blog-readnext .blog-list {
  padding-block: 16px 0;
}

/* ============================ shared ====================== */

.blog-hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .blog-body {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .blog-live {
    animation: none;
  }
  .blog-tile,
  .blog-tile-img,
  .blog-tile::after,
  .blog-tile-body::before,
  .blog-card,
  .blog-card-thumb,
  .blog-load-more {
    transition: none;
  }
  .blog-tile:hover,
  .blog-card:hover,
  .blog-load-more:hover {
    transform: none;
  }
  .blog-tile:hover .blog-tile-img,
  .blog-card:hover .blog-card-thumb {
    transform: scale(1.03);
  }
}

/* No-JS fallback: hydration is stripped on blog pages, so the MUI mobile drawer button is
   inert. Show the primary nav at every width and hide the dead hamburger. */
@media (max-width: 1023px) {
  nav[aria-label='Primary'] {
    display: flex !important;
    flex-wrap: wrap;
  }
  [aria-label='Open menu'] {
    display: none !important;
  }
}
