/* ==========================================================================
   Home page (src/index.njk). Loads after style.css.
   Sizes were measured on the live home page at 1440px and 412px wide.
   ========================================================================== */

/* ---------- Hero: video behind a light panel with the <h1> ---------- */
.home-hero {
  position: relative;
  isolation: isolate; /* keeps the photo and video behind the panel */
  overflow: clip;
  padding-block: 50px 80px; /* video shows above and below the panel, as live */
}

/* The photo (.bg-layer, style.css) fills the hero; the video sits on top of it. */
.home-hero__video {
  z-index: -1;
}

/* Pause/play button (js/hero-video.js), over the video: bottom right of the
   hero on phones, top right from tablets up (there the hero can run past the
   first screen, which would hide a button at its bottom). A round dark button
   with a white icon and border, so it shows on light and dark parts of the video. */
.home-hero__toggle {
  position: absolute;
  right: var(--gutter);
  bottom: 18px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: rgb(0 0 0 / 0.6);
  color: var(--white);
  cursor: pointer;
}

/* Stays hidden until the script shows it (display: grid above would override
   the hidden attribute). */
.home-hero__toggle[hidden] {
  display: none;
}

.home-hero__toggle:hover {
  background: var(--green);
}

.home-hero__toggle:focus-visible {
  outline-color: var(--white);
}

.home-hero__icon {
  width: 22px;
  height: 22px;
  fill: currentcolor;
}

/* Show the pause icon while the video plays, the play icon while paused. */
.home-hero__toggle[data-state="playing"] .home-hero__icon--play,
.home-hero__toggle[data-state="paused"] .home-hero__icon--pause {
  display: none;
}

/* Reduced motion: hide the video, so only the still photo shows. The video's
   sources already skip loading in this case; this covers older browsers, and
   visitors who switch the setting on while the page is open. */
@media (prefers-reduced-motion: reduce) {
  .home-hero__video,
  .home-hero__toggle {
    display: none;
  }
}

/* Phones: the panel spans the screen, with video showing above and below it. */
.home-hero .container {
  padding-inline: 0;
}

.home-hero__panel {
  padding: 30px var(--gutter);
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgb(242 242 242 / 0.9);
}

.home-hero__panel h1 {
  max-width: 75%; /* live wraps the phone heading at three quarters of the panel */
  margin: 10px 0 4px;
  line-height: 42px; /* live's phone line spacing for this heading */
}

.home-hero__panel p {
  margin: 0;
}

.home-hero__panel .btn {
  margin-block: 12px 10px;
}

/* Tablets and desktop: the panel takes the left half of the page width, starts
   at the top of the hero, and 250px of video shows below it. */
@media (min-width: 768px) {
  .home-hero {
    padding-block: 0 250px;
  }

  /* 18px below the header, which covers the top 76px of the hero on
     tablets (see "Header and menu" in style.css). */
  .home-hero__toggle {
    top: 94px;
    bottom: auto;
  }

  .home-hero .container {
    padding-inline: var(--gutter);
  }

  .home-hero__panel {
    width: 50%;
    padding: 50px 30px;
  }

  .home-hero__panel h1 {
    max-width: none;
    margin-bottom: 6px;
    line-height: 1.17; /* back to the usual heading spacing */
  }

  .home-hero__panel .btn {
    width: 100%;
    max-width: 354px;
    margin: 20px 0 10px;
  }
}

/* Tablets: the panel starts below the header, which covers the top 76px of
   the hero. Live's panel starts under it, so its heading's first line is
   cut off; ours isn't (D5). */
@media (min-width: 768px) and (max-width: 1024px) {
  .home-hero {
    padding-top: 76px;
  }
}

/* Desktop: the header covers up to 19px of the hero (1600px and wider). */
@media (min-width: 1025px) {
  .home-hero__toggle {
    top: 37px;
  }
}

/* ---------- "Quality Soil and Mulch…": text and one photo (split partial) ---------- */

.home-quality {
  padding-top: 68px; /* phones: 68px below the hero video, as live */
  padding-bottom: 0; /* the products section's own space follows */
}

/* Paragraphs are separated by one blank line, as live. */
.home-quality p {
  margin: 0;
}

.home-quality p + p {
  margin-top: 2em;
}

.home-quality .btn {
  max-width: 343px; /* phones: live's "See Products" button is 343×53 */
  min-height: 53px;
  margin-top: 25px;
}

/* Phones: the photo runs to the screen edges, 216px tall, as live. */
.home-quality .split__media {
  margin-inline: calc(-1 * var(--gutter));
}

.home-quality .split__img {
  height: 216px;
  min-height: 0;
}

@media (min-width: 768px) {
  .home-quality {
    padding-top: var(--section-space); /* the usual space from tablets up */
  }

  .home-quality .split__media {
    margin-inline: 0;
  }

  /* Text column 630px and photo 500px at full width, as live. */
  .home-quality .split__inner {
    grid-template-columns: 630fr 500fr;
  }

  .home-quality .split__img {
    height: 100%;
    min-height: 400px;
  }

  .home-quality .btn {
    min-height: 55px; /* the usual size from tablets up */
    margin-top: 20px;
  }
}

/* Tablets: text 350px and photo 300px wide at 800px, as live. The photo
   reaches 87px above the heading and 80px below the button. */
@media (min-width: 768px) and (max-width: 1024px) {
  .home-quality .split__inner {
    grid-template-columns: 350fr 300fr;
  }

  .home-quality .split__text {
    padding-block: 87px 80px;
  }
}

@media (min-width: 1025px) {
  .home-quality .split__img {
    min-height: 758px;
  }
}

/* ---------- "Our Top Products" ---------- */

/* On wide screens the cards spread wider than the usual page width (1360px), as live. */
.home-products .container {
  max-width: calc(1360px + 2 * var(--gutter));
}

/* Phones: shorter card photos, as live. */
.home-products .card__img {
  height: 172px;
}

/* "Learn more" on phones: 301×52, left-aligned text, as live. */
.home-products .card__link {
  justify-content: flex-start;
  width: 100%;
  max-width: 301px;
  min-height: 52px;
}

@media (min-width: 768px) {
  /* Intro line: at most 743px wide, 58px above the cards, as live. */
  .home-products .section__intro {
    margin-bottom: 58px;
  }

  .home-products .section__intro p {
    max-width: 743px;
    margin: 5px auto 0;
  }

  /* Three even columns on tablets as well as desktop (decision D28). */
  .home-products .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-products .card__img {
    height: 234px;
  }

  .home-products .card__link {
    max-width: 249px;
    min-height: 49px;
  }
}

/* ---------- "Serving San Marcos…" band (cta-band partial, panel variant) ---------- */

/* Phones: the photo shows around the green panel, as live. */
.cta-band--panel {
  padding: 75px 10px 50px;
}

.cta-band--panel .cta-band__content {
  padding: 30px 15px;
}

.cta-band--panel h2 {
  font-weight: 700;
}

.cta-band--panel p {
  margin-bottom: 25px;
}

.cta-band--panel .btn {
  min-height: 56px; /* phones: live's button is 362×56 */
}

@media (min-width: 768px) {
  .cta-band--panel {
    padding: 0;
  }

  .cta-band--panel .cta-band__content {
    padding: 100px 50px;
  }

  /* Heading, text and button spacing as live: the band is 537px tall at 1440px. */
  .cta-band--panel h2 {
    margin: 10px 0 16px;
  }

  .cta-band--panel p {
    max-width: 490px;
    margin: 0 auto 28px;
  }

  .cta-band--panel .btn {
    min-width: 249px;
    min-height: 54px;
  }
}

/* Tablets: a narrower panel (half the width, 100px in at 800px) with the text
   further in and a 232px button, as live. The heading keeps the tablet size
   (T10 F09). */
@media (min-width: 768px) and (max-width: 1024px) {
  .cta-band--panel .cta-band__content {
    width: 50%;
    margin-left: 12.5%;
  }

  .cta-band--panel p {
    margin-inline: 42px;
  }

  .cta-band--panel .btn {
    min-width: 232px;
  }
}
