/* How it works: two annotated phones instead of eleven screens of prose.
   Loaded by how-it-works only, so the rest of the site keeps rs.css's cache.

   One figure per side. Below 1024px it is the phone with numbered pins and a
   numbered list under it. From 1024px the list items are lifted out around
   the phone and an SVG draws the arrows; the figure keeps a fixed 1080x700
   aspect ratio, so the arrows' viewBox and the callouts' percentages always
   agree. Pin positions are percentages of the 660x1434 capture, so they hold
   in every language's screenshot. */

/* ------------------------------------------------ the loop strip */

.hiw-loop {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: clamp(26px, 3vw, 38px);
  counter-reset: hiw;
}
.hiw-loop li {
  position: relative;
  background: #FFFFFF;
  border-radius: var(--r-sm);
  padding: 18px 20px 20px;
}
.hiw-loop li + li::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-top: 2.5px solid var(--acc);
  border-right: 2.5px solid var(--acc);
  transform: translate(-1px, -50%) rotate(45deg);
}
.hiw-loop strong {
  display: block;
  font-family: var(--display);
  font-size: 19px;
  color: var(--ink);
  margin-bottom: 4px;
}
.hiw-loop strong::before {
  counter-increment: hiw;
  content: counter(hiw);
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--acc);
  color: #FFFFFF;
  font-size: 14px;
  vertical-align: 2px;
}
.hiw-loop li:nth-child(even) strong::before { background: var(--amber); color: var(--ink); }
.hiw-loop span { display: block; font-size: 15px; line-height: 1.45; color: var(--body); }

@media (max-width: 860px) {
  .hiw-loop { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hiw-loop li:nth-child(3)::before { display: none; }
}
@media (max-width: 480px) {
  .hiw-loop { grid-template-columns: 1fr; gap: 10px; }
  .hiw-loop li + li::before { display: none; }
}

/* ------------------------------------------------ the annotated phone */

.hiw-head { text-align: center; }
.hiw-head .h2--sec { margin-left: auto; margin-right: auto; }
.hiw-head .eyebrow { margin-bottom: 8px; }

.hiw-fig { position: relative; margin: clamp(18px, 2.4vw, 30px) auto 0; }

.hiw-phone {
  position: relative;
  width: min(300px, 78vw);
  margin: 0 auto;
}
.hiw-phone img {
  width: 100%;
  border-radius: 34px;
  border: 7px solid var(--ink);
  box-shadow: var(--shot-sh);
  background: var(--ink);
}

/* A pin sits beside the thing it names, never on it. */
.hiw-pin {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  background: var(--amber);
  color: var(--ink);
  box-shadow: 0 0 0 3px #FFFFFF, 0 4px 10px rgba(25, 20, 51, .28);
}

.hiw-notes {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 34px;
  max-width: 760px;
  margin: 34px auto 0;
}
.hiw-note { display: grid; grid-template-columns: 28px 1fr; gap: 0 12px; }
.hiw-note .hiw-pin { position: static; margin: 2px 0 0; grid-row: span 2; box-shadow: none; }
.hiw-note h3 { font-size: 20px; color: var(--acc-deep); margin: 0 0 4px; }
.hiw-note p { font-size: 15.5px; line-height: 1.5; color: var(--body); margin: 0; }

.hiw-arrows { display: none; }

@media (max-width: 640px) {
  .hiw-notes { grid-template-columns: 1fr; gap: 18px; }
}

/* From here the notes leave the list and stand around the phone. */
@media (min-width: 1024px) {
  .hiw-fig { width: 100%; max-width: 1080px; aspect-ratio: 1080 / 700; }
  .hiw-phone {
    position: absolute;
    left: 36.11%;          /* 390 / 1080 */
    top: 4.86%;            /*  34 / 700  */
    width: 27.78%;         /* 300 / 1080 */
    margin: 0;
  }
  .hiw-arrows {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: var(--ink);
    pointer-events: none;
    overflow: visible;
    z-index: 2;
  }
  .hiw-phone .hiw-pin { z-index: 3; }
  .hiw-notes { display: contents; }
  .hiw-note {
    position: absolute;
    width: 27%;
    max-width: 290px;
  }
  /* On the wide layout the arrow does the pointing, so the numbers go. */
  .hiw-pin { display: none !important; }
  .hiw-note { display: block; }
  .hiw-note--l { left: 0; text-align: right; }
  .hiw-note--r { right: 0; }
  .hiw-note h3 { font-size: 22px; }
}

/* ------------------------------------------------ where each pin sits
   x and y are fractions of the 660x1434 capture; the 7px is the frame. */

.hiw-phone .hiw-pin { left: calc(7px + (100% - 14px) * var(--x)); top: calc(7px + (100% - 14px) * var(--y)); }

.hiw-fig--parent .hiw-phone .hiw-pin:nth-of-type(1) { --x: 0.4950; --y: 0.1743; }  /* waiting for approval */
.hiw-fig--parent .hiw-phone .hiw-pin:nth-of-type(2) { --x: 0.4200; --y: 0.3556; }  /* the balance */
.hiw-fig--parent .hiw-phone .hiw-pin:nth-of-type(3) { --x: 0.3050; --y: 0.9219; }  /* the tab bar */
.hiw-fig--parent .hiw-phone .hiw-pin:nth-of-type(4) { --x: 0.8000; --y: 0.1060; }  /* add a child */
.hiw-fig--parent .hiw-phone .hiw-pin:nth-of-type(5) { --x: 0.5600; --y: 0.2692; }  /* hand over */
.hiw-fig--parent .hiw-phone .hiw-pin:nth-of-type(6) { --x: 0.9500; --y: 0.8201; }  /* bonus */

.hiw-fig--child .hiw-phone .hiw-pin:nth-of-type(1) { --x: 0.0000; --y: 0.1004; }   /* the lock */
.hiw-fig--child .hiw-phone .hiw-pin:nth-of-type(2) { --x: 0.3000; --y: 0.3333; }   /* credits to spend */
.hiw-fig--child .hiw-phone .hiw-pin:nth-of-type(3) { --x: 0.4800; --y: 0.4351; }   /* the tick */
.hiw-fig--child .hiw-phone .hiw-pin:nth-of-type(4) { --x: 0.7400; --y: 0.1560; }   /* language */
.hiw-fig--child .hiw-phone .hiw-pin:nth-of-type(5) { --x: 0.8400; --y: 0.5077; }   /* a price */
.hiw-fig--child .hiw-phone .hiw-pin:nth-of-type(6) { --x: 0.5800; --y: 0.9000; }   /* the shop */

.hiw-fig--tasks .hiw-phone .hiw-pin:nth-of-type(1) { --x: .3700; --y: .1200; }   /* 100 templates */
.hiw-fig--tasks .hiw-phone .hiw-pin:nth-of-type(2) { --x: .9100; --y: .1640; }   /* age chips */
.hiw-fig--tasks .hiw-phone .hiw-pin:nth-of-type(3) { --x: .2400; --y: .2620; }   /* type chips */
.hiw-fig--tasks .hiw-phone .hiw-pin:nth-of-type(4) { --x: .7400; --y: .3075; }   /* a price */
.hiw-fig--tasks .hiw-phone .hiw-pin:nth-of-type(5) { --x: .9850; --y: .3807; }   /* the add button */

.hiw-after { text-align: center; max-width: 52ch; margin: 30px auto 0; font-size: 16px; color: var(--body); }

@media (min-width: 1024px) {
  .hiw-fig--tasks .hiw-note:nth-child(1) { top: 6%; }
  .hiw-fig--tasks .hiw-note:nth-child(2) { top: 25%; }
  .hiw-fig--tasks .hiw-note:nth-child(3) { top: 44%; }
  .hiw-fig--tasks .hiw-note:nth-child(4) { top: 22%; }
  .hiw-fig--tasks .hiw-note:nth-child(5) { top: 46%; }
  .hiw-after { margin-top: 6px; }

  .hiw-fig--parent .hiw-note:nth-child(1) { top: 12%; }
  .hiw-fig--parent .hiw-note:nth-child(2) { top: 36%; }
  .hiw-fig--parent .hiw-note:nth-child(3) { top: 74%; }
  .hiw-fig--parent .hiw-note:nth-child(4) { top: 6%; }
  .hiw-fig--parent .hiw-note:nth-child(5) { top: 30%; }
  .hiw-fig--parent .hiw-note:nth-child(6) { top: 68%; }

  .hiw-fig--child .hiw-note:nth-child(1) { top: 8%; }
  .hiw-fig--child .hiw-note:nth-child(2) { top: 30%; }
  .hiw-fig--child .hiw-note:nth-child(3) { top: 52%; }
  .hiw-fig--child .hiw-note:nth-child(4) { top: 8%; }
  .hiw-fig--child .hiw-note:nth-child(5) { top: 44%; }
  .hiw-fig--child .hiw-note:nth-child(6) { top: 76%; }

  .hiw-arrows .halo { stroke: var(--halo, #FFFFFF); }
  .band--warm .hiw-arrows { --halo: var(--warm); }
  .band--cool .hiw-arrows { --halo: var(--cool); }
}

/* ------------------------------------------------ the rest, in one row */

.hiw-extras {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.hiw-extras li { background: var(--cool); border-radius: var(--r-sm); padding: 20px 22px; }
.hiw-extras h3 { font-size: 18px; margin: 0 0 6px; }
.hiw-extras p { font-size: 15px; line-height: 1.5; color: var(--body); margin: 0; }
@media (max-width: 960px) { .hiw-extras { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .hiw-extras { grid-template-columns: 1fr; } }

/* ------------------------------------------------ built for simplicity */

.hiw-simple {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 820px;
  margin: 0 auto clamp(30px, 3.4vw, 44px);
  text-align: center;
}
.hiw-simple li { padding: 8px 10px; }
.hiw-simple strong {
  display: block;
  font-family: var(--display);
  font-size: clamp(56px, 7vw, 88px);
  line-height: 1;
  color: var(--acc);
}
.hiw-simple li:nth-child(2) strong { color: var(--ink); }
.hiw-simple span { display: block; margin-top: 8px; font-size: 17px; font-weight: 600; color: var(--body); }
@media (max-width: 420px) {
  .hiw-simple strong { font-size: 48px; }
  .hiw-simple span { font-size: 15px; }
}

/* The figure scales with the column but the type does not, so between 1024
   and 1200 the longest translations (German, French) ran one callout into the
   next. Measured per language; this band is where it happened. */
@media (min-width: 1024px) and (max-width: 1199px) {
  .hiw-note h3 { font-size: 19px; margin-bottom: 2px; }
  .hiw-note p { font-size: 14px; line-height: 1.42; }
}
