/* ════════════════════════════════════════════════════
   Historia – Comparador de Imágenes
   ════════════════════════════════════════════════════ */

/* ── Variables compartidas ── */
.hist {
  --h-green: #2e7d32;
  --h-green-lt: #4caf50;
  --h-dark: #1a1a2e;
  --h-ink: #333;
  --h-sub: #777;
  --h-line: #e8e8e8;
  background: #fff;
  padding: 40px 0 36px;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--h-ink);
}

.hist h2 {
  font-family: 'Playfair Display', serif;
  color: var(--h-dark);
}

.hist__box {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */
.hist__head {
  text-align: center;
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(20px);
  transition: all .55s ease;
}

.hist__head.show {
  opacity: 1;
  transform: none;
}

.hist__logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(46, 125, 50, .15));
  animation: float-logo 3s ease-in-out infinite;
}

@keyframes float-logo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hist__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--h-green);
  margin-bottom: 6px;
}

.hist__tag::before,
.hist__tag::after {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--h-green);
  border-radius: 2px;
}

.hist__h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 4px;
}

.hist__h2 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--h-green), var(--h-green-lt));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hist__sub {
  font-size: .88rem;
  color: var(--h-sub);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ── Comparador ── */
.cmp {
  max-width: 1100px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(24px);
  transition: all .6s ease .1s;
}

.cmp.show {
  opacity: 1;
  transform: none;
}

.cmp__frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .09);
  border: 1px solid var(--h-line);
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
  aspect-ratio: 16 / 9;
}

.cmp__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.cmp__after {
  clip-path: inset(0 0 0 50%);
}

.cmp__line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #fff;
  z-index: 3;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0, 0, 0, .25);
  transition: left 0s;
}

.cmp__handle {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--h-green-lt);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  transition: box-shadow .25s, border-color .25s;
}

.cmp__handle:hover,
.cmp__frame:active .cmp__handle {
  border-color: var(--h-green);
  box-shadow: 0 4px 20px rgba(46, 125, 50, .3);
}

.cmp__handle svg {
  width: 20px;
  height: 20px;
  fill: var(--h-green);
  pointer-events: none;
}

/* ── Logo esquina superior derecha ── */
.cmp__corner-logo {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 60px;
  height: 60px;
  object-fit: contain;
  z-index: 5;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .3));
  transition: transform .3s ease;
}

.cmp__frame:hover .cmp__corner-logo {
  transform: scale(1.08);
}

/* ── Frases sobre las imágenes ── */
.cmp__phrase {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
  max-width: 45%;
}

.cmp__phrase p {
  color: #fff;
  font-family: 'Playfair Display', serif;
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 600;
  font-style: italic;
  line-height: 1.4;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .6), 0 0 30px rgba(0, 0, 0, .4);
  margin: 0;
}

.cmp__phrase--before {
  left: 20px;
  text-align: left;
}

.cmp__phrase--after {
  right: 20px;
  text-align: right;
}

@media (max-width: 700px) {
  .cmp__corner-logo {
    width: 45px;
    height: 45px;
    top: 10px;
    right: 10px;
  }
  .cmp__phrase p {
    font-size: .85rem;
  }
  .cmp__phrase--before {
    left: 12px;
  }
  .cmp__phrase--after {
    right: 12px;
  }
}

@media (max-width: 500px) {
  .cmp__phrase {
    display: none;
  }
}

.cmp__label {
  position: absolute;
  top: 14px;
  z-index: 2;
  padding: 4px 14px;
  border-radius: 30px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.cmp__label--before {
  left: 14px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
}

.cmp__label--after {
  right: 14px;
  background: rgba(255, 255, 255, .85);
  color: var(--h-dark);
}

/* ── Badges Contextualizados ── */
.cmp__badge {
  position: absolute;
  bottom: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: .8rem;
  font-weight: 600;
  pointer-events: none;
  backdrop-filter: blur(10px);
  transition: transform .3s ease, opacity .3s ease;
}

.cmp__badge i {
  font-size: 1rem;
}

.cmp__badge--before {
  left: 16px;
  background: linear-gradient(135deg, rgba(139, 90, 43, .85), rgba(101, 67, 33, .9));
  color: #fff;
  box-shadow: 0 4px 16px rgba(101, 67, 33, .3);
}

.cmp__badge--after {
  right: 16px;
  background: linear-gradient(135deg, rgba(46, 125, 50, .9), rgba(76, 175, 80, .85));
  color: #fff;
  box-shadow: 0 4px 16px rgba(46, 125, 50, .3);
}

.cmp__frame:hover .cmp__badge {
  transform: translateY(-3px);
}

@media (max-width: 600px) {
  .cmp__badge {
    padding: 8px 12px;
    font-size: .7rem;
    border-radius: 8px;
  }
  .cmp__badge i {
    font-size: .85rem;
  }
  .cmp__badge span {
    display: none;
  }
}

.cmp__caption {
  text-align: center;
  margin-top: 10px;
  font-size: .78rem;
  color: var(--h-sub);
}

.cmp__caption i {
  color: var(--h-green);
  margin-right: 4px;
}
