/* ==========================================================================
   Agent layer for the Rio theme (Tiendanube)
   HUMAN: seller note on treatment PDPs and the /grafo-de-productos/ wrapper.
   MACHINE: the machine-readable index (#machine-view) and the HUMAN | MACHINE pill. Reads Rio's own design tokens (set from the
   theme editor), so it follows the store's colors and fonts automatically.
   Kept free of Twig delimiters so it also works if renamed to .scss / .scss.tpl.
   ========================================================================== */

.agl-seller,
.agl-graph,
.agl-graph-page,
.agl-dock,
.agl-m {
  --agl-fg: var(--main-foreground, #000);
  --agl-bg: var(--main-background, #fff);
  --agl-line: var(--main-foreground-opacity-10, rgba(0, 0, 0, 0.1));
  --agl-line-strong: var(--main-foreground-opacity-20, rgba(0, 0, 0, 0.2));
  --agl-soft: var(--main-foreground-opacity-05, rgba(0, 0, 0, 0.05));
  --agl-text-2: var(--main-foreground-opacity-80, rgba(0, 0, 0, 0.8));
  --agl-muted: var(--main-foreground-opacity-60, rgba(0, 0, 0, 0.6));
  --agl-faint: var(--main-foreground-opacity-40, rgba(0, 0, 0, 0.4));
  --agl-label-bg: var(--label-background, #eeedbc);
  --agl-label-fg: var(--label-foreground, #333);
  --agl-accent: var(--button-background, #e67e22);
  --agl-accent-fg: var(--button-foreground, #fff);
  --agl-heading: var(--heading-font, "Readex Pro", sans-serif);
  --agl-body: var(--body-font, "Work Sans", sans-serif);
  --agl-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --agl-radius: 4px;
  --agl-radius-img: 10px;
  --agl-bleed: 15px;
  --agl-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --agl-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

.agl-seller *,
.agl-seller *::before,
.agl-seller *::after,
.agl-graph *,
.agl-graph *::before,
.agl-graph *::after,
.agl-dock *,
.agl-m *,
.agl-m *::before,
.agl-m *::after {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Shared bits
   -------------------------------------------------------------------------- */

.agl-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font: 700 10px/1.2 var(--agl-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--agl-muted);
}

.agl-eyebrow::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--agl-accent);
}

.agl-eyebrow--plain::before {
  display: none;
}

/* --------------------------------------------------------------------------
   Seller note (PDP)
   -------------------------------------------------------------------------- */

.agl-seller {
  margin: 8px 0 32px;
  padding-top: 24px;
  border-top: 1px solid var(--agl-line);
  font-family: var(--agl-body);
  color: var(--agl-fg);
  -webkit-font-smoothing: antialiased;
}

.agl-seller__title {
  margin: 0 0 10px;
  font: 700 22px/1.22 var(--agl-heading);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.agl-seller__pitch {
  max-width: 62ch;
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--agl-text-2);
  text-wrap: pretty;
}

.agl-notes {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--agl-line);
  border-radius: var(--agl-radius);
}

.agl-note {
  padding: 12px 14px;
}

.agl-note + .agl-note {
  border-top: 1px solid var(--agl-line);
}

.agl-note dt {
  margin: 0 0 4px;
  font: 700 10px/1.2 var(--agl-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--agl-muted);
}

.agl-note dd::first-letter {
  text-transform: uppercase;
}

.agl-note dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  text-wrap: pretty;
}

.agl-note--ask {
  background: var(--agl-label-bg);
  color: var(--agl-label-fg);
}

.agl-note--ask dt {
  color: inherit;
  opacity: 0.7;
}

.agl-note--ask + .agl-note,
.agl-note + .agl-note--ask {
  border-top-color: transparent;
}

/* Groups */

.agl-group {
  margin-top: 28px;
}

.agl-seller .agl-group__title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 2px;
  font: 700 12px/1.3 var(--agl-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.agl-count {
  font: 400 11px/1 var(--agl-body);
  letter-spacing: 0;
  color: var(--agl-faint);
  font-variant-numeric: tabular-nums;
}

/* Items (shared) */

.agl-item {
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.agl-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--agl-radius-img);
  background: var(--agl-soft);
}

.agl-thumb::after {
  /* hairline image outline: keeps white product shots from melting into the page */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

.agl-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms var(--agl-ease-out);
}

.agl-thumb--brand {
  display: grid;
  place-items: center;
  container-type: inline-size;
  background: #f6f5ea;
  background: color-mix(in srgb, var(--agl-label-bg) 42%, var(--agl-bg));
}

.agl-thumb__brand {
  max-width: 100%;
  padding: 0 4px;
  overflow: hidden;
  font: 700 8px/1 var(--agl-heading);
  font-size: clamp(6px, 10cqi, 11px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--agl-label-fg);
  opacity: 0.75;
}

.agl-item__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.agl-item__name {
  font: 400 13px/1.35 var(--agl-heading);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--agl-fg);
  text-decoration: none;
  overflow-wrap: anywhere;
}

/* one link per product, whole tile clickable */
.agl-item__name::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.agl-item__name:focus {
  outline: none;
}

.agl-item:focus-within {
  outline: 2px solid var(--agl-fg);
  outline-offset: 3px;
  border-radius: var(--agl-radius);
}

.agl-item:has(.agl-item__name:focus:not(:focus-visible)) {
  outline: none;
}

.agl-item__reason {
  font-size: 13px;
  line-height: 1.45;
  color: var(--agl-muted);
  text-wrap: pretty;
}

.agl-item__price {
  font: 700 14px/1.3 var(--agl-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .agl-item:hover .agl-item__name {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  }

  .agl-item:hover .agl-thumb img {
    transform: scale(1.04);
  }
}

/* Routine: numbered rows */

.agl-routine {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: agl-step;
}

.agl-item--row {
  counter-increment: agl-step;
  display: grid;
  grid-template-columns: 16px 56px minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  column-gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--agl-line);
}

.agl-item--row .agl-item__body {
  display: contents;
}

.agl-item--row .agl-thumb {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.agl-item--row .agl-item__name {
  grid-column: 3;
  grid-row: 1;
  padding-top: 2px;
}

.agl-item--row .agl-item__price {
  grid-column: 4;
  grid-row: 1;
  padding-top: 2px;
}

.agl-item--row .agl-item__reason {
  grid-column: 3 / span 2;
  grid-row: 2;
  margin-top: 4px;
}

.agl-item--row:last-child {
  border-bottom: 0;
}

/* step number of the routine, outside the thumbnail so photos stay clean */
.agl-item--row::before {
  content: counter(agl-step, decimal-leading-zero);
  grid-column: 1;
  grid-row: 1 / span 2;
  padding-top: 4px;
  font: 700 10px/1 var(--agl-heading);
  letter-spacing: 0.02em;
  color: var(--agl-faint);
  font-variant-numeric: tabular-nums;
}


/* Alternatives: horizontal rail, scroll-snap, no JS */

.agl-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 136px;
  gap: 14px;
  margin: 12px calc(-1 * var(--agl-bleed)) 0;
  padding: 2px var(--agl-bleed) 14px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--agl-bleed);
  scrollbar-width: thin;
  scrollbar-color: var(--agl-line-strong) transparent;
  -webkit-overflow-scrolling: touch;
}

.agl-item--card {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  row-gap: 6px;
  align-content: start;
  scroll-snap-align: start;
}

.agl-item--card .agl-item__body {
  display: contents;
}

.agl-item--card .agl-thumb {
  order: 0;
  margin-bottom: 4px;
}

.agl-item--card .agl-item__name {
  order: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 12px;
}

.agl-item--card .agl-item__price {
  order: 2;
  font-size: 13px;
}

.agl-item--card .agl-item__reason {
  order: 3;
  font-size: 12.5px;
}

/* Versions: compact chips */

.agl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.agl-item--chip {
  flex: 1 1 260px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--agl-line);
  border-radius: 12px;
  transition: border-color 150ms ease;
}

.agl-item--chip .agl-thumb {
  border-radius: 8px;
}

.agl-item--chip .agl-thumb__brand {
  padding: 0;
  font-size: 0;
  letter-spacing: 0;
}

.agl-item--chip .agl-thumb__brand::before {
  content: attr(data-initial);
  font-size: 14px;
}

.agl-item--chip .agl-item__body {
  gap: 1px;
}

.agl-item--chip .agl-item__name {
  font-size: 12px;
}

.agl-item--chip .agl-item__reason {
  font-size: 12px;
  line-height: 1.4;
}

.agl-item--chip .agl-item__price {
  font-size: 12px;
}

@media (hover: hover) and (pointer: fine) {
  .agl-item--chip:hover {
    border-color: var(--agl-fg);
  }
}

/* Upsell: one feature card in Rio's label color */

.agl-upsell {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.agl-item--feature {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto 1fr;
  column-gap: 14px;
  align-items: start;
  padding: 14px;
  border-radius: var(--agl-radius-img);
  background: var(--agl-label-bg);
  color: var(--agl-label-fg);
  transition: transform 160ms var(--agl-ease-out);
}

.agl-item--feature:active {
  transform: scale(0.985);
}

.agl-item--feature .agl-thumb {
  grid-column: 1;
  grid-row: 1 / span 4;
  background: var(--agl-bg);
}

.agl-item--feature .agl-item__body {
  display: contents;
}

.agl-item--feature .agl-eyebrow {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

.agl-item--feature .agl-item__price {
  grid-column: 3;
  grid-row: 1;
}

.agl-item--feature .agl-item__name {
  grid-column: 2 / span 2;
  grid-row: 2;
  margin-top: 2px;
}

.agl-item--feature .agl-item__reason {
  grid-column: 2 / span 2;
  grid-row: 3;
  margin-top: 3px;
}

.agl-item--feature .agl-item__cta {
  grid-column: 2 / span 2;
  grid-row: 4;
}

.agl-item--feature .agl-thumb--brand {
  background: var(--agl-bg);
}

.agl-item--feature .agl-eyebrow {
  margin: 0 0 4px;
  color: inherit;
  opacity: 0.7;
}

.agl-item--feature .agl-item__name {
  font-size: 14px;
  color: inherit;
}

.agl-item--feature .agl-item__reason {
  color: inherit;
  opacity: 0.78;
}

.agl-item--feature .agl-item__price {
  font-size: 15px;
}

.agl-item__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font: 700 11px/1 var(--agl-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.agl-arrow {
  display: inline-block;
  transition: transform 200ms var(--agl-ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .agl-item--feature:hover .agl-arrow {
    transform: translateX(3px);
  }

  .agl-item--feature:hover .agl-item__name {
    text-decoration: none;
  }
}

/* --------------------------------------------------------------------------
   Graph page /grafo-de-productos/ (HUMAN)
   -------------------------------------------------------------------------- */

.agl-graph {
  margin: 0 0 56px;
  font-family: var(--agl-body);
  color: var(--agl-fg);
  -webkit-font-smoothing: antialiased;
}

.agl-graph__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0;
}

.agl-btn {
  display: inline-block;
  padding: 13px 18px;
  border-radius: var(--agl-radius);
  background: var(--agl-accent);
  color: var(--agl-accent-fg);
  font: 700 12px/1 var(--agl-body);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 160ms var(--agl-ease-out), opacity 150ms ease;
}

.agl-btn:hover,
.agl-btn:focus {
  color: var(--agl-accent-fg);
  opacity: 0.85;
}

.agl-btn:active {
  transform: scale(0.97);
}

.agl-graph__format {
  font: 400 12px/1.2 var(--agl-mono);
  color: var(--agl-muted);
}

/* --------------------------------------------------------------------------
   Graph page wrapper around the TN Page body (plain semantic HTML, no classes)
   -------------------------------------------------------------------------- */

.agl-graph__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 28px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--agl-line);
}

.agl-graph__bar .agl-eyebrow { margin: 0; }

.agl-graph__bar .agl-btn { scroll-margin-top: 140px; }

.agl-graph__content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  font-size: 14px;
  line-height: 1.55;
}

.agl-graph__content > * { grid-column: 1 / -1; min-width: 0; }

.agl-graph__content > h2 {
  margin: 48px 0 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--agl-fg);
  font: 700 12px/1.3 var(--agl-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.agl-graph__content > h2:first-child {
  max-width: 30ch;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  font: 700 24px/1.25 var(--agl-heading);
  letter-spacing: -0.01em;
  text-transform: none;
  text-wrap: balance;
}

.agl-graph__content > p { max-width: 62ch; margin: 0 0 10px; font-size: 15px; color: var(--agl-text-2); }

.agl-graph__content > h3 { margin: 28px 0 6px; font: 700 15px/1.3 var(--agl-heading); }

.agl-graph__content > p:has(> strong:first-child) {
  max-width: none;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--agl-line);
  font-size: 13.5px;
  color: var(--agl-muted);
}

.agl-graph__content > h3 + p:has(> strong:first-child) { border-top: 0; padding-top: 4px; }

.agl-graph__content > p > strong:first-child a {
  font: 700 14.5px/1.35 var(--agl-heading);
  color: var(--agl-fg);
  text-decoration: none;
}

.agl-graph__content > ul { display: grid; gap: 4px; margin: 6px 0 14px; padding: 0; list-style: none; }

.agl-graph__content > ul > li { position: relative; padding-left: 16px; font-size: 13.5px; color: var(--agl-muted); }

.agl-graph__content > ul > li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--agl-line-strong);
}

.agl-graph__content a { color: var(--agl-fg); text-decoration: underline; text-decoration-color: var(--agl-line-strong); text-underline-offset: 3px; }
.agl-graph__content a:hover { text-decoration-color: currentColor; }

@media (min-width: 992px) {
  .agl-graph__content { grid-template-columns: minmax(240px, 1fr) 2fr; }
  .agl-graph__content > p:has(> strong:first-child) { grid-column: 1; padding-right: 32px; }
  .agl-graph__content > p:has(> strong:first-child) + ul { grid-column: 2; margin: 0; padding: 14px 0; border-top: 1px solid var(--agl-line); }
  .agl-graph__content > h3 + p:has(> strong:first-child) + ul { border-top: 0; padding-top: 4px; }
}

/* ==========================================================================
   MACHINE mode
   Same page, reinterpreted as a machine-readable index: black, one Rio accent
   (the store's button color), mono uppercase. The text stays sentence-case in
   the HTML (uppercase is CSS only), so the markdown an agent gets reads normal.
   ========================================================================== */

.agl-m,
.agl-graph-page,
.agl-dock {
  --m-bg: #000;
  --m-accent: var(--button-background, #e67e22);
  --m-dim: #7a4313;
  --m-dim: color-mix(in srgb, var(--m-accent) 52%, #000);
  --m-bright: var(--label-background, #eeedbc);
  --m-ink: #e6e6e6;
  --m-font: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --m-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

/* boot: a returning MACHINE visitor never sees the human page flash (failsafe reveal) */
html.agl-boot-machine body {
  opacity: 0;
  animation: agl-boot-failsafe 0s linear 1.2s forwards;
}

html.agl-boot-machine.agl-machine body {
  opacity: 1;
  animation: none;
}

@keyframes agl-boot-failsafe {
  to { opacity: 1; }
}

/* page swap: only the machine host and the pill stay */
html.agl-machine,
html.agl-machine body {
  background: #000 !important;
}

html.agl-machine body {
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden;
}

html.agl-machine body > :not([data-agl-machine-host]):not(.agl-dock) {
  display: none !important;
}

html.agl-swap-out body > :not(.agl-dock) {
  opacity: 0;
  transition: opacity 150ms ease-out;
}

html.agl-swap-in body > :not(.agl-dock) {
  animation: agl-swap-in 280ms var(--m-ease-out, ease-out) both;
}

@keyframes agl-swap-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---- the index ---------------------------------------------------------- */

.agl-m[hidden],
[data-agl-machine-only][hidden] {
  display: none !important;
}

.agl-m,
html.agl-machine .agl-graph-page {
  box-sizing: border-box;
  max-width: 712px;
  margin: 0 auto;
  padding: 56px 20px 140px;
  background: var(--m-bg);
  color: var(--m-accent);
  font: 500 13px/1.65 var(--m-font);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* DOM order = markdown order (h1 first, index last). Visual order, basement-style: */
.agl-m:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.agl-m > * { order: 10; }
.agl-m > .agl-m-ascii { order: 0; }
.agl-m > .agl-m-nav { order: 1; }
.agl-m > .agl-m-title { order: 2; }
.agl-m > .agl-m-comment { order: 3; }
.agl-m > .agl-m-tools { order: 4; }
.agl-m > .agl-m-fetch { order: 5; }
.agl-m > .agl-m-h1 { order: 6; }

.agl-m > pre {
  align-self: stretch;
}

:is(.agl-m, .agl-graph-page) ::selection {
  background: var(--m-accent);
  color: #000;
}

:is(.agl-m, .agl-graph-page) a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
  .agl-m a:hover,
  html.agl-machine .agl-graph-page a:hover {
    color: var(--m-bright);
  }
}

:is(.agl-m, .agl-graph-page) a:focus-visible,
:is(.agl-m, .agl-graph-page) button:focus-visible {
  outline: 1px solid var(--m-bright);
  outline-offset: 3px;
}

.agl-m-ascii {
  margin: 0 0 30px !important;
  padding: 0;
  overflow: hidden;
  background: none;
  border: 0;
  color: var(--m-accent);
  font: 400 min(15px, calc((100vw - 40px) / 50))/1.08 var(--m-font);
  letter-spacing: 0;
  text-transform: none;
  text-shadow: 0 0 6px rgba(230, 126, 34, 0.38);
  text-shadow: 0 0 6px color-mix(in srgb, var(--m-accent) 38%, transparent);
  white-space: pre;
  user-select: none;
}

.agl-m-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
}

.agl-m-nav li {
  margin: 0;
  padding: 0;
}

.agl-m-nav li::before {
  content: none !important;
}

.agl-m-nav a[aria-current="page"] {
  margin: 0 -5px;
  padding: 2px 5px;
  background: var(--m-accent);
  color: #000;
  text-decoration: none;
}

.agl-m-title {
  margin: 0 0 18px;
  color: var(--m-bright);
}

.agl-m-comment {
  max-width: 46ch;
  margin: 0 0 18px;
  color: var(--m-dim);
}

.agl-m-comment::before {
  content: "# ";
}

.agl-m-h1 {
  position: relative;
  padding-left: 2ch;
  margin: 30px 0 12px;
  color: var(--m-bright);
  font: 600 13px/1.65 var(--m-font);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.agl-m-h1::before {
  content: "*";
  position: absolute;
  left: 0;
}

/* key ........ value */
.agl-m-kv {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agl-m-kv li {
  display: flex;
  margin: 0;
  padding: 0;
}

.agl-m-kv li::before {
  content: none !important;
}

.agl-m-kv strong {
  flex: none;
  width: 18ch;
  overflow: hidden;
  font-weight: 500;
  color: var(--m-dim);
  white-space: nowrap;
}

.agl-m-kv strong::after {
  content: " ..............................................";
}

.agl-m-kv strong + * {
  min-width: 0;
  padding-left: 1ch;
  overflow-wrap: anywhere;
}

.agl-m-colon,
.agl-m-sep {
  display: none;
}

/* ── section ──────────────── */
.agl-m h2 {
  display: flex;
  align-items: center;
  gap: 1ch;
  margin: 34px 0 14px;
  overflow: hidden;
  color: var(--m-dim);
  font: 500 13px/1.65 var(--m-font);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.agl-m h2::before {
  content: "\2500\2500";
  letter-spacing: 0;
}

.agl-m h2::after {
  content: "";
  flex: 1;
  height: 0;
  border-top: 1px solid currentColor;
}

.agl-m p {
  margin: 0 0 10px;
}

.agl-m > ul:not([class]) {
  display: grid;
  gap: 4px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.agl-m > ul:not([class]) li {
  position: relative;
  margin: 0;
  padding-left: 2ch;
}

.agl-m > ul:not([class]) li::before {
  content: "-";
  position: absolute;
  left: 0;
  color: var(--m-dim);
}

/* * ITEM (underlined) / reason / [tags] */
.agl-m-items {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agl-m-items li {
  position: relative;
  margin: 0;
  padding-left: 2ch;
}

.agl-m-items li::before {
  content: "*";
  position: absolute;
  left: 0;
  color: var(--m-bright);
}

.agl-m-items a {
  color: var(--m-bright);
}

.agl-m-reason {
  display: block;
  margin-top: 2px;
}

.agl-m-tags {
  display: block;
  color: var(--m-dim);
}

/* "(complemento · $1.288,89)" in the markdown, "[COMPLEMENTO] [$1.288,89]" on screen */
.agl-m-paren,
.agl-m-dot {
  display: none;
}

.agl-m-tag::before { content: "["; }
.agl-m-tag::after { content: "]"; }

.agl-m-tag + .agl-m-tag,
.agl-m-dot + .agl-m-tag {
  margin-left: 1ch;
}

.agl-m pre:not(.agl-m-ascii):not(.agl-m-md) {
  margin: 10px 0 0;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--m-dim);
  background: none;
  color: var(--m-bright);
  font: inherit;
  text-transform: none;
  white-space: pre;
  scrollbar-width: thin;
  scrollbar-color: var(--m-dim) transparent;
}

.agl-m pre:not(.agl-m-ascii):not(.agl-m-md) code {
  font: inherit;
  color: inherit;
  background: none;
  padding: 0;
}

.agl-m pre:not(.agl-m-ascii):not(.agl-m-md) code::before {
  content: "$ ";
  color: var(--m-dim);
}

/* ---- JS-only tools (not in the server HTML, so never in the markdown) ---- */

.agl-m-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0 0 8px;
}

.agl-m-tool {
  margin: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--m-accent);
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 150ms ease, transform 160ms var(--m-ease-out);
  -webkit-tap-highlight-color: transparent;
}

.agl-m-tool::before { content: "["; color: var(--m-dim); }
.agl-m-tool::after { content: "]"; color: var(--m-dim); }

.agl-m-tool span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
  .agl-m-tool:hover {
    color: var(--m-bright);
  }
}

.agl-m-tool:active {
  transform: scale(0.97);
}

.agl-m-tool[data-state="done"] {
  color: var(--m-bright);
}

.agl-m-fetch {
  margin: 28px 0 0;
}

.agl-m-fetch[hidden] {
  display: none;
}

.agl-m-rule {
  display: flex;
  align-items: center;
  gap: 1ch;
  margin: 0 0 12px;
  overflow: hidden;
  color: var(--m-dim);
  white-space: nowrap;
}

.agl-m-rule::before { content: "\2500\2500"; }
.agl-m-rule::after { content: ""; flex: 1; border-top: 1px solid currentColor; }

.agl-m-status {
  margin: 0 0 10px;
  color: var(--m-dim);
  overflow-wrap: anywhere;
}

.agl-m-status b {
  font-weight: 500;
  color: var(--m-accent);
}

.agl-m-status .ok { color: var(--m-bright); }

.agl-m-md,
.agl-m .agl-m-md {
  max-height: min(62vh, 560px);
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid var(--m-dim);
  background: #050505;
  color: var(--m-accent);
  font: 400 12px/1.6 var(--m-font);
  text-transform: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--m-dim) transparent;
  animation: agl-swap-in 240ms var(--m-ease-out) both;
}

.agl-md-h { color: var(--m-bright); font-weight: 600; }
.agl-md-dim { color: var(--m-dim); }
.agl-md-link { color: var(--m-bright); text-decoration: underline; text-underline-offset: 3px; }

/* ---- HUMAN | MACHINE pill ------------------------------------------------ */

.agl-dock {
  position: fixed;
  z-index: 40001;
  left: 0;
  right: 0;
  bottom: var(--agl-dock-lift, 0px);
  transition: bottom 220ms cubic-bezier(0.23, 1, 0.32, 1);
  display: flex;
  justify-content: center;
  padding-bottom: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.agl-pill {
  display: flex;
  align-items: center;
  padding: 3px;
  border: 1px solid #2e2e2e;
  border-radius: 999px;
  background: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
  transition: border-color 200ms ease;
  animation: agl-dock-in 320ms var(--m-ease-out) both;
}

html.agl-machine .agl-pill {
  border-color: rgba(230, 126, 34, 0.4);
  border-color: color-mix(in srgb, var(--m-accent) 40%, transparent);
  box-shadow: none;
}

@keyframes agl-dock-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.agl-pill button {
  margin: 0;
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--m-ink);
  font: 600 12px/1 var(--m-font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 150ms ease, transform 160ms var(--m-ease-out);
  -webkit-tap-highlight-color: transparent;
}

.agl-pill button[aria-pressed="true"] {
  color: var(--m-accent);
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .agl-pill button[aria-pressed="false"]:hover {
    color: var(--m-accent);
  }
}

.agl-pill button:active {
  transform: scale(0.96);
}

.agl-pill button:focus-visible {
  outline: 1px solid var(--m-accent);
  outline-offset: -1px;
}

/* keep the last line of the human page clear of the pill */
body.agl-has-dock {
  padding-bottom: 64px;
}

/* ---- /grafo-de-productos/ in MACHINE mode: same page, same aesthetic ----- */

html.agl-machine .agl-graph-page .container-fluid {
  max-width: none;
  padding: 0;
}

html.agl-machine .agl-graph {
  margin: 0;
  color: inherit;
  font: inherit;
}

html.agl-machine .agl-graph__bar {
  display: block;
  margin: 10px 0 8px;
  padding: 0;
  border: 0;
}

html.agl-machine .agl-graph__bar .agl-eyebrow {
  display: none;
  margin: 0 0 10px;
  color: var(--m-dim);
  font: inherit;
  letter-spacing: inherit;
}

html.agl-machine .agl-graph__bar .agl-eyebrow::before {
  content: "# ";
  display: inline;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
}

html.agl-machine .agl-graph__actions {
  display: block;
  margin: 0;
}

html.agl-machine .agl-graph__bar .agl-btn {
  display: inline;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--m-accent);
  font: inherit;
  letter-spacing: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
}

html.agl-machine .agl-graph__bar .agl-btn::before { content: "["; color: var(--m-dim); text-decoration: none; display: inline-block; }
html.agl-machine .agl-graph__bar .agl-btn::after { content: "]"; color: var(--m-dim); display: inline-block; }

html.agl-machine .agl-graph__format {
  display: none;
}

html.agl-machine .agl-graph__content {
  display: block;
  font: inherit;
  color: inherit;
}

html.agl-machine .agl-graph__content > h2:first-child {
  max-width: none;
  margin: 36px 0 12px;
  color: var(--m-bright);
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
}

html.agl-machine .agl-graph__content > h2:not(:first-child) {
  display: flex;
  align-items: center;
  gap: 1ch;
  margin: 48px 0 16px;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--m-dim);
  font: inherit;
  letter-spacing: inherit;
  white-space: nowrap;
}

html.agl-machine .agl-graph__content > h2:not(:first-child)::before { content: "\2500\2500"; }
html.agl-machine .agl-graph__content > h2:not(:first-child)::after { content: ""; flex: 1; border-top: 1px solid currentColor; }

html.agl-machine .agl-graph__content > h3 {
  margin: 28px 0 10px;
  color: var(--m-bright);
  font: inherit;
}

html.agl-machine .agl-graph__content > h3::before {
  content: "// ";
  color: var(--m-dim);
}

html.agl-machine .agl-graph__content > p {
  max-width: 66ch;
  margin: 0 0 12px;
  color: inherit;
  font: inherit;
}

html.agl-machine .agl-graph__content > p:has(> strong:first-child) {
  position: relative;
  max-width: none;
  margin: 20px 0 4px;
  padding: 0 0 0 2ch;
  border: 0;
  color: inherit;
}

html.agl-machine .agl-graph__content > p:has(> strong:first-child)::before {
  content: "*";
  position: absolute;
  left: 0;
  color: var(--m-bright);
}

html.agl-machine .agl-graph__content > p > strong:first-child,
html.agl-machine .agl-graph__content > p > strong:first-child a {
  font: inherit;
  font-weight: 600;
  color: var(--m-bright);
}

html.agl-machine .agl-graph__content > ul {
  display: grid;
  gap: 3px;
  margin: 0 0 0 2ch;
  padding: 0;
  border: 0;
}

html.agl-machine .agl-graph__content > ul > li {
  position: relative;
  padding: 0 0 0 2ch;
  color: inherit;
  font: inherit;
}

html.agl-machine .agl-graph__content > ul > li::before {
  content: "-";
  position: absolute;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  color: var(--m-dim);
}

html.agl-machine .agl-graph__content > p:has(> strong:first-child) + ul,
html.agl-machine .agl-graph__content > h3 + p:has(> strong:first-child) + ul {
  margin: 4px 0 0 2ch;
  padding: 0;
  border: 0;
}

html.agl-machine .agl-graph__content a {
  color: inherit;
  text-decoration-color: currentColor;
}

/* the hidden head that MACHINE reveals on the graph page */
.agl-graph-page .agl-m-head {
  margin: 0 0 6px;
}

@media (max-width: 767px) {
  .agl-m,
  html.agl-machine .agl-graph-page {
    padding: 36px 16px 120px;
    font-size: 12px;
  }

  .agl-m h2,
  .agl-m-h1 {
    font-size: 12px;
  }

  .agl-m-kv strong {
    width: 15ch;
  }

  .agl-m-items {
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.agl-swap-in body > :not(.agl-dock),
  .agl-m-md {
    animation: agl-fade 160ms ease both;
  }

  .agl-pill {
    animation: agl-fade 160ms ease both;
  }

  .agl-pill button,
  .agl-m-tool {
    transition: color 150ms ease;
  }

  .agl-pill button:active,
  .agl-m-tool:active {
    transform: none;
  }

  .agl-thumb img,
  .agl-arrow,
  .agl-item--feature,
  .agl-btn {
    transition: none;
  }

  .agl-item:hover .agl-thumb img,
  .agl-item--feature:hover .agl-arrow,
  .agl-item--feature:active {
    transform: none;
  }
}

@keyframes agl-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .agl-dock { transition: none; }
}
