/* ==========================================================================
   The small films inside the panel's tiles on the landing (#panel): what the
   owner finds in the panel, each drawn as the panel draws it and played on a
   loop. A film plays once its tile has been seen (.is-in) and waits while the
   tile is out of sight (.is-away, landing.css). As written here, with motion
   off, each stands in the state it would be read in.
   Loaded after landing-story.css, whose `pop` and `rise-in` it uses.
   ========================================================================== */

.tile__demo > * { position: absolute; inset: 0; }

/* ---- «While you were out»: the hours the team worked while the owner was away ---- */

.dm-away {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 3vw, 40px);
  padding: 14px clamp(14px, 3vw, 36px);
}

.dm-away__copy { display: grid; gap: 6px; min-width: 0; }
.dm-away__live { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; font-weight: 700; line-height: 1.5; }
.dm-away__live i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-tint); }
.dm-away__num { display: flex; align-items: center; gap: 10px; }
.dm-away__num b { font-size: clamp(40px, 6vw, 60px); font-weight: 900; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dm-away__num span { color: var(--text-3); font-size: 12.5px; font-weight: 600; line-height: 1.55; }
.dm-away__list { display: grid; gap: 5px; margin-top: 2px; }
.dm-away__list li { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.dm-away__list .ic { width: 22px; height: 22px; padding: 4px; border-radius: 7px; background: var(--brand-soft); color: var(--brand); }
.dm-away__chart { display: grid; gap: 6px; min-width: 0; }

/* A chart reads left to right: the oldest hour at the left, now at the right. */
.dm-away__bars { direction: ltr; display: flex; align-items: flex-end; gap: clamp(2px, 0.5vw, 5px); height: clamp(96px, 12vw, 132px); }
.dm-away__bars i { flex: 1; height: 7px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); transform-origin: bottom; }
.dm-away__bars i.is-on { height: calc(var(--h) * 100%); background: var(--brand); }
.dm-away__axis { direction: ltr; display: flex; justify-content: space-between; color: var(--text-4); font-size: 10.5px; line-height: 1.4; }
.dm-away__axis span { direction: ltr; }
.dm-away__faces { display: flex; padding-inline-start: 6px; }
.dm-away__faces .face { width: 26px; margin-inline-start: -6px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg); }

.tile.is-in .dm-away__live i { animation: pulse 1600ms ease-in-out infinite; }
.tile.is-in .dm-away__bars i.is-on { animation: bar-up 640ms var(--spring) both; animation-delay: calc(var(--i) * 70ms + 250ms); }
.tile.is-in .dm-away__list li { animation: rise-in 480ms var(--out) both; }
.tile.is-in .dm-away__list li:nth-child(1) { animation-delay: 500ms; }
.tile.is-in .dm-away__list li:nth-child(2) { animation-delay: 650ms; }
.tile.is-in .dm-away__list li:nth-child(3) { animation-delay: 800ms; }

@keyframes bar-up { from { background: rgba(255, 255, 255, 0.12); transform: scaleY(0.06); } }

@media (max-width: 460px) {
  .dm-away__list li:nth-child(3) { display: none; }
  .dm-away__num { align-items: flex-start; flex-direction: column; gap: 0; }
}

/* A narrow phone has no room for the two side by side: the words take the tile's
   width and the hours lie under them as a short strip, without the faces, so the
   list keeps its lines whole and nothing lies over it. */
@media (max-width: 399.98px) {
  .dm-away { grid-template-columns: minmax(0, 1fr); align-content: center; gap: 12px; }
  .dm-away__num { align-items: center; flex-direction: row; gap: 10px; }
  .dm-away__bars { height: 44px; }
  .dm-away__faces { display: none; }
}

/* ---- A word to the team, and the work it becomes ------------------------------------------ */

.dm-chat { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 9px; padding: 14px 16px; }
.dm-chat p { margin: 0; }
.dm-chat__you { justify-self: end; max-width: 88%; padding: 6px 13px; border-radius: 15px; border-end-end-radius: 5px; background: #2a3444; font-size: 13px; font-weight: 600; line-height: 1.7; transform-origin: right bottom; }
.dm-chat__row { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; line-height: 1.7; }
.dm-chat__row .face { width: 30px; }
.dm-chat__row b { display: block; font-size: 12.5px; font-weight: 800; }
.dm-chat__row mark { padding: 0 5px; border-radius: 6px; background: var(--brand-soft); color: var(--text); font-weight: 700; }

/* The writer's dots, and then the article in their place. */
.dm-chat__row--b, .dm-chat__card { grid-area: 3 / 1; }
.dm-chat__row--b { opacity: 0; }
.dots { display: inline-flex; gap: 4px; padding-top: 7px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: dot 1100ms ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 160ms; }
.dots i:nth-child(3) { animation-delay: 320ms; }

.dm-chat__card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: 39px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--edge);
  transform-origin: right center;
}

.dm-chat__card svg { flex: none; width: 66px; height: 46px; border-radius: 8px; }
.dm-chat__card span { min-width: 0; display: grid; line-height: 1.55; }
.dm-chat__card b { overflow: hidden; font-size: 12.5px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.dm-chat__card small { color: var(--ok); font-size: 11.5px; font-weight: 700; }

.tile.is-in .dm-chat__you { animation: chat-you 9s var(--out) infinite; }
.tile.is-in .dm-chat__row--a { animation: chat-a 9s var(--out) infinite; }
.tile.is-in .dm-chat__row--b { animation: chat-b 9s ease infinite; }
.tile.is-in .dm-chat__card { animation: chat-card 9s var(--out) infinite; }

@keyframes dot { 0%, 60%, 100% { opacity: 0.35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes chat-you { 0% { opacity: 0; transform: scale(0.8); } 6%, 93% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes chat-a { 0%, 15% { opacity: 0; transform: translateY(8px); } 21%, 93% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes chat-b { 0%, 30% { opacity: 0; } 35%, 54% { opacity: 1; } 58%, 100% { opacity: 0; } }
@keyframes chat-card { 0%, 57% { opacity: 0; transform: scale(0.86); } 64%, 93% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---- The owner's word: an article approved, the autopilot turned on ------------------------- */

.dm-ok { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 10px; padding: 14px 16px; }
.dm-ok p { margin: 0; }
.dm-ok__card { display: grid; gap: 7px; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--edge); }
.dm-ok__t { overflow: hidden; font-size: 13.5px; font-weight: 800; line-height: 1.7; text-overflow: ellipsis; white-space: nowrap; }
.dm-ok__s { display: grid; font-size: 12px; font-weight: 700; line-height: 1.6; }
.dm-ok__wait, .dm-ok__done { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 5px; }
.dm-ok__wait { color: var(--brand); opacity: 0; }
.dm-ok__done { color: var(--ok); }
.dm-ok__done .ic { width: 14px; height: 14px; stroke-width: 3; }
.dm-ok__acts { display: flex; gap: 8px; margin-top: 2px; }
.dm-ok__yes, .dm-ok__no { display: grid; place-items: center; min-height: 34px; padding: 0 14px; border-radius: 10px; font-size: 12.5px; font-weight: 800; line-height: 1; white-space: nowrap; }
.dm-ok__yes { background: var(--text); color: #0b1119; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55); opacity: 0.4; }
.dm-ok__no { border: 1px solid var(--border); color: var(--text-2); opacity: 0.4; }
.dm-ok__auto { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border: 1px solid var(--hairline); border-radius: 13px; background: rgba(255, 255, 255, 0.03); font-size: 13px; font-weight: 700; }
.dm-ok__switch { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--brand); }
.dm-ok__switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #0b1119; }

/* The owner's own pointer. */
.dm-ok__cur { position: absolute; top: 214px; left: 50%; width: 20px; height: 22px; opacity: 0; }
.dm-ok__cur svg { width: 100%; height: 100%; fill: var(--brand); stroke: #0b1119; stroke-width: 1.4; stroke-linejoin: round; }

.tile.is-in .dm-ok__wait { animation: ok-wait 9s ease infinite; }
.tile.is-in .dm-ok__done { animation: ok-done 9s var(--out) infinite; }
.tile.is-in .dm-ok__yes { animation: ok-yes 9s ease infinite; }
.tile.is-in .dm-ok__no { animation: ok-no 9s ease infinite; }
.tile.is-in .dm-ok__switch { animation: ok-switch 9s ease infinite; }
.tile.is-in .dm-ok__switch::after { animation: ok-knob 9s var(--out) infinite; }
.tile.is-in .dm-ok__cur { animation: ok-cur 9s var(--out) infinite; }

@keyframes ok-wait { 0%, 30% { opacity: 1; } 33%, 96% { opacity: 0; } 100% { opacity: 1; } }
@keyframes ok-done { 0%, 31% { opacity: 0; transform: translateY(5px); } 36%, 96% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes ok-yes { 0%, 27% { opacity: 1; transform: none; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55); } 30% { opacity: 1; transform: translateY(3px); box-shadow: 0 0 0 rgba(0, 0, 0, 0.55); } 34%, 96% { opacity: 0.4; transform: none; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55); } 100% { opacity: 1; } }
@keyframes ok-no { 0%, 30% { opacity: 1; } 34%, 96% { opacity: 0.4; } 100% { opacity: 1; } }
@keyframes ok-switch { 0%, 62% { background: rgba(255, 255, 255, 0.16); } 66%, 96% { background: var(--brand); } 100% { background: rgba(255, 255, 255, 0.16); } }
@keyframes ok-knob { 0%, 62% { background: #f7f9fc; transform: translateX(16px); } 66%, 96% { background: #0b1119; transform: none; } 100% { background: #f7f9fc; transform: translateX(16px); } }

/* From the tile's lower corner to «Approve and publish», then down to the switch. */
@keyframes ok-cur {
  0%, 8% { opacity: 0; top: 214px; left: 50%; }
  14% { opacity: 1; top: 214px; left: 50%; }
  27%, 40% { opacity: 1; top: 124px; left: calc(100% - 96px); }
  58%, 70% { opacity: 1; top: 184px; left: 42px; }
  78%, 100% { opacity: 0; top: 184px; left: 42px; }
}

/* ---- What the team suggests for the business itself ------------------------------------------- */

.dm-tip { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }

.dm-tip__card {
  flex: none;
  width: min(78%, 250px);
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 12px 13px 14px;
  border: 1px solid var(--brand-line);
  border-radius: 16px;
  background: var(--brand-ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
}

.dm-tip__top { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; }
.dm-tip__ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--on-brand); }
.dm-tip__ic .ic { width: 16px; height: 16px; stroke-width: 2; }
.dm-tip__new { padding: 0 9px; border-radius: 999px; background: rgba(254, 204, 2, 0.22); color: var(--brand); font-size: 11.5px; font-weight: 800; line-height: 1.75; }
.dm-tip__card b { font-size: 13.5px; font-weight: 800; line-height: 1.7; text-wrap: balance; }
.dm-tip__card small { color: var(--text-2); font-size: 12px; line-height: 1.75; }

/* A narrow tile shows one at a time: the row slides to the next. */
.tile.is-in .dm-tip__card { animation: tip-slide 12s var(--out) infinite; }

@keyframes tip-slide {
  0%, 26% { transform: none; }
  33%, 59% { transform: translateX(calc(100% + 10px)); }
  66%, 92% { transform: translateX(calc(200% + 20px)); }
  100% { transform: none; }
}

@media (min-width: 700px) {
  .dm-tip { justify-content: center; gap: 12px; padding-inline: clamp(16px, 2.4vw, 30px); }
  .dm-tip__card { flex: 1; width: auto; max-width: 290px; }

  /* A wide tile shows all three: each is lifted in its turn. */
  .tile.is-in .dm-tip__card { animation: tip-lift 9s var(--out) infinite; animation-delay: calc(var(--i) * 3s); }
}

@keyframes tip-lift {
  0%, 4% { transform: none; border-color: var(--brand-line); }
  9%, 28% { transform: translateY(-7px); border-color: var(--brand); }
  34%, 100% { transform: none; border-color: var(--brand-line); }
}

/* ---- The owner's own site, and what the studio is joined to ------------------------------------- */

/* The seven places the studio publishes to, each under its own mark (the
   symbols b-* in the page's sprite), round the studio's own. A wire's end and
   its mark's place are the same two numbers in the page: --x across the tile,
   --y down its 236px. A brand's mark keeps its colours on a light tile. */

.dm-link { --hub: 52px; --step: 1500ms; }

.dm-link__wires { position: absolute; inset: 0; width: 100%; height: 100%; }
.dm-link__wires path { fill: none; stroke: rgba(254, 204, 2, 0.4); stroke-width: 1.6; stroke-dasharray: 4 7; stroke-linecap: round; vector-effect: non-scaling-stroke; }

.dm-link__hub {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: var(--hub);
  height: var(--hub);
  margin: calc(var(--hub) / -2) 0 0 calc(var(--hub) / -2);
  border-radius: 50%;
  background: var(--brand);
  color: #0b1119;
  --mark-team: #f7f9fc;
  box-shadow: 0 5px 0 var(--brand-deep), 0 0 44px rgba(254, 204, 2, 0.34);
}

.dm-link__hub svg { width: 54%; height: 54%; overflow: visible; }

/* A narrow tile: the mark alone, its name over it (under it in the lower row),
   so a wire meets the mark and never crosses a name. */
.dm-link__app { position: absolute; top: var(--y); left: var(--x); width: 38px; height: 38px; margin: -19px 0 0 -19px; }
.dm-link__app i { display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 11px; background: #fff; box-shadow: var(--edge); }
.dm-link__app svg { display: block; width: 100%; height: 100%; }
.dm-link__app b { position: absolute; bottom: calc(100% + 4px); left: 50%; color: var(--text-2); font-size: 11.5px; font-weight: 700; line-height: 16px; white-space: nowrap; transform: translateX(-50%); }
.dm-link__app--low b { top: calc(100% + 7px); bottom: auto; }

/* One after another round the studio: the wire brightens, the mark is ringed. */
.tile.is-in .dm-link__wires path { animation: wire 1400ms linear infinite, link-wire calc(var(--step) * 7) ease infinite; animation-delay: 0s, calc(var(--i) * var(--step)); }
.tile.is-in .dm-link__app i { animation: link-ping calc(var(--step) * 7) var(--out) infinite; animation-delay: calc(var(--i) * var(--step)); }
.tile.is-in .dm-link__app b { animation: link-name calc(var(--step) * 7) ease infinite; animation-delay: calc(var(--i) * var(--step)); }
.tile.is-in .dm-link__hub { animation: link-hub var(--step) ease-in-out infinite; }

/* The dashes run from the hub out to each of the seven. */
@keyframes wire { to { stroke-dashoffset: -22; } }
@keyframes link-wire { 0%, 2% { stroke: rgba(254, 204, 2, 0.4); stroke-width: 1.6; } 6%, 14% { stroke: var(--brand); stroke-width: 2.4; } 20%, 100% { stroke: rgba(254, 204, 2, 0.4); stroke-width: 1.6; } }
@keyframes link-ping { 0%, 3% { box-shadow: var(--edge), 0 0 0 0 rgba(254, 204, 2, 0); transform: none; } 7%, 14% { box-shadow: 0 0 0 rgba(0, 0, 0, 0.5), 0 0 0 3px var(--brand); transform: scale(1.08); } 20%, 100% { box-shadow: var(--edge), 0 0 0 0 rgba(254, 204, 2, 0); transform: none; } }
@keyframes link-name { 0%, 3% { color: var(--text-2); } 7%, 14% { color: var(--brand); } 20%, 100% { color: var(--text-2); } }
@keyframes link-hub { 0%, 30%, 100% { transform: none; } 12% { transform: scale(1.06); } }

/* A wide tile has room for a card: the mark and its name side by side. */
@media (min-width: 1040px) {
  .dm-link { --hub: 64px; }

  .dm-link__app {
    display: flex;
    align-items: center;
    gap: 10px;
    width: auto;
    height: 48px;
    margin: 0;
    padding-inline: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface-2);
    box-shadow: var(--edge);
    transform: translate(-50%, -50%);
  }

  .dm-link__app i { flex: none; width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
  .dm-link__app b, .dm-link__app--low b { position: static; color: var(--text); font-size: 14px; font-weight: 800; line-height: 1.6; transform: none; }

  .tile.is-in .dm-link__app { animation: link-card calc(var(--step) * 7) ease infinite; animation-delay: calc(var(--i) * var(--step)); }
  .tile.is-in .dm-link__app i { animation-name: link-mark; }
  .tile.is-in .dm-link__app b { animation-name: none; }
}

@keyframes link-card { 0%, 3% { border-color: var(--border); } 7%, 14% { border-color: var(--brand); } 20%, 100% { border-color: var(--border); } }
@keyframes link-mark { 0%, 3% { box-shadow: 0 0 0 0 rgba(254, 204, 2, 0); } 7%, 14% { box-shadow: 0 0 0 2.5px var(--brand); } 20%, 100% { box-shadow: 0 0 0 0 rgba(254, 204, 2, 0); } }

/* ---- A rule said once, kept for every article after ------------------------------------------- */

.dm-rule { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 12px; padding: 14px 16px; }
.dm-rule p { margin: 0; }
.dm-rule__you { justify-self: end; max-width: 90%; padding: 6px 13px; border-radius: 15px; border-end-end-radius: 5px; background: #2a3444; font-size: 13px; font-weight: 600; line-height: 1.7; transform-origin: right bottom; }
.dm-rule__list { display: grid; gap: 7px; }

.dm-rule__list li {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--edge);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.dm-rule__list .ic { width: 20px; height: 20px; padding: 4px; border-radius: 50%; background: var(--brand); color: var(--on-brand); stroke-width: 3; }

.tile.is-in .dm-rule__you { animation: rule-you 8s var(--out) infinite; }
.tile.is-in .dm-rule__new { animation: rule-new 8s var(--out) infinite; }
.tile.is-in .dm-rule__new .ic { animation: rule-tick 8s var(--spring) infinite; }

@keyframes rule-you { 0% { opacity: 0; transform: scale(0.8); } 7%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes rule-new { 0%, 22% { opacity: 0; transform: translateY(10px); border-color: var(--border); } 30% { opacity: 1; transform: none; border-color: var(--brand); } 46%, 94% { opacity: 1; transform: none; border-color: var(--border); } 100% { opacity: 0; } }
@keyframes rule-tick { 0%, 30% { transform: scale(0); } 37%, 100% { transform: none; } }
