:root {
  /* Paleta burdeos / realeza */
  --burgundy-950: #1a0409;
  --burgundy-900: #2b0a12;
  --burgundy-800: #45101f;
  --burgundy-700: #611526;
  --burgundy-600: #7c1f2e;
  --burgundy-500: #9a2a3a;
  --wine-glow: #b13347;

  --gold: #d4af37;
  --gold-soft: #e8cf7e;
  --gold-deep: #a9862a; /* parada oscura de los degradados dorados */
  --champagne: #f3e6c4;

  --ink: #f7ecec;
  --ink-dim: rgba(247, 236, 236, 0.66);
  --shadow: rgba(0, 0, 0, 0.55);
  --panel-w: 520px;

  --font-display: "Quintessential", Georgia, "Times New Roman", serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--burgundy-950);
  font-family: var(--font-body);
  color: var(--ink);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#pano {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#pano:active { cursor: grabbing; }

/* Viñeta ambiental sobre el panorama */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(26, 4, 9, 0.55) 100%);
}

/* Loader */
#loader {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: radial-gradient(circle at 50% 38%, var(--burgundy-700), var(--burgundy-950) 70%);
  z-index: 50;
  transition: opacity 0.6s ease;
}
#loader.hidden { opacity: 0; pointer-events: none; }
#loader p {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--gold-soft);
}
.spinner {
  width: 52px; height: 52px;
  border: 2px solid rgba(212, 175, 55, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s cubic-bezier(0.6, 0.1, 0.3, 0.9) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Top bar */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 26px;
  background: linear-gradient(180deg, rgba(26, 4, 9, 0.9) 0%, rgba(26, 4, 9, 0));
  z-index: 20;
  pointer-events: none;
}
#topbar .btn { pointer-events: auto; }
.brand {
  display: flex;
  align-items: center;
}
#topbar h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}
.sub {
  font-size: 12px;
  color: var(--gold-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}

.btn {
  background: rgba(43, 10, 18, 0.82);
  border: 1px solid rgba(212, 175, 55, 0.42);
  color: var(--champagne);
  padding: 11px 18px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s;
}
.icon-btn {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
}
.icon-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn:hover {
  border-color: var(--gold);
  background: rgba(97, 21, 38, 0.9);
  transform: translateY(-1px);
}

/* Panel */
#panel {
  position: fixed;
  top: 84px;
  right: 18px;
  width: min(var(--panel-w), calc(100% - 52px));
  height: calc(100% - 108px);
  background: linear-gradient(180deg, rgba(43, 10, 18, 0.94), rgba(26, 4, 9, 0.97));
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 22px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  z-index: 15;
  transform: translateX(calc(100% + 28px));
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(14px);
  overflow: hidden;
  isolation: isolate;
}
#panel::before {
  display: none;
}
#panel.open { transform: translateX(0); }
.panel-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 30px 20px 38px 30px;
  border-radius: inherit;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.58) transparent;
}
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-track { margin: 18px 0; }
.panel-scroll::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.58);
  border-radius: 999px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 26px;
  background: rgba(0, 0, 0, 0.2);
  padding: 5px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.18);
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--ink-dim);
  padding: 10px 4px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.2s, background 0.25s;
}
.tab:hover { color: var(--champagne); }
.tab.active {
  color: var(--champagne);
  background: rgba(124, 31, 46, 0.82);
  box-shadow: none;
}

.tab-content { display: none; animation: fade 0.45s ease; }
.tab-content.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.tab-content h2 {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 400;
  color: var(--champagne);
  margin-bottom: 6px;
  line-height: 1.15;
}
.tab-content .lead {
  color: var(--gold-soft);
  margin-bottom: 22px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tab-content h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.01em;
  margin: 28px 0 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}
.tab-content p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 13px;
  text-align: justify;
}
.tab-content .fact {
  background: none;
  border: 0;
  border-left: 2px solid var(--gold);
  border-radius: 0;
  padding: 2px 0 2px 22px;
  margin: 18px 0;
  font-size: 14px;
  line-height: 1.65;
}
.tab-content .fact strong { color: var(--gold); }
.tab-content ul { margin: 10px 0 16px 4px; list-style: none; }
.tab-content li {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
}
.tab-content li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

/* Controls */
#controls {
  position: fixed;
  left: 26px; bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 18;
}
.ctrl {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  padding: 0;
  background: rgba(43, 10, 18, 0.82);
  border: 1px solid rgba(212, 175, 55, 0.38);
  color: var(--champagne);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.ctrl svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
#autoRotate svg { fill: currentColor; stroke: none; }
.ctrl:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}
.ctrl.active {
  background: linear-gradient(160deg, var(--gold), var(--gold-deep));
  color: var(--burgundy-900);
  border-color: var(--gold-soft);
}

#hint {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  z-index: 18;
  pointer-events: none;
  transition: opacity 0.6s;
  background: rgba(26, 4, 9, 0.5);
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  backdrop-filter: blur(8px);
}
#hint.hidden { opacity: 0; }

@media (max-width: 720px) {
  :root { --panel-w: 100%; }
  #topbar h1 { font-size: 17px; }
  #topbar { padding: 14px; }
  .sub { font-size: 10px; letter-spacing: 0.1em; }
  #panel {
    top: 76px;
    right: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 88px);
    border-radius: 20px;
    transform: translateX(calc(100% + 20px));
  }
  .panel-scroll { padding: 25px 16px 32px 24px; }
  #hint { display: none; }
}

/* Vuelta a la web cuando el tour se abre en su propia pestaña
   (embebido en el modal del banner queda oculto: el modal ya cierra). */
#backToSite {
  display: inline-block;
  margin-bottom: 6px;
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gold);
  opacity: 0.8;
  transition: opacity 0.25s, color 0.25s;
}
#backToSite:hover { opacity: 1; color: var(--gold-soft); }
#backToSite[hidden] { display: none; }
