/*
 * Nest N Thrive. Home page (front-page.php).
 *
 * Direction: "Quiet Authority" (A typography + B functionality + a real face).
 * Spec: design/briefs/homepage-redesign-2026-05.md, status: approved.
 *
 * Loaded only on the front page (see functions.php).
 * Light + dark both first-class via token swaps.
 */

/* ───────── Byline (template-parts/part-byline.php) ─────────
 * Reusable across hero, single-review, and newsletter sections.
 */

.byline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-sans);
}

.byline-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  flex-shrink: 0;
}

.byline-photo--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xl);
  color: var(--color-brand);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-strong);
}

.byline-text {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.3;
}

.byline-name {
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.005em;
}
.byline-name:hover { color: var(--color-brand); }

.byline-bio {
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
}

.byline--lg .byline-photo { width: 64px; height: 64px; }
.byline--lg .byline-name  { font-size: var(--text-base); }
.byline--sm .byline-photo { width: 36px; height: 36px; }
.byline--sm .byline-name  { font-size: var(--text-xs); }

.byline--stacked {
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}


/* Newsletter form (template-parts/part-newsletter-inline.php) lives in
 * assets/css/newsletter.css and is enqueued globally so the form gets the
 * brand styling everywhere it appears, not just on the front page. */


/* ───────── Section rhythm (used on every home section) ───────── */

.home-main { padding-bottom: var(--space-section-y-mobile); }
@media (min-width: 1024px) {
  .home-main { padding-bottom: var(--space-section-y); }
}

.home-featured,
.home-latest,
.home-listicles,
.home-pillars,
.home-newsletter {
  padding: var(--space-section-y-mobile) 0;
}
@media (min-width: 1024px) {
  .home-featured,
  .home-latest,
  .home-listicles,
  .home-pillars,
  .home-newsletter {
    padding: var(--space-section-y) 0;
  }
}

/* Alternating subtle background */
.home-featured  { background: var(--color-bg-subtle); }
.home-listicles { background: var(--color-bg-subtle); }

.home-section-header {
  margin: 0 0 var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.home-section-title {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: clamp(var(--text-3xl), 4vw, var(--text-4xl));
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
  color: var(--color-text);
  text-wrap: balance;
}


/* ───────── Section 1: Hero ───────── */
/* Mobile (default): full-bleed background image, text overlaid with strong
 * cream/dark wash for readability. The image hints through underneath but
 * is muted enough that long-form text stays comfortable. Desktop (≥1024px):
 * split layout with text left, contained image card right, mark behind. */

.home-hero {
  position: relative;
  padding: var(--space-section-y-mobile) 32px;
  overflow: hidden;
  background: var(--color-bg);
  min-height: 540px;
}
@media (min-width: 768px) {
  .home-hero {
    padding: var(--space-section-y) 40px;
    min-height: 620px;
  }
}
@media (min-width: 1024px) {
  .home-hero {
    padding: var(--space-section-y) 32px;
    min-height: 0;
  }
}

/* Mobile readability overlay. Heavy cream/dark wash uniform across most of
 * the hero, with the image hinting through at lower opacity. Editorial
 * register: photo is texture, text is the message. Hidden on desktop. */
.home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  pointer-events: none;
}
:root[data-theme="dark"] .home-hero::before {
  background: color-mix(in srgb, var(--color-bg) 80%, transparent);
}
@media (min-width: 1024px) {
  .home-hero::before { display: none; }
}

/* Grid wraps the text content. On mobile the visual is absolutely positioned
 * (out of grid flow, fills hero edge-to-edge). Grid does NOT have
 * position: relative — that lets the visual climb to .home-hero as its
 * positioning context. */
.home-hero-grid {
  max-width: var(--max-w-page);
  margin: 0 auto;
}
@media (min-width: 1024px) {
  .home-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: var(--space-10);
    align-items: center;
  }
}

.home-hero-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
  position: relative;
  z-index: 2;
  /* Mobile: cap text width so long lines don't dominate the photo. */
  max-width: 540px;
  margin: 0 auto;
  width: 100%;
}
@media (min-width: 1024px) {
  .home-hero-text {
    grid-area: 1 / 1;
    max-width: none;
    margin: 0;
  }
}

/* MOBILE: visual is absolutely positioned to fill the entire hero edge-to-edge,
 * top to bottom — bleeding past the hero's padding so the image reads as
 * the hero background. */
.home-hero-visual {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  max-width: none;
}

/* DESKTOP: visual switches to a grid item in the right column. */
@media (min-width: 1024px) {
  .home-hero-visual {
    position: relative;
    inset: auto;
    grid-area: 1 / 2;
    aspect-ratio: 4 / 5;
    z-index: auto;
  }
}

.home-hero-image {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--color-bg-subtle);
}
.home-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Mobile: keep the bedroom + plant centered. Desktop: bias right so
   * the window light side reads. */
  object-position: 50% center;
  display: block;
}
@media (min-width: 1024px) {
  .home-hero-image {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }
  .home-hero-image img {
    object-position: 60% center;
  }
}

.home-hero-eyebrow {
  display: inline-block;
  color: var(--color-brand);
  margin: 0;
}

.home-hero-title {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: clamp(var(--text-4xl), 7vw, var(--text-6xl));
  line-height: 1.05;
  letter-spacing: var(--tracking-tight);
  margin: 0;
  text-wrap: balance;
  color: var(--color-text);
  max-width: 18ch;
}

.home-hero-lead {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(var(--text-lg), 2vw, var(--text-2xl));
  line-height: var(--leading-snug);
  color: var(--color-text-secondary);
  margin: 0;
  max-width: 56ch;
  text-wrap: pretty;
}

/* The mark sits BEHIND the image card, peeking out from the left edge
 * of the photo. Editorial magazine register: the photo crops the mark.
 * Hidden on mobile (centered image + a hovering glyph fights for
 * attention). */
.home-hero-watermark {
  display: none;
  position: absolute;
  top: 50%;
  /* Mostly hidden behind the image card; only a sliver peeks out the
   * left edge so the mark suggests itself rather than dominating. */
  left: -10%;
  width: 260px;
  height: 260px;
  transform: translateY(-50%);
  color: var(--color-brand);
  pointer-events: none;
}
:root[data-theme="dark"] .home-hero-watermark {
  color: var(--color-brand);
}
@media (min-width: 1024px) {
  .home-hero-watermark { display: block; }
}
@media (min-width: 1280px) {
  .home-hero-watermark { width: 300px; height: 300px; left: -11%; }
}

/* The image card sits in front of the mark via explicit z-index. */
.home-hero-image { z-index: 1; }

/* Stagger entry on the text column children */
.home-hero-text > * {
  opacity: 0;
  transform: translateY(16px);
  animation: home-hero-fade 600ms var(--easing-decelerate) forwards;
}
.home-hero-text > *:nth-child(1) { animation-delay:  60ms; }
.home-hero-text > *:nth-child(2) { animation-delay: 120ms; }
.home-hero-text > *:nth-child(3) { animation-delay: 180ms; }
.home-hero-text > *:nth-child(4) { animation-delay: 240ms; }

.home-hero-visual {
  opacity: 0;
  transform: translateY(16px);
  animation: home-hero-fade 800ms var(--easing-decelerate) 200ms forwards;
}

@keyframes home-hero-fade {
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .home-hero-text > *,
  .home-hero-visual {
    opacity: 1;
    transform: none;
    animation: none;
  }
}


/* ───────── Section 2: Featured review card ───────── */

.home-featured-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 1024px) {
  .home-featured-card { grid-template-columns: 1.3fr 1fr; gap: 0; }
}

.home-featured-image {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--gradient-warm);
}
/* Desktop: drop the aspect-ratio so the image stretches to match the
 * content column's height. Without this, a tall TL;DR + CTA + pros list
 * makes the right column taller than the 4:3 image, leaving the section
 * background visible below the photo. */
@media (min-width: 1024px) {
  .home-featured-image {
    aspect-ratio: auto;
    height: 100%;
    min-height: 100%;
  }
}
.home-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Center horizontally + slightly above center vertically so when the
   * card stretches to a tall row, we keep the product (mattress / etc.)
   * in frame instead of cropping to just the floor. */
  object-position: center 35%;
  display: block;
  transition: transform var(--duration-slow) var(--easing-standard);
}
.home-featured-image:hover img { transform: scale(1.02); }

.home-featured-image-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--gradient-warm);
}

/* Stretch the grid items so image + body share row height. */
@media (min-width: 1024px) {
  .home-featured-card { align-items: stretch; }
}

.home-featured-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
@media (min-width: 768px) { .home-featured-body { padding: var(--space-8); } }

.home-featured-eyebrow { color: var(--color-accent); }

.home-featured-brand {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin: 0;
}

.home-featured-title {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: clamp(var(--text-3xl), 3.5vw, var(--text-4xl));
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
  color: var(--color-text);
  text-wrap: balance;
}
.home-featured-title a { color: inherit; text-decoration: none; }
.home-featured-title a:hover { color: var(--color-brand); }

.home-featured-rating {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}
.home-featured-rating-num {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: var(--text-2xl);
  color: var(--color-text);
}

.home-featured-tldr {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--color-text);
  margin: 0;
  max-width: 50ch;
}

.home-featured-price-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}
.home-featured-price {
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
  font-size: var(--text-3xl);
  color: var(--color-text);
}
.home-featured-price-msrp {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-decoration: line-through;
}

.home-featured-cta {
  margin-top: var(--space-2);
  align-self: flex-start;
}

.home-featured-trust {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}


/* ───────── Section 3: Latest reviews grid ───────── */

.home-latest-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
@media (min-width: 700px)  { .home-latest-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .home-latest-grid { grid-template-columns: repeat(3, 1fr); } }

.home-review-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--duration-base) var(--easing-standard),
    box-shadow var(--duration-base) var(--easing-standard),
    border-color var(--duration-base) var(--easing-standard);
}
.home-review-card:hover,
.home-review-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-border-strong);
}

.home-review-card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--gradient-warm);
  overflow: hidden;
}
.home-review-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-review-card-image-placeholder { display: block; width: 100%; height: 100%; background: var(--gradient-warm); }

.home-review-card-rating-pill {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: var(--color-rating-gold-bg);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  backdrop-filter: blur(4px);
}

.home-review-card-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.home-review-card-title {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
  color: var(--color-text);
  text-wrap: balance;
}

.home-review-card-tldr {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
  line-height: var(--leading-normal);
}

.home-review-card-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}
.home-review-card-price {
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}
.home-review-card-author {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}


/* ───────── Section 4: Best-of listicles ───────── */

.home-listicles-eyebrow { color: var(--color-accent); }

.home-listicles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
@media (min-width: 768px) { .home-listicles-grid { grid-template-columns: 1fr 1fr; gap: var(--space-6); } }

.home-listicle-card {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--duration-base) var(--easing-standard),
    box-shadow var(--duration-base) var(--easing-standard),
    border-color var(--duration-base) var(--easing-standard);
}
.home-listicle-card:hover,
.home-listicle-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-border-strong);
}

.home-listicle-card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--gradient-warm);
}
.home-listicle-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-listicle-card-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--gradient-warm);
}
.home-listicle-card-image-placeholder span {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.home-listicle-card-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
@media (min-width: 768px) { .home-listicle-card-body { padding: var(--space-6); } }

.home-listicle-card-title {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: clamp(var(--text-2xl), 2.5vw, var(--text-3xl));
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
  color: var(--color-text);
  text-wrap: balance;
}

.home-listicle-card-tldr {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  margin: 0;
  line-height: var(--leading-normal);
}

.home-listicle-card-cta {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-brand);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-2);
}
.home-listicle-card:hover .home-listicle-card-cta { color: var(--color-brand-deep); }


/* ───────── Section 5: Pillar grid ───────── */

.home-pillars-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
@media (min-width: 700px)  { .home-pillars-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-4); } }
@media (min-width: 1280px) { .home-pillars-grid { grid-template-columns: repeat(5, 1fr); gap: var(--space-3); } }

.home-pillar-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition:
    transform var(--duration-base) var(--easing-standard),
    box-shadow var(--duration-base) var(--easing-standard),
    border-color var(--duration-base) var(--easing-standard);
}
.home-pillar-card:hover,
.home-pillar-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-border-strong);
}

.home-pillar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-brand);
  margin-bottom: var(--space-2);
  flex-shrink: 0;
}

.home-pillar-name {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

.home-pillar-lead {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
  margin: 0;
}

.home-pillar-count {
  margin-top: auto;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding-top: var(--space-3);
}


/* ───────── data-reveal scroll-trigger reveal (used per-section) ───────── */

.home-main [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 700ms var(--easing-decelerate),
    transform 700ms var(--easing-decelerate);
}
.home-main [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .home-main [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
