/* ==========================================================================
   components.css — Piezas reutilizables (isotipo, medios)
   ========================================================================== */

/* --- Isotipo: 4 puntos en cuadrícula 2×2 (rojo, verde / azul, amarillo) --- */
.dots {
  display: grid;
  grid-template-columns: repeat(2, var(--dot-size));
  gap: var(--dot-gap);
}

.dots__dot {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
}

.dots__dot--red { background: var(--brand-red); }
.dots__dot--green { background: var(--brand-green); }
.dots__dot--blue { background: var(--brand-blue); }
.dots__dot--yellow { background: var(--brand-yellow); }

/* Variante animada (portada) */
.dots--animated .dots__dot {
  animation: dot-pop 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dots--animated .dots__dot:nth-child(1) { animation-delay: 0.10s; }
.dots--animated .dots__dot:nth-child(2) { animation-delay: 0.25s; }
.dots--animated .dots__dot:nth-child(3) { animation-delay: 0.40s; }
.dots--animated .dots__dot:nth-child(4) { animation-delay: 0.55s; }

@keyframes dot-pop {
  from { opacity: 0; transform: scale(0.2); }
  to { opacity: 1; transform: scale(1); }
}

/* Variante pequeña (pie de página) */
.dots--small {
  grid-template-columns: repeat(2, var(--dot-size-sm));
  gap: var(--dot-gap-sm);
}

.dots--small .dots__dot {
  width: var(--dot-size-sm);
  height: var(--dot-size-sm);
}

/* --- Medios --- */
.media-16x9 {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-placeholder);
}

.media-16x9 iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Contenedor de reels de Instagram */
.reel {
  flex: 0 1 var(--reel-w);
  min-width: 0;
  min-height: calc(var(--reel-w) * 1.25 + 230px); /* reserva el espacio mientras carga Instagram (evita saltos) */
}

/* Texto corto debajo del reel (día, excursión…) */
.reel__caption {
  margin: 16px 0 0;
  font-size: var(--fs-label);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Celular: los dos reels lado a lado, cada uno a la mitad del ancho */
@media (max-width: 640px) {
  .reel {
    flex: 1 1 0;
    min-height: 420px;
  }

  .reel__views {
    --fs-views: 20px;
    gap: 6px;
    margin-top: 12px;
    flex-wrap: wrap;
  }
}

.reel__views {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 0;
  font-size: var(--fs-views);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--brand-blue);
}

.reel__icon {
  flex: none;
  width: var(--fs-views);
  height: var(--fs-views);
}

.reel__views-label {
  align-self: flex-end;
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-muted);
  padding-bottom: 4px;
}

.reel .instagram-media {
  min-width: 0 !important;
  width: 100% !important;
  max-width: var(--reel-w) !important;
  margin: 0 !important;
  border-radius: var(--radius) !important;
}

/* --- Video a pantalla completa (documental) ---
   Cubre todo el ancho y alto de la pantalla, recortando como un fondo.
   Con sonido (.is-sound) se muestra completo, con controles. */
.media-full {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 420px;
  overflow: hidden;
  background: var(--color-text);
}

.media-full__frame {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Cubrir la pantalla manteniendo 16:9 */
  width: max(100%, calc(100svh * 16 / 9));
  height: max(100%, calc(100vw * 9 / 16));
  transform: translate(-50%, -50%);
  border: 0;
  pointer-events: none;
}

.media-full.is-sound .media-full__frame {
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.media-full__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 24px var(--gutter);
  color: var(--color-bg);
  pointer-events: none;
}

.media-full.is-sound .media-full__caption {
  display: none;
}

.media-full__label {
  margin: 0;
  font-size: var(--fs-label);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.media-full__sound {
  pointer-events: auto;
  min-height: calc(var(--target-min) + 12px);
  padding: 0 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out);
}

.media-full__sound:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.media-full__sound:focus-visible {
  outline: 2px solid var(--color-bg);
  outline-offset: 3px;
}

/* --- Foto a pantalla completa --- */
.photo-full {
  margin: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 420px;
  overflow: hidden;
  background: var(--color-placeholder);
}

.photo-full picture,
.photo-full__img {
  width: 100%;
  height: 100%;
}

.photo-full__img {
  object-fit: cover;
  object-position: center;
}

/* --- Portada de foto que enlaza a una galería --- */
.photo-cover {
  position: relative;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 420px;
  overflow: hidden;
  color: var(--color-bg);
  background: var(--color-placeholder);
}

.photo-cover:hover {
  color: var(--color-bg);
}

.photo-cover picture,
.photo-cover__img {
  width: 100%;
  height: 100%;
}

.photo-cover__img {
  object-fit: cover;
  transition: transform 800ms var(--ease-out);
}

.photo-cover:hover .photo-cover__img {
  transform: scale(1.02);
}

.photo-cover__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 24px var(--gutter);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.35), transparent);
}

.photo-cover__label {
  font-size: var(--fs-label);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.photo-cover__cta {
  display: inline-flex;
  align-items: center;
  min-height: calc(var(--target-min) + 12px);
  padding: 0 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: var(--fs-small);
  font-weight: 500;
  transition: background-color var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out);
}

.photo-cover:hover .photo-cover__cta,
.photo-cover:focus-visible .photo-cover__cta {
  background: var(--color-bg);
  color: var(--color-text);
}

.photo-cover:focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: -3px;
}

/* --- Fila de fotos verticales (2 o 3 lado a lado, alto de pantalla) --- */
.photo-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  height: 100vh;
  height: 100svh;
  min-height: 420px;
}

.photo-row--2 { --cols: 2; }
.photo-row--3 { --cols: 3; }
.photo-row--4 { --cols: 4; }

.photo-row__item {
  margin: 0;
  overflow: hidden;
  background: var(--color-placeholder);
}

.photo-row__item picture,
.photo-row__item .photo-full__img {
  width: 100%;
  height: 100%;
}

.photo-row__item .photo-full__img {
  object-fit: cover;
}

/* En celular las filas se deshacen y sus fotos se acomodan en el collage (ver gallery.css) */

/* Foto vertical a pantalla completa: recorte centrado en la cara */
.photo-full--top .photo-full__img {
  object-position: center 50%;
}

/* --- Foto firmada con el logo de ALGOLOCAL (esquina inferior izquierda) --- */
.photo-full--signed {
  position: relative;
}

.photo-sign {
  position: absolute;
  left: var(--gutter);
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-bg);
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.45));
}

.photo-sign .dots--small {
  grid-template-columns: repeat(2, 10px);
  gap: 4px;
}

.photo-sign .dots--small .dots__dot {
  width: 10px;
  height: 10px;
}

.photo-sign__name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}

/* --- Créditos (equipo de un proyecto) --- */
.credits {
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 64px var(--gutter) 40px;
}

.credits__row {
  display: grid;
  align-content: start;
  gap: 6px;
}

.credits__role {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--fs-label);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-muted);
}

.credits__role::before {
  content: "";
  flex: none;
  margin-top: 0.35em; /* alineado con la primera línea aunque el rol ocupe dos */
  width: var(--dot-size-sm);
  height: var(--dot-size-sm);
  border-radius: 50%;
  background: var(--brand-blue);
}

/* Color del punto por persona (Raúl azul, Luigi rojo…) */
.credits__row--red .credits__role::before { background: var(--brand-red); }
.credits__row--green .credits__role::before { background: var(--brand-green); }
.credits__row--blue .credits__role::before { background: var(--brand-blue); }
.credits__row--yellow .credits__role::before { background: var(--brand-yellow); }

.credits__names {
  margin: 0;
  font-size: var(--fs-body);
}

/* Varias personas en un mismo crédito: una por línea */
.credits__person {
  display: block;
}

.credits__person + .credits__person {
  margin-top: 4px;
}

.credits__link {
  color: var(--color-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.credits__link:hover {
  color: var(--color-text);
}

/* Variante dentro de un encabezado: sin relleno propio */
.credits--inline {
  padding: 0;
  margin-top: 24px;
}

@media (min-width: 900px) {
  .credits:not(.credits--inline) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 32px;
  }
}

/* --- Barra superior de páginas internas (galería, casos) --- */
.gallery-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 24px var(--gutter);
}

.gallery-bar__home {
  display: inline-flex;
  min-height: calc(var(--target-min) + 8px);
  align-items: center;
}

