/* Public blog: cards, article and content blocks */

/* ---------- Cards ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; margin-top: 32px; }
.blog-state { grid-column: 1 / -1; padding: 40px 0; text-align: center; color: var(--muted); }

.blog-card { height: 100%; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.blog-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.blog-card__link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
/* 2026-11-26: the image shows whole at its own ratio on every screen (was a 16:9 box + object-fit: cover, which cropped it) */
.blog-card__media { background: var(--panel); overflow: hidden; }
.blog-card__media img { display: block; width: 100%; height: auto; }
.blog-card__placeholder { display: grid; place-items: center; height: 100%; font-size: 2rem; color: var(--border-strong); }
.blog-card__body { display: flex; flex-direction: column; flex: 1; gap: 8px; padding: 20px; }
.blog-card__cat { align-self: flex-start; padding: 3px 10px; border-radius: var(--radius-pill); background: rgba(255, 76, 41, .1); color: var(--primary); font-size: .75rem; font-weight: 700; }
.blog-card__title { margin: 0; font-size: 1.12rem; font-weight: 700; line-height: 1.35; color: var(--text); }
.blog-card__excerpt { margin: 0; color: var(--muted); font-size: .93rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card__meta { display: flex; gap: 6px; margin: auto 0 0; padding-top: 8px; font-size: .82rem; color: var(--muted); }

/* ---------- Article ---------- */
.blog-article { padding: 48px 0 72px; }
.blog-article__head { max-width: 760px; margin-bottom: 32px; }
.blog-crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; font-size: .85rem; color: var(--muted); }
.blog-crumbs a { color: var(--muted); text-decoration: none; }
.blog-crumbs a:hover { color: var(--primary); }
.blog-article__title { margin: 8px 0 12px; font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 800; line-height: 1.15; color: var(--text); }
.blog-article__meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; color: var(--muted); }
.blog-article__author a { color: var(--text); font-weight: 600; text-decoration: none; }
.blog-article__author a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.blog-related .section-title { margin-bottom: 0; }

/* ---------- Content blocks ---------- */
.blog-content { --narrow: 840px; --wide: 960px; padding-inline: var(--gutter, 16px); color: var(--text); font-size: 1.06rem; line-height: 1.75; }
.blog-block { margin-inline: auto; box-sizing: border-box; }
.blog-content > .blog-block:first-child { margin-top: 0; }

.blog-w-narrow { max-width: var(--narrow); }
.blog-w-wide { max-width: var(--wide); }
.blog-w-full { max-width: none; }

/* Side ad rails (2026-11-26): the article body isn't in a .container, so keep its wide / full-width blocks clear of the rails */
@media (min-width: 1280px) {
  .has-side-ads .blog-content { padding-inline: var(--ad-rail); }
}

.blog-a-left { text-align: left; }
.blog-a-center { text-align: center; }
.blog-a-right { text-align: right; }

.blog-s-sm { margin-top: 16px; }
.blog-s-md { margin-top: 32px; }
.blog-s-lg { margin-top: 64px; }

.blog-block.has-bg { padding: 28px; border-radius: var(--radius-lg); }

.blog-title { margin: 0; font-weight: 800; line-height: 1.25; color: inherit; }
h1.blog-title { font-size: 2.2rem; }
h2.blog-title { font-size: 1.7rem; }
h3.blog-title { font-size: 1.35rem; }
h4.blog-title { font-size: 1.12rem; }

.blog-rich > :first-child { margin-top: 0; }
.blog-rich > :last-child { margin-bottom: 0; }
.blog-rich a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.blog-rich ul, .blog-rich ol { padding-left: 1.4em; }
/* base.css resets list-style to none; articles need their bullets / numbers back (2026-11-25) */
.blog-rich ul { margin: 12px 0; list-style: disc; }
.blog-rich ol { margin: 12px 0; list-style: decimal; }
.blog-rich li { margin: 4px 0; }
.blog-rich p { margin: 0 0 14px; }
.blog-rich code { padding: 1px 6px; border-radius: 6px; background: var(--panel); font-size: .9em; }
.blog-rich pre { overflow-x: auto; padding: 16px; border-radius: var(--radius-sm); background: var(--dark); color: var(--dark-text); }
/* Tables (added 2026-11-25 for the imported old posts); scroll sideways on small screens */
.blog-rich table { display: block; max-width: 100%; overflow-x: auto; margin: 20px 0; border-collapse: collapse; font-size: .95rem; }
.blog-rich th, .blog-rich td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.blog-rich th { background: var(--panel); font-weight: 700; }
.blog-rich caption { padding-bottom: 8px; text-align: left; font-weight: 700; }

/* ---------- /blog search + category filter (2026-11-26) ---------- */
.blog-filter { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 28px; }
.blog-search { position: relative; width: 100%; max-width: 520px; margin: 0; }
.blog-search > .fa-magnifying-glass { position: absolute; top: 50%; left: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.blog-search input { width: 100%; height: 48px; padding: 0 48px 0 46px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--card); color: var(--text); font: inherit; font-size: 1rem; transition: border-color .2s, box-shadow .2s; }
.blog-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 76, 41, .15); }
.blog-search input::-webkit-search-cancel-button { display: none; }
.blog-search__clear { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.blog-search__clear:hover { background: var(--panel); color: var(--text); }
.blog-search__clear[hidden] { display: none; }

.blog-cats { width: 100%; }
.blog-cats__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.blog-cat { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--card); color: var(--text); font-size: .9rem; font-weight: 600; text-decoration: none; transition: border-color .2s, background .2s, color .2s; }
.blog-cat:hover { border-color: var(--primary); color: var(--primary); }
.blog-cat.is-active { border-color: var(--primary); background: var(--primary); color: #fff; }
.blog-cat__count { padding: 1px 7px; border-radius: var(--radius-pill); background: var(--panel); color: var(--muted); font-size: .75rem; font-weight: 700; }
.blog-cat.is-active .blog-cat__count { background: rgba(255, 255, 255, .25); color: #fff; }
.blog-cats__list:not(.is-open) .is-extra { display: none; }
.blog-cats__more { border-style: dashed; background: transparent; color: var(--muted); cursor: pointer; font-family: inherit; }
.blog-cats__more-item { order: 1; }
.blog-cats__select { display: none; width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); color: var(--text); font: inherit; }

.blog-grid[aria-busy="true"] { opacity: .5; transition: opacity .2s; }
.blog-state__reset { display: block; margin: 16px auto 0; }

@media (max-width: 640px) {
  .blog-cats__list { display: none; }
  .blog-cats__select { display: block; }

  /* /blog on mobile: tighter section padding and heading block (2026-11-26) */
  .section.blog-index { padding-block: 32px; }
  .blog-index .section-head { gap: 8px; margin-bottom: 20px; }
  .blog-index .eyebrow { margin: 0; }
  .blog-index .section-sub { margin-top: 4px; font-size: 14px; }
  .blog-index .blog-filter { margin-top: 16px; }

  /* Search + category on ONE row (2026-11-26): [🔍 Search articles…   ][ All (208) ▾]
     (was two full-width rows, ~110px tall). Font sizes stay 16px so iPhone doesn't zoom on focus. */
  .blog-index .blog-filter { flex-direction: row; align-items: center; gap: 8px; }
  .blog-index .blog-search { flex: 1 1 auto; min-width: 0; }
  .blog-index .blog-search > .fa-magnifying-glass { left: 14px; font-size: 14px; }
  .blog-index .blog-search input { height: 42px; padding: 0 38px 0 36px; }
  .blog-index .blog-search__clear { right: 5px; }
  .blog-index .blog-cats { flex: 0 0 auto; width: 42%; max-width: 170px; }
  .blog-index .blog-cats__select {
    height: 42px; padding: 0 30px 0 14px;
    border-radius: var(--radius-pill);
    -webkit-appearance: none; appearance: none;
    background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 11px center / 14px no-repeat;
    font-size: 16px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .blog-index .blog-cats__select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 76, 41, .15); }
}

/* "Load more" under the /blog card grid */
.blog-more { display: flex; justify-content: center; margin-top: 32px; }
.blog-more[hidden] { display: none; }

/* 2026-11-26: scroll pagination (blog.js) — spinner while the next 12 load; the button only shows for "Try again" */
.blog-more .btn[hidden] { display: none; }
.blog-loader { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; color: var(--muted); }
.blog-loader[hidden] { display: none; }
.blog-loader__spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--primary);
  animation: blogSpin .7s linear infinite;
}
@keyframes blogSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .blog-loader__spin { animation-duration: 2s; } }
.blog-sentinel { height: 1px; }

.blog-quote { margin: 0; padding: 8px 0 8px 24px; border-left: 4px solid var(--primary); font-size: 1.2rem; font-style: italic; color: inherit; }
.blog-a-center .blog-quote, .blog-a-right .blog-quote { border-left: 0; padding-left: 0; }

.blog-cta { padding: 32px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); }
.has-bg .blog-cta { padding: 0; border: 0; background: none; }
.blog-cta__btn { margin-top: 20px; }

.blog-figure { margin: 0; }
.blog-figure img { display: block; margin: auto; max-width: 100%; height: auto; border-radius: var(--radius); }
.blog-a-center .blog-figure img { margin-inline: auto; }
.blog-a-right .blog-figure img { margin-left: auto; }

.blog-hero { position: relative; margin: 0; overflow: hidden; border-radius: var(--radius-lg); }
.blog-w-full .blog-hero { border-radius: 0; }
.blog-hero img { display: block; width: 100%; height: clamp(260px, 45vw, 520px); object-fit: cover; }
.blog-hero__overlay { position: absolute; inset: auto 0 0 0; padding: 40px 32px 32px; background: linear-gradient(transparent, rgba(0, 0, 0, .72)); color: #fff; }
.blog-hero__eyebrow { display: inline-block; margin-bottom: 8px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--primary); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.blog-hero__title { margin: 0; font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 800; line-height: 1.2; color: #fff; }

.blog-pair { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 16px; margin: 0; }
.blog-block--image-pair .blog-figure img { width: 100%; }

.blog-gallery { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--cols, 3) - 1) * 16px) / var(--cols, 3)); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.blog-gallery__item { margin: 0; scroll-snap-align: start; }
.blog-gallery__item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); }

.blog-video { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius); background: #000; }
.blog-video iframe, .blog-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.blog-divider { height: 1px; margin: 0; border: 0; background: var(--border); }

@media (max-width: 640px) {
  .blog-article { padding-top: 24px; }
  .blog-block.has-bg, .blog-cta { padding: 20px; }
  .blog-pair { grid-template-columns: 1fr; }
  .blog-gallery { grid-auto-columns: 80%; }
  .blog-hero__overlay { padding: 24px 20px 20px; }
}
