/* /explora: feed vertical a pantalla completa. Se monta como una capa fija
   sobre la cabecera del sitio para que cada tarjeta mida exactamente la
   pantalla (100dvh) sin restar nada. Los botones reutilizan las clases de
   favoritas, compartir y capturar momento para heredar su JS; aquí sólo se
   les quita el posicionamiento absoluto de la rejilla. */

.explora {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 900;
  display: flex;
  justify-content: center;
  background: #07080c;
  color: #fff;
}

.explora-feed {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  background: #000;
}

.explora-feed::-webkit-scrollbar {
  display: none;
}

.explora-feed:focus {
  outline: none;
}

.explora-feed:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
}

.explora-bar {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 3;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) max(12px, env(safe-area-inset-right, 0px)) 24px max(12px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}

.explora-bar > * {
  pointer-events: auto;
}

.explora-bar-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 21, 25, 0.55);
}

.explora-bar-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(20, 21, 25, 0.35);
  cursor: pointer;
}

.explora-menu {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 54px);
  right: max(12px, env(safe-area-inset-right, 0px));
  width: min(320px, calc(100vw - 24px));
  max-height: calc(100dvh - 90px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 16px;
  color: #fff;
  background: rgba(24, 26, 33, 0.94);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.explora-menu[hidden] {
  display: none;
}

.explora-menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  color: inherit;
  background: none;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.explora-menu-row:hover,
.explora-menu-row:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.explora-menu-row > span:nth-child(2) {
  flex: 1;
}

.explora-menu-row small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.55);
}

.explora-switch {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  transition: background 0.2s;
}

.explora-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

[aria-checked="true"] > .explora-switch {
  background: #6366f1;
}

[aria-checked="true"] > .explora-switch::after {
  transform: translateX(16px);
}

.explora-menu-info {
  margin-top: 4px;
  padding: 10px 10px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.explora-menu-info h2 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.explora-menu-info ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.explora-menu-info li {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.8);
}

.explora-menu-info li .material-icons {
  flex: none;
  font-size: 20px;
  color: #a5b4fc;
}

.explora-menu-info b {
  color: #fff;
  font-weight: 600;
}

.explora-bar-title {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.explora-card {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: linear-gradient(160deg, #161923, #0b0c11);
}

.explora-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s;
}

.explora-replay-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.12s linear;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.explora-replay-frame.is-shown {
  opacity: 1;
}

.explora-card.is-loaded .explora-img {
  opacity: 1;
}

.explora-shade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 55%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%);
  pointer-events: none;
}

.explora-info {
  position: absolute;
  left: 0;
  bottom: 0;
  right: 72px;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 24px) 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.explora-name {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.explora-name a {
  color: #fff;
}

.explora-place {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.explora-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.explora-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  color: #fff;
  background: rgba(20, 21, 25, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.explora-chip .material-icons {
  font-size: 16px;
}

.explora-chip--age {
  color: rgba(255, 255, 255, 0.8);
}

.explora-actions {
  position: absolute;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.explora .explora-action {
  position: static;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 21, 25, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.explora .explora-action .material-icons {
  font-size: 26px;
}

.explora .live-camera-fav-btn.is-favorite {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.6);
}

.explora a:focus-visible,
.explora button:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

.explora-card.is-error::after {
  content: "Sin imagen";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
}


.explora-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.explora-empty-link {
  color: #f59e0b;
}

@media (min-width: 600px) {
  .explora-feed {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 60px rgba(0, 0, 0, 0.6);
  }
}

.explora-card::before {
  display: none;
}

/* Horizontal full-bleed: la imagen se adapta al ancho y ocupa toda la pantalla
   (object-fit: cover), sin bandas laterales. */
@media (orientation: landscape) {
  .explora-feed,
  .explora-bar {
    max-width: none;
  }

  .explora-bar {
    padding-top: max(4px, env(safe-area-inset-top, 0px));
    padding-bottom: 4px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
  }

  .explora-bar-title {
    font-size: 16px;
  }

  .explora-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .explora-shade {
    height: 45%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.25) 55%, transparent);
  }

  .explora-info {
    left: max(12px, env(safe-area-inset-left, 0px));
    right: calc(max(12px, env(safe-area-inset-right, 0px)) + 216px);
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    padding: 0;
    gap: 4px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 12px;
  }

  .explora-name {
    max-width: 100%;
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .explora-place {
    font-size: 13px;
  }

  .explora-chips {
    flex-basis: 100%;
    margin-top: 0;
  }

  .explora-actions {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    flex-direction: row;
    gap: 8px;
  }

  .explora .explora-action {
    width: 44px;
    height: 44px;
  }

  .explora .explora-action .material-icons {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .explora-img,
  .explora-replay-frame {
    transition: none;
  }
}

/* INICIO gesto horizontal e historial de capturas de /explora.
   Bloque independiente del modo landscape: conservar scroll vertical y zoom. */
.explora-card {
  touch-action: pan-y pinch-zoom;
}

.explora-img {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.explora-history {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.explora-history[hidden],
.explora-history [hidden],
.explora-history-weather[hidden] {
  display: none;
}

.explora-history-caption {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 76px);
  left: 16px;
  right: 16px;
  width: fit-content;
  max-width: calc(100% - 32px);
  padding: 6px 10px;
  border-radius: 12px;
  color: #fff;
  background: rgba(20, 21, 25, 0.72);
  font-size: 12px;
  line-height: 1.4;
}

.explora-history-live {
  display: block;
  min-height: 44px;
  margin-top: 2px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
}

.explora .explora-history-arrow {
  position: absolute;
  top: 45%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(20, 21, 25, 0.62);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
}

.explora-history-prev { left: 12px; }
.explora-history-next { right: 12px; }

.explora .explora-history-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.explora-history-weather { font-size: 11px; }
/* FIN gesto horizontal e historial de capturas de /explora. */

/* El historial comparte la barra superpuesta en horizontal. */
@media (orientation: landscape) {
  .explora-history-caption {
    z-index: 4;
    top: max(4px, env(safe-area-inset-top, 0px));
    left: calc(max(12px, env(safe-area-inset-left, 0px)) + 128px);
    right: max(12px, env(safe-area-inset-right, 0px));
    display: flex;
    align-items: center;
    gap: 12px;
    width: auto;
    max-width: none;
    height: 44px;
    padding: 0;
    background: transparent;
    text-shadow: 0 1px 4px #000, 0 1px 8px #000;
  }

  .explora-history-status {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .explora-history-live {
    flex-shrink: 0;
    margin-top: 0;
    padding: 4px 8px;
  }

  .explora-history-prev {
    left: max(12px, env(safe-area-inset-left, 0px));
  }

  .explora-history-next {
    right: max(12px, env(safe-area-inset-right, 0px));
  }
}

/* Flechas y estado del historial: sólo se sugieren al entrar (clase
   .explora-hint en el feed, la quita explora.js) y luego desaparecen. Con foco
   de teclado vuelven a verse. El estado queda para lectores de pantalla. */
.explora .explora-history-arrow {
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.explora .explora-hint .explora-history-arrow:not(:disabled),
.explora .explora-history-arrow:focus-visible {
  opacity: 1;
}

.explora-history-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.explora-history-caption {
  padding: 0;
  background: transparent;
}

@media (orientation: landscape) {
  .explora-history-caption {
    left: auto;
    width: auto;
    height: auto;
  }
}

.explora-history-live {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 18px;
  background: rgba(20, 21, 25, 0.72);
  text-decoration: none;
  font-size: 13px;
}

.explora .explora-history-arrow:disabled {
  opacity: 0;
}
