/* The Tap line: three statements and Our businesses, between the hero
   and Locations. The sections are written from tapline.json by the build; the line
   itself is drawn by tapline.js in one SVG behind the content. */

.tapline {
  --tl-gut: 72px;
  --tl-gap: 40px;
  --tl-ghost: rgba(20, 33, 61, 0.08);
  --tl-chip: #F0ECE5;
  --tl-shadow: rgba(20, 33, 61, 0.1);
  --tl-warm-1: #E9E1D3;
  --tl-warm-2: #D9CDB9;
  position: relative;
  z-index: 2;   /* above Locations, so the line's last dot sits on its top edge */
  background: var(--paper);
  color: var(--navy);
}

.tapline > section {
  position: relative;
  z-index: 1;
}

/* The line. Its box runs from the bar to just past the last dot (tapline.js sets
   --tl-top and --tl-h). Inside: the orange line, drawn once in full, and over it a
   cover the colour of the page that slides down off it as you scroll, with the
   faint line inside the cover moved the opposite way so it stays still. Only
   transforms move, so scrolling never lays out or repaints the line. */
.tapline__line {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--tl-top, 0px);
  height: var(--tl-h, 0px);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.tapline__svg {
  position: absolute;
  left: 0;
  top: calc(-1 * var(--tl-top, 0px));
  overflow: visible;
}

.tapline__track,
.tapline__cover {
  position: absolute;
  inset: 0;
}

.tapline__cover {
  background: var(--paper);
  will-change: transform;
}

/* The faint line drawn over the cover, used on phones (see below). */
.tapline__svg--over {
  display: none;
}

.tapline__svg--ghost {
  will-change: transform;
}

.tapline__svg path {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}

.tapline__svg--live path {
  stroke: var(--accent);
}

.tapline__svg--ghost path {
  stroke: var(--tl-ghost);
}

.tapline__svg--live circle {
  fill: var(--accent);
}

/* Wide screens: the browser moves the cover itself, in step with the scroll: from
   the scroll position where the tip reaches the top of the box to where it passes
   the end. */
@supports (animation-timeline: scroll()) {
@media (min-width: 760px) {
  .tapline__cover {
    animation: tl-cover linear both;
    animation-timeline: scroll(root block);
    animation-range: var(--tl-from, 0px) var(--tl-to, 1px);
  }

  .tapline__svg--ghost {
    animation: tl-ghost linear both;
    animation-timeline: scroll(root block);
    animation-range: var(--tl-from, 0px) var(--tl-to, 1px);
  }
}
}

/* Phones: a cover only as tall as the screen, held at the tip by position: sticky.
   Phone browsers (Safari on every iOS version, Chrome) place sticky elements on the
   scrolling thread itself, so it stays on the tip through momentum scrolling, and
   no page-tall layer has to move. The box clips without becoming a scroll
   container (overflow: clip), so the cover sticks to the window. Its track is one
   screen taller than the box, so at the end the cover can leave the line entirely.
   The faint line is drawn over the cover and blended so that it only darkens:
   on the page colour it shows as before, on the orange line it all but vanishes. */
@supports (overflow: clip) {
  @media (max-width: 759px) {
    .tapline__line {
      overflow: clip;
    }

    .tapline__track {
      bottom: auto;
      height: calc(var(--tl-h, 0px) + 100lvh);
    }

    .tapline__cover {
      position: sticky;
      inset: auto;
      top: var(--tl-tip, 62svh);
      height: 100lvh;
      will-change: auto;
      transform: none !important;
    }

    .tapline__svg--ghost {
      display: none;
    }

    .tapline__svg--over {
      display: block;
      mix-blend-mode: darken;
    }

    .tapline__svg--over path {
      stroke: #E5E5E4;
    }
  }
}

@keyframes tl-cover {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, var(--tl-h, 0px), 0); }
}

@keyframes tl-ghost {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, calc(-1 * var(--tl-h, 0px)), 0); }
}

/* Statements: gutter for the line, the words, a photo */

.tl-st__inner {
  display: grid;
  grid-template-columns: var(--tl-gut) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--tl-gap);
  align-items: center;
  min-height: 88vh;
  padding-top: 40px;
  padding-bottom: 40px;
}

.tl-gut {
  align-self: stretch;
}

.tl-st__title {
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

/* Each word lights up as the statement comes into view. Only while tapline.js runs. */
.tl-w {
  transition: opacity 0.2s ease;
}

.tl-js .tl-w {
  opacity: 0.16;
}

.tl-js .tl-w.is-on {
  opacity: 1;
}

.tl-st__line {
  max-width: 40ch;
  margin: 18px 0 0;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* Photos. A slot with no photo yet is a plain warm panel of the same shape. */

.tl-photo {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--tl-warm-1), var(--tl-warm-2));
}

.tl-photo--tall {
  aspect-ratio: 4 / 5;
  width: 100%;
  max-width: 540px;
  justify-self: end;
  border-radius: 18px;
}

.tl-photo--wide {
  aspect-ratio: 16 / 9;
}

.tl-photo picture,
.tl-photo img {
  display: block;
  width: 100%;
  height: 100%;
}

.tl-photo img {
  object-fit: cover;
}

/* Our businesses: two staggered columns, the line down the gap between them */

.tl-biz {
  padding: 80px 0 var(--section);
}

.tl-biz__head {
  display: grid;
  grid-template-columns: var(--tl-gut) minmax(0, 1fr);
  gap: var(--tl-gap);
}

.tl-biz__title {
  margin: 0 0 8px;
  font-size: clamp(28px, 3.6vw, 42px);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}

.tl-biz__line {
  max-width: 56ch;
  margin: 0;
  font-size: 18px;
  color: var(--ink-soft);
}

.tl-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 180px;
  row-gap: 28px;
  margin: 120px 0 0;
  padding: 0;
  list-style: none;
}

.tl-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 10px 30px var(--tl-shadow);
  transition: opacity 0.5s ease;
}

.tl-card:nth-child(odd) {
  grid-column: 1;
}

.tl-card:nth-child(even) {
  grid-column: 2;
  margin-top: 90px;
}

/* Dim until the line's branch reaches it. Only while tapline.js runs. */
.tl-js .tl-card {
  opacity: 0.35;
}

.tl-js .tl-card.is-on {
  opacity: 1;
}

.tl-card__body {
  padding: 18px 20px 20px;
}

.tl-card__label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-deep);
}

.tl-card__title {
  margin: 2px 0 6px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

.tl-card__text {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.tl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.tl-chips li {
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--tl-chip);
  font-size: 14px;
}

/* Leaving the hero: the Tap line slides up over it like a curtain (fx.js) */

.tx-sticky main > .tapline {
  z-index: 2;
}

/* The line's box follows the rounded top edge, so its cover never shows square corners. */
.tx-curtain .tapline__line {
  border-radius: 28px 28px 0 0;
}

.tx-curtain .tapline {
  margin-top: -28px;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -22px 60px rgba(20, 33, 61, 0.2);
}

@media (max-width: 1040px) {
  .tl-cards {
    column-gap: 120px;
  }
}

/* Phones: the line keeps to the left margin, with everything indented from it */
@media (max-width: 759px) {
  .tapline {
    --tl-gut: 36px;
    --tl-gap: 18px;
  }

  .tl-st__inner {
    grid-template-columns: var(--tl-gut) minmax(0, 1fr);
    min-height: 0;
    padding-top: 56px;
    padding-bottom: 56px;
  }

  .tl-photo--tall {
    grid-column: 2;
    max-width: none;
    aspect-ratio: 4 / 3;
  }

  .tl-cards {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 22px;
    margin-top: 60px;
    padding-left: 54px;
  }

  .tl-card:nth-child(odd),
  .tl-card:nth-child(even) {
    grid-column: 1;
    margin-top: 0;
  }

  .tx-curtain .tapline__line {
    border-radius: 20px 20px 0 0;
  }

  .tx-curtain .tapline {
    margin-top: -20px;
    border-radius: 20px 20px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tl-w,
  .tl-card {
    transition: none;
  }

  /* The whole line, drawn and still. */
  .tapline__cover,
  .tapline__svg--over {
    display: none;
  }
}
