/* ==========================================================================
   ZAGREB — LA CRÓNICA DEL CORAZÓN AUSTROHÚNGARO DE CROACIA
   Diseño Web Inmersivo & Elegante | HSL & Variables CSS | Glassmorphism & Motion
   ========================================================================== */

:root {
  /* Tipografías */
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  /* Paleta de Colores "Zagreb & Elegancia Imperial" */
  --bg-dark: #0a1118;          /* Noche Mitteleuropa Profunda */
  --bg-surface: #101d28;       /* Pizarra Barroca */
  --bg-card: #162636;          /* Tarjeta Elevada */
  --bg-card-hover: #1e3348;    /* Tarjeta Hover */
  
  --text-main: #f4f7fa;        /* Blanco Piedra */
  --text-muted: #a4b8c9;       /* Ceniza Suave */
  --text-dim: #6d8498;         /* Texto Secundario */

  --accent-gold: #d4a373;      /* Dorado Arenisca Imperial */
  --accent-gold-bright: #e4b88a;
  --accent-terracotta: #c05621;/* Rojo Teja Emblemático de San Marcos */
  --accent-blue: #2563eb;      /* Azul Tranvía ZET de Zagreb */
  --accent-teal: #00a896;      /* Turquesa Suave */

  --border-subtle: rgba(164, 184, 201, 0.12);
  --border-gold: rgba(212, 163, 115, 0.3);
  --border-terracotta: rgba(192, 86, 33, 0.3);

  /* Sombras y Elevación */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.7);
  --shadow-gold: 0 0 25px rgba(212, 163, 115, 0.18);

  /* Radios y Curvas */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* Transiciones */
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --transition: all 0.35s var(--ease-out);
  --max-width: 1700px;
}

/* Reset Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  scrollbar-gutter: stable;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.lightbox-open {
  overflow: hidden;
}

/* Utilidad para accesibilidad (lectores de pantalla) */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* Selección de texto y tipografía balanceada */
::selection {
  background: rgba(212, 163, 115, 0.35);
  color: #fff;
}

h1, h2, h3 {
  text-wrap: balance;
}

/* Link de Accesibilidad */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-gold);
  color: var(--bg-dark);
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  z-index: 10000;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--accent-terracotta);
}

/* HERO SECTION */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 6rem 1.5rem 4rem;
  overflow: hidden;
  background-color: var(--bg-surface);
}

.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.45) contrast(1.1);
  transform: scale(1.03);
  transition: transform 1.2s var(--ease-out);
}

.hero:hover .hero__bg {
  transform: scale(1.06);
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(10, 17, 24, 0.4) 0%, rgba(10, 17, 24, 0.85) 100%),
              linear-gradient(to bottom, rgba(10, 17, 24, 0.3), var(--bg-dark));
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.1rem;
  background: rgba(212, 163, 115, 0.12);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold-bright);
  backdrop-filter: blur(12px);
  margin-bottom: 1.5rem;
}

.hero__badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-terracotta);
  box-shadow: 0 0 10px var(--accent-terracotta);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(3.5rem, 9vw, 7.5rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
  margin-bottom: 1.25rem;
}

.hero__lead {
  font-size: clamp(1.2rem, 2.8vw, 1.8rem);
  font-weight: 300;
  color: var(--text-main);
  max-width: 750px;
  margin: 0 auto 0.75rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.hero__sublead {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  color: var(--accent-gold);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: var(--transition);
}

.hero__scroll:hover {
  color: var(--accent-gold);
}

.hero__scroll-indicator {
  width: 24px;
  height: 40px;
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-full);
  position: relative;
}

.hero__scroll-indicator::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  background-color: var(--accent-gold);
  border-radius: 2px;
  animation: scrollDot 2s infinite ease-in-out;
}

@keyframes scrollDot {
  0% { transform: translateY(0); opacity: 1; }
  80% { transform: translateY(16px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* HISTORIA / STORY SECTION */
.story {
  padding: 6rem 1.5rem;
  background: linear-gradient(to bottom, var(--bg-dark), var(--bg-surface));
  border-bottom: 1px solid var(--border-subtle);
}

.story__inner {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.story__eyebrow {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-terracotta);
  margin-bottom: 0.75rem;
}

.story__title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 500;
  line-height: 1.15;
  color: var(--text-main);
  margin-bottom: 2rem;
}

.story__body {
  font-size: 1.125rem;
  color: var(--text-muted);
  text-align: left;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.story__body p strong {
  color: var(--accent-gold-bright);
  font-weight: 600;
}

.story__body p em {
  color: var(--text-main);
  font-style: italic;
}

/* SECCIÓN DE GALERÍA Y FILTROS */
.gallery-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.5rem 7rem;
}

.gallery-section__header {
  text-align: center;
  max-width: 900px;
  margin: 0 auto 3.5rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 2rem 0 1rem;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-gold);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-terracotta));
  color: var(--bg-dark);
  border-color: transparent;
  font-weight: 700;
  box-shadow: var(--shadow-gold);
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
}

.filter-btn.active .filter-count {
  background: rgba(10, 17, 24, 0.3);
  color: #fff;
}

.gallery-section__hint {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 1rem;
}

/* REJILLA MASONRY DE GALERÍA */
/* REJILLA MASONRY DE GALERÍA EN CASCADA (Misma tecnología de columnas que en Split) */
.gallery {
  column-count: 4;
  column-gap: 1.35rem;
  padding: 0 1.5rem;
  list-style: none;
}

.gallery-item {
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 1.35rem;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out), border-color 0.4s ease;
  box-shadow: var(--shadow-sm);
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md), var(--shadow-gold);
  border-color: var(--border-gold);
}

.gallery-item__btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
  color: inherit;
  cursor: zoom-in;
  position: relative;
}

.gallery-item__img-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.gallery-item__img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.6s var(--ease-out), filter 0.4s ease;
}

.gallery-item:hover .gallery-item__img {
  transform: scale(1.04);
}

.gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 17, 24, 0.92) 0%, rgba(10, 17, 24, 0.3) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.gallery-item:hover .gallery-item__overlay,
.gallery-item__btn:focus-visible .gallery-item__overlay {
  opacity: 1;
}

.gallery-item__title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.gallery-item__badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-gold-bright);
  background: rgba(212, 163, 115, 0.15);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-gold);
}

/* LIGHTBOX MODAL */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 11, 16, 0.94);
  backdrop-filter: blur(16px);
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  z-index: 10;
  background: rgba(22, 38, 54, 0.75);
  border: 1px solid var(--border-gold);
  color: var(--text-main);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.lightbox__close {
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
}

.lightbox__close:hover {
  background: var(--accent-terracotta);
  color: #fff;
  transform: rotate(90deg);
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
}

.lightbox__nav--prev { left: 1.5rem; }
.lightbox__nav--next { right: 1.5rem; }

.lightbox__nav:hover {
  background: var(--accent-gold);
  color: var(--bg-dark);
  transform: translateY(-50%) scale(1.1);
}

.lightbox__stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  margin: 3.5rem 0 1rem;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 72vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.lightbox__img.loading {
  opacity: 0;
  transform: scale(0.97);
}

.lightbox__info {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  background: rgba(16, 29, 40, 0.85);
  border: 1px solid var(--border-gold);
  padding: 1.25rem 2rem;
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
}

.lightbox__title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--accent-gold-bright);
  margin-bottom: 0.35rem;
}

.lightbox__caption {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.lightbox__bar {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 0.5rem;
}

.lightbox__counter {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* FOOTER */
.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 4rem 1.5rem 3rem;
}

.footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.footer__title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--text-main);
  margin-bottom: 0.3rem;
}

.footer__desc {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.footer__credit strong {
  color: var(--accent-gold);
}

.footer__small {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.footer__top-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-full);
  color: var(--accent-gold);
  transition: var(--transition);
}

.footer__top-btn:hover {
  background: var(--accent-gold);
  color: var(--bg-dark);
  transform: translateY(-4px);
}

/* RESPONSIVE DESIGN */
@media (max-width: 1400px) {
  .gallery {
    column-count: 3;
  }
}

@media (max-width: 900px) {
  .gallery {
    column-count: 2;
    column-gap: 1rem;
    padding: 0 1rem;
  }
  .gallery-item {
    margin-bottom: 1rem;
  }
  .lightbox__nav--prev { left: 0.5rem; }
  .lightbox__nav--next { right: 0.5rem; }
  .lightbox__close { top: 0.75rem; right: 0.75rem; }
  .lightbox__info { padding: 1rem 1.25rem; }
  .lightbox__title { font-size: 1.3rem; }
  .lightbox__caption { font-size: 0.9rem; }
}

@media (max-width: 520px) {
  .gallery {
    column-count: 1;
  }
}
