/* Home page
   ------------------------------------------------------------------
   The hero shows the thing the logo draws: a Pelton runner, cropped
   round so its ring of buckets fills the circle. The circle is large,
   runs off the right edge and drops into the section below. */

/* ------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------ */

.home-hero {
  /* Diameter of the runner circle and how far it drops below the band */
  --runner: 104vw;
  --runner-drop: calc(var(--runner) * 0.26);
  padding-block: var(--space-7) var(--space-6);
}

.home-hero__inner {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--grid-gap);
  row-gap: var(--space-6);
}

.home-hero__title {
  grid-column: 1 / -1;
  max-width: 12ch;
  font-size: var(--text-display);
  line-height: 1.04;
  letter-spacing: -0.015em;
}

.home-hero__runner {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  width: var(--runner);
  max-width: none;
  margin-left: 14vw;
  margin-bottom: calc(var(--runner-drop) * -1);
}

/* The shared .photo--round rounds the image itself. Here the image is
   scaled up inside a round frame so the buckets, not the workshop,
   fill the circle. */
.home-hero__disc {
  overflow: hidden;
  border-radius: var(--radius-round);
  background: var(--granite-100);
}

.home-hero__disc img {
  object-position: 50% 74%;
  transform: translate(-1%, -4%) scale(1.3);
  transform-origin: 51% 50%;
}

.home-hero__runner figcaption {
  margin-top: var(--space-3);
}

@media (min-width: 48rem) {
  .home-hero {
    /* From the start of column 7 to the viewport edge, plus a little
       more so the circle is cut by the edge of the screen. */
    --runner: min(calc((50vw - var(--grid-gap) / 2) * 1.25), 54rem);
    --runner-drop: calc(var(--runner) * 0.3);
    padding-block: var(--space-7) var(--space-8);
  }

  .home-hero__inner {
    align-items: end;
  }

  .home-hero__title {
    grid-column: 1 / span 6;
    max-width: none;
  }

  .home-hero__runner {
    grid-column: 7 / -1;
    margin-left: 0;
  }

  .home-hero__runner figcaption {
    /* Tucked under the lower-left curve of the circle */
    padding-left: calc(var(--runner) * 0.2);
  }
}

/* ------------------------------------------------------------------
   The three introductions: one leads, one follows, one is a note
   ------------------------------------------------------------------ */

.home-intro__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--grid-gap);
  row-gap: var(--space-9);
}

.home-intro__grid > * {
  grid-column: 1 / -1;
}

/* Riverpower sites: the lead */

.home-intro__lead {
  display: grid;
  grid-template-columns: subgrid;
  row-gap: var(--space-7);
}

.home-intro__lead-text {
  grid-column: 1 / -1;
}

.home-intro__lead-text > * + * {
  margin-top: var(--space-5);
}

.home-intro__lead-title {
  font-size: var(--text-h1);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
}

.home-intro__lead-photo {
  grid-column: 1 / -1;
  margin-inline: calc(var(--page-gutter) * -1);
}

.home-intro__lead-photo figcaption {
  padding-inline: var(--page-gutter);
}

/* Technical information: medium weight, photo beside the text */

.home-intro__technical {
  display: grid;
  grid-template-columns: subgrid;
  row-gap: var(--space-6);
}

.home-intro__technical-photo {
  grid-column: 3 / -1;
  margin-right: calc(var(--page-gutter) * -1);
}

.home-intro__technical-text {
  grid-column: 1 / -1;
  max-width: var(--measure);
}

/* Frequently asked questions: text only, the lightest of the three */

.home-intro__faq {
  max-width: 34rem;
}

.home-intro__faq > * + * {
  margin-top: var(--space-3);
}

.home-intro__faq-title {
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
}

@media (max-width: 47.99rem) {
  .home-intro {
    /* Clear the bottom of the runner circle */
    padding-top: calc(104vw * 0.26 + var(--space-7));
  }
}

@media (min-width: 48rem) {
  .home-intro__lead-text {
    grid-column: 1 / span 6;
  }

  .home-intro__lead-photo {
    grid-column: 1 / span 9;
    /* Run the photo out to the left edge of the window */
    margin-inline: calc(max(var(--page-gutter), (100vw - var(--page-max)) / 2) * -1) 0;
  }

  .home-intro__lead-photo figcaption {
    padding-inline: calc(max(var(--page-gutter), (100vw - var(--page-max)) / 2)) 0;
  }

  .home-intro__technical-photo {
    grid-column: 4 / -1;
  }

  .home-intro__technical-text {
    grid-column: 1 / span 8;
  }

  .home-intro__faq {
    grid-column: 6 / -1;
  }
}

@media (min-width: 64rem) {
  .home-intro__lead-text {
    grid-column: 1 / span 5;
  }

  .home-intro__lead-photo {
    grid-column: 1 / span 8;
  }

  .home-intro__technical {
    align-items: end;
  }

  .home-intro__technical-text {
    grid-column: 2 / span 4;
    grid-row: 1;
    padding-bottom: var(--space-7);
  }

  .home-intro__technical-photo {
    grid-column: 7 / span 6;
    grid-row: 1;
    margin-right: 0;
  }

  .home-intro__faq {
    grid-column: 7 / span 4;
    margin-top: calc(var(--space-5) * -1);
  }
}

/* ------------------------------------------------------------------
   The two sites in photos
   ------------------------------------------------------------------ */

.home-sites__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--grid-gap);
  row-gap: var(--space-6);
}

.home-sites__grid > * {
  grid-column: 1 / -1;
}

.home-sites__title {
  margin-bottom: var(--space-2);
}

.home-sites__photo--wide img {
  aspect-ratio: 1472 / 825;
  object-fit: cover;
}

.home-sites__photo--wide {
  margin-inline: calc(var(--page-gutter) * -1);
}

.home-sites__photo--wide figcaption {
  padding-inline: var(--page-gutter);
}

.home-sites__photo--tall {
  grid-column: 4 / -1;
}

.home-sites__photo--tall img {
  object-position: 50% 50%;
}

.home-sites__photo--small {
  grid-column: 1 / span 10;
}

.home-sites__photo--small img {
  object-position: 40% 50%;
}

.home-sites__action {
  margin-top: var(--space-3);
}

/* .band--deep a sets link colour more specifically than .btn--on-dark,
   which turns the button label pale blue. Restore the button colours. */
.home-sites .btn--on-dark,
.home-sites .btn--on-dark:hover {
  color: var(--deep-800);
}

@media (min-width: 48rem) {
  .home-sites__grid {
    row-gap: var(--space-7);
  }

  .home-sites__title {
    grid-column: 1 / span 6;
    grid-row: 1;
  }

  .home-sites__photo--wide {
    grid-column: 1 / span 8;
    grid-row: 2;
    margin-inline: 0;
  }

  .home-sites__photo--wide figcaption {
    padding-inline: 0;
  }

  .home-sites__photo--tall {
    grid-column: 9 / -1;
    grid-row: 2 / span 2;
    margin-top: var(--space-9);
  }

  .home-sites__photo--small {
    grid-column: 3 / span 5;
    grid-row: 3;
  }

  .home-sites__action {
    grid-column: 3 / span 5;
    grid-row: 4;
    margin-top: 0;
  }
}

/* ------------------------------------------------------------------
   Closing contact prompt
   ------------------------------------------------------------------ */

.home-contact__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5) var(--space-7);
}

.home-contact__title {
  font-size: var(--text-h2);
}
