/* ============================================================
   Panel de Ayuda del portal (js/ayuda-panel.js)
   ============================================================ */

body { --ga-ancho: clamp(320px, 26vw, 400px); }
body.ga-abierta:not(.ga-superpuesto) { height: auto; min-height: 100%; }

.ga-panel {
  position: fixed; top: var(--ga-top, 56px); right: 0; bottom: 0;
  width: min(400px, 100vw - 16px);
  z-index: 400;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  color: var(--text-1);
  font-family: var(--sans);
}

@media (min-width: 1200px) {
  .ga-panel { width: var(--ga-ancho); box-shadow: none; }
  body.ga-superpuesto .ga-panel { box-shadow: var(--shadow-lg); }
  body.ga-abierta [data-ga-empuja], html.ga-pre :is(main, #content, #es-app, #sim-app, #gprs-app, #corr-main) { margin-right: var(--ga-ancho) !important; width: auto !important; max-width: calc(100% - var(--ga-ancho)) !important; }
}

#ayuda-btn[aria-expanded="true"] { background: rgba(255,255,255,.18); color: #fff; }
#ayuda-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#ayuda-btn.ga-solo-icono { font-size: 0; gap: 0; padding: 6px 7px; }
#ayuda-btn.ga-solo-icono i { font-size: 15px; }

.ga-cab {
  flex-shrink: 0;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.ga-cab-fila { display: flex; align-items: flex-start; gap: 8px; }
.ga-cab h2 { flex: 1; margin: 2px 0 0; font-size: 16px; font-weight: 600; color: var(--text-1); }
.ga-cab h2:focus { outline: none; }
.ga-cab h2:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ga-cerrar {
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-2); font-size: 18px; cursor: pointer;
}
.ga-cerrar:hover { background: var(--bg); color: var(--text-1); }

.ga-panel :is(button, a, textarea, [tabindex]):focus-visible { scroll-margin-top: 0; }

.ga-migas { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.ga-migas [aria-current] { color: var(--text-2); }
.ga-migas:empty { min-height: 24px; }
.ga-sep { color: var(--text-3); }
.ga-glosario { margin-left: auto; }

.ga-liga {
  background: none; border: none; padding: 2px 0; min-height: 24px;
  color: var(--blue); font: inherit; text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer; text-align: left;
}
.ga-liga:hover { color: var(--text-1); }

.ga-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r);
  font-size: 12px; font-weight: 500;
  transition: all var(--transition); cursor: pointer; border: none;
}
.ga-volver { margin-top: 8px; white-space: normal; text-align: left; }

.ga-cuerpo {
  position: relative;
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 4px 16px 16px;
  font-size: 13px; line-height: 1.5;
}
.ga-cuerpo h3 { font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: var(--text-1); }
.ga-cuerpo p { margin: 0 0 8px; }
.ga-cuerpo ol { margin: 0 0 8px; padding-left: 20px; }
.ga-cuerpo li { margin-bottom: 4px; }
.ga-avisos { margin: 0; }
.ga-avisos dt { font-weight: 600; margin-top: 8px; }
.ga-avisos dd { margin: 2px 0 0 12px; color: var(--text-2); }
.ga-ancla { border-top: 1px solid var(--border); margin-top: 12px; }
.ga-panel .ga-cuerpo h4.ga-ancla { margin: 14px 0 2px; border-top: 0; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.ga-ver { list-style: none; padding: 0; margin: 0; }

.ga-tenue { color: var(--text-2); font-size: 12px; margin: 2px 0 6px; }

.ga-oculto {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (pointer: coarse) {
  .ga-btn { min-height: 44px; }
}

@media (max-width: 600px) {
  #ayuda-btn { font-size: 0; gap: 0; padding: 6px 7px; }
  #ayuda-btn i { font-size: 15px; }
  .sa-topbar { gap: 8px; padding: 0 12px; }
  .ga-panel { left: 0; right: auto; width: min(100%, 100vw); border-left: 0; }
  body.ga-abierta .onav-tab { display: none; }
}

@media (max-width: 600px), (pointer: coarse) {
  #ayuda-btn, .ga-cerrar { min-height: 44px; min-width: 44px; }
  .ga-liga { min-height: 44px; }
}

@media (forced-colors: active) {
  #ayuda-btn[aria-expanded="true"] { outline: 2px solid ButtonText; }
  .ga-btn { border: 1px solid ButtonText; }
}

@media (prefers-reduced-motion: no-preference) {
  .ga-panel:not([hidden]) { animation: ga-entra 150ms ease-out; }
  @keyframes ga-entra { from { transform: translateX(24px); } to { transform: none; } }
}

@media print {
  .ga-panel { display: none !important; }
}

@media (max-height: 520px) {
  .ga-panel { overflow-y: auto; }
  .ga-cuerpo { flex: none; overflow: visible; }
}
