/* =====================================================
   GALERIA - Diseno PCSC
   Paleta suavizada alineada con noticias y biblioteca
===================================================== */
:root {
  --rojo: #0f4d78;
  --rojo-light: #1c7ab6;
  --dorado: #f7b426;
  --dorado-light: #f9d67a;
  --azul: #0f4d78;
  --azul-light: #1c7ab6;
  --bg: #f4f7fb;
  --text: #10223a;
  --muted: #667085;
  --card: #ffffff;
  --shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.07);
  --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.12);
  --radius: 16px;
}

* { box-sizing: border-box; }
a { text-decoration: none; color: inherit; }

/* BODY */
body[data-page="galeria"] {
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding-top: var(--header-height);
  font-family: 'Roboto', system-ui, sans-serif;
}

body[data-page="galeria"] main.container {
  width: min(96vw, 1380px);
  max-width: none;
  padding-inline: 12px;
}

/* HERO */
.hero {
  background:
    linear-gradient(120deg, rgba(10, 10, 16, 0.76), rgba(15, 77, 120, 0.72)),
    url('../img/aniversario.jpg') center/cover no-repeat;
  color: #fff;
  margin-top: 0;
  position: relative;
  overflow: hidden;
  min-height: 255px;
  display: flex;
  align-items: flex-end;
}

.hero .container {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding-bottom: 28px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.hero h1 span {
  color: var(--dorado);
}

.hero p {
  margin: 0;
  color: #f0e8e8;
  font-size: 1.05rem;
}

.crumbs {
  margin-top: 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.65);
}
.crumbs a { color: var(--dorado-light); }
.crumbs a:hover { color: var(--dorado); }
.crumbs span { color: #fff; font-weight: 700; }

/* Decoracion esquina */
.hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 28px;
  background: var(--bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}

/* CONTROLES */
.controls {
  width: min(92vw, 1080px);
  margin: 20px auto 0;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-top: 3px solid rgba(15, 77, 120, 0.72);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  position: relative;
}

/* Chips de categorias */
.chip {
  min-height: 36px;
  padding: 0 16px;
  border: 1.5px solid rgba(15, 77, 120, 0.14);
  border-radius: 999px;
  background: #fff;
  color: var(--azul);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.chip[aria-pressed="true"] {
  background: var(--azul);
  color: #fff;
  border-color: var(--azul);
  box-shadow: 0 10px 18px rgba(28, 122, 182, 0.22);
}
.chip:hover:not([aria-pressed="true"]) {
  background: #eef6fb;
  border-color: rgba(15, 77, 120, 0.28);
}

/* Busqueda */
.search {
  margin-left: auto;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid rgba(15, 77, 120, 0.14);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search i { color: var(--azul); }
.search input {
  border: none; outline: none;
  min-width: min(180px, 100%);
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
}
.search input::placeholder { color: #9ca3af; }
.search:focus-within {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(28, 122, 182, 0.14);
}

/* select orden */
.select {
  min-height: 36px;
  border: 1.5px solid rgba(15, 77, 120, 0.14);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.select:focus { border-color: var(--azul); }

/* GRID */
.grid {
  margin: 20px 0 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 580px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1240px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

/* CARD */
.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  position: relative;
  background: var(--card);
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  cursor: pointer;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

/* Linea de acento superior */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--azul), var(--dorado));
  z-index: 2;
  opacity: 0;
  transition: opacity 0.25s;
}
.card:hover::before { opacity: 1; }

.card figure {
  margin: 0;
  position: relative;
  overflow: hidden;
}

.card img {
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  object-position: center 18%;
  display: block;
  background: #e5e7eb;
  transition: transform 0.4s ease;
}
.card:hover img { transform: scale(1.04); }

.card.size-large img { aspect-ratio: 5 / 7; }
.card.size-medium img { aspect-ratio: 5 / 7; }
.card.size-small img { aspect-ratio: 5 / 7; }


.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.42);
  color: rgba(31, 41, 55, 0.92);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
  border-top: 1px solid rgba(17, 24, 39, 0.06);
  background: #fff;
}
.meta > div { flex: 1; min-width: 0; }
.meta .title {
  font-weight: 800;
  color: var(--text);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta .desc {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta .dot {
  flex: 0 0 auto;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}

.btn {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(15, 77, 120, 0.18);
  background: transparent;
  color: var(--azul);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.btn:hover {
  background: var(--azul);
  color: #fff;
  box-shadow: 0 10px 18px rgba(28, 122, 182, 0.22);
}
.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}
.btn-icon i {
  font-size: 0.98rem;
}
.actions-overlay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  z-index: 3;
}
.actions-overlay .btn-icon {
  background: rgba(255,255,255,0.96);
  color: var(--azul);
  backdrop-filter: blur(8px);
  border-color: rgba(15, 77, 120, 0.16);
}
.actions-overlay .btn-icon:hover,
.actions-overlay .btn-icon:focus-visible {
  background: var(--azul);
  color: #fff;
  border-color: var(--azul);
  box-shadow: 0 12px 22px rgba(28, 122, 182, 0.26);
}
.actions-overlay .btn-icon.primary {
  background: rgba(255,255,255,0.96);
  color: var(--azul);
  border-color: rgba(15, 77, 120, 0.16);
}
.actions-overlay .btn-icon.primary:hover,
.actions-overlay .btn-icon.primary:focus-visible {
  background: var(--azul);
  color: #fff;
  border-color: var(--azul);
}
.btn.primary {
  background: #eef6fb;
  color: var(--azul);
  border-color: rgba(15, 77, 120, 0.14);
}
.btn.primary:hover {
  background: var(--azul);
  border-color: var(--azul);
  color: #fff;
}

.loadmore {
  display: flex;
  justify-content: center;
  margin: 8px 0 24px;
}
.btn-ghost {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #0f4d78, #1c7ab6);
  color: #fff;
  border: none;
  padding: 13px 28px;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  box-shadow: 0 14px 28px rgba(28, 122, 182, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
}
.btn-ghost:hover {
  background: linear-gradient(135deg, #155c8d, #2587c6);
  box-shadow: 0 18px 32px rgba(28, 122, 182, 0.28);
  transform: translateY(-2px);
}
.btn-ghost i { transition: transform 0.2s; }
.btn-ghost:hover i { transform: translateY(2px); }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10,0,0,0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 6px 16px 8px;
  overflow-y: auto;
}
.lightbox.hidden { display: none; }

.lightbox-inner {
  width: min(1100px, 96vw);
  max-height: none;
  margin: auto;
  display: grid;
  gap: 8px;
  justify-items: center;
  align-content: center;
}

.lb-main {
  width: min(94vw, 860px);
  max-width: min(94vw, 860px);
  display: grid;
  gap: 10px;
  justify-items: center;
  position: relative;
}

.lb-category-chip {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(calc(-100% - 10px));
  z-index: 3;
  background: rgba(15, 77, 120, 0.92);
  color: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.24);
}

.lb-main > img {
  width: auto;
  margin-inline: auto;
  height: auto;
  max-width: min(94vw, 860px);
  max-height: min(82vh, calc(100vh - 110px));
  object-fit: contain;
  border-radius: 14px;
  display: block;
  box-shadow: 0 0 0 2px rgba(28, 122, 182, 0.18);
}

.lightbox .lb-meta {
  position: static;
  max-width: min(94vw, 860px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  color: #e5e7eb;
  width: 100%;
  margin: 0;
}
.lightbox .lb-meta > div:first-child { max-width: 70%; }
.lightbox .lb-meta > .lb-caption {
  white-space: nowrap;
  text-align: right;
  align-self: flex-end;
}

.lb-title { font-weight: 900; font-size: 19px; color: #fff; }
.lb-caption { font-size: 13px; color: #cbd5e1; }

.lb-controls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.lb-btn {
  pointer-events: auto;
  background: rgba(15, 77, 120, 0.44);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.lb-btn:hover { background: var(--azul); }

.lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.lb-related {
  width: min(92vw, 760px);
  color: #e5e7eb;
  margin-top: 0;
}
.lb-related-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #d6e7f5;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.lb-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--azul) transparent;
}
.lb-thumb {
  border: 2px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color 0.2s;
}
.lb-thumb img {
  width: 76px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.lb-thumb.active { border-color: var(--azul-light); }
.lb-thumb:hover:not(.active) { border-color: rgba(28, 122, 182, 0.45); }

@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border-radius: 14px;
  }
  .controls .search { margin-left: 0; width: 100%; }
  .controls .select { width: 100%; }
  .chips { flex-wrap: wrap; }

  .card img,
  .card.size-large img,
  .card.size-medium img,
  .card.size-small img { aspect-ratio: 5 / 7; }
}

@media (max-height: 780px) {
  .lightbox { padding: 3px 10px 4px; }
  .lightbox-inner { gap: 4px; }
  .lb-main > img {
    max-width: min(94vw, 820px);
    max-height: min(74vh, calc(100vh - 100px));
  }
  .lb-title { font-size: 17px; }
  .lb-thumb img { width: 68px; height: 48px; }
}

.sr-only {
  position: absolute; left: -10000px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}

@media (max-width: 900px) {
  .lb-category-chip {
    top: 10px;
    left: 10px;
    transform: none;
  }
}