/* ========================= */
/* VARIABLES CORPORATIVAS */
/* ========================= */
:root {
  --brand: #454E3C;
  --brand-dark: #30372A;
  --brand-soft: #6B735F;
  --brand-light: #EEF0EA;

  --paper: #ffffff;
  --background: #F5F4F1;
  --surface: #ffffff;

  --text: #1F1F1F;
  --muted: #666666;
  --line: #DAD8D2;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.16);
}


/* ========================= */
/* BASE */
/* ========================= */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  background: var(--background);
  color: var(--text);
}

body.lightbox-open {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
}


/* ========================= */
/* HEADER */
/* ========================= */
h1 {
  padding: 22px 24px;
  margin: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
}


/* ========================= */
/* GRID ÁLBUMES */
/* ========================= */
#albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  padding: 24px;
}

.album {
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.album:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.album-image {
  position: relative;
  overflow: hidden;
  background: #ddd;
}

.album-image img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.album:hover .album-image img {
  transform: scale(1.04);
}

.album-image h2 {
  position: absolute;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 16px;
  width: 100%;
  color: white;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.72),
    rgba(0, 0, 0, 0.34)
  );
  font-size: 22px;
  font-weight: 800;
}

.album-info {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--muted);
}


/* ========================= */
/* VISTA ÁLBUM */
/* ========================= */
#album-view {
  padding: 24px;
}

#back {
  background: var(--brand);
  color: white;
  border: none;
  padding: 11px 16px;
  cursor: pointer;
  margin-bottom: 18px;
  border-radius: 4px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s ease, transform 0.2s ease;
}

#back:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}


/* ========================= */
/* HERO DEL ÁLBUM */
/* ========================= */
.album-hero {
  position: relative;
  margin-bottom: 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #ddd;
  box-shadow: var(--shadow-sm);
}

.album-hero img {
  width: 100%;
  height: 330px;
  object-fit: cover;
}

.album-hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 24px 28px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.78),
    rgba(0, 0, 0, 0.38)
  );
  color: white;
}

.album-hero-content h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.album-hero-content p {
  margin-top: 10px;
  font-size: 14px;
}


/* ========================= */
/* GRID SECCIONES */
/* ========================= */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
  align-items: start;
}


/* ========================= */
/* TARJETAS DE SECCIÓN */
/* ========================= */
.section-wrapper {
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: visible;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.section-wrapper:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.section-card {
  cursor: pointer;
}

.section-image {
  position: relative;
  overflow: hidden;
  background: #ddd;
}

.section-image img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.section-card:hover img {
  transform: scale(1.05);
}

.section-image h3 {
  position: absolute;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 13px 14px;
  width: 100%;
  color: white;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.72),
    rgba(0, 0, 0, 0.34)
  );
  font-size: 18px;
  font-weight: 800;
}


/* ========================= */
/* GALERÍA */
/* ========================= */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;

  max-height: 0;
  overflow: hidden;
  opacity: 0;

  transition: opacity 0.35s ease, margin 0.35s ease, padding 0.35s ease;
}

.gallery.open {
  max-height: none;
  overflow: visible;
  opacity: 1;
  margin-top: 8px;
  padding: 12px;
}

.gallery img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  cursor: pointer;
  background: #eee;
  border: 1px solid var(--line);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery img:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-sm);
}


/* ========================= */
/* LIGHTBOX / CARRUSEL */
/* ========================= */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  background: rgba(0, 0, 0, 0.92);
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 32px;
}

.lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  background: #111;
}

.lightbox-caption {
  width: 100%;
  margin-top: 10px;
  color: white;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-size: 14px;
  opacity: 0.9;
}

#lightbox-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#lightbox-counter {
  flex-shrink: 0;
  color: #ddd;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 24px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  z-index: 10001;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.04);
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 72px;
  border: none;
  background: rgba(69, 78, 60, 0.78);
  color: white;
  font-size: 54px;
  line-height: 1;
  cursor: pointer;
  z-index: 10001;
  border-radius: 6px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-nav:hover {
  background: rgba(69, 78, 60, 0.95);
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}


/* ========================= */
/* BOTONES DE DESCARGA */
/* ========================= */
.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 12px;
  padding: 11px 17px;
  background: var(--brand);
  color: white;
  text-decoration: none;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.1px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.20);
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease,
    box-shadow 0.2s ease;
  appearance: none;
}

.download-btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.24);
}

.download-btn:disabled,
.download-btn.is-loading {
  background: #777;
  cursor: wait;
  opacity: 0.78;
  transform: none;
  box-shadow: none;
}

.album-hero-content .download-btn {
  margin-left: 0;
  margin-top: 16px;
}

.section-wrapper .download-btn {
  margin: 12px;
}


/* ========================= */
/* OVERLAY GENERANDO ZIP */
/* ========================= */
.zip-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(69, 78, 60, 0.72);
  z-index: 10000;
  backdrop-filter: blur(2px);
}

.zip-overlay-card {
  background: white;
  padding: 30px 34px;
  max-width: 390px;
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}

.zip-overlay-card h3 {
  margin: 14px 0 8px;
  font-size: 18px;
  color: var(--text);
}

.zip-overlay-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.zip-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border: 4px solid #E4E2DC;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: zip-spin 0.9s linear infinite;
}

@keyframes zip-spin {
  to {
    transform: rotate(360deg);
  }
}


/* ========================= */
/* RESPONSIVE */
/* ========================= */
@media (max-width: 900px) {
  #album-view {
    padding: 16px;
  }

  .album-hero img {
    height: 260px;
  }

  .sections-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .lightbox-nav {
    width: 46px;
    height: 62px;
    font-size: 46px;
  }

  .lightbox-prev {
    left: 12px;
  }

  .lightbox-next {
    right: 12px;
  }
}

@media (max-width: 600px) {
  h1 {
    font-size: 23px;
    padding: 18px;
  }

  #albums {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .album-hero img {
    height: 220px;
  }

  .album-hero-content {
    padding: 18px;
  }

  .album-hero-content h2 {
    font-size: 22px;
  }

  .sections-grid {
    grid-template-columns: 1fr;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery img {
    height: 135px;
  }

  .download-btn {
    width: calc(100% - 24px);
  }

  .lightbox {
    padding: 16px;
  }

  .lightbox-content img {
    max-width: 94vw;
    max-height: 76vh;
  }

  .lightbox-caption {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 30px;
  }

  .lightbox-nav {
    width: 42px;
    height: 58px;
    font-size: 42px;
    background: rgba(69, 78, 60, 0.86);
  }

  .lightbox-prev {
    left: 8px;
  }

  .lightbox-next {
    right: 8px;
  }
}

/* ========================= */
/* TEXTO DEL LIGHTBOX */
/* ========================= */
.lightbox-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 80%;
}

#lightbox-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

#lightbox-description {
  font-size: 13px;
  font-weight: 400;
  color: #d0d0d0;
  line-height: 1.3;
}

@media (max-width: 600px) {
  .lightbox-text {
    max-width: 100%;
    text-align: center;
  }
}
/* ========================= */
/* LIGHTBOX - CARGA DE IMAGEN */
/* ========================= */
.lightbox-content {
  position: relative;
}

.lightbox-content::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  margin-top: -21px;
  margin-left: -21px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: lightbox-spin 0.9s linear infinite;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.lightbox.is-loading .lightbox-content::before {
  opacity: 1;
}

#lightbox-img {
  opacity: 0;
  transition: opacity 0.22s ease;
}

#lightbox-img.is-loaded {
  opacity: 1;
}

.lightbox.is-loading #lightbox-title,
.lightbox.is-loading #lightbox-description,
.lightbox.is-loading #lightbox-counter {
  opacity: 0.45;
}

@keyframes lightbox-spin {
  to {
    transform: rotate(360deg);
  }
}