/* KC EPÍSTOLA · fotos rectangulares y jardín de progreso. */
#historia { overflow-x: clip; }
#historia .kc-story__year:empty,
#historia .kc-story__item h3:empty,
#historia .kc-story__item p:empty { display: none; }
.ep-garden {
  --ep-pw: min(58vw, 15rem);
  --ep-gap: 1rem;
  --ep-travel: 0px;
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  isolation: isolate;
}
.ep-garden__layers {
  position: absolute;
  z-index: 0;
  inset: 0 0 2.5rem;
  overflow: hidden;
  pointer-events: none;
}
.ep-garden__flora {
  position: absolute;
  left: 0;
  bottom: 0;
  height: clamp(11rem, 30vh, 17rem);
  will-change: transform;
}
.ep-garden__ground {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 4.4rem;
  z-index: 4;
  max-width: none;
  object-fit: fill;
}
.ep-garden__plant {
  position: absolute;
  left: 12.5%;
  bottom: 1.6rem;
  width: clamp(4.6rem, 19vw, 8rem);
  aspect-ratio: 4 / 7;
  transform: translateX(-50%) scale(calc(var(--f, 1) * var(--s, 1)), calc(var(--s, 1) * var(--g, 0)));
  transform-origin: 50% 100%;
  will-change: transform; /* capa propia: crecer no repinta toda la franja */
}
.ep-garden__plant img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}
.ep-garden__plant-bud { opacity: calc(1 - clamp(0, (var(--g, 0) - .5) * 2, 1)); }
.ep-garden__plant-bloom {
  opacity: clamp(0, (var(--g, 0) - .5) * 2, 1);
  transform: scale(calc(1 + (1 - clamp(0, (var(--g, 0) - .5) * 2, 1)) * .025));
  transform-origin: 50% 100%;
}
.ep-garden .kc-story {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: var(--ep-gap);
  padding: 1.6rem 0 11rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ep-garden .kc-story::-webkit-scrollbar { display: none; }
.ep-garden .kc-story:focus-visible { outline: 2px solid var(--ep-burgundy-ribbon); outline-offset: -6px; }
.ep-garden .kc-story__item {
  position: relative;
  flex: 0 0 var(--ep-pw);
  width: var(--ep-pw);
  padding: 0;
  gap: .5rem;
  scroll-snap-align: center;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.ep-garden .kc-story__item:first-child { margin-inline-start: calc((100vw - var(--ep-pw)) / 2); }
.ep-garden .kc-story__item:last-child { margin-inline-end: calc((100vw - var(--ep-pw)) / 2); }
.ep-garden .kc-story__photo {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: visible;
  border-radius: 0;
  background: none;
  /* R4 (clienta): las fotos tal cual, rectangulares; filete de plata y sombra de papel. */
  box-shadow: 0 0.5px 1px rgba(52, 17, 29, .25), 0 .6rem 1.4rem -.5rem rgba(52, 17, 29, .3);
}
.ep-garden .kc-story__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: none;
}
.ep-garden .kc-story__photo::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(215, 216, 221, .85);
  pointer-events: none;
}
.ep-garden .kc-story__item::before { content: none; }
.ep-garden .kc-story__item:nth-child(odd) { margin-top: .4rem; }
/* R3.2 (CEO): indicador de scroll hacia la derecha, entre el título y las gotas. */
.ep-garden__hint {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  margin: .1rem 0 -.6rem;
  font-family: var(--ep-font-caps);
  font-size: .72rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--ep-burgundy-ribbon, #6E1F33);
  transition: opacity .5s ease, transform .5s ease;
  pointer-events: none;
  user-select: none;
}
.ep-garden__hint-arrow {
  position: relative;
  width: 4.2rem;
  height: 9px;
}
/* Filete de plata que se traza hacia la derecha… */
.ep-garden__hint-arrow::before {
  content: "";
  position: absolute;
  left: 0;
  right: 2px;
  top: 4px;
  height: 1px;
  background: linear-gradient(90deg, rgba(110, 31, 51, .1), rgba(110, 31, 51, .55) 55%, rgba(110, 31, 51, .85));
  transform-origin: 0 50%;
}
/* …y el chevrón viaja con él. */
.ep-garden__hint-arrow::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 0;
  width: 8px;
  height: 8px;
  border-top: 1.3px solid currentColor;
  border-right: 1.3px solid currentColor;
  rotate: 45deg;
}
.ep-garden__hint.is-gone { opacity: 0; transform: translateX(10px); }
@media (prefers-reduced-motion: no-preference) {
  .ep-garden__hint:not(.is-gone) .ep-garden__hint-word { animation: ep-hint-breathe 2s ease-in-out infinite; }
  .ep-garden__hint:not(.is-gone) .ep-garden__hint-arrow::before { animation: ep-hint-line 2s ease-in-out infinite; }
  .ep-garden__hint:not(.is-gone) .ep-garden__hint-arrow::after { animation: ep-hint-chevron 2s ease-in-out infinite; }
}
@keyframes ep-hint-breathe { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
@keyframes ep-hint-line { 0%, 10% { scale: 0 1; } 55%, 80% { scale: 1 1; } 100% { scale: 1 1; opacity: 0; } }
@keyframes ep-hint-chevron { 0%, 10% { opacity: 0; translate: -2.6rem 0; } 55% { opacity: 1; translate: 0 0; } 80% { opacity: 1; translate: .35rem 0; } 100% { opacity: 0; translate: .6rem 0; } }

@media (min-width: 40rem) { .ep-garden { --ep-gap: 1.6rem; } }
@media (min-width: 64rem) and (prefers-reduced-motion: no-preference) {
  #historia[data-ep-mode="pin"] { height: calc(100svh + var(--ep-travel, 0px)); padding-block: 0; }
  #historia[data-ep-mode="pin"] .kc-container {
    position: sticky;
    top: 0;
    height: 100svh;
    max-width: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: 1.6rem 1rem;
  }
  #historia[data-ep-mode="pin"] .kc-container > .kc-title { flex: none; }
  #historia[data-ep-mode="pin"] .kc-title { margin-bottom: .4rem; }
  #historia[data-ep-mode="pin"] .ep-garden {
    --ep-pw: clamp(13rem, calc((100svh - 22rem) * .58), 20rem);
    --ep-gap: 2.6rem;
    flex: none;
    align-self: flex-start;
  }
  #historia[data-ep-mode="pin"] .ep-garden .kc-story {
    width: max-content;
    min-width: 100%;
    overflow: visible;
    scroll-snap-type: none;
    will-change: transform;
  }
  #historia[data-ep-mode="pin"] .ep-garden { overflow: clip; }
  /* En escritorio las gotas son grandes: el jardín se queda bajo los capítulos. */
  #historia[data-ep-mode="pin"] .ep-garden__plant { width: clamp(3.6rem, 4.6vw, 5.4rem); bottom: 1.2rem; }
  #historia[data-ep-mode="pin"] .ep-garden__flora { height: clamp(8rem, 20vh, 11rem); }
}
@media (prefers-reduced-motion: reduce) {
  .ep-garden .kc-story { scroll-behavior: auto; }
  .ep-garden__plant { transform: translateX(-50%) scale(calc(var(--f, 1) * var(--s, 1)), var(--s, 1)); }
  .ep-garden__plant-bloom { opacity: 1; transform: none; }
  .ep-garden__plant-bud { opacity: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .ep-garden .kc-story__item[data-reveal] { transform: translateY(34px) scale(.955); transition: opacity .9s var(--ep-ease-paper), transform 1.1s var(--ep-ease-paper); }
  .ep-garden .kc-story__item.is-revealed { transform: none; }
  .ep-garden__plant-bud, .ep-garden__plant-bloom { transition: opacity .16s linear, transform .35s cubic-bezier(.2, .8, .3, 1); }
}
