/* FilPolMap — plataforma de «Explorar»: botón y menú de la cabecera, índice de secciones y
   componentes compartidos (js/features/ui.js). Solo tokens de css/styles.css.
   Prefijos: .nav-explore / .em-* (menú), .fx-* (componentes). Cada sección usa su propio prefijo. */

/* ============ Botón «Explorar» en la cabecera ============ */
.nav-explore {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 5px 9px 5px 13px; border-radius: 9px; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: color var(--t1), background var(--t1);
}
.nav-explore:hover, .nav-explore[aria-expanded="true"] { color: var(--text); }
.nav-explore[aria-expanded="true"] { background: var(--surface-2); }
.nav-explore[aria-current="page"] { color: var(--text); background: var(--surface-3); box-shadow: inset 0 1px 0 var(--highlight), var(--shadow-1); }
.nav-chev { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .7; transition: transform var(--t2) var(--ease); }
.nav-explore[aria-expanded="true"] .nav-chev { transform: rotate(180deg); }

/* ============ Menú desplegable (escritorio) / hoja inferior (móvil) ============ */
.explore-menu { position: fixed; top: calc(var(--header-h) - 4px); right: var(--em-right, 16px); z-index: 40; }
.em-backdrop { display: none; }
.em-panel {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - var(--header-h) - 16px); overflow: auto;
  padding: 14px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--sheen), transparent 40%), var(--surface);
  border: 1px solid var(--border-strong); box-shadow: inset 0 1px 0 var(--highlight), var(--shadow-3);
  opacity: 0; transform: translateY(-6px) scale(.985); transform-origin: top right;
  transition: opacity var(--t2) var(--ease), transform var(--t2) var(--ease);
}
.explore-menu.open .em-panel { opacity: 1; transform: none; }
.em-panel .sheet-grip { display: none; }
.em-head { display: none; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.em-title { font-size: 17px; margin: 0; }
.em-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.em-group:first-child { grid-column: 1 / -1; }
.em-group:first-child .em-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
.em-group-label { margin: 6px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.em-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.em-item, .em-all {
  display: flex; align-items: flex-start; gap: 11px; padding: 9px 10px; border-radius: 11px;
  color: var(--text); text-decoration: none; transition: background var(--t1), color var(--t1);
}
.em-item:hover, .em-item:focus-visible, .em-all:hover, .em-all:focus-visible { background: var(--surface-2); }
.em-item:focus-visible, .em-all:focus-visible { outline-offset: -2px; }
.em-item[aria-current="page"] { background: var(--accent-soft); }
.em-item[aria-current="page"] .em-label { color: var(--accent); }
.em-ico {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  box-shadow: inset 0 1px 0 var(--highlight);
}
.em-ico svg, .em-all > svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.em-item:hover .em-ico, .em-item[aria-current="page"] .em-ico { color: var(--accent); border-color: var(--accent-line); }
.em-text { display: grid; gap: 1px; min-width: 0; }
.em-label { font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.em-desc { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.em-all {
  align-items: center; margin-top: 8px; padding: 10px 12px; border-top: 1px solid var(--border); border-radius: 0 0 10px 10px;
  font-size: 13.5px; font-weight: 550; color: var(--text-2);
}
.em-all > svg { color: var(--muted); }
.em-all span:first-of-type { flex: 1; }
.em-all .arrow { transition: transform var(--t2) var(--ease); }
.em-all:hover .arrow { transform: translateX(3px); }
.em-all[aria-current="page"] { color: var(--accent); }

@media (max-width: 760px) {
  .nav-explore { padding: 5px 7px 5px 9px; font-size: 13.5px; }
  .explore-menu { inset: 0; top: 0; right: 0; z-index: 60; }
  .em-backdrop { display: block; position: absolute; inset: 0; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity var(--t2) var(--ease); }
  .explore-menu.open .em-backdrop { opacity: 1; }
  .em-panel {
    position: absolute; left: 0; right: 0; bottom: 0; width: auto; max-height: 82dvh;
    border-radius: 22px 22px 0 0; padding: 4px 14px calc(14px + env(safe-area-inset-bottom));
    transform: translateY(100%); opacity: 1;
  }
  .explore-menu.open .em-panel { transform: none; }
  .em-panel .sheet-grip { display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 6px auto 8px; }
  .em-head { display: flex; }
  .em-groups, .em-group:first-child .em-list { grid-template-columns: minmax(0, 1fr); }
  .em-item { padding: 10px 8px; }
  body.em-sheet-open { overflow: hidden; }
}
@media (max-width: 400px) {
  .site-header .brand { display: none; }
  .site-header { gap: 6px; }
  .site-header .site-nav { margin-left: 0; flex: 1 1 auto; justify-content: space-between; }
  .site-nav a { padding: 5px 7px; font-size: 13px; }
  .nav-explore { padding: 5px 4px 5px 7px; font-size: 13px; gap: 2px; }
  .nav-chev { width: 13px; height: 13px; }
}

/* ============ Vista Explorar ============ */
.fx-head { margin-bottom: 28px; }
.fx-title { font-size: clamp(30px, 4.2vw, 44px); letter-spacing: -.03em; font-weight: 650; margin-bottom: 12px; }
.fx-head .lead { margin-bottom: 0; }
.fx-head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.fx-index-group { margin-top: 26px; }
.fx-index-label { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.fx-index-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.fx-index-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px; align-items: center;
  padding: 16px; border-radius: var(--r-lg); text-decoration: none; color: var(--text);
  background: linear-gradient(180deg, var(--sheen), transparent 70%), var(--surface);
  border: 1px solid var(--border); box-shadow: inset 0 1px 0 var(--highlight);
  transition: border-color var(--t2), transform var(--t2) var(--ease);
}
.fx-index-card:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.fx-index-card .em-ico { grid-row: 1 / span 2; width: 38px; height: 38px; }
.fx-index-name { font-weight: 600; font-size: 15px; }
.fx-index-desc { font-size: 13px; color: var(--muted); line-height: 1.45; }

.fx-soon {
  padding: 36px 24px; border-radius: var(--r-lg); text-align: center; color: var(--text-2);
  border: 1px dashed var(--border-strong); background: var(--surface);
}
.fx-soon .btn { margin: 4px; }
.fx-soon-badge {
  display: inline-flex; margin-bottom: 14px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
}

/* ============ Aviso metodológico ============ */
.fx-notice {
  display: flex; gap: 12px; align-items: flex-start; margin: 24px 0; padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 13.5px; line-height: 1.6;
}
.fx-notice p { margin: 0; }
.fx-notice strong { color: var(--text-2); font-weight: 600; }
.fx-notice-ico { flex: none; width: 18px; height: 18px; margin-top: 2px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; }
.fx-notice.compact { margin: 12px 0; padding: 9px 12px; font-size: 12.5px; }

/* ============ Avatar de ideología ============ */
.fx-avatar-ideo { box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent); }

/* ============ Chip de entidad ============ */
.fx-chip-wrap { display: inline-flex; align-items: center; max-width: 100%; }
.fx-chip {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%;
  padding: 3px 11px 3px 3px; border-radius: 999px; text-decoration: none; color: var(--text);
  font-size: 13px; font-weight: 550; line-height: 1.2;
  background: color-mix(in srgb, var(--c, var(--muted)) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 35%, var(--border));
  transition: background var(--t1), border-color var(--t1);
}
a.fx-chip:hover { background: color-mix(in srgb, var(--c, var(--muted)) 17%, var(--surface)); border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.fx-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-chip-pct { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.fx-chip-wrap:has(.fx-chip-rm) .fx-chip { padding-right: 30px; }
.fx-chip-rm {
  margin-left: -28px; width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
.fx-chip-rm:hover { color: var(--text); background: var(--surface-3); }
.fx-chip-rm svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ============ Tarjeta de entidad ============ */
.fx-card {
  position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--sheen), transparent 70%), var(--surface);
  border: 1px solid var(--border); box-shadow: inset 0 1px 0 var(--highlight);
  transition: border-color var(--t2);
}
.fx-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px; border-radius: 2px; background: var(--c); opacity: .8; }
.fx-card:hover { border-color: var(--border-strong); }
.fx-card-body { flex: 1; min-width: 0; }
.fx-card-kicker { margin: 0 0 2px; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.fx-card-kicker strong { color: var(--text-2); }
.fx-card-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.fx-card-link { color: var(--text); text-decoration: none; }
.fx-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* toda la tarjeta clicable */
.fx-card-link:focus-visible { outline: none; }
.fx-card:has(.fx-card-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.fx-card-meta { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.fx-card-text { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.fx-card-radar { flex: none; align-self: center; }

/* ============ Mini-radar ============ */
.mini-radar { display: block; overflow: visible; }
.mini-radar * { vector-effect: non-scaling-stroke; }
.mini-radar polygon:not(.mr-ring) { stroke-width: 1.5; }
.mr-ring { fill: color-mix(in srgb, var(--surface-3) 45%, transparent); stroke: var(--border-strong); stroke-width: 1; }
.mr-ring.zero { fill: none; stroke: var(--muted); stroke-dasharray: 2 3; opacity: .55; }
.mr-spoke { stroke: var(--border-strong); stroke-width: 1; opacity: .7; }

/* ============ Selector de entidad (combobox) ============ */
.fx-picker { position: relative; min-width: 0; }
.fx-picker-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.fx-picker-box {
  position: relative; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 8px 0 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: inset 0 1px 0 var(--highlight);
  transition: border-color var(--t1), box-shadow var(--t1);
}
.fx-picker-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.fx-picker-ava { flex: none; display: grid; place-items: center; width: 24px; height: 24px; color: var(--muted); }
.fx-picker-ava svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.fx-picker input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 14.5px; }
.fx-picker input::placeholder { color: var(--muted); }
.fx-picker.has-value input { font-weight: 600; }
.fx-picker-clear { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.fx-picker-clear:hover { background: var(--surface-3); color: var(--text); }
.fx-picker-clear svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.fx-picker-list {
  position: absolute; left: -1px; right: -1px; top: calc(100% + 6px); z-index: 25; list-style: none; margin: 0; padding: 5px;
  max-height: min(340px, 50vh); overflow: auto; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-3);
}
.fx-picker-list [role="option"] { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; cursor: pointer; }
.fx-picker-list [role="option"][aria-selected="true"], .fx-picker-list [role="option"]:not(.fx-opt-empty):hover { background: var(--surface-3); }
.fx-opt-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-opt-kind { flex: none; font-size: 12px; color: var(--muted); }
.fx-opt-empty { color: var(--muted); cursor: default !important; }
