/* Blog index — editorial index (sibling of resources.css): the shared
   EditorialHero lockup (.ed-hero), then a two-column feed — sticky filter
   rail left (search + category column with counts, Sofia 2026-07-29),
   featured split card + thumb grid right. The rail narrows the content
   column so the thumbnails stay reasonable. Filtering lives in
   /js/behaviors/blog-filter.js ([data-blog-filter] → [data-blog-card]).
   Tokens only. */

/* ---------- hero: EditorialHero lockup · filters ---------- */
.p-blog__hero {
  /* pure white, not the grey-50 page ground (Sofia 2026-08-14: post
     thumbnails carry off-white backgrounds — they need to read against
     true white) */
  background: var(--color-white);
  color: var(--color-foreground);
}
.p-blog__hero-inner {
  margin-inline: auto;
  max-width: var(--container-large);
  /* tightened 2026-07-29 (Sofia: "unnecessarily wide white spaces") —
     the top pad still clears the ~70px fixed header */
  padding: 116px 20px 16px;
}
@media (min-width: 768px) { .p-blog__hero-inner { padding-top: 132px; } }
@media (min-width: 1024px) { .p-blog__hero-inner { padding-inline: 24px; } }

/* ---------- filter rail: search on top, category column below ---------- */
.p-blog__rail {
  margin-bottom: 48px;
}
@media (min-width: 1024px) {
  .p-blog__rail {
    position: sticky;
    top: 124px; /* clear of the fixed header */
    align-self: start;
    margin-bottom: 0;
  }
}

/* category filters: quiet text rows on hairlines, active goes ink */
.p-blog__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-top: 28px;
}
/* phones (Sofia, 2026-08-07: the wrapped word-cloud "doesn't work"):
   ONE swipeable line between hairlines, edge to edge — categories keep
   their quiet text style, the thumb does the exploring */
@media (max-width: 1023px) {
  .p-blog__filters {
    flex-wrap: nowrap;
    gap: 24px;
    overflow-x: auto;
    margin-inline: calc(-1 * var(--space-inline));
    padding: 12px var(--space-inline);
    border-block: 1px solid var(--color-border-light);
    scroll-snap-type: x proximity;
    /* without this the snap pulls the first category onto the border
       edge, swallowing the 20px inset */
    scroll-padding-inline: var(--space-inline);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .p-blog__filters::-webkit-scrollbar { display: none; }
  .p-blog__filter {
    flex-shrink: 0;
    white-space: nowrap;
    scroll-snap-align: start;
  }
}
@media (min-width: 1024px) {
  .p-blog__filters {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    border-top: 1px solid var(--color-border-light);
  }
}

/* search trigger: quiet underlined button, opens the modal (Sofia,
   2026-07-29: the inline field was too cramped to type in) */
.p-blog__search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  border: 0;
  border-bottom: 1px solid var(--color-border-light);
  background: none;
  padding: 0 0 8px;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  letter-spacing: 0;
  /* grey-300 measured 2.37:1 on white (a11y 2026-07-29) */
  color: var(--color-grey-on-white);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.p-blog__search:hover,
.p-blog__search:focus-visible {
  border-color: var(--color-black);
  color: var(--color-black);
}
.p-blog__search.has-query { color: var(--color-black); }
@media (min-width: 1024px) {
  .p-blog__search {
    min-width: 0;
    width: 100%;
  }
}
.p-blog__search svg { flex-shrink: 0; }
.p-blog__search-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- search modal ---------- */
/* (page scroll locks via an inline overflow style from blog-filter.js —
   a bare html.<class> rule would break the .p-{slug} scoping hard rule) */
.p-blog__modal {
  position: fixed;
  inset: 0;
  z-index: 90; /* above the fixed header (50) */
}
.p-blog__modal-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--color-black) 40%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.p-blog__modal-dialog {
  position: relative;
  margin: 16vh auto 0;
  width: min(640px, calc(100% - 32px));
  border-radius: 20px;
  border: 1px solid var(--color-border-light);
  background: var(--color-background);
  box-shadow: none;
  overflow: hidden;
}
.p-blog__modal-field {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
  color: var(--color-grey-300);
}
.p-blog__modal-field:focus-within { color: var(--color-black); }
.p-blog__modal-field svg { flex-shrink: 0; }
.p-blog__modal-field input {
  width: 100%;
  border: 0;
  background: none;
  font-family: var(--font-sans);
  font-size: var(--fs-xl);
  color: var(--color-black);
  outline: none;
}
.p-blog__modal-field input::placeholder { color: var(--color-grey-300); }
.p-blog__modal-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.p-blog__modal-esc {
  flex-shrink: 0;
  border: 1px solid var(--color-border-light);
  border-radius: 6px;
  background: none;
  padding: 3px 8px;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  letter-spacing: var(--track-wide);
  color: var(--color-grey-400);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.p-blog__modal-esc:hover {
  border-color: var(--color-grey-200);
  color: var(--color-black);
}
.p-blog__modal-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 46vh;
  overflow-y: auto;
}
.p-blog__modal-results:not(:empty) { border-top: 1px solid var(--color-border-light); }
.p-blog__modal-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--color-border-light);
  background: none;
  padding: 14px 24px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.p-blog__modal-results li:last-child .p-blog__modal-result { border-bottom: 0; }
.p-blog__modal-result:hover { background: var(--color-grey-50); }
.p-blog__modal-result-title {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--color-black);
}
.p-blog__modal-result:hover .p-blog__modal-result-title { color: var(--color-blue); }
.p-blog__modal-result-meta {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  letter-spacing: var(--track-widest);
  color: var(--color-grey-400);
}
.p-blog__modal-none {
  padding: 18px 24px;
  border-top: 1px solid var(--color-border-light);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--color-grey-on-white);
}
.p-blog__modal-hint {
  border-top: 1px solid var(--color-border-light);
  padding: 12px 24px;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  letter-spacing: var(--track-wide);
  color: var(--color-grey-400);
}
.p-blog__modal-hint[hidden] { display: none; }

/* empty state: shows only when search + filter leave nothing */
.p-blog__empty {
  margin-top: 48px;
  border-top: 1px solid var(--color-border-light);
  padding-top: 48px;
  font-size: var(--fs-body);
  color: var(--color-grey-on-white);
}
.p-blog__filter {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border: 0;
  background: none;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  letter-spacing: var(--track-wide);
  color: var(--color-grey-500);
  cursor: pointer;
  transition: color 0.2s ease;
}
@media (min-width: 1024px) {
  .p-blog__filter {
    width: 100%;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border-light);
    text-align: left;
  }
}
.p-blog__filter:hover { color: var(--color-black); }
.p-blog__filter.is-active {
  color: var(--color-black);
  font-weight: 500;
}
.p-blog__filter-count {
  font-size: var(--fs-xs);
  letter-spacing: var(--track-widest);
  /* grey-300 measured 2.37:1 on white (a11y 2026-07-29) */
  color: var(--color-grey-on-white);
  transition: color 0.2s ease;
}
.p-blog__filter.is-active .p-blog__filter-count { color: var(--color-blue); }

/* ---------- feed ---------- */
.p-blog__feed {
  /* pure white to match the hero (see note above) */
  background: var(--color-white);
  color: var(--color-foreground);
}
.p-blog__feed-inner {
  margin-inline: auto;
  max-width: var(--container-large);
  padding: 24px 20px 96px;
}
@media (min-width: 1024px) {
  .p-blog__feed-inner {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 72px;
    align-items: start;
    padding-inline: 24px;
  }
}
.p-blog__main { min-width: 0; }

/* shared mono meta line: category · read time */
.p-blog__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  letter-spacing: var(--track-widest);
  color: var(--color-grey-on-white);
}
.p-blog__meta-featured { color: var(--color-blue); }
.p-blog__meta-sep {
  width: 1px;
  height: 11px;
  background: var(--color-border-light);
}

/* ---------- featured: editorial split card ---------- */
.p-blog__featured {
  display: grid;
  gap: 28px;
  border-top: 1px solid var(--color-border-light);
  /* 28 above matches the 28 below (grid margin-top) — even seams, a step
     tighter so the featured card clears the MacBook fold (Sofia,
     2026-08-18; was 40/40 per 2026-07-29) */
  padding-top: 28px;
  text-decoration: none;
  color: inherit;
}
@media (min-width: 1024px) {
  .p-blog__featured {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 56px;
    align-items: center;
  }
}
.p-blog__featured-media {
  overflow: hidden;
  border-radius: 20px;
  aspect-ratio: 16 / 10;
}
/* desktop: a flatter cover so the hero + the whole featured card fit one
   MacBook viewport without scrolling (Sofia, 2026-08-18) */
@media (min-width: 1024px) {
  .p-blog__featured-media { aspect-ratio: 2 / 1; }
}
.p-blog__featured-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out-expo);
}
.p-blog__featured:hover .p-blog__featured-img { transform: scale(1.03); }
.p-blog__featured-title {
  margin-top: 20px;
  font-weight: 500;
  letter-spacing: var(--track-tighter);
  /* a step smaller (Sofia, 2026-08-18; was 28/36) */
  font-size: 25px;
  line-height: 1.1;
  color: var(--color-black);
  transition: color 0.2s ease;
}
@media (min-width: 768px) { .p-blog__featured-title { font-size: 31px; } }
.p-blog__featured:hover .p-blog__featured-title { color: var(--color-blue); }
.p-blog__featured-excerpt {
  margin-top: 16px;
  max-width: 56ch;
  font-size: var(--fs-body);
  line-height: var(--leading-body);
  color: var(--color-grey-on-white);
}

/* read-more: quiet arrow link, arrow answers the hover */
.p-blog__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  letter-spacing: var(--track-wide);
  color: var(--color-grey-500);
  transition: color 0.2s ease;
}
.p-blog__more svg { transition: transform 0.25s ease; }
.p-blog__featured:hover .p-blog__more,
.p-blog__card:hover .p-blog__more { color: var(--color-blue); }
.p-blog__featured:hover .p-blog__more svg,
.p-blog__card:hover .p-blog__more svg { transform: translate(2px, -2px); }

/* ---------- grid: thumb-forward cards on a hairline table ---------- */
.p-blog__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px 32px;
  /* 28 matches the featured card's tightened top seam (2026-08-18) */
  margin-top: 28px;
  border-top: 1px solid var(--color-border-light);
  padding-top: 48px;
}
@media (min-width: 640px) { .p-blog__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .p-blog__grid { grid-template-columns: repeat(3, 1fr); } }

.p-blog__card { min-width: 0; }
.p-blog__card[hidden],
.p-blog__featured[hidden] { display: none; }

/* gradient tile (corner index numbers retired, Sofia 2026-07-29) */
.p-blog__card-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}
.p-blog__card-title {
  margin-top: 12px;
  font-weight: 500;
  letter-spacing: var(--track-tight);
  font-size: 19px;
  line-height: 1.25;
  color: var(--color-black);
  transition: color 0.2s ease;
}
.p-blog__card:hover .p-blog__card-title { color: var(--color-blue); }
.p-blog__card-excerpt {
  margin-top: 10px;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--color-grey-on-white);
}
.p-blog__more--card { margin-top: 16px; }

/* ---------- pagination: numbered pages under the grid ---------- */
.p-blog__pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 56px;
  border-top: 1px solid var(--color-border-light);
  padding-top: 32px;
}
.p-blog__page {
  min-width: 40px;
  height: 40px;
  padding-inline: 12px;
  border: 1px solid var(--color-border-light);
  border-radius: 10px;
  background: none;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  letter-spacing: var(--track-wide);
  color: var(--color-grey-500);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.p-blog__page:hover {
  border-color: var(--color-grey-200);
  color: var(--color-black);
}
.p-blog__page.is-active {
  border-color: var(--color-black);
  background: var(--color-black);
  color: var(--color-white);
}
