/* ==========================================================================
   Grupo de anuncios: las piezas se activan, se miden (alcance, frecuencia,
   CPM, CPA), reciben un rol (top, mid, low funnel) y se mueven a su carril;
   las que no aportan en ninguna etapa se pausan. Piezas con movimiento y luz
   de foto, sin ilustraciones planas.
   ========================================================================== */

.aag__head {
  max-width: 760px;
}
.agp {
  position: relative;
  margin: 44px 0 0;
  padding: clamp(16px, 2.2vw, 26px);
  border-radius: 28px;
  background: #0f1126;
  color: #f4f4f6;
  box-shadow: 0 40px 80px -40px rgba(14, 16, 40, 0.8);
}
.agp__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #262a52;
}
.agp__name {
  display: flex;
  align-items: center;
  gap: 12px;
}
.agp__name p {
  display: grid;
  gap: 3px;
}
.agp__name b {
  font: 600 0.9375rem/1.2 var(--f-display);
}
.agp__name span:not(.agp__dot) {
  font-size: 0.8125rem;
  color: #9a9ec0;
}
.agp__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.18);
}
.agp__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: st;
}
.agp__steps li {
  counter-increment: st;
  padding: 7px 12px;
  border-radius: 999px;
  background: #1a1d3d;
  color: #8f93b8;
  font: 600 0.8125rem/1 var(--f-display);
  transition:
    background-color 200ms ease,
    color 200ms ease;
}
.agp__steps li::before {
  content: counter(st) ' · ';
  opacity: 0.7;
}
.agp__steps li.on {
  background: var(--brand-lime);
  color: #1b1e3b;
}

/* ----- Board: one fixed grid of four lanes (top, mid, low, paused). Cards only
   swap places inside it, so the height never changes and nothing overflows. */
.agb {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  gap: 0 12px;
  margin-top: 18px;
}
.agb__lane {
  grid-row: 1 / 4;
  border-radius: 20px;
  border: 1px dashed #2d3260;
  transition:
    border-color 300ms ease,
    background-color 300ms ease;
}
.agb__lane[data-lane='top'],
.agb__h[data-lane='top'] {
  grid-column: 1;
}
.agb__lane[data-lane='mid'],
.agb__h[data-lane='mid'] {
  grid-column: 2;
}
.agb__lane[data-lane='low'],
.agb__h[data-lane='low'] {
  grid-column: 3;
}
.agb__lane[data-lane='off'],
.agb__h[data-lane='off'] {
  grid-column: 4;
}
.agb__h {
  grid-row: 1;
  display: grid;
  gap: 2px;
  padding: 14px 14px 10px;
}
.agb__h b {
  font: 600 0.9375rem/1.2 var(--f-display);
  color: #8f93b8;
  transition: color 300ms ease;
}
.agb__h small {
  font-size: 0.75rem;
  color: #7d82aa;
}
.agp.sorted .agb__lane {
  border-style: solid;
  background: #14173a;
}
.agp.sorted .agb__lane[data-lane='off'] {
  background: #17152b;
  border-color: #3a2a40;
}
.agp.sorted .agb__h b {
  color: var(--brand-lime);
}
.agp.sorted .agb__h[data-lane='off'] b {
  color: #ff8a8f;
}
.agb .adc {
  position: relative;
  z-index: 1;
  margin: 0 10px 10px;
}

/* ----- Ad card ---------------------------------------------------------------- */
.adc {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border-radius: 16px;
  background: #1a1d3d;
  box-shadow:
    inset 0 0 0 1px #2a2e58,
    0 14px 26px -18px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition:
    opacity 260ms ease,
    transform 320ms var(--ease-out),
    filter 300ms ease,
    box-shadow 300ms ease;
}
.adc.live {
  opacity: 1;
  transform: none;
}
.adc__media {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  overflow: hidden;
  isolation: isolate;
  font-family: var(--f-display);
}
.adc__media::before {
  /* film grain */
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0.2;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.adc__body {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}
.adc__name {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 0.8125rem/1.2 var(--f-display);
  color: #fff;
}
.adc__name::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34c759;
}
.adc__role {
  justify-self: start;
  min-height: 20px;
  padding: 4px 8px;
  border-radius: 999px;
  font: 600 0.6875rem/1 var(--f-display);
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 200ms ease,
    transform 260ms var(--ease-out);
}
.adc__kpi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  margin: 2px 0 0;
}
.adc__kpi div {
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 220ms ease,
    transform 260ms var(--ease-out);
}
.adc__kpi dt {
  font-size: 0.625rem;
  color: #8f93b8;
}
.adc__kpi dd {
  margin: 1px 0 0;
  font: 600 0.8125rem/1.1 var(--f-display);
  color: #c9cbe0;
  transition: color 250ms ease;
}
.adc.measured .adc__kpi div {
  opacity: 1;
  transform: none;
}
.adc.measured .adc__kpi div:nth-child(2) {
  transition-delay: 60ms;
}
.adc.measured .adc__kpi div:nth-child(3) {
  transition-delay: 120ms;
}
.adc.measured .adc__kpi div:nth-child(4) {
  transition-delay: 180ms;
}
.adc.ranked .adc__role {
  opacity: 1;
  transform: none;
}
.adc[data-role='top'] .adc__role,
.adc[data-role='mid'] .adc__role,
.adc[data-role='low'] .adc__role {
  background: var(--brand-lime);
  color: #1b1e3b;
}
.adc.ranked .adc__kpi dd.key {
  color: var(--brand-lime);
}
.adc.ranked[data-role='off'] {
  filter: grayscale(1);
  box-shadow: inset 0 0 0 1px #3b3f60;
}
.adc.ranked[data-role='off'] .adc__role {
  background: #3a2230;
  color: #ff8a8f;
}
.adc.ranked[data-role='off'] dd.key {
  color: #ff8a8f;
}
.adc.ranked[data-role='off'] .adc__name::before {
  background: #8f93b8;
}

/* ----- Media: motion and photographic looks ---------------------------------- */
.m-ugc {
  background:
    radial-gradient(30% 22% at 72% 26%, rgba(255, 214, 160, 0.6), transparent 70%),
    radial-gradient(22% 16% at 24% 18%, rgba(255, 170, 120, 0.45), transparent 70%),
    radial-gradient(46% 34% at 50% 58%, rgba(150, 92, 74, 0.9), transparent 75%),
    linear-gradient(180deg, #3a2a2a, #1f1718 60%, #120d0e);
  background-size: 120% 120%;
  background-position: 50% 40%;
}
.m-ugc::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 50% 45%, transparent 40%, rgba(0, 0, 0, 0.55));
}
.m-rec {
  position: absolute;
  z-index: 2;
  top: 7px;
  left: 7px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  color: #ff5a61;
  font: 600 0.5625rem/1.2 var(--f-body);
}
.m-subs {
  position: absolute;
  z-index: 2;
  left: 6px;
  right: 6px;
  bottom: 18%;
  display: grid;
  justify-items: center;
}
.m-subs span {
  grid-area: 1 / 1;
  padding: 2px 5px;
  border-radius: 3px;
  background: #fff;
  color: #000;
  font: 700 0.625rem/1.2 var(--f-body);
  text-align: center;
  opacity: 0;
}
.m-subs span:first-child {
  opacity: 1;
}
.m-timer {
  display: grid;
  align-content: end;
  padding-bottom: 16px !important;
  justify-items: start;
  padding: 10px;
  background: radial-gradient(110% 70% at 30% 20%, #3a40a0, #1b1e3b 60%, #0c0d1f);
  color: #fff;
}
.m-ring {
  position: absolute;
  right: -38%;
  top: -8%;
  width: 92%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--brand-lime) 0 72%, rgba(255, 255, 255, 0.08) 0);
  -webkit-mask: radial-gradient(closest-side, transparent 84%, #000 85%);
  mask: radial-gradient(closest-side, transparent 84%, #000 85%);
}
.m-min {
  position: relative;
  white-space: nowrap;
  font: 800 1.0625rem/1 var(--f-display);
  letter-spacing: -0.03em;
}
.m-min .num {
  color: var(--brand-lime);
}
.m-timer small {
  position: relative;
  margin-top: 4px;
  font: 500 0.625rem var(--f-body);
  color: #c9cbe0;
}
.m-precio {
  display: grid;
  align-content: center;
  padding: 10px;
  background: radial-gradient(120% 80% at 80% 10%, #f6ffc4, #e8fb8c 45%, #c2dc4e);
  color: #14163a;
}
.m-precio small {
  font: 600 0.5625rem/1 var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.m-precio b {
  margin-top: 4px;
  font: 800 1.125rem/0.95 var(--f-display);
  letter-spacing: -0.03em;
}
.m-sticker {
  position: absolute;
  right: 6px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #14163a;
  color: var(--brand-lime);
  font: 800 0.5625rem/1 var(--f-display);
  transform: rotate(-12deg);
  box-shadow: 0 8px 14px -6px rgba(20, 22, 58, 0.6);
}
.m-reviews {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: radial-gradient(120% 90% at 50% 0%, #fff, #eef0f6 60%, #dfe2ee);
  color: #14163a;
  text-align: center;
}
.m-reviews b {
  font: 800 1.5rem/1 var(--f-display);
  letter-spacing: -0.03em;
}
.m-stars {
  position: relative;
  width: 60px;
  height: 11px;
  background: #d1d3e0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 11'%3E%3Cg%3E%3Cpath id='s' d='M5.5 0l1.6 3.6 3.9.3-3 2.5.9 3.8-3.4-2-3.4 2 .9-3.8-3-2.5 3.9-.3z'/%3E%3Cuse href='%23s' x='12'/%3E%3Cuse href='%23s' x='24'/%3E%3Cuse href='%23s' x='36'/%3E%3Cuse href='%23s' x='48'/%3E%3C/g%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 11'%3E%3Cg%3E%3Cpath id='s' d='M5.5 0l1.6 3.6 3.9.3-3 2.5.9 3.8-3.4-2-3.4 2 .9-3.8-3-2.5 3.9-.3z'/%3E%3Cuse href='%23s' x='12'/%3E%3Cuse href='%23s' x='24'/%3E%3Cuse href='%23s' x='36'/%3E%3Cuse href='%23s' x='48'/%3E%3C/g%3E%3C/svg%3E")
    center / contain no-repeat;
}
.m-stars i {
  position: absolute;
  inset: 0;
  background: #ffb400;
  transform-origin: left;
  transform: scaleX(0.96);
}
.m-reviews small {
  margin-top: 4px;
  font: 500 0.5625rem/1.2 var(--f-body);
}
.m-vs {
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px;
  background: radial-gradient(120% 80% at 70% 0%, #2b3166, #14163a 70%);
  color: #fff;
}
.m-vs small {
  font: 500 0.5625rem var(--f-body);
  color: #c9cbe0;
}
.m-bar {
  height: 5px;
  border-radius: 3px;
  margin-bottom: 5px;
  transform-origin: left;
}
.m-bar--slow {
  background: #4e5276;
}
.m-bar--fast {
  width: 14%;
  background: var(--brand-lime);
}
.m-vs b {
  font: 800 1rem/1 var(--f-display);
  color: var(--brand-lime);
}
.m-catalog {
  background: linear-gradient(180deg, #f4f4f6, #e6e8f0);
  color: #14163a;
}
.m-list {
  position: absolute;
  inset: 0 6px;
  display: grid;
  gap: 4px;
  padding-top: 8px;
}
.m-list i {
  display: grid;
  padding: 5px 6px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 22, 58, 0.12);
  font: 600 0.5rem/1.2 var(--f-body);
  font-style: normal;
}
.m-list b {
  font: 700 0.5rem/1.2 var(--f-display);
  color: #3d4ee4;
}
.m-count {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 8px 8px;
  background: linear-gradient(180deg, transparent, #14163a 55%);
  color: var(--brand-lime);
  font: 800 0.75rem/1.1 var(--f-display);
}
.m-brand {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  background: #e9ebf4;
  color: #14163a;
}
.m-brand .app-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(155deg, #f2ffb0, #c9e65a);
  font: 800 0.8125rem/1 var(--f-display);
}
.m-brand b {
  padding: 0 4px;
  font: 600 0.625rem/1.2 var(--f-display);
  text-align: center;
}
.m-promo {
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 8px;
  background: radial-gradient(120% 90% at 20% 10%, #ff8a7a, #ff3e46 50%, #c61f2c);
  color: #fff;
  text-align: center;
}
.m-promo b {
  font: 800 1.75rem/1 var(--f-display);
}
.m-promo small {
  font: 500 0.5rem/1.2 var(--f-body);
}

/* Motion inside the pieces, only while the section is on screen */
.aag.on .m-ugc {
  animation: kenburns 9s ease-in-out infinite alternate;
}
.aag.on .m-subs span {
  animation: subs 3.6s steps(1) infinite;
}
.aag.on .m-subs span:nth-child(2) {
  animation-delay: 1.2s;
}
.aag.on .m-subs span:nth-child(3) {
  animation-delay: 2.4s;
}
.aag.on .m-ring {
  animation: spin 6s linear infinite;
}
.aag.on .m-sticker {
  animation: wobble 2.4s var(--ease-io) infinite;
}
.aag.on .m-stars i {
  animation: stars 3s var(--ease-out) infinite;
}
.aag.on .m-bar--slow {
  animation: grow 3s var(--ease-io) infinite;
}
.aag.on .m-list {
  animation: scrollList 6s linear infinite;
}
@keyframes kenburns {
  to {
    background-size: 140% 140%;
    background-position: 46% 52%;
  }
}
@keyframes subs {
  0% {
    opacity: 1;
  }
  33.3%,
  100% {
    opacity: 0;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes wobble {
  50% {
    transform: rotate(-4deg) scale(1.08);
  }
}
@keyframes stars {
  0% {
    transform: scaleX(0);
  }
  60%,
  100% {
    transform: scaleX(0.96);
  }
}
@keyframes grow {
  0% {
    transform: scaleX(0.1);
  }
  70%,
  100% {
    transform: scaleX(1);
  }
}
@keyframes scrollList {
  to {
    transform: translateY(-50%);
  }
}
.aag.on .m-subs span:first-child {
  opacity: 0;
}

/* ----- Responsive: below 1100px the cards stay in a list and only get their role. */
@media (max-width: 1100px) {
  .agb {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
  }
  .agb__lane,
  .agb__h {
    display: none;
  }
  .agb .adc {
    grid-column: auto !important;
    grid-row: auto !important;
    margin: 0;
  }
}

@media (max-width: 600px) {
  .agp__steps {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 100%;
  }
  .agp__steps li {
    flex: none;
  }
  .adc__kpi dt {
    font-size: 0.6875rem;
  }
}
@media (max-width: 1100px) {
  .agb {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* Celular: los pasos en dos renglones (el activo siempre a la vista) y los anuncios en un carrusel que se desliza. */
@media (max-width: 600px) {
  .agp__steps {
    flex-wrap: wrap;
    overflow: visible;
  }
  .agb {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 84%;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 2px;
    scrollbar-width: none;
    padding-bottom: 4px;
    -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent);
    mask-image: linear-gradient(90deg, #000 86%, transparent);
  }
  .agb::-webkit-scrollbar {
    display: none;
  }
  .agb .adc {
    scroll-snap-align: start;
  }
}
