/* Mapa de autores — full-bleed graph canvas + floating chrome.
   Uses site.css tokens (--accent, --bg-*, --text-*, fonts) for cohesion. */

:root {
  /* Period palette — desaturated tonal sepia */
  --p-origen:        #3e2218;
  --p-guardia-nueva: #6a4030;
  --p-edad-de-oro:   #b58862;
  --p-tardio:        #c69771;
  --p-vanguardia:    #8d3d2c;
  --p-contemporaneo: #8a7d74;

  /* Role palette */
  --r-compositor:     #c69771;
  --r-letrista:       #e7dfd5;
  --r-cantor:         #8d3d2c;
  --r-orquesta:       #a87a55;
  --r-instrumentista: #6a4030;
  --r-otros:          #8a7d74;
}

/* Body opens up: the graph claims the entire viewport below the sticky header. */
body.page-graph { overflow: hidden; }
body.page-graph .site-main { padding-bottom: 0; }
body.page-graph .site-backdrop { display: none; }
body.page-graph .site-footer { display: none; }
body.page-graph .content-ad-slot { display: none; }

.graph-scene {
  position: relative;
  /* Header is ~64-72px sticky; use 100dvh fallback for mobile chromes. */
  height: calc(100dvh - var(--header-h, 4.2rem));
  min-height: 480px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, #161013 0%, var(--bg-main) 55%, #07060a 100%);
}

.graph-scene::after {
  /* Soft vignette over the canvas */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(0,0,0,0.55) 100%);
  z-index: 1;
}

#graph-canvas {
  position: absolute; inset: 0;
}

/* ── Floating chrome panels ────────────────────────────────────── */

.graph-chrome {
  position: absolute; z-index: 4; pointer-events: none;
}
.graph-chrome > * { pointer-events: auto; }

.graph-chrome.tl  { top: 20px; left: 20px; width: 280px; }
.graph-chrome.tr  { top: 20px; right: 20px; }
.graph-chrome.bl  { bottom: 24px; left: 20px; }

/* Search */
.graph-search-box {
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}
.graph-search-box input {
  width: 100%; background: transparent; border: 0; outline: 0;
  padding: 10px 14px;
  font-family: var(--font-ui); font-size: 12px;
  color: var(--text-main); letter-spacing: 0.02em;
}
.graph-search-box input::placeholder { color: var(--text-muted); font-style: italic; }
.graph-search-box input:focus { box-shadow: inset 0 -1px 0 var(--accent); }

#graph-autocomplete {
  margin-top: 6px;
  max-height: 360px; overflow-y: auto;
  background: var(--bg-panel-strong);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  display: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.32);
}
#graph-autocomplete.open { display: block; }
.graph-ac-item {
  padding: 9px 14px;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background-color 120ms ease;
}
.graph-ac-item:last-child { border-bottom: 0; }
.graph-ac-item:hover, .graph-ac-item.focused { background: var(--bg-soft); }
.graph-ac-item .ac-name { font-family: var(--font-display); font-style: italic; color: var(--text-main); font-size: 13px; }
.graph-ac-item .ac-meta { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }

/* Mode toggle */
.graph-toggle {
  display: inline-flex; background: var(--bg-panel);
  border: 1px solid var(--line-soft); border-radius: 999px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 3px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}
.graph-toggle button {
  background: transparent; border: 0; outline: 0; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-muted);
  transition: background-color 200ms ease, color 200ms ease;
}
.graph-toggle button:hover { color: var(--text-soft); }
.graph-toggle button.active {
  background: rgba(181, 136, 98, 0.92);
  color: #1a120c;
}

/* Legend */
.graph-legend {
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 11px 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  min-width: 168px;
}
.graph-legend-title {
  font-family: var(--font-ui); font-weight: 500;
  font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px; opacity: 0.85;
}
.graph-legend-row {
  display: flex; align-items: center; gap: 9px;
  font-size: 11px; padding: 2px 0; color: var(--text-soft);
}
.graph-legend-swatch {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255,245,230,0.08);
}

/* Tooltip */
#graph-tooltip {
  position: absolute; z-index: 5;
  background: var(--bg-panel-strong);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 8px 12px 9px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity 140ms ease;
  white-space: nowrap;
}
#graph-tooltip.visible { opacity: 1; }
#graph-tooltip .tt-name {
  font-family: var(--font-display); font-style: italic;
  font-size: 14px; color: var(--text-main); line-height: 1.1;
}
#graph-tooltip .tt-meta {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted); margin-top: 3px;
}

/* ── Side panel ────────────────────────────────────────────────── */
#graph-panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 5;
  width: 380px; max-width: 92vw;
  background: var(--bg-panel-strong);
  border-left: 1px solid var(--line-soft);
  transform: translateX(105%);
  transition: transform 460ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: -28px 0 72px rgba(0,0,0,0.40);
}
#graph-panel.open { transform: translateX(0); }

.graph-panel-close {
  position: absolute; top: 16px; right: 16px;
  width: 28px; height: 28px; border-radius: 50%;
  background: transparent; border: 1px solid var(--line-soft);
  color: var(--text-soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
  transition: background-color 160ms, border-color 160ms;
  z-index: 2;
}
.graph-panel-close:hover { background: var(--bg-soft); border-color: var(--line-strong); }

.graph-panel-scroll { overflow-y: auto; padding: 36px 32px 40px; flex: 1; }

.graph-panel-eyebrow {
  font-family: var(--font-ui); font-weight: 500;
  font-size: 9px; letter-spacing: 0.20em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px; opacity: 0.85;
}
.graph-panel-name {
  font-family: var(--font-display); font-style: italic;
  font-weight: 400; font-size: 28px; line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--text-main);
  margin: 0 0 4px;
}
.graph-panel-alias {
  font-family: var(--font-reading); font-style: italic;
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 16px;
}

.graph-panel-avatar {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  object-fit: cover;
  margin-bottom: 18px;
  filter: saturate(0.85) contrast(1.05);
}
.graph-panel-avatar-fallback {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-style: italic;
  font-size: 28px; color: var(--text-muted);
  margin-bottom: 18px;
}

.graph-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.graph-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-soft);
  border: 1px solid var(--line-soft);
}
.graph-chip-dot { width: 6px; height: 6px; border-radius: 50%; }

.graph-panel-bio {
  font-family: var(--font-reading);
  font-size: 14px; line-height: 1.6;
  color: var(--text-soft);
  margin: 18px 0 22px;
}

.graph-section-title {
  font-family: var(--font-ui); font-weight: 500;
  font-size: 9px; letter-spacing: 0.20em; text-transform: uppercase;
  color: var(--accent);
  margin: 22px 0 10px; opacity: 0.85;
}

.graph-works-list { display: flex; flex-direction: column; gap: 1px; }
.graph-work-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center; gap: 12px;
  padding: 7px 10px; margin: 0 -10px;
  border-radius: 3px;
  transition: background-color 140ms;
}
.graph-work-row:hover { background: var(--bg-soft); }
.graph-work-spotify {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #1db954;
  background: rgba(29, 185, 84, 0.07);
  text-decoration: none;
  transition: background 180ms, transform 180ms;
}
.graph-work-spotify:hover {
  background: rgba(29, 185, 84, 0.20);
  transform: scale(1.08);
}
.graph-work-title {
  font-family: var(--font-display); font-style: italic;
  font-size: 14px; line-height: 1.2;
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 160ms;
}
.graph-work-title:hover { color: var(--accent-strong); }
.graph-work-roles {
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.graph-neighbor-list { display: flex; flex-direction: column; gap: 1px; }
.graph-neighbor {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin: 0 -10px;
  cursor: pointer;
  border-radius: 3px;
  transition: background-color 140ms;
}
.graph-neighbor:hover { background: var(--bg-soft); }
.graph-neighbor-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.graph-neighbor-name { font-family: var(--font-display); font-style: italic; font-size: 14px; color: var(--text-main); }

.graph-panel-cta {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 22px;
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent-strong);
  text-decoration: none;
  font-family: var(--font-ui); font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  transition: background-color 200ms, color 200ms;
}
.graph-panel-cta:hover { background: var(--accent); color: #1a120c; }

.graph-panel-meta {
  font-size: 10px; color: var(--text-muted);
  margin: 12px 0 0; letter-spacing: 0.06em;
}

/* Focus hint */
.graph-focus-hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 3;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 7px 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none;
  transition: opacity 280ms;
}
.graph-focus-hint.visible { opacity: 1; }

/* Loading splash */
.graph-loading {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-main);
  transition: opacity 600ms;
}
.graph-loading.fading { opacity: 0; pointer-events: none; }
.graph-loading-pulse {
  font-family: var(--font-display); font-style: italic;
  font-size: 18px; color: var(--accent);
  letter-spacing: 0.04em;
  animation: graph-pulse 1.6s ease-in-out infinite;
}
@keyframes graph-pulse { 0%,100% { opacity: 0.25; } 50% { opacity: 0.9; } }

/* Counts strip just under the header */
.graph-counts {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 3; pointer-events: none;
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 6px 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

/* Mobile fallback */
.graph-mobile-fallback {
  display: none;
}
@media (max-width: 720px) {
  .graph-scene > :not(.graph-mobile-fallback) { display: none; }
  .graph-mobile-fallback {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 18px;
    padding: 80px 32px;
    height: 100%;
    text-align: center;
  }
  .graph-mobile-fallback h2 {
    font-family: var(--font-display); font-style: italic;
    font-size: 26px; color: var(--text-main); margin: 0;
  }
  .graph-mobile-fallback p {
    font-family: var(--font-reading); font-size: 15px;
    color: var(--text-soft); max-width: 36ch; margin: 0;
  }
  .graph-mobile-fallback a {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 22px;
    border: 1px solid var(--accent); border-radius: 999px;
    color: var(--accent-strong); text-decoration: none;
    font-family: var(--font-ui); font-size: 12px;
    letter-spacing: 0.16em; text-transform: uppercase;
  }
}
