/* ==========================================================================
   Influent Academy - blog archive
   Loaded only on the blog index, the category and date archives and the search
   results. Every selector is scoped to .ia-blog or the wrapper that holds it,
   so nothing here reaches the six Elementor pages or the single-post template.

   Tokens, .wrap, .eyebrow, .btn and the type scale all come from influent.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Astra container
   -------------------------------------------------------------------------- */
/* The archive supplies its own .wrap and its own vertical rhythm. Astra gives
   #primary a margin at (1,1,0), so the override needs the id too. */
body #primary.ia-blog-primary {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  float: none;
  border: 0;
}

.ia-blog {
  /* Between the site's 12px and 20px tokens: rounded enough to read as a card,
     not so rounded that a row of them turns into lozenges. */
  --ia-card-radius: 16px;

  background: var(--paper);
}

/* --------------------------------------------------------------------------
   2. Masthead
   -------------------------------------------------------------------------- */
.ia-blog__intro {
  padding-block: clamp(44px, 5vw, 76px) clamp(28px, 3vw, 40px);
}

.ia-blog__title {
  max-width: 22ch;
  margin-bottom: 0;
}

.ia-blog__lede {
  margin: var(--s3) 0 0;
  max-width: 62ch;
}

/* Categories lead on a wide screen because they are the navigation; search is
   the narrower, secondary control beside them. */
.ia-blog__controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "cats search";
  align-items: center;
  gap: 16px 24px;
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   3. Search
   -------------------------------------------------------------------------- */
.ia-search {
  grid-area: search;
  position: relative;
  display: flex;
  align-items: center;
}

/* Astra styles bare inputs, so the left padding that clears the magnifier has
   to be claimed above element specificity or the placeholder sits on top of
   the icon. */
.ia-blog .ia-search .ia-search__field {
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0 16px 0 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.ia-search__field::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

.ia-search__field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.16);
}

/* The magnifier is the submit control rather than decoration, so the field has
   a real button for anyone who does not press Enter. */
.ia-blog .ia-search__submit {
  position: absolute;
  left: 1px;
  top: 1px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  box-shadow: none;
}

.ia-blog .ia-search__submit:hover,
.ia-blog .ia-search__submit:focus-visible {
  color: var(--accent-text);
  background: none;
}

.ia-search__icon {
  width: 17px;
  height: 17px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.6' cy='10.6' r='6.4'/%3E%3Cpath d='M15.4 15.4l4.4 4.4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.6' cy='10.6' r='6.4'/%3E%3Cpath d='M15.4 15.4l4.4 4.4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* --------------------------------------------------------------------------
   4. Category filter
   -------------------------------------------------------------------------- */
.ia-cats {
  grid-area: cats;
  min-width: 0;
}

.ia-cats__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ia-cats__item {
  margin: 0;
}

.ia-blog .ia-cats__link,
.ia-blog .ia-cats__link:link,
.ia-blog .ia-cats__link:visited {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.ia-blog .ia-cats__link:hover,
.ia-blog .ia-cats__link:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
}

.ia-blog .ia-cats__link[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-text);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   5. Cards
   -------------------------------------------------------------------------- */
/* The elevation the whole page is built on: a hairline, a tight neutral shadow
   for the edge, and a wide warm one below it. The orange sits low and stays
   under 0.3 alpha at rest, so it reads as ambient light rather than a colour. */
.ia-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--ia-card-radius);
  background: var(--card);
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(22, 21, 15, 0.04),
    0 4px 12px -8px rgba(22, 21, 15, 0.10),
    0 12px 26px -16px rgba(255, 77, 0, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.ia-card:hover,
.ia-card:has(.ia-card__link:focus-visible) {
  transform: translateY(-3px);
  border-color: rgba(255, 77, 0, 0.28);
  box-shadow:
    0 1px 2px rgba(22, 21, 15, 0.05),
    0 8px 18px -10px rgba(22, 21, 15, 0.12),
    0 20px 34px -18px rgba(255, 77, 0, 0.42);
}

/* The link is stretched over the card, so the ring belongs to the card. */
.ia-card:has(.ia-card__link:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.ia-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--fill);
  overflow: hidden;
}

.ia-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* No featured image: a quiet branded panel rather than a hole or a broken
   icon. The mark is the same one the section labels use. */
.ia-card__media--empty {
  background:
    linear-gradient(135deg, rgba(255, 77, 0, 0.08), rgba(255, 77, 0, 0) 62%),
    var(--fill);
}

.ia-card__media--empty::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 38px;
  height: 38px;
  opacity: 0.22;
  background-color: var(--accent);
  -webkit-mask: var(--ico-brackets) center / contain no-repeat;
  mask: var(--ico-brackets) center / contain no-repeat;
}

/* Freshness, not a promotion: small, square-ish, and out of the way of the
   image's subject. */
.ia-card__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  line-height: 1;
  text-transform: uppercase;
}

.ia-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
}

.ia-card__cat {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.ia-card__title {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.32;
  letter-spacing: -0.015em;
}

.ia-blog .ia-card__link,
.ia-blog .ia-card__link:link,
.ia-blog .ia-card__link:visited {
  color: var(--text);
  text-decoration: none;
}

.ia-card:hover .ia-card__link {
  color: var(--accent-text);
}

/* One anchor, stretched: the card is entirely clickable and there is still
   only one link in it. */
.ia-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.ia-card__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.ia-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: auto 0 0;
  padding-top: 4px;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.ia-card__dot {
  flex: none;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

/* --------------------------------------------------------------------------
   6. Featured article
   -------------------------------------------------------------------------- */
.ia-featured {
  padding-block: clamp(20px, 2.5vw, 32px) 0;
}

.ia-blog__sectionlabel {
  margin: 0 0 var(--s3);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.ia-card--featured {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: stretch;
  box-shadow:
    0 1px 2px rgba(22, 21, 15, 0.04),
    0 6px 16px -10px rgba(22, 21, 15, 0.12),
    0 18px 38px -20px rgba(255, 77, 0, 0.34);
}

.ia-card--featured:hover,
.ia-card--featured:has(.ia-card__link:focus-visible) {
  box-shadow:
    0 1px 2px rgba(22, 21, 15, 0.05),
    0 10px 22px -12px rgba(22, 21, 15, 0.14),
    0 26px 46px -22px rgba(255, 77, 0, 0.46);
}

.ia-card__media--featured {
  aspect-ratio: 3 / 2;
  height: 100%;
}

.ia-card--featured .ia-card__body {
  gap: 12px;
  padding: clamp(24px, 3vw, 40px);
  justify-content: center;
}

.ia-card__title--featured {
  font-size: clamp(1.35rem, 1.1rem + 0.95vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.ia-card__excerpt--featured {
  -webkit-line-clamp: 4;
  line-clamp: 4;
  font-size: 0.9688rem;
}

/* Grid cards push their meta line to the card foot so a row stays aligned. The
   featured card is a single block beside an image, so its meta simply follows
   the excerpt rather than leaving a gap under a short one. */
.ia-card--featured .ia-card__meta {
  margin-top: 0;
  padding-top: 2px;
}

.ia-readmore {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent-text);
}

.ia-readmore::after {
  content: "";
  width: 15px;
  height: 15px;
  background-color: currentColor;
  -webkit-mask: var(--ico-arrow-down) center / contain no-repeat;
  mask: var(--ico-arrow-down) center / contain no-repeat;
  transform: rotate(-90deg);
  transition: transform 0.18s ease;
}

.ia-card--featured:hover .ia-readmore::after {
  transform: rotate(-90deg) translateY(4px);
}

/* --------------------------------------------------------------------------
   7. Grid
   -------------------------------------------------------------------------- */
.ia-blog__articles {
  padding-block: clamp(40px, 4.5vw, 64px) clamp(56px, 7vw, 96px);
}

.ia-blog__articles-heading {
  margin: 0 0 var(--s5);
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
}

.ia-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

/* --------------------------------------------------------------------------
   8. Pagination
   -------------------------------------------------------------------------- */
.ia-blog .ia-pagination {
  margin-top: clamp(40px, 5vw, 64px);
}

.ia-blog .ia-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ia-blog .ia-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.ia-blog .ia-pagination a.page-numbers:hover,
.ia-blog .ia-pagination a.page-numbers:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
}

.ia-blog .ia-pagination .page-numbers.current {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-text);
  font-weight: 600;
}

.ia-blog .ia-pagination .page-numbers.dots {
  min-width: 0;
  padding: 0 4px;
  border: 0;
  background: none;
}

/* --------------------------------------------------------------------------
   9. Empty states
   -------------------------------------------------------------------------- */
.ia-empty {
  max-width: 46rem;
  padding: clamp(28px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: var(--ia-card-radius);
  background: var(--card);
}

.ia-empty__title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.ia-empty__body {
  margin: 0 0 var(--s3);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   10. Responsive
   -------------------------------------------------------------------------- */
/* Matches the site's own grid rhythm: three across down to 900px, two to 680px,
   one below that. */
@media (max-width: 1040px) {
  .ia-blog__controls {
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .ia-grid {
    gap: 24px;
  }
}

@media (max-width: 900px) {
  .ia-blog__controls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "search"
      "cats";
  }

  .ia-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ia-card--featured {
    grid-template-columns: minmax(0, 1fr);
  }

  .ia-card__media--featured {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 680px) {
  .ia-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .ia-blog__title {
    max-width: none;
  }

  .ia-card__media--featured {
    aspect-ratio: 16 / 10;
  }

  .ia-card__body {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ia-card,
  .ia-blog .ia-cats__link,
  .ia-blog .ia-pagination .page-numbers,
  .ia-readmore::after {
    transition: none;
  }

  .ia-card:hover,
  .ia-card:has(.ia-card__link:focus-visible) {
    transform: none;
  }

  .ia-card--featured:hover .ia-readmore::after {
    transform: rotate(-90deg);
  }
}
