/*
 * Blog index (/blog/) and articles (/blog/<slug>/). Loaded after styles.css and glow.css by
 * includes/blog-template.php (version SB_BLOG_VER there). Library cards and the aside card are lit by
 * glow.js (.bl-card, .bl-aside-card), each in its category's --glow-rgb from sb_blog_categories().
 * Every post's photo lives at images/blog/<slug>.jpg; until one exists the art is drawn in the category color.
 */

/* ---------- Labels and meta ---------- */

.bl-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: rgb(var(--glow-rgb, 77 159 255));
  font: 500 0.7rem/1.2 var(--font-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.bl-label::before {
  content: "#";
  font: 700 0.95rem/1 var(--font-display);
  letter-spacing: 0;
  text-shadow: 0 0 14px rgb(var(--glow-rgb, 77 159 255) / 0.75);
}

.bl-meta {
  color: var(--text-dim);
  font: 500 0.72rem/1.4 var(--font-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bl-go {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font: 600 0.95rem/1 var(--font-body);
}

.bl-go::after {
  content: "→";
  transition: transform 0.35s var(--ease-out);
}

/* ---------- Art: the post's photo, or a drawn stand-in in its category color ---------- */

.bl-art {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #070a12;
}

.bl-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s var(--ease-out), filter 0.6s;
}

:root:not(.sb-flat) .bl-art > img:first-child {
  border-radius: 0;
}

.bl-art--drawn {
  background:
    radial-gradient(70% 90% at 72% 12%, rgb(var(--glow-rgb) / 0.3), transparent 62%),
    radial-gradient(60% 70% at 12% 110%, rgb(var(--glow-rgb) / 0.14), transparent 66%),
    linear-gradient(160deg, #0c1322, #05070d);
}

.bl-art-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(80% 85% at 62% 28%, #000, transparent 75%);
  mask-image: radial-gradient(80% 85% at 62% 28%, #000, transparent 75%);
}

.bl-art-icon {
  position: absolute;
  top: 50%;
  right: 9%;
  width: 28%;
  max-width: 150px;
  aspect-ratio: 1;
  color: rgb(var(--glow-rgb));
  opacity: 0.92;
  transform: translateY(-50%);
  filter: drop-shadow(0 0 18px rgb(var(--glow-rgb) / 0.7));
}

.bl-art-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.1;
}

/* ---------- Index: masthead ---------- */

.bl-masthead.landing-hero {
  padding-bottom: clamp(1.75rem, 4.5vh, 3rem);
}

.bl-masthead {
  min-height: clamp(400px, 52vh, 520px);
}

.bl-masthead-inner {
  max-width: var(--container, 1200px);
}

.bl-masthead-inner > * {
  max-width: min(40rem, 58%);
}

.bl-masthead-title {
  max-width: 15ch;
  margin: 0.55rem 0 1.4rem;
  color: #fff;
  font: 800 clamp(2.4rem, 5.2vw, 4.75rem) / 0.97 var(--font-display);
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.bl-masthead-title em {
  color: rgb(255 255 255 / 0.4);
  font-style: normal;
}

.bl-masthead-lead {
  max-width: 32rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

/* ---------- Index: cover (the newest story big, three more beside it) ---------- */

.bl-cover {
  position: relative;
  padding-bottom: clamp(3.5rem, 9vh, 6rem);
}

.bl-cover-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr);
  gap: 14px;
}

.bl-lead {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: clamp(480px, 66vh, 660px);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 22px;
  color: inherit;
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgb(var(--glow-rgb) / 0.4),
    0 50px 140px -70px rgb(var(--glow-rgb) / 0.85);
  transition: border-color 0.4s, box-shadow 0.6s var(--ease-out);
}

.bl-lead-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  aspect-ratio: auto;
  border-radius: 0;
}

.bl-lead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(0deg, rgb(2 2 4 / 0.97) 0%, rgb(2 2 4 / 0.78) 30%, rgb(2 2 4 / 0) 66%),
    linear-gradient(90deg, rgb(2 2 4 / 0.6), transparent 62%);
  pointer-events: none;
}

.bl-lead-body {
  display: grid;
  gap: 0.95rem;
  max-width: 42rem;
  padding: clamp(1.5rem, 3.6vw, 3rem);
}

.bl-lead-title {
  color: #fff;
  font: 800 clamp(2rem, 3.9vw, 3.5rem) / 0.99 var(--font-display);
  letter-spacing: -0.05em;
  text-shadow: 0 2px 40px rgb(0 0 0 / 0.5);
  text-wrap: balance;
}

.bl-lead-excerpt {
  max-width: 34rem;
  color: #c9cdd8;
  font-size: 1.06rem;
  line-height: 1.6;
}

.bl-lead-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.4rem;
  margin-top: 0.5rem;
}

.bl-lead .bl-go {
  padding: 0.8rem 1.2rem;
  border: 1px solid rgb(var(--glow-rgb) / 0.45);
  border-radius: 999px;
  background: rgb(var(--glow-rgb) / 0.14);
  box-shadow: 0 0 30px -10px rgb(var(--glow-rgb) / 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.bl-lead:is(:hover, :focus-visible) {
  border-color: rgb(var(--glow-rgb) / 0.35);
  box-shadow:
    inset 0 1px 0 rgb(var(--glow-rgb) / 0.65),
    0 60px 160px -60px rgb(var(--glow-rgb) / 1);
}

.bl-side {
  display: grid;
  grid-template-rows: auto repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.bl-side-head {
  margin: 0;
  padding: 0.15rem 0.3rem 0;
  color: var(--text-dim);
  font: 500 0.7rem/1.2 var(--font-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.bl-side-story {
  display: grid;
  grid-template-columns: 42% minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--sb-line, rgb(255 255 255 / 0.075));
  border-radius: 18px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.035), rgb(255 255 255 / 0.008));
  color: inherit;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgb(var(--glow-rgb) / 0.28);
  transition: transform 0.55s var(--ease-out), border-color 0.4s, box-shadow 0.5s var(--ease-out);
}

.bl-side-art {
  height: 100%;
  min-height: 112px;
  aspect-ratio: auto;
  border-radius: 12px;
}

.bl-side-body {
  display: grid;
  gap: 0.45rem;
  padding: 0.25rem 0.5rem 0.25rem 0;
}

.bl-side-title {
  display: -webkit-box;
  overflow: hidden;
  color: #fff;
  font: 700 1.04rem/1.2 var(--font-display);
  letter-spacing: -0.025em;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.bl-side-story:is(:hover, :focus-visible) {
  border-color: rgb(var(--glow-rgb) / 0.3);
  box-shadow:
    inset 0 1px 0 rgb(var(--glow-rgb) / 0.55),
    0 30px 80px -40px rgb(var(--glow-rgb) / 0.7);
  transform: translateY(-3px);
}

:is(.bl-lead, .bl-side-story, .bl-card):is(:hover, :focus-visible) .bl-art img {
  transform: scale(1.045);
}

:is(.bl-lead, .bl-card):is(:hover, :focus-visible) .bl-go::after {
  transform: translateX(4px);
}

/* ---------- Index: the library ---------- */

.bl-library,
.bl-article,
.bl-related {
  overflow-x: clip;
}

.bl-library-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.bl-library-head .eyebrow {
  margin-bottom: 0.6rem;
}

.bl-count {
  margin: 0;
  color: var(--text-dim);
  font: 500 0.72rem/1.4 var(--font-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bl-filters {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 1.5rem 0 1.75rem;
  padding: 6px;
  border: 1px solid rgb(255 255 255 / 0.07);
  border-radius: 999px;
  background: rgb(6 7 12 / 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
}

.bl-filter {
  --glow-rgb: 77 159 255;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--text-muted);
  font: 500 0.88rem/1 var(--font-body);
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, background 0.25s, box-shadow 0.25s;
}

.bl-filter::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(var(--glow-rgb));
  box-shadow: 0 0 10px rgb(var(--glow-rgb) / 0.85);
}

.bl-filter-n {
  color: var(--text-dim);
  font: 500 0.7rem/1 var(--font-label);
}

.bl-filter:hover {
  color: var(--text);
}

.bl-filter.is-active {
  border-color: rgb(var(--glow-rgb) / 0.55);
  background: rgb(var(--glow-rgb) / 0.13);
  color: #fff;
  box-shadow: 0 0 24px -8px rgb(var(--glow-rgb) / 0.85);
}

.bl-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bl-stream > [hidden] {
  display: none;
}

.bl-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.bl-card-art {
  aspect-ratio: 16 / 10;
  border-radius: 17px 17px 0 0;
}

.bl-card-art::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: linear-gradient(0deg, rgb(4 5 9 / 0.85), transparent);
  pointer-events: none;
}

.bl-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.1rem 1.3rem 1.3rem;
}

.bl-card-title {
  color: #fff;
  font: 700 1.24rem/1.18 var(--font-display);
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.bl-card-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bl-card .bl-meta {
  margin-top: auto;
  padding-top: 0.4rem;
}

/* ---------- Article: poster (photo full-bleed, title set over it) ---------- */

.bl-progress {
  position: fixed;
  top: var(--header-h);
  right: 0;
  left: 0;
  z-index: 40;
  height: 2px;
  pointer-events: none;
}

.bl-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3fd4ea, #79b6ef, #4d9fff, #84c2ae, #f9d93f, #f0a35e, #ff7a1a, #ff3b30, #ff4f8b, #d0688f);
  box-shadow: 0 0 14px rgb(var(--glow-rgb) / 0.6);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.bl-poster {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: clamp(560px, 86vh, 880px);
  padding: calc(var(--header-h) + 3rem) 0 clamp(2.5rem, 6vh, 4rem);
  overflow: hidden;
}

.bl-poster-media {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.bl-poster-art {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  border-radius: 0;
  animation: bl-settle 2.6s var(--ease-out) both;
}

.bl-poster-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, #020204 0%, rgb(2 2 4 / 0.88) 22%, rgb(2 2 4 / 0.1) 62%, rgb(2 2 4 / 0.5) 100%),
    linear-gradient(90deg, rgb(2 2 4 / 0.72) 0%, rgb(2 2 4 / 0.2) 55%, transparent 85%);
}

.bl-poster.is-drawn {
  min-height: clamp(460px, 64vh, 640px);
}

@keyframes bl-settle {
  from {
    transform: scale(1.07);
  }
}

.bl-poster-copy > * {
  max-width: 56rem;
}

.bl-poster .landing-breadcrumb {
  margin-bottom: 1.4rem;
}

.bl-topic {
  color: rgb(var(--glow-rgb));
}

.bl-topic::before {
  color: rgb(var(--glow-rgb));
  text-shadow: 0 0 18px rgb(var(--glow-rgb) / 0.7);
}

.bl-title {
  max-width: 17ch;
  margin: 0.4rem 0 0;
  color: #fff;
  font: 800 clamp(2.4rem, 5.4vw, 4.8rem) / 0.98 var(--font-display);
  letter-spacing: -0.052em;
  text-shadow: 0 2px 40px rgb(0 0 0 / 0.55);
  text-wrap: balance;
}

.bl-deck {
  max-width: 42rem;
  margin: 1.25rem 0 0;
  color: #cfd3dd;
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  line-height: 1.55;
}

.bl-poster .bl-meta {
  margin: 1.5rem 0 0;
}

/* ---------- Article: body ---------- */

.bl-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
  padding-block: clamp(1.5rem, 4vh, 2.5rem) clamp(3rem, 8vh, 5rem);
}

.bl-prose {
  max-width: 68ch;
  color: #d5d8e1;
  font-size: 1.125rem;
  line-height: 1.75;
}

.bl-prose > * {
  margin: 0;
}

.bl-prose > * + * {
  margin-top: 1.15em;
}

.bl-prose > p:first-child::first-line {
  color: #fff;
}

.bl-prose h2 {
  margin-top: 2.2em;
  color: #fff;
  font: 700 clamp(1.5rem, 2.4vw, 2rem) / 1.15 var(--font-display);
  letter-spacing: -0.035em;
}

.bl-prose h3 {
  margin-top: 1.8em;
  color: #fff;
  font: 600 1.25rem/1.25 var(--font-display);
  letter-spacing: -0.02em;
}

.bl-prose a {
  color: var(--accent-light);
  text-decoration: underline;
  text-decoration-color: rgb(158 207 255 / 0.35);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.2s;
}

.bl-prose a:hover {
  text-decoration-color: currentColor;
}

.bl-prose strong {
  color: #fff;
}

.bl-prose ul,
.bl-prose ol {
  display: grid;
  gap: 0.6em;
  padding: 0;
  list-style: none;
}

.bl-prose ul li,
.bl-prose ol li {
  position: relative;
  padding-left: 1.7rem;
}

.bl-prose ul li::before {
  content: "";
  position: absolute;
  top: 0.82em;
  left: 0;
  width: 0.8rem;
  height: 2px;
  border-radius: 2px;
  background: rgb(var(--glow-rgb));
  box-shadow: 0 0 10px rgb(var(--glow-rgb) / 0.6);
}

.bl-prose ol {
  counter-reset: step;
}

.bl-prose ol li {
  padding-left: 2.3rem;
  counter-increment: step;
}

.bl-prose ol li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: 0.3em;
  left: 0;
  color: rgb(var(--glow-rgb));
  font: 500 0.78rem/1.6 var(--font-label);
  letter-spacing: 0.06em;
}

.bl-prose blockquote {
  position: relative;
  margin: 2.4em 0;
  padding: 1.6rem 1.75rem 1.6rem 4.2rem;
  border: 1px solid rgb(var(--glow-rgb) / 0.22);
  border-radius: 18px;
  background:
    radial-gradient(90% 120% at 0% 0%, rgb(var(--glow-rgb) / 0.13), transparent 60%),
    rgb(255 255 255 / 0.02);
  box-shadow: inset 0 1px 0 rgb(var(--glow-rgb) / 0.4), 0 30px 80px -50px rgb(var(--glow-rgb) / 0.8);
}

.bl-prose blockquote::before {
  content: "“";
  position: absolute;
  top: 0.9rem;
  left: 1.3rem;
  color: rgb(var(--glow-rgb));
  font: 800 4rem/1 var(--font-display);
  text-shadow: 0 0 24px rgb(var(--glow-rgb) / 0.8);
}

.bl-prose blockquote p {
  color: #fff;
  font: 700 clamp(1.3rem, 2.2vw, 1.7rem) / 1.28 var(--font-display);
  letter-spacing: -0.03em;
}

.bl-aside {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  display: grid;
  gap: 1.5rem;
}

.bl-aside-card {
  display: grid;
  gap: 0.85rem;
  justify-items: start;
  padding: 1.4rem;
}

.bl-aside-lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.bl-aside-note {
  margin: 0;
  color: var(--text-dim);
  font: 500 0.68rem/1.4 var(--font-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bl-aside-links {
  display: grid;
  gap: 0.55rem;
  padding: 0 0.3rem;
}

.bl-aside-links .bl-label {
  margin-bottom: 0.2rem;
}

.bl-aside-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.2s;
}

.bl-aside-links a:hover {
  color: var(--accent-light);
}

.bl-section-head {
  margin-bottom: 1.75rem;
}

/* ---------- Archive: the original blog (includes/blog-archive-template.php) ---------- */

.bl-archive-all {
  color: rgb(var(--glow-rgb, 240 163 94));
  font-weight: 600;
  text-decoration: none;
}

.bl-archive-all::after {
  content: " →";
}

.bl-archive-teaser .bl-card,
.bl-archive-teaser .bl-archive-all {
  --glow-rgb: 240 163 94;
}

.bl-prose > .bl-archive-note {
  margin: 0 0 2em;
  padding: 1.1rem 1.3rem;
  border: 1px solid rgb(var(--glow-rgb) / 0.3);
  border-radius: 14px;
  background: rgb(var(--glow-rgb) / 0.07);
  font-size: 0.98rem;
  line-height: 1.6;
}

.bl-archive-note > * + * {
  margin-top: 0.5rem;
}

/* ---------- Closing call to action ---------- */

.bl-cta-inner {
  display: grid;
  justify-items: center;
  gap: 1rem;
  max-width: 40rem;
  margin-inline: auto;
  text-align: center;
}

.bl-cta-inner .landing-lead {
  margin: 0;
}

/* ---------- Smaller screens ---------- */

@media (max-width: 1100px) {
  .bl-cover-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .bl-side {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
  }

  .bl-side-head {
    grid-column: 1 / -1;
  }

  .bl-side-story {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .bl-side-art {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .bl-side-body {
    padding: 0.2rem 0.4rem 0.5rem;
  }
}

@media (max-width: 1024px) {
  .bl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bl-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .bl-aside {
    position: static;
  }
}

@media (max-width: 760px) {
  .bl-masthead-inner,
  .bl-grid,
  .bl-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .bl-lead {
    min-height: 460px;
  }

  .bl-side-story {
    grid-template-columns: 38% minmax(0, 1fr);
    align-items: center;
  }

  .bl-side-art {
    height: 100%;
    min-height: 96px;
    aspect-ratio: auto;
  }

  .bl-filters {
    position: static;
    width: auto;
    border-radius: 18px;
  }

  .bl-poster {
    min-height: 82svh;
  }

  .bl-prose {
    font-size: 1.05rem;
  }

  .bl-prose blockquote {
    padding: 3.6rem 1.3rem 1.3rem;
  }

  .bl-prose blockquote::before {
    top: 0.6rem;
  }
}
