/* ==========================================================================
   Product pages (Soil, Soil Amendments, Bark & Mulch, Crushed Rock,
   Planting Mixes, Sod & Seed). Loaded after style.css by `css: products.css`
   in each page's front matter. Shared pieces (hero, split, product grid,
   bands, FAQ) are styled in style.css; this file only adds what these
   pages need on top.
   Screen sizes: phones are the base rules, tablets 768px and up,
   desktop 1025px and up.
   ========================================================================== */

/* ---------- Text and two photos under the hero ---------- */

/* This section runs the full screen width on the live site (the page's
   other sections stop at 1200px). */
.split--wide-media .container {
  max-width: none;
}

/* Phones: two square photos side by side, 5px in from the text edges and
   5px apart, as live. */
.split--wide-media .split__media {
  gap: 5px;
  padding-inline: 5px;
}

.split--wide-media .split__img {
  height: auto;
  min-height: 0;
  aspect-ratio: 1;
}

/* Larger screens, as live: the width splits into three equal columns.
   The text takes the first; the two photos share the other two. The
   photos are a fixed 519px tall, whatever the length of the text, and
   start 19px above the heading. */
@media (min-width: 768px) {
  .split--wide-media .split__inner {
    grid-template-columns: 1fr 2fr;
    align-items: start;
    gap: 0;
  }

  .split--wide-media .split__text {
    align-self: start;
    padding-right: 30px;
  }

  .split--wide-media .split__media {
    margin-top: -19px;
    padding-inline: 11px;
    gap: 10px;
  }

  .split--wide-media .split__img {
    height: 519px;
    aspect-ratio: auto;
  }

  /* Planting Mixes: the text column is wider (5 of 12 parts), as live. */
  .split--wide-text .split__inner {
    grid-template-columns: 5fr 7fr;
  }
}

/* ---------- Text and one photo (Planting Mixes, Sod & Seed) ---------- */

/* Phones: a 3:2 photo under the text, so a tall photo doesn't fill the
   screen. (Live shows a thin strip of the photo here.) */
.split--text-wide .split__img {
  height: auto;
  aspect-ratio: 3 / 2;
}

/* Larger screens, as live: the text takes 7 of 12 parts of the width and
   the photo the other 5. The photo runs 40px above and below the text. */
@media (min-width: 768px) {
  .split--text-wide {
    padding-block: 50px;
  }

  .split--text-wide .split__inner {
    grid-template-columns: 7fr 5fr;
    gap: 0;
  }

  .split--text-wide .split__text {
    padding: 40px 30px 40px 0;
  }

  .split--text-wide .split__media {
    position: relative;
  }

  .split--text-wide .split__img {
    position: absolute;
    inset: 0;
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
  }
}

/* ---------- "Our … Products" section ---------- */

/* The products section runs straight into the "How Much … Do You Need?"
   band below it, which has its own space above. */
.products {
  padding-bottom: 0;
}

/* The intro text runs almost the full page width, as live. The first
   photos start 15px below its last line on phones and 25px on larger
   screens, as live. */
.products .section__intro {
  max-width: none;
  margin-bottom: 13px;
}

.products__unit {
  margin-bottom: 0;
}

/* 12px from the "Our … Products" heading to its text at every size, as live. */
.products .section__intro h2 {
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .products .section__intro {
    margin-bottom: 22px;
  }
}

/* "All products are sold per cubic yard." sits right under the intro text. */
.section__intro p:has(+ .products__unit) {
  margin-bottom: 0;
}

/* A long name such as "Container/Palm Mix" wraps inside its column on
   phones instead of widening the column and the page, as live. */
.product__name {
  overflow-wrap: anywhere;
}

/* Product text uses the font's normal line spacing, as live. */
.product__text {
  line-height: normal;
}

/* Phones and tablets: product text is centered, and each card's name and
   text sit in the middle of the space under the photo, so cards in a row
   line up on their middles, as live. */
@media (max-width: 1024px) {
  .product {
    display: flex;
    flex-direction: column;
  }

  .product__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
  }

  .product__text {
    text-align: center;
  }
}

/* Tablets and desktop: three columns of 250px-tall photos, 10px apart,
   with 25px from the end of a card's text to the next row, as live. */
@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .product__img {
    height: 250px;
    aspect-ratio: auto;
  }
}

/* Tablets: the grid sits 10px in from the text edges, as live. */
@media (min-width: 768px) and (max-width: 1024px) {
  .product-grid {
    padding-inline: 10px;
  }
}

/* Price lines under each product description: a gap above the block,
   and no gap between its lines, as live. */
.product__price {
  margin-top: 2em;
}

.product__text .product__price p + p {
  margin-top: 0;
}

/* Planting Mixes: two lists of mixes. On phones they stack, 20px apart;
   on larger screens they sit side by side, 40px in from the text edges.
   Sizes and spacing as live. */
.mix-lists {
  display: grid;
  row-gap: 20px;
  margin-top: 35px;
}

.mix-list {
  margin: 0;
  padding-left: 2em;
  line-height: 1.56;
}

@media (min-width: 768px) {
  .mix-lists {
    grid-template-columns: 1fr 1fr;
    margin-inline: 40px;
  }
}

/* ---------- Sod & Seed ---------- */

/* "Healthy Lawns Start with the Right Turf" leads straight into the
   "Advantages" section below it. */
.lawn-intro {
  padding-bottom: 0;
}

.lawn-intro .section__intro,
.lawn-intro .section__intro p {
  margin-bottom: 0;
}

/* The heading and text span the page width, so lines break as live. */
.lawn-intro .section__intro {
  max-width: none;
}

/* "What Type Of Grass Should I Get?": a flowchart made of text (D40), styled
   like the picture live shows. Yellow boxes are questions and lines to check,
   green boxes are answers and choices; green arrows mean "Yes", red "No".
   Colours from that picture; the green is a shade darker so its white text is
   easy to read. Phones: questions stacked, the three grasses side by side. */
.grass-chart {
  --chart-yellow: rgb(247 206 4);
  --chart-green: rgb(37 125 15);
  --chart-red: rgb(209 46 50);
}

.grass-chart__how {
  margin-bottom: 25px;
}

.grass-chart__questions,
.grass-chart__lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.grass-chart__box {
  position: relative;
  display: grid;
  place-content: center;
  margin: 0;
  padding: 12px 8px;
  border-radius: 8px;
  background: var(--chart-yellow);
  text-align: center;
}

.grass-chart__answer,
.grass-chart__choice {
  background: var(--chart-green);
  color: var(--white);
}

.grass-chart__answer {
  display: block;
  text-align: left;
}

.grass-chart__choice {
  font-weight: 700;
}

/* The arrows: shapes cut from a coloured box, labelled "Yes" or "No". The
   label is decoration ("/ ''"), so screen readers skip it. */
.grass-chart__questions > li::after,
.grass-chart__ask::before,
.grass-chart__ask::after,
.grass-chart__lines > li::before,
.grass-chart__lines > li::after {
  position: absolute;
  z-index: 1;
  display: grid;
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* Down arrows: "No" under each question, "Yes" under each line to check. */
.grass-chart__questions > li::after,
.grass-chart__ask::before,
.grass-chart__lines > li::before {
  top: 100%;
  left: 50%;
  width: 48px;
  height: 30px;
  padding-top: 4px;
  justify-items: center;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform: translateX(-50%);
}

.grass-chart__questions > li::after,
.grass-chart__ask::before {
  content: "No" / "";
  background: var(--chart-red);
}

.grass-chart__lines > li::before {
  content: "Yes" / "";
  background: var(--chart-green);
}

/* Right arrows: "Yes" from a question to its answer, "No" to the next grass. */
.grass-chart__ask::after,
.grass-chart__lines > li::after {
  top: 50%;
  left: 100%;
  width: 64px;
  height: 84px;
  padding-left: 6px;
  align-items: center;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  transform: translateY(-50%);
}

.grass-chart__ask::after {
  content: "Yes" / "";
  background: var(--chart-green);
}

.grass-chart__grass:not(:last-child) .grass-chart__lines > li::after {
  content: "No" / "";
  background: var(--chart-red);
}

/* Phones: each question with its answer below it, a "No" arrow to the next. */
.grass-chart__questions > li {
  position: relative;
  display: grid;
  gap: 6px;
  margin-bottom: 40px;
}

.grass-chart__ask::before,
.grass-chart__ask::after,
.grass-chart__lines > li::after {
  display: none;
}

/* The last "No" leads to the first grass (the left column). */
.grass-chart__questions > li:last-child::after {
  left: calc((100% - 12px) / 6);
}

/* Phones: the three grasses side by side; read down, move right on "No". */
.grass-chart__grasses {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(5, auto);
  gap: 32px 6px;
  font-size: 14px;
  line-height: 1.35;
}

.grass-chart__grass,
.grass-chart__lines {
  display: grid;
  grid-template-rows: subgrid;
}

.grass-chart__grass {
  grid-row: span 5;
}

.grass-chart__lines {
  grid-row: span 4;
}

.grass-chart__lines .grass-chart__box,
.grass-chart__choice {
  padding: 10px 4px;
}

/* Tablets and desktop: as the picture, questions on the left with their answers
   to the right, and arrows between the grasses. */
@media (min-width: 768px) {
  .grass-chart__how {
    max-width: 760px;
    margin: 0 auto 35px;
    text-align: center;
  }

  .grass-chart__questions > li {
    grid-template-columns: minmax(0, 410fr) minmax(0, 850fr);
    gap: 0 30px;
    min-height: 144px;
    margin-bottom: 36px;
  }

  .grass-chart__questions > li:last-child {
    margin-bottom: 57px;
  }

  .grass-chart__questions > li::after {
    display: none;
  }

  /* The arrow says "Yes" here; the word stays for screen readers. */
  .grass-chart__yes {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .grass-chart__ask::before,
  .grass-chart__ask::after,
  .grass-chart__grass:not(:last-child) .grass-chart__lines > li::after {
    display: grid;
  }

  .grass-chart__questions > li::after,
  .grass-chart__ask::before,
  .grass-chart__lines > li::before {
    width: 84px;
    height: 64px;
    padding-top: 8px;
  }

  .grass-chart__questions > li::after,
  .grass-chart__ask::before,
  .grass-chart__ask::after,
  .grass-chart__lines > li::before,
  .grass-chart__lines > li::after {
    font-size: 18px;
  }

  /* Room for the arrows that reach into a box. */
  .grass-chart__box {
    padding: 30px 20px 20px;
  }

  .grass-chart__answer {
    padding: 20px 25px 20px 50px;
  }

  .grass-chart__grasses {
    gap: 37px 30px;
    font-size: inherit;
    line-height: inherit;
  }

  .grass-chart__lines .grass-chart__box,
  .grass-chart__choice {
    min-height: 105px;
    padding: 30px 15px 20px;
  }

  .grass-chart__grass + .grass-chart__grass .grass-chart__box {
    padding-left: 44px;
  }

  .grass-chart__choice {
    font-size: 24px;
    line-height: 1.2;
  }
}

@media (min-width: 768px) {
  /* 110px from the "Advantages" photo to this heading, as live. */
  .grass-chart {
    padding-top: 60px;
  }

  .grass-chart__title {
    text-align: center;
  }
}
