/* ==========================================================================
   Medición y atribución: teléfonos que viajan como señales (Android continuo,
   iOS por tandas) hacia el MMP, Boomit One Analytics y los algoritmos de las
   plataformas publicitarias. Animaciones solo mientras la sección se ve.
   ========================================================================== */

.amed__head {
  max-width: 740px;
}
.flow {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 28px minmax(0, 0.9fr) 28px minmax(0, 1fr) 28px minmax(0, 0.85fr);
  align-items: center;
  gap: 0 10px;
  margin-top: 56px;
}
.flow__k {
  font: 600 1.0625rem/1.2 var(--f-display);
  letter-spacing: -0.01em;
}
.flow__s {
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.flow__link {
  position: relative;
  height: 3px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--line-2) 0 6px, transparent 6px 11px);
  background-size: 22px 100%;
}
.flow__link::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 50%;
  width: 7px;
  height: 7px;
  border: solid var(--ink-3);
  border-width: 2px 2px 0 0;
  transform: translateY(-50%) rotate(45deg);
}
.amed.on .flow__link {
  animation: dash 900ms linear infinite;
}
@keyframes dash {
  to {
    background-position: 22px 0;
  }
}

/* Lanes with phones as signals */
.flow__lanes {
  display: grid;
  gap: 12px;
}
.lane2 {
  padding: 14px 16px 12px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.lane2 p {
  display: grid;
  gap: 3px;
}
.lane2 b {
  font: 600 1rem/1.2 var(--f-display);
}
.lane2 small {
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.lane2__track {
  position: relative;
  height: 46px;
  margin-top: 10px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--sunk), color-mix(in srgb, var(--sunk) 40%, var(--surface)));
  overflow: hidden;
}
.mp {
  /* a tiny phone: titanium frame, dark bezel, lit screen */
  position: absolute;
  top: 7px;
  left: 0;
  width: 16px;
  height: 32px;
  padding: 1.5px;
  border-radius: 4.5px;
  background: linear-gradient(140deg, #a3a6ae, #2b2d33 30%, #15161a 70%, #7c7f88);
  box-shadow:
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.5),
    0 4px 6px -2px rgba(20, 22, 58, 0.5);
  transform: translateX(-24px);
}
.mp::before {
  content: '';
  display: block;
  height: 100%;
  border-radius: 3.2px;
  background:
    linear-gradient(122deg, rgba(255, 255, 255, 0.4), transparent 45%), linear-gradient(180deg, #3d4ee4, #1b1e3b);
}
.lane2__track--batch .mp::before {
  background:
    linear-gradient(122deg, rgba(255, 255, 255, 0.4), transparent 45%), linear-gradient(180deg, #a084f1, #1b1e3b);
}
.amed.on .mp {
  animation: mpRun 3s linear infinite;
}
.amed.on .lane2__track:not(.lane2__track--batch) .mp:nth-child(2) {
  animation-delay: -0.6s;
}
.amed.on .lane2__track:not(.lane2__track--batch) .mp:nth-child(3) {
  animation-delay: -1.2s;
}
.amed.on .lane2__track:not(.lane2__track--batch) .mp:nth-child(4) {
  animation-delay: -1.8s;
}
.amed.on .lane2__track:not(.lane2__track--batch) .mp:nth-child(5) {
  animation-delay: -2.4s;
}
@keyframes mpRun {
  from {
    transform: translateX(-24px);
  }
  to {
    transform: translateX(calc(var(--track, 320px) + 4px));
  }
}
/* iOS: phones wait, then travel together */
.amed.on .lane2__track--batch .mp {
  animation: mpBatch 5.4s var(--ease-io) infinite;
}
.amed.on .lane2__track--batch .mp:nth-child(2) {
  top: 7px;
  margin-left: 20px;
}
.amed.on .lane2__track--batch .mp:nth-child(3) {
  margin-left: 40px;
}
.amed.on .lane2__track--batch .mp:nth-child(4) {
  margin-left: 60px;
}
@keyframes mpBatch {
  0%,
  45% {
    transform: translateX(10px);
  }
  100% {
    transform: translateX(calc(var(--track, 320px) + 4px));
  }
}

/* MMP */
.flow__mmp {
  padding: 18px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.mmp {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.mmp li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--sunk);
  font: 700 0.875rem/1 var(--f-display);
  letter-spacing: -0.01em;
  color: var(--ink-2);
}
.mmp-sg {
  display: block;
  width: 78px;
  height: auto;
  color: var(--ink-2);
}
.mmp-sg path {
  fill: currentColor;
}
.mmp__logo svg {
  display: block;
  height: 16px;
  width: auto;
  color: var(--ink-2);
}
.mmp--af svg {
  height: 22px;
}
.mmp--br svg {
  height: 14px;
}

/* Boomit One: where decisions are made */
.flow__b1 {
  position: relative;
  padding: 22px 20px;
  border-radius: 22px;
  background: radial-gradient(120% 90% at 85% 0%, #2d3260 0%, transparent 60%), #1b1e3b;
  color: #fff;
  box-shadow:
    0 0 0 3px rgba(232, 251, 140, 0.45),
    0 30px 50px -28px rgba(27, 30, 59, 0.9);
}
.flow__b1 .flow__k {
  color: var(--brand-lime);
  font-size: 1.1875rem;
}
.flow__b1 .flow__s {
  color: #c9cbe0;
}
.flow__nota {
  position: absolute;
  left: 10%;
  top: -64px;
}
.flow__algo {
  padding: 18px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.pfs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.pf {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border-radius: 10px;
  background: var(--sunk);
  font: 600 0.75rem/1.15 var(--f-display);
  color: var(--ink-2);
  transition:
    background-color 200ms ease,
    color 200ms ease;
}
.pf svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: #8f93b0;
  transition:
    color 200ms ease,
    filter 200ms ease;
}
.pf--more {
  grid-column: 1 / -1;
  justify-content: center;
  background: none;
  border: 1px dashed var(--line-2);
  font-weight: 500;
  color: var(--ink-3);
}
@media (hover: hover) and (pointer: fine) {
  .pf:not(.pf--more):hover {
    background: var(--surface);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line-2);
  }
  .pf--mt:hover svg {
    color: #0866ff;
  }
  .pf--ga:hover svg {
    color: #4285f4;
  }
  .pf--tt:hover svg {
    color: #000;
    filter: drop-shadow(-1px -1px 0 #25f4ee) drop-shadow(1px 1px 0 #fe2c55);
  }
  .pf--ap:hover svg,
  .pf--x:hover svg {
    color: #000;
  }
  .pf--pi:hover svg {
    color: #e60023;
  }
}

.amed__mmp {
  max-width: 760px;
  margin-top: 56px;
}
.amed__mmp h3 {
  font-size: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);
}
.amed__mmp p {
  margin-top: 10px;
  color: var(--ink-2);
}
.amed__steps {
  counter-reset: s;
  list-style: none;
  margin: 48px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}
.amed__steps li {
  counter-increment: s;
  padding-top: 16px;
  border-top: 2px solid var(--line);
  color: var(--ink-2);
}
.amed__steps li::before {
  content: counter(s, decimal-leading-zero);
  display: block;
  margin-bottom: 8px;
  font: 600 0.8125rem/1 var(--f-display);
  color: var(--coral);
}
.amed__steps b {
  color: var(--ink);
  font-weight: 500;
}
@media (max-width: 1100px) {
  .flow {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .flow__link {
    justify-self: center;
    width: 3px;
    height: 26px;
    background: repeating-linear-gradient(180deg, var(--line-2) 0 6px, transparent 6px 11px);
  }
  .flow__link::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -2px;
    transform: translateX(-50%) rotate(135deg);
  }
  .amed.on .flow__link {
    animation: none;
  }
  .flow__nota {
    position: static;
    margin-bottom: 8px;
  }
  .flow__nota svg {
    display: none;
  }
  .amed__steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .amed__steps {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (prefers-reduced-motion: reduce) {
  .mp {
    transform: translateX(calc(var(--i, 1) * 40px));
  }
}

/* Return path: the platforms learn and bring better users back to the start. */
.loop {
  position: relative;
  height: 58px;
  margin: 8px 6% 0 12%;
  border: 2px dashed var(--line-2);
  border-top: 0;
  border-radius: 0 0 22px 22px;
}
.loop::before {
  /* arrowhead pointing up, into the device lanes */
  content: '';
  position: absolute;
  left: -8px;
  top: -10px;
  border: 7px solid transparent;
  border-bottom: 10px solid var(--ink-3);
  border-top: 0;
}
.loop::after {
  /* the right end leaves the platforms card */
  content: '';
  position: absolute;
  right: -6px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-3);
}
.loop p {
  position: absolute;
  left: 50%;
  bottom: -13px;
  max-width: 90%;
  padding: 2px 14px;
  background: var(--bg);
  transform: translateX(-50%);
  font: 600 0.875rem/1.3 var(--f-display);
  color: var(--ink-2);
  text-align: center;
  white-space: nowrap;
}
.loop__dot {
  position: absolute;
  bottom: -6px;
  left: 100%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--brand-red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-red) 20%, transparent);
  opacity: 0;
}
.amed.on .loop__dot {
  animation: loopBack 3.6s var(--ease-io) infinite;
}
@keyframes loopBack {
  0% {
    left: 100%;
    opacity: 0;
  }
  10%,
  85% {
    opacity: 1;
  }
  100% {
    left: 0%;
    opacity: 0;
  }
}
@media (max-width: 1100px) {
  .loop {
    height: auto;
    margin: 14px 0 0;
    padding: 14px 16px 14px 44px;
    border: 2px dashed var(--line-2);
    border-radius: 16px;
  }
  .loop::before {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
  }
  .loop::after,
  .loop__dot {
    display: none;
  }
  .loop p {
    position: static;
    max-width: none;
    padding: 0;
    background: none;
    transform: none;
    white-space: normal;
    text-align: left;
  }
}

/* La nota se parte en dos líneas si el idioma la alarga: crece hacia arriba y no pisa la columna de plataformas. */
.flow__nota {
  top: auto;
  bottom: calc(100% + 16px);
  right: -67px;
}
.flow__nota span {
  white-space: normal;
}
.flow__nota svg {
  align-self: flex-end;
}
