
/* ============================================================
   BLOG, index + article. Same void/ember/blue system as the hub.
   ============================================================ */

/* The site shell pins .screen to the viewport (position: fixed) and sets
   overflow: hidden on html/body, so the document never scrolls. Long pages
   therefore need their own scroll container, the modding page does the same
   with .mods. Without min-height:0 + overflow-y:auto the article below the
   fold is simply unreachable. */
.page-blog .screen.is-active,
.page-post .screen.is-active {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  /* Long reading pages dim the animated fire so text stays legible. The hub
     keeps the fire at full strength; here it would sit right behind body copy. */
  background: linear-gradient(180deg, rgba(3, 5, 12, 0.82), rgba(3, 5, 12, 0.93));
}

.page-blog .screen > .hub__bar,
.page-post .screen > .hub__bar {
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(3, 5, 12, 0.94), rgba(3, 5, 12, 0.72));
}

.page-blog .screen {
  width: 100%;
  padding: 0;
}

.page-post .screen {
  width: 100%;
  padding: 0;
}

/* Inner column: centred content, but the scroll container itself stays
   full width. Anything given a max-width here must also get auto margins,
   or it hugs the left edge of the viewport. */
.page-blog .screen > *,
.page-post .screen > * {
  padding-left: clamp(14px, 3.4vw, 40px);
  padding-right: clamp(14px, 3.4vw, 40px);
}

.page-blog .screen > .hub__bar,
.page-post .screen > .hub__bar {
  padding-left: clamp(14px, 3.4vw, 40px);
  padding-right: clamp(14px, 3.4vw, 40px);
}

.blog__lede,
.blog__filters,
.posts,
.post {
  width: 100%;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

/* The lede is prose, so it gets a reading measure and is centred rather than
   sitting flush against the left edge of a 1080px column.
   NOTE: the older ".blog__lede { margin: 18px 0 30px }" rule below resets the
   left/right margins to 0 and wins on source order, so centring is declared
   again at the end of this file. */
.blog__lede {
  max-width: 62ch;
  text-align: center;
}

.blog__filters {
  justify-content: center;
}

.posts {
  padding-bottom: 96px;
}

.post__body {
  padding-bottom: 0;
}

.post__nav {
  margin-bottom: 72px;
}

/* ---------- index header ---------- */

.blog__lede {
  margin: 18px 0 30px;
  max-width: 62ch;
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.65;
}

.blog__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.blog__filter {
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: 1px;
  padding: 9px 13px;
  color: var(--ink-dim);
  background: rgba(8, 17, 38, 0.72);
  border: 1px solid var(--edge);
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.blog__filter:hover {
  color: var(--ink);
  border-color: var(--edge-hot);
}

.blog__filter.is-on {
  color: var(--ember-6);
  border-color: var(--edge-hot);
  background: rgba(58, 31, 8, 0.75);
}

/* ---------- post grid ---------- */

.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 18px;
  align-content: start;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 22px 20px;
  background: linear-gradient(180deg, rgba(10, 18, 38, 0.92), rgba(6, 11, 24, 0.92));
  border: 1px solid var(--edge);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s var(--ease-out), border-color 0.25s, box-shadow 0.25s;
}

/* display:flex above beats the browser default for [hidden], which is only
   display:none at zero specificity. Without this the filter never hides a
   card. !important is the cheap, correct fix for that one declaration. */
.post-card[hidden] { display: none !important; }

.post-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blue-3), var(--post-accent, var(--ember-4)));
  opacity: 0.85;
}

.post-card:hover,
.post-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--edge-hot);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 155, 47, 0.14);
  outline: none;
}

.post-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.post-card__tag {
  font-family: var(--font-pixel);
  font-size: 8px;
  letter-spacing: 0.8px;
  padding: 5px 8px;
  border-radius: 3px;
  color: var(--post-accent, var(--ember-5));
  border: 1px solid color-mix(in srgb, var(--post-accent, var(--ember-4)) 45%, transparent);
  background: color-mix(in srgb, var(--post-accent, var(--ember-4)) 12%, transparent);
}

.post-card__title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.32;
  color: var(--ink);
  letter-spacing: -0.1px;
}

.post-card__desc {
  color: var(--ink-dim);
  font-size: 13.5px;
  line-height: 1.6;
  flex: 1;
}

.post-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(47, 134, 255, 0.14);
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.3px;
}

.post-card__arrow {
  color: var(--post-accent, var(--ember-4));
  transition: transform 0.25s var(--ease-out);
}

.post-card:hover .post-card__arrow {
  transform: translateX(4px);
}

/* ---------- article ---------- */

.post {
  max-width: 74ch;
  margin: 0 auto;
}

.post__head {
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid rgba(47, 134, 255, 0.16);
}

.post__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.post__title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(26px, 4.2vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.6px;
  color: var(--ink);
  margin: 0 0 14px;
}

.post__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 12.5px;
  color: var(--ink-faint);
  letter-spacing: 0.3px;
}

.post__meta b {
  color: var(--ink-dim);
  font-weight: 500;
}

.post__body {
  color: #c7d5ef;
  font-size: 16px;
  line-height: 1.78;
}

/* Space block elements from each other, but not nested ones: a blanket
   `> * + *` leaves <p> children of a <div> touching, which is what made
   consecutive paragraphs and a <strong> look glued to the previous line. */
.post__body > * + *:not(li) {
  margin-top: 18px;
}

.post__body p + p {
  margin-top: 18px;
}

.post__body > .note + p,
.post__body > p + .note {
  margin-top: 22px;
}

.post__body h2 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.3px;
  margin-top: 40px;
  padding-top: 4px;
}

.post__body h3 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 17.5px;
  color: var(--ember-5);
  margin-top: 30px;
}

.post__body p {
  margin: 0;
}

.post__body strong {
  color: var(--ink);
  font-weight: 600;
}

.post__body em {
  color: var(--blue-4);
  font-style: normal;
}

.post__body ul,
.post__body ol {
  padding-left: 22px;
}

.post__body li + li {
  margin-top: 8px;
}

.post__body li::marker {
  color: var(--ember-4);
}

.post__body a {
  color: var(--blue-4);
  text-decoration: underline;
  text-decoration-color: rgba(124, 196, 255, 0.4);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s, color 0.15s;
}

.post__body a:hover {
  color: var(--ember-5);
  text-decoration-color: var(--ember-5);
}

.post__body code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(10, 42, 99, 0.55);
  border: 1px solid rgba(47, 134, 255, 0.2);
  color: var(--blue-5);
}

.post__body pre {
  padding: 16px 18px;
  overflow-x: auto;
  background: rgba(4, 8, 18, 0.85);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--ember-3);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
}

.post__body pre code {
  background: none;
  border: 0;
  padding: 0;
  color: var(--blue-5);
  font-size: inherit;
}

.post__body blockquote {
  margin-left: 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--ember-3);
  color: var(--ink-dim);
  font-style: italic;
}

/* callout boxes, opaque, because they sit over the animated fire */
.post__body .note {
  padding: 16px 18px;
  border-radius: 6px;
  background: linear-gradient(180deg, #0a1730, #071023);
  border: 1px solid rgba(47, 134, 255, 0.28);
  box-shadow: inset 3px 0 0 var(--blue-3);
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-dim);
}

.post__body .note--hot {
  background: linear-gradient(180deg, #241104, #170a03);
  border-color: rgba(255, 155, 47, 0.34);
  box-shadow: inset 3px 0 0 var(--ember-3);
}

.post__body .note b {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--ember-5);
}

/* table */
.post__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.post__body th,
.post__body td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(47, 134, 255, 0.16);
}

.post__body th {
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.post__body td:first-child {
  color: var(--ink);
}

/* footer nav */
.post__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid rgba(47, 134, 255, 0.16);
}

@media (max-width: 560px) {
  .post-card__title { font-size: 17.5px; }
  .post__body { font-size: 15.5px; }
}

/* Final centring pass. The lede rule earlier in this file sets
   "margin: 18px 0 30px", whose 0 side margins override the auto margins that
   centre a max-width block. Declared last so it wins, and the vertical rhythm
   is kept explicit. */
.page-blog .blog__lede {
  margin-left: auto;
  margin-right: auto;
  margin-top: 18px;
  margin-bottom: 30px;
  text-align: center;
}

.page-blog .blog__filters {
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
}

/* shown by js/blog.js when a filter matches nothing */
.blog__empty {
  max-width: 62ch;
  margin: 10px auto 60px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 15px;
}

.blog__empty[hidden] { display: none; }
