:root {
  --bg: #0c0b10;
  --panel: rgba(18, 17, 24, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f1ea;
  --muted: #a8a3b3;
  --accent: #f3c677;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* ---------- barra superior ---------- */

.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(to bottom, rgba(12, 11, 16, 0.85), rgba(12, 11, 16, 0));
  z-index: 5;
}

.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand-name { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--accent); }
.brand-sub { color: var(--muted); font-size: 13px; white-space: nowrap; }

.modes {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  backdrop-filter: blur(12px);
}

.mode {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 13px var(--sans);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.mode.active { background: var(--accent); color: #1a1408; }

.filters { display: flex; align-items: center; gap: 10px; }

/* ---------- redes sociales ---------- */

.social { display: flex; gap: 6px; }
.social-link {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  backdrop-filter: blur(12px);
  transition: color 0.2s, border-color 0.2s;
}
.social-link:hover, .social-link:focus-visible { color: var(--accent); border-color: var(--accent); }
.social-icon {
  width: 17px;
  height: 17px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.social-icon.generic {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1'/%3E%3Cpath d='M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1'/%3E%3C/svg%3E");
}

.filters select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: 13px var(--sans);
  max-width: 200px;
  backdrop-filter: blur(12px);
}

/* ---------- años ---------- */

.years {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  max-width: calc(100% - 32px);
  overflow-x: auto;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  z-index: 5;
  scrollbar-width: none;
}
.years:empty { display: none; }
.years button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 13px var(--sans);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.years button.active { color: var(--text); background: rgba(255, 255, 255, 0.1); }

.hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 12px;
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
  z-index: 5;
}

.empty, .loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 16px;
  z-index: 4;
}
.empty h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0; }
.empty a { color: var(--accent); }
.loading { color: var(--muted); font-size: 14px; pointer-events: none; }

/* ---------- visor ---------- */

.viewer {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 11, 0.92);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 10;
  padding: 56px 16px 16px;
  animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; } }

.viewer figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(1100px, 100%);
  max-height: 100%;
}
.viewer img {
  max-width: 100%;
  max-height: calc(100vh - 220px);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.viewer figcaption { text-align: center; padding-top: 16px; max-width: 640px; }
.viewer h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0 0 4px; }
.viewer .meta { color: var(--accent); font-size: 14px; margin: 0 0 8px; }
.viewer .desc { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0; }

.viewer-close, .viewer-nav {
  position: absolute;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.viewer-close { top: 14px; right: 16px; }
.viewer-nav { top: 50%; transform: translateY(-50%); }
.viewer-nav.prev { left: 16px; }
.viewer-nav.next { right: 16px; }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .brand-name { font-size: 22px; }
  .filters { order: 2; }
  .modes { order: 3; width: 100%; justify-content: center; }
  .mode { flex: 1; }
  .filters select { max-width: 160px; }
  .viewer-nav { top: auto; bottom: 16px; transform: none; }
  .viewer img { max-height: calc(100vh - 260px); }
}

/* ---------- sesiones ---------- */

.sala-bar {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100% - 32px);
  padding: 10px 20px 10px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  z-index: 6;
}
.sala-back {
  border: 0;
  background: var(--accent);
  color: #1a1408;
  font: 600 14px var(--sans);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.sala-info { min-width: 0; }
.sala-info h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 20px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sala-info p { margin: 2px 0 0; color: var(--accent); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.en-sala .years, body.en-sala .modes, body.en-sala #lugar-select { visibility: hidden; }

.fade {
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 8;
}
.fade.on { opacity: 1; }

.viewer-count { color: var(--muted); font-size: 12px; margin: 8px 0 0; letter-spacing: 0.04em; }
.viewer-count:empty { display: none; }
.btn-sesion {
  margin-top: 12px;
  border: 0;
  background: var(--accent);
  color: #1a1408;
  font: 600 14px var(--sans);
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
}

@media (max-width: 720px) {
  .sala-bar { bottom: 36px; gap: 10px; padding: 8px 14px 8px 8px; }
  .sala-info h2 { font-size: 17px; }
}

/* ---------- contacto ---------- */

.btn-contacto, .sala-cotizar {
  background: var(--accent);
  color: #1a1408;
  font: 600 13px var(--sans);
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 999px;
  white-space: nowrap;
}
.btn-contacto:hover, .sala-cotizar:hover { filter: brightness(1.08); }
.sala-cotizar { font-size: 14px; padding: 10px 16px; margin-left: 4px; }
.sala-back { background: transparent; color: var(--text); border: 1px solid var(--line); }
body.en-sala .btn-contacto { visibility: hidden; }

@media (max-width: 720px) {
  .btn-contacto { padding: 8px 12px; }
  .sala-bar { flex-wrap: wrap; justify-content: center; border-radius: 20px; }
  .sala-cotizar { padding: 8px 12px; font-size: 13px; }
}
