/*
 * blog.css: page-lane stylesheet (BUILD-BRIEF section 6, Lane T). Loads
 * after ve-site.css, tokens.css/base.css/chrome.css only; classes prefixed
 * ve-blog- and ve-post-. Covers /blog/ (Blog.tsx), /blog/topic/<key>/
 * (BlogTopic.tsx), /blog/<post>/ (BlogPost.tsx) and the shared PostCard.
 * `.blogposts.nb` and `#recent-newsletters-widget-2` are Backstop hide
 * hooks (BUILD-BRIEF section 3.2) and stay on the elements untouched.
 */

/* ------------------------------------------------ /blog/ band: subscribe */
/* The index opens on the same C3 title band as every topic page; Subscribe
   sits under the lead instead of in a tinted box of its own. */
.ve-blog-subscribe { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 18px; }
.ve-blog-subscribe-note { font-size: var(--fs-small); color: var(--c-muted); }

/* --------------------------------------------------------- subscribe modal */
.ve-blog-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(28 28 28 / 0.55);
}
.ve-blog-modal {
  position: relative;
  width: min(460px, 100%);
  background: var(--c-white);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-card);
}
.ve-blog-modal h2 { margin-top: 0; font-weight: 500; }
.ve-blog-modal-form .field { margin-bottom: 14px; }
.ve-blog-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: var(--c-muted);
}
.ve-blog-modal-close:hover { color: var(--c-pink); }
.ve-blog-modal-error { color: #b00020; }
.ve-blog-modal-success { color: #1b6e3a; font-weight: 600; }

/* ---------------------------------------------------------------- search */
.ve-blog-search { margin: 0 0 28px; }
.ve-blog-search-label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--fs-h3);
  font-weight: 500;
  color: var(--c-ink);
}
.ve-blog-search-field { display: flex; gap: 10px; align-items: stretch; }
.ve-blog-search-field input[type='search'] {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  font-size: 1rem;
}
.ve-blog-search-field input[type='search']::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.ve-blog-search-clear {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 18px;
  border: 2px solid var(--c-pink);
  border-radius: 999px;
  background: var(--c-white);
  color: var(--c-pink);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur-base) var(--ease-std), color var(--dur-base) var(--ease-std);
}
.ve-blog-search-clear:hover { background: var(--c-pink-tint); color: var(--c-pink-deep); }
.ve-blog-search-status { margin: 10px 0 0; color: var(--c-muted); font-weight: 500; }
.ve-blog-search-status:empty { display: none; }
.ve-blog-search-results mark { background: rgb(253 179 18 / 0.35); color: inherit; padding: 0 2px; border-radius: 3px; }
.ve-blog-search-more { display: flex; justify-content: center; margin: 28px 0 8px; }

/* ------------------------------------------ C18 post cards (shared) */
/* PostCard.tsx: the /blog/ index, /blog/topic/<key>/, "From our blog" on
   condition pages and "More on <topic>" under a post. Three across, two on
   tablets, one on phones; photo top 16:10 at the card radius; topic + date
   line; title (two lines); excerpt (two lines). No box, no shadow: only the
   photo is framed. The title link is stretched over the card (::after), so
   the whole card is one click target and one link for screen readers. */
.ve-post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 3vw, 40px) clamp(20px, 2.6vw, 32px);
}
.ve-post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--c-text);
  border-radius: var(--radius-img);
}
/* Cards past the first row skip layout and paint until they near the
   viewport; the reserved height is about one rendered card. */
.ve-post-grid > .ve-post-card:nth-child(n + 4) {
  content-visibility: auto;
  contain-intrinsic-size: auto 320px auto 400px;
}
.ve-post-card-photo {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  margin: 0 0 14px;
  border-radius: var(--radius-img);
  background: var(--c-navy-tint);
  overflow: hidden;
}
.ve-post-card-photo picture { display: contents; }
.ve-post-card-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  transition: transform 600ms var(--ease-out);
}
.ve-post-card:hover .ve-post-card-photo img { transform: scale(1.035); }
.ve-post-card-photo--empty { display: grid; place-items: center; padding: 20px; background: var(--grad-brand); color: var(--c-white); text-align: center; }
.ve-post-card-fallback { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ve-post-card-fallback-label { font-size: 22px; font-weight: 300; line-height: 1.25; color: var(--c-white); }
.ve-post-card-fallback::after { content: ''; display: block; width: 44px; height: 2px; background: var(--c-gold); }
/* a YouTube thumbnail stands in for the photo: small white disc, pink play */
.ve-post-card-play {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.92);
}
.ve-post-card-play::after {
  content: '';
  position: absolute;
  left: 21px;
  top: 16px;
  border-left: 16px solid var(--c-pink);
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
}
.ve-post-card-body { display: flex; flex-direction: column; gap: 6px; }
.ve-post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--c-muted);
}
.ve-post-card-topic { font-weight: 600; color: var(--c-pink); text-decoration: none; }
/* the topic link sits above the stretched title link */
a.ve-post-card-topic { position: relative; z-index: 1; }
a.ve-post-card-topic:hover { color: var(--c-pink-deep); text-decoration: underline; text-underline-offset: 3px; }
.ve-post-card-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--c-line-strong); }
.ve-post-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--c-ink);
  text-wrap: balance;
}
.ve-post-card-title a { color: inherit; text-decoration: none; transition: color var(--dur-fast) var(--ease-std); }
.ve-post-card-title a::after { content: ''; position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.ve-post-card:hover .ve-post-card-title a { color: var(--c-pink); }
.ve-post-card-title a:focus-visible { outline: none; }
.ve-post-card:has(.ve-post-card-title a:focus-visible) { outline: 2px solid var(--c-pink); outline-offset: 6px; }
.ve-post-card-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--c-text);
}
.ve-post-card-snippet { margin: 4px 0 0; padding-left: 10px; border-left: 2px solid var(--c-gold); font-size: 14px; line-height: 1.55; color: var(--c-muted); }

/* the /blog/ "Latest post": the same card, larger, photo beside the text */
.ve-post-card--feature { margin: 0 0 clamp(40px, 5vw, 64px); }
.ve-post-card-flag {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-ink);
}
.ve-post-card-flag::before { content: ''; width: 28px; height: 2px; background: var(--c-gold); }
.ve-post-card--feature .ve-post-card-title {
  display: block;
  overflow: visible;
  font-size: clamp(1.5rem, 1.25rem + 0.9vw, 2rem);
  font-weight: 300;
  line-height: 1.22;
}
.ve-post-card--feature .ve-post-card-excerpt { -webkit-line-clamp: 3; font-size: var(--fs-body); line-height: 1.7; }
.ve-post-card-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-weight: 600;
  color: var(--c-pink);
}
.ve-post-card-more::after { content: '\2192'; transition: transform var(--dur-base) var(--ease-std); }
.ve-post-card:hover .ve-post-card-more::after { transform: translateX(4px); }
@media (min-width: 700px) {
  .ve-post-card--feature {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: center;
    gap: clamp(28px, 3.4vw, 48px);
  }
  .ve-post-card--feature .ve-post-card-photo { margin: 0; }
  .ve-post-card--feature .ve-post-card-body { gap: 10px; }
}

@media (max-width: 1023px) {
  .ve-post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .ve-post-grid { grid-template-columns: 1fr; gap: 32px; }
  .ve-post-grid > .ve-post-card:nth-child(n + 2) { content-visibility: auto; contain-intrinsic-size: auto 320px auto 360px; }
}
@media (prefers-reduced-motion: reduce) {
  .ve-post-card-photo img,
  .ve-post-card-more::after { transition: none; }
  .ve-post-card:hover .ve-post-card-photo img,
  .ve-post-card:hover .ve-post-card-more::after { transform: none; }
}

/* ------------------------------------------------ /blog/ index layout */
.ve-blog-toolbar {
  display: grid;
  gap: 18px;
  margin: 0 0 clamp(32px, 4vw, 48px);
  padding-bottom: clamp(20px, 2.4vw, 28px);
  border-bottom: 1px solid var(--c-line);
}
.ve-blog-toolbar .ve-blog-search { margin: 0; max-width: 640px; }
.ve-blog-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 0 22px;
  padding-top: 18px;
  border-top: 1px solid var(--c-line);
}
.ve-blog-list-title { margin: 0; font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem); font-weight: 300; color: var(--c-ink); }
.ve-blog-list-page { margin: 0; font-size: var(--fs-small); color: var(--c-muted); }
#blog-list { scroll-margin-top: calc(var(--header-h-stuck) + 16px); }

/* ---------------------------------------------------- browse by topic */
.ve-blog-topics { margin: 0; min-width: 0; }
.ve-blog-topics-title { margin: 0 0 4px; font-size: var(--fs-h3); font-weight: 500; color: var(--c-ink); }
/* plain inline list (base.css .ve-inline-list); no pill per topic */
.ve-blog-topic-list { margin: 0; }
/* phones: three short rows that scroll sideways instead of eight wrapped
   lines; the next column peeks in under a soft fade, so it reads as "more" */
@media (max-width: 767px) {
  .ve-blog-topic-list {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(3, auto);
    grid-auto-columns: max-content;
    gap: 2px 24px;
    font-size: var(--fs-small);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-right: 32px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
  }
  .ve-blog-topic-list::-webkit-scrollbar { display: none; }
  .ve-blog-topic-list li { scroll-snap-align: start; }
  .ve-blog-topic-list a { white-space: nowrap; }
}

/* ------------------------------------------------ "More on <topic>" strip */
.ve-blog-more { margin: 48px 0 8px; padding-top: 32px; border-top: 1px solid var(--c-line); }
.ve-blog-more-head { margin: 0 0 20px; }
.ve-blog-more-head h2 { margin: 0; font-size: clamp(24px, 2.2vw, 30px); font-weight: 300; color: var(--c-ink); }
.ve-blog-more-cta { margin-top: 28px; }

/* ------------------------------------------------------- topic page */
.ve-blog-topic-page { padding-bottom: var(--block-gap); }
.ve-blog-topic-page .ve-blog-search { max-width: 640px; }
.ve-blog-topic-page .ve-post-grid { margin-top: 8px; }
.ve-blog-topic-page .ve-post-card-title { font-size: 19px; }
.ve-blog-topic-back { margin: 32px 0 0; font-size: var(--fs-small); color: var(--c-muted); }
.ve-blog-topic-back a { font-weight: 500; }

/* ------------------------------------------- /blog/ extras (old sidebar) */
/* Newsletter, parent guides and social links as a plain three-part row on a
   hairline under the posts (plain-list rule: no box per item). */
.ve-blog-extras { margin: clamp(40px, 5vw, 64px) 0 clamp(48px, 6vw, 80px); padding-top: 28px; border-top: 1px solid var(--c-line); }
.ve-blog-extras-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px clamp(24px, 4vw, 56px);
  list-style: none;
  margin: 0;
  padding: 0;
}
.ve-blog-extra { margin: 0; }
.ve-blog-extra p { margin: 0 0 10px; font-size: var(--fs-small); line-height: 1.65; }
.ve-blog-extra-title { margin: 0 0 6px; font-size: 1.125rem; font-weight: 500; color: var(--c-ink); }
.ve-blog-extra-link { font-weight: 600; color: var(--c-pink); text-decoration: none; }
.ve-blog-extra-link::after { content: ' \2192'; }
.ve-blog-extra-link:hover { color: var(--c-pink-deep); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 767px) {
  .ve-blog-extras-list { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------- pager */
.ve-blog-nav { display: flex; justify-content: space-between; gap: 16px; margin: clamp(32px, 4vw, 48px) 0 0; }
.ve-blog-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 2px solid var(--c-pink);
  border-radius: var(--radius-btn);
  font-weight: 600;
  color: var(--c-pink);
  text-decoration: none;
  transition: background-color var(--dur-base) var(--ease-std), color var(--dur-base) var(--ease-std);
}
.ve-blog-nav-link:hover { background: var(--c-pink); color: var(--c-white); }
.ve-blog-nav-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* -------------------------------------------------------------- post page */
.ve-blog-post-title {
  font-weight: 300;
  font-size: clamp(28px, 4vw, 40px);
  line-height: var(--lh-heading);
  color: var(--c-ink);
  margin: 0 0 0.6em;
}
.ve-blog-post-body { max-width: 74ch; }
.ve-blog-post-meta { color: var(--c-muted); font-size: 0.9rem; margin-bottom: 1.2em; }
.ve-blog-post-footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--c-line); }
.ve-blog-post-back { font-weight: 500; color: var(--c-pink); text-decoration: none; }
.ve-blog-post-back:hover { color: var(--c-pink-deep); text-decoration: underline; }

@media (max-width: 600px) {
  .ve-blog-search-field { flex-direction: column; }
  .ve-blog-search-clear { width: 100%; }
}
