/* Cabecera y navegación global. Los estilos de contenido no se modifican. */
.site-header .g3-header-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: clamp(12px, 2.4vw, 32px);
}
.site-header .g3-header-logo {
  width: min(350px, 100%);
  height: 50px;
  background-position: left center;
}
.g3-header-profile { margin: 0; }
.g3-header-action, .g3-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.g3-header-action { padding: 12px 19px; border: 1px solid var(--blue); border-radius: 2px; }
.g3-header-profile-button { background: #fff; color: var(--blue); }
.g3-header-book { background: var(--blue); color: #fff; }
.g3-header-action:hover { background: var(--red); border-color: var(--red); color: #fff; }
.g3-menu-toggle { background: none; border: 0; color: var(--blue); gap: 11px; padding: 8px 0 8px 8px; }
.g3-menu-toggle:hover, .g3-menu-close:hover { color: var(--red); }
.g3-menu-toggle svg, .g3-menu-close svg { flex: none; }
.g3-header-layout :focus-visible, .g3-menu-dialog :focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }

/* El diálogo nativo se sitúa sobre el resto de las capas y contiene el foco. */
html.g3-menu-open, html.g3-menu-open body { overflow: hidden; }
.g3-menu-dialog {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  overflow: hidden;
  color: var(--ink);
  background: transparent;
}
.g3-menu-dialog:not([open]) { display: none; }
.g3-menu-dialog::backdrop { background: rgba(255, 255, 255, .15); }
.g3-menu-panel {
  width: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  background: rgba(255, 255, 255, .97);
  position: relative;
  padding: clamp(72px, 10vh, 110px) clamp(24px, 7vw, 110px) clamp(32px, 6vh, 80px);
}
.g3-menu-dialog[open] .g3-menu-panel { animation: g3-menu-in .35s cubic-bezier(.22,.75,.25,1) both; }
.g3-menu-dialog.g3-menu-closing .g3-menu-panel { animation: g3-menu-out .28s ease-in both; }
@keyframes g3-menu-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes g3-menu-out { from { transform: translateX(0); } to { transform: translateX(100%); } }
.g3-menu-close {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  right: max(24px, 4vw, env(safe-area-inset-right));
  background: transparent;
  color: var(--blue);
  border: 0;
  padding: 8px;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.g3-menu-layout {
  width: min(1160px, 100%);
  min-height: 100%;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: clamp(40px, 8vw, 120px);
  align-items: center;
}
.g3-menu-brand { display: block; width: min(100%, 390px); }
.g3-menu-brand img { width: 100%; height: auto; }
.g3-menu-content { min-width: 0; }
.g3-menu-links { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.g3-menu-links a {
  display: block;
  max-width: 100%;
  font-size: clamp(24px, 2.8vw, 40px);
  font-weight: 400;
  line-height: 1.25;
  padding: 4px 0;
  color: var(--ink);
  transition: color .2s;
  overflow-wrap: anywhere;
}
.g3-menu-links a:hover, .g3-menu-links a[aria-current="page"] { color: var(--red); }
.g3-menu-links .g3-menu-platform { font-size: 16px; font-weight: 700; margin-top: 14px; border-bottom: 1px solid currentColor; }
.g3-menu-language { display: flex; gap: 10px; align-items: center; margin: 30px 0 0; font-size: 18px; color: var(--muted); }
.g3-menu-language button { border: 0; padding: 6px 0; color: var(--ink); background: transparent; cursor: pointer; }
.g3-menu-language button[aria-pressed="true"], .g3-menu-language button:hover { color: var(--red); }
@media (max-width: 700px) {
  .site-header .g3-header-layout { gap: 10px; }
  .g3-header-action, .g3-menu-toggle { font-size: 13px; }
  .g3-header-action { padding: 9px 10px; }
  .g3-menu-toggle { gap: 5px; padding-left: 2px; }
  .g3-menu-toggle svg { width: 23px; height: 23px; }
  .g3-menu-layout { min-height: 0; grid-template-columns: 1fr; align-items: start; gap: 32px; }
  .g3-menu-brand { width: min(260px, 80%); }
  .g3-menu-links { gap: 3px; }
  .g3-menu-links a { font-size: clamp(24px, 5vw, 32px); }
  .g3-menu-language { margin-top: 20px; }
}
@media (max-width: 520px) {
  :root { --g3-header-height: 110px; }
  .site-header { height: var(--g3-header-height); }
  .site-header .g3-header-layout { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; }
  .site-header .g3-header-logo { grid-column: 1 / -1; grid-row: 1; width: min(205px, calc(100% - 90px)); height: 39px; }
  .g3-menu-toggle { grid-column: 2; grid-row: 1; justify-self: end; }
  .g3-header-profile { grid-column: 1; grid-row: 2; justify-self: stretch; }
  .g3-header-profile-button { width: 100%; }
  .g3-header-book { grid-column: 2; grid-row: 2; min-width: 90px; }
  .g3-header-action { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .g3-menu-dialog[open] .g3-menu-panel, .g3-menu-dialog.g3-menu-closing .g3-menu-panel { animation: none; }
}
@media print { .g3-menu-dialog { display: none !important; } }
