/* Static-home page-layout CSS.
   Owns *structural* rules (grids, spacing, card chrome) for the six
   layouts in the SHI-180 catalog. Per-template stylesheets contribute
   palette / type tokens (CSS variables) — they must not own structure.
   See docs/superpowers/plans/2026-05-15-static-home-layout-css-decoupling.md */

/* Stat grid (used by the stats_and_testimonials layout — and by any
   page that has 2+ consecutive stat slides in body content).
   Templates theme via:
     --sh-section-stat-tile-bg
     --sh-section-stat-tile-radius
     --sh-section-stat-tile-padding
     --sh-section-stat-number-color
     --sh-section-stat-number-font
     --sh-section-stat-number-size
     --sh-section-stat-label-color
     --sh-section-stat-gap */
.sh-section-stat-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sh-section-stat-gap, 16px);
}
.sh-section-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: var(--sh-section-stat-tile-padding, 20px);
  background: var(--sh-section-stat-tile-bg, rgba(0, 0, 0, 0.05));
  border-radius: var(--sh-section-stat-tile-radius, 12px);
}
.sh-section-stat-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  color: var(--sh-section-stat-number-color, currentColor);
}
.sh-section-stat-icon svg { width: 100%; height: 100%; }
.sh-section-stat-number {
  font-family: var(--sh-section-stat-number-font, inherit);
  font-size: var(--sh-section-stat-number-size, clamp(28px, 5vw, 44px));
  font-weight: 700;
  line-height: 1;
  color: var(--sh-section-stat-number-color, currentColor);
}
.sh-section-stat-label {
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sh-section-stat-label-color, currentColor);
  opacity: 0.85;
}
@media (max-width: 768px) {
  .sh-section-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .sh-section-stat-grid { grid-template-columns: 1fr; }
}

/* Testimonial grid (static — not the homepage marquee, which lives in
   `.sh-testimonial-card` under each template's stylesheet).
   Templates theme via:
     --sh-section-testimonial-card-bg
     --sh-section-testimonial-card-radius
     --sh-section-testimonial-card-padding
     --sh-section-testimonial-mark-color
     --sh-section-testimonial-quote-color
     --sh-section-testimonial-meta-color
     --sh-section-testimonial-gap */
.sh-section-testimonial-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sh-section-testimonial-gap, 16px);
}
.sh-section-testimonial {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--sh-section-testimonial-card-padding, 24px);
  background: var(--sh-section-testimonial-card-bg, rgba(0, 0, 0, 0.05));
  border-radius: var(--sh-section-testimonial-card-radius, 12px);
}
.sh-section-testimonial-mark {
  display: inline-block;
  font-size: 40px;
  line-height: 1;
  color: var(--sh-section-testimonial-mark-color, currentColor);
  /* The partial sets a literal opening curly quote as the text node. */
}
.sh-section-testimonial-quote {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--sh-section-testimonial-quote-color, currentColor);
}
.sh-section-testimonial-meta {
  margin: 0;
  font-size: 14px;
  color: var(--sh-section-testimonial-meta-color, currentColor);
  opacity: 0.7;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.sh-section-testimonial-name { font-weight: 600; }
.sh-section-testimonial-dash { opacity: 0.5; }
.sh-section-testimonial-role { font-style: italic; }

@media (max-width: 640px) {
  .sh-section-testimonial-grid { grid-template-columns: 1fr; }
}

/* Figure grid (photo_story layout). Templates theme via:
     --sh-section-figure-card-bg
     --sh-section-figure-card-radius
     --sh-section-figure-card-padding
     --sh-section-figure-img-aspect
     --sh-section-figure-caption-color
     --sh-section-figure-gap
     --sh-section-figure-prose-color
     --sh-section-figure-min      (per-tile floor, default 220px)
     --sh-section-figure-max-cols (cap on column count, default 4)

   Sizing strategy: auto-fit + minmax() so the grid packs as many tiles
   per row as fit at the floor width, with a hard upper cap from
   --sh-section-figure-max-cols. With max-cols=4 the row tops out at 4
   tiles regardless of how wide the container gets, and naturally drops
   to 3 → 2 → 1 as the viewport shrinks (the @media query below pins
   1-col on phone portrait). */
.sh-section-figure-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sh-section-figure-gap, 16px);
  grid-template-columns: repeat(
    auto-fit,
    minmax(
      max(
        var(--sh-section-figure-min, 220px),
        calc(
          (100% - (var(--sh-section-figure-max-cols, 4) - 1) * var(--sh-section-figure-gap, 16px))
          / var(--sh-section-figure-max-cols, 4)
        )
      ),
      1fr
    )
  );
}
.sh-section-figure {
  display: flex;
  flex-direction: column;
  background: var(--sh-section-figure-card-bg, rgba(0, 0, 0, 0.05));
  border-radius: var(--sh-section-figure-card-radius, 12px);
  padding: var(--sh-section-figure-card-padding, 12px);
  overflow: hidden;
}
.sh-section-figure-inner {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sh-section-figure-img {
  display: block;
  width: 100%;
  aspect-ratio: var(--sh-section-figure-img-aspect, 4 / 3);
  object-fit: cover;
  border-radius: calc(var(--sh-section-figure-card-radius, 12px) - 4px);
}
.sh-section-figure-caption {
  margin-top: 10px;
  padding: 0 6px;
  font-size: 13px;
  font-style: italic;
  line-height: 1.5;
  text-align: center;
  letter-spacing: 0.005em;
  color: var(--sh-section-figure-caption-color, currentColor);
  opacity: 0.85;
}
/* TipTap wraps the caption text in an <em> when the editor's Caption
   affordance writes it (`<figcaption><em>...</em></figcaption>`). The
   whole figcaption is already italic, so the inner <em> would compound
   into a double-emphasis — flatten its styling back to inherit. */
.sh-section-figure-caption em {
  font-style: inherit;
}
/* Trailing prose under a figure tile — body text the user authored
   after the figcaption on a "figure" section_type slide. Sits inside
   the same .sh-section-figure <li> below the figcaption so WYSIWYG
   holds. Top margin separates it from the (italic, centered) caption;
   the prose itself stays left-aligned at a body-text size. */
.sh-section-figure-prose {
  margin-top: 12px;
  padding: 0 6px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--sh-section-figure-prose-color, currentColor);
}
.sh-section-figure-prose > * { margin: 0 0 8px; }
.sh-section-figure-prose > *:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .sh-section-figure-grid { grid-template-columns: 1fr; }
}
