/* ==========================================================================
   Income Outsource — Homepage
   Hero (latest/sticky post) + responsive post-card grid + pagination.
   All values pulled from variables.css — nothing hardcoded here.
   ========================================================================== */

.site-main {
  display: block;
}

/* ---------------------------------------------------------------------
   Shared bits: category chip (a solid pop-color badge) + meta row. This
   pairing is the site's signature motif — everything else stays quiet
   around it.
   --------------------------------------------------------------------- */
.post-chip {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--color-on-ink);
  background: var(--color-chip-bg);
  border: none;
  border-radius: var(--radius-pill);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--ls-caps);
  color: var(--color-text-muted);
}

.post-meta__sep {
  color: var(--color-border-strong);
}

/* ---------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------- */
.home-hero {
  /* Top padding trimmed a step (space-8 → space-6) — the gap under the
     sticky header read as too much across the site; bottom kept as-is. */
  padding-block: var(--space-6) var(--space-9);
  border-bottom: 1px solid var(--color-border);
}

.home-hero__link {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  color: inherit;
}

.home-hero__link:hover .home-hero__title,
.home-hero__link:focus-visible .home-hero__title {
  color: var(--color-accent-hover);
}

.home-hero__link:hover .home-hero__media img,
.home-hero__link:focus-visible .home-hero__media img {
  transform: scale(1.03);
}

.home-hero__media,
.home-hero__media-viewport {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-md);
}

.home-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.home-hero__media-placeholder {
  width: 100%;
  height: 100%;
  background-color: var(--color-ink);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--color-ink-light) 0,
    var(--color-ink-light) 1px,
    transparent 1px,
    transparent 12px
  );
}

.home-hero__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}

.home-hero__title {
  margin: 0;
  font-size: var(--fs-h2);
  transition: color var(--duration-base) var(--ease-standard);
}

.home-hero__excerpt {
  margin: 0;
  max-width: var(--content-measure);
  font-size: var(--fs-lead);
  color: var(--color-text-muted);
}

.home-hero__cta {
  margin-top: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--color-accent-hover);
}

/* ---------------------------------------------------------------------
   Hero slider (plan 15) — 2+ sticky posts. Media and content crossfade
   as two independent stacks (stacked via grid-area, not translated, so
   there's no layout shift and no swipe/drag complexity — matches this
   theme's existing preference for subtle crossfades over sliding motion)
   kept in sync by the same slide index, rather than one <a> per slide
   wrapping both — that split is what lets the prev/next buttons sit as
   real siblings of the image, overlaid on it, instead of nested inside
   its link (a <button> can't nest inside an <a>). Everything below only
   applies when .home-hero--slider is present — the 0/1-post static hero
   above (.home-hero__link et al) is untouched.
   --------------------------------------------------------------------- */
.home-hero--slider .home-hero__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.home-hero__media-viewport {
  display: grid;
}

.home-hero__slide-media {
  grid-area: 1 / 1;
  display: block;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-slow) var(--ease-standard),
    visibility 0s linear var(--duration-slow);
}

.home-hero__slide-media.is-active {
  opacity: 1;
  visibility: visible;
  transition:
    opacity var(--duration-slow) var(--ease-standard),
    visibility 0s linear 0s;
}

.home-hero__slide-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-hero__content-viewport {
  position: relative;
  display: grid;
}

.home-hero__slide-content {
  grid-area: 1 / 1;
  color: inherit;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-slow) var(--ease-standard),
    visibility 0s linear var(--duration-slow);
}

.home-hero__slide-content.is-active {
  opacity: 1;
  visibility: visible;
  transition:
    opacity var(--duration-slow) var(--ease-standard),
    visibility 0s linear 0s;
}

.home-hero__slide-content:hover .home-hero__title,
.home-hero__slide-content:focus-visible .home-hero__title {
  color: var(--color-accent-hover);
}

/* Prev/next overlaid on the image itself — pinned to its left/right
   edges, vertically centered — the conventional carousel treatment,
   rather than floating in the whitespace below the text. A translucent
   background (color-mix over the surface token, not a flat color) so
   they read as a light glass control sitting on top of the photo rather
   than a solid UI chrome element. */
.home-hero__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-surface-1) 65%, transparent);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

.home-hero__arrow--prev {
  left: var(--space-3);
}

.home-hero__arrow--next {
  right: var(--space-3);
}

.home-hero__arrow svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

.home-hero__arrow:hover,
.home-hero__arrow:focus-visible,
.home-hero__arrow:focus,
.home-hero__arrow:active {
  color: var(--color-accent-hover);
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.home-hero__arrow:focus-visible {
  outline: none;
  box-shadow: var(--shadow-sm), var(--shadow-focus);
}

.home-hero__arrow:focus {
  outline: none;
}

/* Dots overlaid on the image too — bottom-center, in their own
   translucent "ink" pill so they stay legible over any photo, rather
   than sitting in the whitespace below the text column. */
.home-hero__dots {
  position: absolute;
  z-index: 1;
  bottom: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: color-mix(in srgb, var(--color-ink) 55%, transparent);
  border-radius: var(--radius-pill);
}

.home-hero__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  background: color-mix(in srgb, var(--color-on-ink) 40%, transparent);
  border: none;
  border-radius: var(--radius-pill);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.home-hero__dot:hover,
.home-hero__dot:focus-visible,
.home-hero__dot:focus {
  background: var(--color-accent);
  transform: scale(1.2);
}

.home-hero__dot:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.home-hero__dot:focus {
  outline: none;
}

.home-hero__dot:active {
  background: var(--color-accent-hover);
}

.home-hero__dot.is-active {
  background: var(--color-accent);
  transform: scale(1.2);
}

@media (prefers-reduced-motion: reduce) {
  .home-hero__slide-media,
  .home-hero__slide-media.is-active,
  .home-hero__slide-content,
  .home-hero__slide-content.is-active {
    transition: opacity var(--duration-fast) linear, visibility 0s linear;
  }
}

/* ---------------------------------------------------------------------
   Hero "Featured" row (plan 15 follow-up) — the same posts as the slider
   above, shown again as a row of small cards for quick-jump access. Only
   rendered alongside the slider (2+ sticky posts); reuses .post-card's
   media-placeholder pattern rather than introducing a new one.
   --------------------------------------------------------------------- */
.home-hero__featured {
  padding-top: var(--space-7);
}

.home-hero__featured-eyebrow {
  margin: 0 0 var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--color-accent-hover);
}

.home-hero__featured-grid {
  /* auto-fit + 1fr so the row always spans the full container width —
     columns stretch evenly to fill it (however many posts there are) and
     wrap to a new row once each card would drop below ~140px. */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
}

.home-hero__featured-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  color: inherit;
}

.home-hero__featured-item:hover .home-hero__featured-title,
.home-hero__featured-item:focus-visible .home-hero__featured-title {
  color: var(--color-accent-hover);
}

.home-hero__featured-item:hover .home-hero__featured-media img,
.home-hero__featured-item:focus-visible .home-hero__featured-media img {
  transform: scale(1.05);
}

.home-hero__featured-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}

.home-hero__featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.home-hero__featured-media-placeholder {
  width: 100%;
  height: 100%;
  background-color: var(--color-ink);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--color-ink-light) 0,
    var(--color-ink-light) 1px,
    transparent 1px,
    transparent 12px
  );
}

.home-hero__featured-title {
  margin: 0;
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--duration-base) var(--ease-standard);
}

.home-hero__featured-date {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--ls-caps);
  color: var(--color-text-muted);
}

/* ---------------------------------------------------------------------
   Category index — every published category, between the hero and the
   post grid.
   --------------------------------------------------------------------- */
.category-index {
  padding-block: var(--space-8);
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
}

.category-index__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
}

.category-index__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--color-accent-hover);
}

.category-index__title {
  margin: 0;
}

.category-index__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.category-index__item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  color: inherit;
  /* --color-surface-1, not --color-card-bg — card-bg is identical to this
     section's own --color-bg-alt background in this palette, which made
     the tiles blend invisibly into the section behind them. surface-1 is
     the cleanest, most distinct neutral available in both themes. */
  background: var(--color-surface-1);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}

.category-index__item:hover,
.category-index__item:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
}

.category-index__item:hover .category-index__name,
.category-index__item:focus-visible .category-index__name {
  color: var(--color-accent-hover);
}

.category-index__item:hover .category-index__arrow,
.category-index__item:focus-visible .category-index__arrow {
  transform: translateX(4px);
  opacity: 1;
}

.category-index__name {
  font-family: var(--font-heading);
  font-size: var(--fs-h5);
  font-weight: var(--fw-semibold);
  color: var(--color-primary);
  transition: color var(--duration-base) var(--ease-standard);
}

.category-index__count {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.category-index__arrow {
  position: absolute;
  right: var(--space-5);
  bottom: var(--space-5);
  color: var(--color-accent-hover);
  opacity: 0;
  transition:
    transform var(--duration-base) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
}

/* ---------------------------------------------------------------------
   Post grid
   --------------------------------------------------------------------- */
.post-grid-section {
  padding-block: var(--space-9);
}

.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.post-grid-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding-block: var(--space-10);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--fs-lead);
}

.post-grid-empty p {
  margin: 0;
}

/* ---------------------------------------------------------------------
   Post card
   --------------------------------------------------------------------- */
.post-card {
  border-radius: var(--radius-lg);
  background: var(--color-card-bg);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}

.post-card:hover,
.post-card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.post-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  border-radius: inherit;
}

.post-card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-surface-2);
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.post-card:hover .post-card__media img,
.post-card:focus-within .post-card__media img {
  transform: scale(1.05);
}

.post-card__media-placeholder {
  width: 100%;
  height: 100%;
  background-color: var(--color-ink);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--color-ink-light) 0,
    var(--color-ink-light) 1px,
    transparent 1px,
    transparent 12px
  );
}

.post-card__chip {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.post-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  flex: 1 1 auto;
  padding: var(--space-5);
}

.post-card__title {
  margin: 0;
  font-size: var(--fs-h5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__excerpt {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__meta {
  /* .post-card__body uses align-items: flex-start, so a flex child only
     ever shrinks to its own content width by default — align-self:stretch
     overrides that just for this row so it spans the card's full width,
     which is what .post-card__meta-date's margin-left: auto below needs
     to actually have room to push into. */
  align-self: stretch;
  width: 100%;
  margin-top: auto;
  padding-top: var(--space-2);
}

/* Not scoped to .post-card — .post-meta itself (and this modifier) is
   shared by hero.php and single/post-header.php too, since homepage.css
   loads on every template that needs it (see functions.php's enqueue
   conditions). Any author name shown via .post-meta uses this class. */
.post-meta__author {
  text-transform: uppercase;
}

/* margin-left: auto (not justify-content: space-between on .post-card__meta
   itself) so the date still lands flush right even if .post-meta's
   flex-wrap ever kicks in — same reasoning as .recent-posts__item-date in
   single.css. */
.post-card__meta-date {
  margin-left: auto;
  padding-left: var(--space-2);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Scroll reveal (progressive enhancement — see homepage.js)
   --------------------------------------------------------------------- */
.post-card--reveal.reveal-pending {
  opacity: 0;
  transform: translateY(16px);
}

.post-card--reveal.is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
}

/* ---------------------------------------------------------------------
   Pagination
   --------------------------------------------------------------------- */
.post-pagination {
  display: flex;
  justify-content: center;
  margin-top: var(--space-8);
}

.post-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.post-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding-inline: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

.post-pagination .page-numbers:hover,
.post-pagination .page-numbers:focus-visible {
  color: var(--color-primary);
  border-color: var(--color-border-strong);
}

.post-pagination .page-numbers.current {
  color: var(--color-on-ink);
  background: var(--color-ink);
  border-color: var(--color-ink);
}

.post-pagination .page-numbers.dots {
  border-color: transparent;
  background: transparent;
}

/* ---------------------------------------------------------------------
   Breakpoints
   --------------------------------------------------------------------- */
@media (min-width: 600px) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .category-index__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 700px) {
  .home-hero__link {
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
  }

  .home-hero--slider .home-hero__inner {
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
  }
}

@media (min-width: 1024px) {
  .post-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* auto-fit rather than a fixed column count — reads cleanly whether the
     site ends up with 4, 5, or 8 categories, without a breakpoint tuned
     to today's exact count of 5. */
  .category-index__grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (min-width: 1440px) {
  .post-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-7);
  }
}
