:root {
  --navy: #08284f;
  --navy-2: #061a34;
  --gold: #ffb81c;
  --ink: #0f1b2f;
  --muted: #707783;
  --line: #e1e5ec;
  --surface: #f6f7fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { width: 100%; overflow-x: hidden; background: var(--surface); }
body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  overflow-x: hidden;
}
body.lb-open { overflow: hidden; }

button, a { -webkit-tap-highlight-color: transparent; }

/* ── App shell ─────────────────────────────────────────────────────────────── */

.gallery-app {
  width: 100%;
  min-height: 100vh;
  background: var(--surface);
  padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */

.gallery-hero {
  position: relative;
  min-height: clamp(250px, 31vw, 340px);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(122deg, transparent 0 18%, rgba(255,255,255,.035) 18% 28%, transparent 28% 100%),
    linear-gradient(62deg,  transparent 0 68%, rgba(255,255,255,.03)  68% 76%, transparent 76% 100%),
    radial-gradient(circle at 56% 20%, rgba(24,73,120,.45), transparent 34%),
    linear-gradient(145deg, #092c5a 0%, #071f42 48%, #031224 100%);
}

.gallery-hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  height: 5px;
  background: var(--gold);
}

.hero-bar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  width: min(1180px, calc(100% - 48px));
  min-height: clamp(220px, 28vw, 300px);
  margin: 0 auto;
  padding: 20px 0 28px;
}

.hero-bar h1 {
  margin: 0;
  font-size: clamp(38px, 4.8vw, 76px);
  font-weight: 850;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
  letter-spacing: .1em;
  text-shadow: 0 3px 10px rgba(0,0,0,.26);
}

.hero-bar img {
  align-self: center;
  width: clamp(130px, 18vw, 200px);
  height: clamp(130px, 18vw, 200px);
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.35));
}

/* ── Panel ─────────────────────────────────────────────────────────────────── */

.gallery-panel {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 30px;
}

/* ── Empty state ───────────────────────────────────────────────────────────── */

.g-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

/* ── Breadcrumb ────────────────────────────────────────────────────────────── */

.g-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.g-bc-link {
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.g-bc-link:hover { color: var(--gold); }

.g-bc-sep svg {
  width: 14px;
  height: 14px;
  opacity: .4;
  vertical-align: middle;
}

.g-bc-current { color: var(--ink); }

/* ── Album grid (portada) ──────────────────────────────────────────────────── */

.g-album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.g-album-card {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: #d5dce8;
  color: #fff;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 3px 14px rgba(9,43,99,.14);
  transition: transform .18s ease, box-shadow .18s ease;
}

.g-album-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(9,43,99,.2);
}

.g-album-thumb {
  position: absolute;
  inset: 0;
}

.g-album-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .22s ease;
}

.g-album-card:hover .g-album-thumb img { transform: scale(1.04); }

.g-album-no-cover {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #0d3268 0%, #061a3a 55%, #020d1f 100%);
  color: rgba(255,255,255,.55);
}

.g-album-no-cover svg {
  width: 58px;
  height: 58px;
  filter: drop-shadow(0 2px 8px rgba(255,184,28,.18));
}

.g-album-card:hover .g-album-no-cover svg {
  color: var(--gold);
  filter: drop-shadow(0 2px 14px rgba(255,184,28,.45));
  transition: color .2s, filter .2s;
}

.g-album-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.78) 100%);
  pointer-events: none;
}

.g-album-info {
  position: absolute;
  z-index: 1;
  left: 16px;
  right: 14px;
  bottom: 16px;
  display: grid;
  gap: 5px;
}

.g-album-info strong {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
}

.g-album-info span {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.85);
}

/* ── Album header ──────────────────────────────────────────────────────────── */

.g-album-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.g-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(9,43,99,.22);
}

.g-back-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.g-album-title {
  min-width: 0;
}

.g-album-title h2 {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.g-album-title span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

/* ── Masonry grid ──────────────────────────────────────────────────────────── */

.g-masonry {
  columns: 4;
  column-gap: 6px;
}

.g-brick {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  break-inside: avoid;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: #d5dce8;
  cursor: pointer;
  position: relative;
}

.g-brick img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: transform .2s ease, filter .2s ease;
}

.g-brick:hover img {
  transform: scale(1.03);
  filter: brightness(1.06);
}

/* ── Lightbox ──────────────────────────────────────────────────────────────── */

#gLightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
}

#gLightbox.lb-active {
  display: flex;
}

.lb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .93);
  cursor: zoom-out;
}

.lb-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 64px 80px 20px;
}

.lb-img {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .2s ease;
  display: block;
}

.lb-img.lb-img-ready { opacity: 1; }

.lb-spinner {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
}

.lb-spinner::after {
  content: "";
  display: block;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,.18);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lb-spin .7s linear infinite;
}

@keyframes lb-spin { to { transform: rotate(360deg); } }

/* Barra superior */

.lb-top-bar {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,.6) 0%, transparent 100%);
}

.lb-counter {
  margin-right: auto;
  color: rgba(255,255,255,.75);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
}

/* Botones del lightbox */

.lb-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background .15s ease;
  flex-shrink: 0;
}

.lb-btn:hover { background: rgba(255,255,255,.26); }

.lb-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lb-dl { background: rgba(255, 184, 28, .18); color: var(--gold); }
.lb-dl:hover { background: rgba(255, 184, 28, .35); }

/* Flechas prev/next */

.lb-prev,
.lb-next {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,.14);
}

.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-prev svg,
.lb-next svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.2;
}

/* ── Bottom nav ────────────────────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 100%);
  bottom: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(4,22,48,.94);
  border-top: 1px solid rgba(255,255,255,.16);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -14px 34px rgba(0,0,0,.26);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bn-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 62px;
  border: 0;
  background: none;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
}

.bn-tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bn-tab.bn-active { color: #ffb81c; }

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .g-masonry { columns: 3; }
}

@media (max-width: 640px) {
  .gallery-app { background: #fff; }
  .gallery-hero { min-height: 140px; }

  .hero-bar {
    width: calc(100% - 24px);
    min-height: 140px;
    gap: 12px;
    padding: 14px 0 16px;
  }

  .hero-bar img {
    width: 90px;
    height: 90px;
  }

  .hero-bar h1 {
    font-size: clamp(27px, 9vw, 38px);
    letter-spacing: .09em;
  }

  .gallery-panel {
    width: calc(100% - 20px);
    padding: 16px 0 20px;
  }

  .g-album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .g-album-card { min-height: 160px; }
  .g-album-info strong { font-size: 17px; }

  .g-masonry { columns: 2; column-gap: 4px; }
  .g-brick { margin-bottom: 4px; border-radius: 4px; }

  .lb-stage { padding: 60px 8px 16px; }
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
  .lb-prev, .lb-next { width: 40px; height: 40px; }
}
