/* River Power V3: Sites page.
   The page head, then seven reaches. The river rises under the end of the
   lede, swings out beside the pool, runs down the left past the statement,
   then meanders through Trebartha (two reaches) and De Lank (two reaches),
   each opening with its name set large like a place on the map, and ends
   beside the closing question. Lane positions (--x0 to --x7) are set once on
   the walk so each bend starts where the previous lane ended. */

.walk {
  /* Lane centres: the rise under the lede, then reaches 1 to 7 */
  --x0: calc(var(--measure-lede) - 2rem);
  --x1: 62%;
  --x2: 22%;
  --x3: 63%;
  --x4: 40%;
  --x5: 61%;
  --x6: 33%;
  --x7: 63%;
}

/* Map labels on this page wrap evenly (no single word left on a line) */
.walk .label {
  text-wrap: balance;
}

/* ---------- The reaches ---------- */

.sites-reach--pool {
  --from: var(--x0);
  --at: var(--x1);
  --dir: 1;
  --bend: 7rem;
  --river-w: var(--river-1);
}

.sites-reach--payback {
  --from: var(--x1);
  --at: var(--x2);
  --dir: -1;
  --bend: 9rem;
  --river-w: var(--river-2);
}

.sites-reach--trebartha {
  --from: var(--x2);
  --at: var(--x3);
  --dir: 1;
  --bend: 10rem;
  --river-w: var(--river-2);
}

.sites-reach--hall {
  --from: var(--x3);
  --at: var(--x4);
  --dir: -1;
  --bend: 7.5rem;
  --river-w: var(--river-3);
}

.sites-reach--delank {
  --from: var(--x4);
  --at: var(--x5);
  --dir: 1;
  --bend: 8.5rem;
  --river-w: var(--river-4);
}

.sites-reach--screen {
  --from: var(--x5);
  --at: var(--x6);
  --dir: -1;
  --bend: 9.5rem;
  --river-w: var(--river-4);
}

.sites-reach--close {
  --from: var(--x6);
  --at: var(--x7);
  --dir: 1;
  --bend: 7rem;
  --river-w: var(--river-5);
}

/* ---------- Reach 1: the pool on the left bank, the terms on the right ---------- */

.sites-place--pool {
  --photo-max: 34rem;
}

.sites-terms {
  padding-top: var(--space-2xl);
}

/* ---------- Reach 2: the statement, set large on the wide right bank ---------- */

.sites-statement {
  max-width: 14em;
  padding-block: var(--space-s) var(--space-m);
  font-size: var(--text-h2-large);
  font-weight: var(--weight-medium);
  line-height: var(--leading-heading);
  text-wrap: balance;
}

/* ---------- The two sites: each name set large, like a place on the map ---------- */

.sites-site__lead {
  display: grid;
  align-content: start;
  gap: var(--space-l);
}

.sites-site__title {
  font-size: var(--text-h2-large);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
}

/* Trebartha, reach 3: the intake large on the left bank; spate and gorse on the right */
.sites-place--oaks {
  max-width: 42rem;
}

.sites-place--oaks img {
  object-position: 50% 60%;
}

.sites-place--spate {
  max-width: 22rem;
  margin-top: var(--space-3xl);
}

.sites-place--gorse {
  max-width: 16rem;
  margin-top: var(--space-xl);
  margin-left: auto;
}

/* Trebartha, reach 4: the turbine hall against the river; the weir further down */
.sites-place--hall {
  max-width: 26rem;
  margin-left: auto;
}

.sites-place--weir {
  --photo-max: 28rem;
  margin-top: var(--space-2xl);
}

/* De Lank, reach 5: the name over the weir in spate, both by the river; the
   footbridge lower on the right. The name's width matches the photo's, so
   their left edges line up. */
.sites-reach--delank .sites-site__title {
  width: 20rem;
  max-width: 100%;
  justify-self: end;
}

.sites-place--dl-weir {
  --photo-max: 20rem;
}

.sites-place--bridge {
  max-width: 17rem;
  margin-top: var(--space-3xl);
  margin-left: var(--space-xl);
}

/* De Lank, reach 6: the screen on the left bank; turbine hall, leat and moor on the right */
.sites-place--screen {
  max-width: 16rem;
  margin-top: var(--space-2xl);
  margin-left: auto;
}

.sites-delank__water {
  display: grid;
  gap: var(--space-xl);
}

.sites-place--units {
  --photo-max: 30rem;
}

.sites-place--leat {
  max-width: 19rem;
  margin-left: auto;
}

.sites-place--moor {
  max-width: 40rem;
}

.sites-place--moor img {
  object-position: 50% 64%;
}

/* ---------- Last reach: the question ---------- */

.sites-close {
  justify-self: end;
  padding-top: var(--space-m);
  text-align: right;
}

.sites-close__title {
  max-width: 11em;
  margin-bottom: var(--space-m);
  font-size: var(--text-h2-large);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
}

/* ---------- Tablet: tamer meander, labels under the photos ---------- */

@media (max-width: 68.6875rem) {
  .walk {
    --x1: 50%;
    --x2: 20%;
    --x3: 58%;
    --x4: 42%;
    --x5: 58%;
    --x6: 38%;
    --x7: 60%;
  }

  /* The rise (under the end of the lede) is now right of the pool's lane */
  .sites-reach--pool {
    --dir: -1;
  }

  .sites-terms {
    padding-top: var(--space-m);
  }

  .sites-place--pool,
  .sites-place--weir,
  .sites-place--dl-weir,
  .sites-place--units {
    grid-template-columns: minmax(0, 1fr);
  }

  .sites-place--pool > *,
  .sites-place--weir > *,
  .sites-place--dl-weir > *,
  .sites-place--units > *,
  .sites-place--weir > .label,
  .sites-place--units > .label {
    grid-column: 1;
    grid-row: auto;
  }

  .sites-place--pool > .label,
  .sites-place--dl-weir > .label {
    justify-self: end;
    text-align: right;
  }

  .sites-place--dl-weir {
    max-width: 18rem;
    margin-left: auto;
  }

  .sites-reach--delank .sites-site__title {
    width: 18rem;
  }

  .sites-place--bridge {
    margin-left: 0;
  }

  .sites-place--gorse {
    max-width: 12rem;
  }
}

/* ---------- Phone: the river runs down the left edge ---------- */

@media (max-width: 44.9375rem) {
  .sites-terms {
    padding-top: 0;
  }

  .sites-reach--pool .bank--left {
    margin-top: var(--space-l);
  }

  .sites-statement {
    padding-block: 0;
  }

  .sites-site__lead {
    gap: var(--space-m);
  }

  .sites-reach--delank .sites-site__title {
    width: auto;
    justify-self: start;
  }

  .sites-place--pool > .label,
  .sites-place--dl-weir > .label {
    justify-self: start;
    text-align: left;
  }

  .sites-place--spate {
    width: 82%;
    margin-top: var(--space-l);
    margin-left: auto;
  }

  .sites-place--gorse {
    width: 60%;
    max-width: none;
    margin-top: var(--space-l);
    margin-left: 0;
  }

  .sites-place--hall {
    width: 86%;
    margin-left: 0;
  }

  .sites-place--hall > .label {
    justify-self: start;
    text-align: left;
  }

  .sites-place--weir {
    width: 78%;
    margin-top: var(--space-l);
    margin-left: auto;
  }

  .sites-place--dl-weir {
    width: 72%;
    margin-left: 0;
  }

  .sites-place--bridge {
    width: 62%;
    margin-top: var(--space-l);
    margin-left: auto;
  }

  .sites-place--screen {
    width: 60%;
    margin: 0;
  }

  .sites-place--screen > .label {
    justify-self: start;
    text-align: left;
  }

  .sites-reach--screen .sites-delank__water {
    margin-top: var(--space-l);
    gap: var(--space-l);
  }

  .sites-place--leat {
    width: 74%;
  }

  .sites-close {
    justify-self: start;
    padding-top: 0;
    text-align: left;
  }
}
