/* The tiers' pictures, and the row of what Pro unlocks. Each picture says what
   its tier buys, and is a still one until the motion block below plays it:

     Free     two devices inside the dashed edge of one network;
     Pro      the same two, an ocean apart, over a globe;
     Pro Max  every computer and mobile device the plan covers, lit from one
              hub (plans.js draws the seats). */

.art {
  overflow: visible;
}

.art :where(circle, ellipse, g, path) {
  transform-box: view-box;
}

.art-label {
  fill: var(--label-2);
  font: 600 9px var(--font);
  text-anchor: middle;
}

.art-device :is(rect, path) {
  fill: var(--surface);
  stroke: var(--label-2);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.art-device.is-lit rect {
  fill: var(--tint-fill);
}

.art-device.is-lit :is(rect, path) {
  stroke: var(--tint);
}

.art-packet {
  fill: var(--tint);
  filter: drop-shadow(0 0 4px rgba(46, 155, 255, 0.7));
}

/* ------------------------------------------------------------------ free --- */

.art-zone {
  fill: var(--green-fill);
  fill-opacity: 0.45;
  stroke: var(--green);
  stroke-dasharray: 3 6;
  stroke-opacity: 0.5;
}

.art-wire {
  fill: none;
  stroke: var(--green);
  stroke-opacity: 0.4;
  stroke-width: 1.5;
}

/* The arc joining the two devices is centred on (160, 177), radius 125, so
   its ends are 106.26 degrees apart: the packet rests halfway along it. */
.free-packet {
  fill: var(--green);
  filter: none;
  transform-origin: 160px 177px;
  rotate: 53.13deg;
}

/* ------------------------------------------------------------------- pro --- */

.globe {
  fill: var(--tint-fill);
  stroke: var(--tint-line);
  stroke-width: 1.2;
}

.globe-spin ellipse,
.globe-lat {
  fill: none;
  stroke: var(--tint-line);
  stroke-width: 1;
}

.art-arc {
  fill: none;
  stroke: url(#arc-fade);
  stroke-width: 1.5;
  stroke-dasharray: 2 5;
}

/* Over the globe from the desk to the phone, on a 120 degree arc centred on
   (160, 166): one packet, halfway across. */
.pro-packet {
  transform-origin: 160px 166px;
  rotate: 60deg;
}

.pro-packet.is-return,
.signal.is-late,
.hub-ring.is-late {
  display: none;
}

/* The phone online somewhere else, saying so with one still ring. */
.signal {
  fill: none;
  stroke: var(--tint);
  stroke-opacity: 0.4;
}

/* ----------------------------------------------------------------- fleet --- */

.hub {
  fill: var(--tint);
  filter: drop-shadow(0 0 6px rgba(46, 155, 255, 0.6));
}

.hub-ring {
  fill: none;
  stroke: var(--tint);
  stroke-opacity: 0.35;
}

.spoke {
  stroke: var(--hairline-strong);
  stroke-dasharray: 2 4;
  stroke-width: 1;
}

.flink.is-on .spoke {
  stroke: var(--tint-line);
  stroke-dasharray: none;
}

.flink[data-kind="m"].is-on .spoke {
  stroke: var(--green);
  stroke-opacity: 0.35;
}

.fnode-body {
  opacity: 0.3;
  scale: 0.82;
  transform-box: fill-box;
  transform-origin: center;
}

.flink.is-on .fnode-body {
  opacity: 1;
  scale: 1;
}

.fnode-body :is(rect, path) {
  fill: var(--surface);
  stroke: var(--label-2);
  stroke-width: 1.3;
  stroke-linecap: round;
}

.flink.is-on .fnode-body rect {
  fill: var(--tint-fill);
  stroke: var(--tint);
}

.flink[data-kind="m"].is-on .fnode-body rect {
  fill: var(--green-fill);
  stroke: var(--green);
}

.fnode-halo,
.spark {
  display: none;
}

/* ---------------------------------------------------------------- motion --- */

/* The loops main had, in the graphite palette. Every one is a transform or an
   opacity: a packet rides a rotation about the centre of the arc it follows, or
   a translation along a straight spoke, so nothing repaints a path. They run
   only while plans-motion.js has marked the picture .is-playing (on screen, tab
   visible) and not at all under reduced motion, which keeps the still pictures
   above. Each loop's colours are the stills' own: the accent blue, and the
   turquoise status colour on what is online or a mobile device. */
@media (prefers-reduced-motion: no-preference) {
  /* The shorthands below reset the play state, so this one must win outright. */
  .tier-art:not(.is-playing) * {
    animation-play-state: paused !important;
  }

  /* Free: the network breathes and a packet hops from the computer to the phone and back. */
  .art-zone {
    transform-origin: 160px 98px;
    animation: zone-breathe 5s var(--ease-in-out) infinite;
  }

  @keyframes zone-breathe {
    50% {
      opacity: 0.55;
      scale: 1.025;
    }
  }

  .free-packet {
    animation: free-hop 3.2s var(--ease-in-out) infinite alternate;
  }

  @keyframes free-hop {
    to {
      rotate: 106.26deg;
    }
  }

  /* Pro: the globe turns (its meridians are 28 apart, so sliding them 28 left
     is one seamless turn), a packet crosses to the phone and another returns
     half a cycle later, and the phone rings to say it is online. */
  .globe-spin {
    animation: globe-spin 4.6s linear infinite;
  }

  @keyframes globe-spin {
    to {
      translate: -28px 0;
    }
  }

  .pro-packet {
    animation: pro-arc 3.4s var(--ease-in-out) infinite backwards;
  }

  .pro-packet.is-return {
    display: inline;
    animation-name: pro-arc-back;
    animation-delay: 1.7s;
  }

  @keyframes pro-arc {
    0% { rotate: 0deg; opacity: 0; }
    12%, 88% { opacity: 1; }
    100% { rotate: 120deg; opacity: 0; }
  }

  @keyframes pro-arc-back {
    0% { rotate: 0deg; opacity: 0; }
    12%, 88% { opacity: 1; }
    100% { rotate: -120deg; opacity: 0; }
  }

  .signal,
  .hub-ring {
    display: inline;
    stroke-opacity: 0.6;
    opacity: 0;
    animation: signal 2.8s var(--ease-out-soft) infinite;
  }

  .signal {
    transform-origin: 272px 121px;
  }

  .hub-ring {
    transform-origin: 160px 80px;
    animation-duration: 3s;
  }

  .signal.is-late {
    animation-delay: 1.4s;
  }

  .hub-ring.is-late {
    animation-delay: 1.5s;
  }

  @keyframes signal {
    0% {
      opacity: 0.9;
      scale: 0.5;
    }
    100% {
      opacity: 0;
      scale: 1.9;
    }
  }

  /* Pro Max: each seat bobs on its own phase, and a packet runs the spoke from
     the hub to it (plans.js writes --dx, --dy, --spark and --bob). A mobile
     device's packet is turquoise, as its spoke is. */
  .flink.is-on .fnode-body {
    animation: bob 4.2s var(--ease-in-out) var(--bob, 0s) infinite;
  }

  @keyframes bob {
    50% {
      translate: 0 -2.5px;
    }
  }

  .spark {
    display: inline;
    fill: var(--tint);
    opacity: 0;
  }

  .flink[data-kind="m"] .spark {
    fill: var(--green);
  }

  .flink.is-on .spark {
    animation: spark 2.6s var(--ease-in-out) var(--spark, 0s) infinite;
  }

  @keyframes spark {
    0% { translate: 0 0; opacity: 0; }
    15%, 82% { opacity: 1; }
    100% { translate: var(--dx) var(--dy); opacity: 0; }
  }
}

/* ---------------------------------------------------------------- powers --- */

/* What Pro unlocks: four plain columns, a glyph, a name and a line each. No
   boxes: the space between them is the structure. */
.powers {
  display: grid;
  gap: 40px 32px;
}

@media (min-width: 700px) {
  .powers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .powers {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.power h3 {
  margin-top: 18px;
  font-size: var(--headline);
  letter-spacing: var(--track-body);
}

.power p {
  margin-top: 6px;
  color: var(--label-2);
  font-size: var(--callout);
  line-height: 1.5;
}

.power-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-button);
  background: var(--tint-fill);
  color: var(--tint);
}

.power-icon svg {
  width: 24px;
  height: 24px;
  overflow: visible;
}
