/* soap-redesign.css — 2026-11-11
   Layout fix for the mobile step collapse, quieter type, and photo slots.
   Does not replace brand colors or font families. */

/* ---------- 1. Numbered steps: one-word-per-line bug ----------
   Root cause (see audit-report.md):
   At max-width: 580px, project-pages.css set EVERY .project-step — including
   those with a figure — to `grid-template-columns: 2.1rem minmax(0, 1fr)`.
   That only works when `.project-step__number` is a direct grid child.
   On /projects/leaf/ the number lives inside `.project-step__copy`, so the
   whole step body (heading + paragraph) was placed in a 2.1rem (~34px)
   column and wrapped to one word per line on iPhone-sized viewports.
   These rules override that mobile grid after project-pages.css. */

.project-page .project-step,
.project-page .project-step:has(.project-step__figure) {
  min-width: 0;
}

.project-page .project-step__copy,
.project-page .project-step__body,
.project-page .project-step p,
.guide-step,
.lesson-step {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: manual;
}

.project-page .project-step h3 {
  max-width: none;
}

@media (max-width: 580px) {
  .project-page .project-step,
  .project-page .project-step:has(.project-step__figure) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.7rem 0.85rem;
  }

  /* Number as a direct child: keep a tight index column + fluid text. */
  .project-page .project-step:has(> .project-step__number) {
    grid-template-columns: 2.1rem minmax(0, 1fr);
  }

  .project-page .project-step:has(.project-step__figure) .project-step__figure {
    grid-column: 1 / -1;
    grid-row: auto;
    margin-top: 0.15rem;
    aspect-ratio: 4 / 3;
  }

  .project-page .project-step h3 {
    max-width: none;
    font-size: 1.45rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
  }

  .project-page .project-step p {
    max-width: none;
    font-size: 0.95rem;
    line-height: 1.65;
  }
}

/* Also stack the two-column process heading+steps earlier if a later
   stylesheet reintroduces minmax(14rem, …) — 14rem + gap already leaves
   only ~50–60px for steps at 390px. */
@media (max-width: 780px) {
  .project-page .project-process,
  .project-page .project-guidance,
  .project-page .project-rescue,
  .project-page .project-troubleshooting,
  .project-page .project-faq,
  .project-page .project-next,
  .project-page .project-materials,
  .project-page .project-tools,
  .project-page .project-hero,
  .project-page .project-header__grid,
  .start-section {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- 2. Quieter, more readable type (de-AI-slop) ---------- */

.project-page .project-hero h1,
.project-page .project-header h1,
body.project-page .project-hero h1,
body.project-page .project-header h1,
.guide-hero h1,
.guide-hero__copy h1 {
  max-width: 16ch;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.project-page .project-process__intro h2,
.project-page .project-process__heading h2 {
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

@media (max-width: 580px) {
  .project-page .project-hero h1,
  .project-page .project-header h1,
  body.project-page .project-hero h1,
  body.project-page .project-header h1,
  .guide-hero h1,
  .guide-hero__copy h1,
  h1#hero-title,
  .hero h1 {
    max-width: 14ch;
    font-size: clamp(2.35rem, 11vw, 3.15rem);
    line-height: 1.08;
    letter-spacing: -0.04em;
  }

  .project-page .project-hero h2 {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
    line-height: 1.1;
  }

  .hero__lede,
  .guide-hero__summary,
  .project-hero__lede {
    font-size: 1.02rem;
    line-height: 1.6;
  }
}

/* Homepage start path should not stay 15rem + leftover on a phone. */
@media (max-width: 780px) {
  .start-section {
    gap: 2rem;
  }
}

/* ---------- 3. Homepage photo slots ---------- */

.hero__photo {
  margin: 0;
  overflow: hidden;
  background: var(--paper-deep, #efe6d6);
  border: 1px solid var(--line, #d9d0c2);
  border-radius: 0.2rem 0.2rem 3rem 0.2rem;
}

.hero__photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 40%;
}

.hero__visual-caption {
  margin-top: 0.85rem;
}

.project-card__visual {
  position: relative;
  overflow: hidden;
  background: var(--paper-deep, #efe6d6);
}

.project-card__visual img,
.note-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card__visual img {
  aspect-ratio: 4 / 3;
}

.project-card--large .project-card__visual img {
  aspect-ratio: 16 / 10;
}

.project-visual--leaf .visual-note,
.project-visual--leaf .visual-stamp,
.note-card__image svg,
.note-card__big-mark {
  display: none;
}

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

.note-card__image {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--paper-deep, #efe6d6);
}

.note-card__image img {
  aspect-ratio: 16 / 9;
}

.note-card:not(.note-card--featured) .note-card__image {
  margin: 0;
}

@media (min-width: 781px) {
  .note-card:not(.note-card--featured) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- 4. Article / project featured photos ---------- */

.article-featured,
.guide-featured,
.project-featured {
  margin: 1.25rem 0 1.75rem;
  overflow: hidden;
  background: var(--paper-deep, #efe6d6);
  border: 1px solid var(--line, #d9d0c2);
}

.article-featured img,
.guide-featured img,
.project-featured img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.article-featured figcaption,
.guide-featured figcaption,
.project-featured figcaption {
  padding: 0.55rem 0.75rem 0.7rem;
  color: var(--ink-soft, #5c564e);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  line-height: 1.45;
}

.guide-hero + .guide-featured,
.guide-hero__copy + .guide-featured {
  margin-top: 0;
}

/* If a project hero already shows a photo, keep it contained. */
.project-hero__image,
.project-hero__media img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}
