/* Correcciones compartidas. Cargar después de estilos.css y campana-extra.css. */
:root { --header-height: 100px; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-height) + 16px); }
body { min-width: 0; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { overflow-wrap: anywhere; }
main, section, article, .menu-panel, .home-rewards > article,
.merch-grid > article, .games > article { min-width: 0; }
body main [id] { scroll-margin-top: calc(var(--header-height) + 16px) !important; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, summary:focus-visible {
  outline: 3px solid #bdeed3;
  outline-offset: 4px;
}
[hidden] { display: none !important; }

/* El panel engloba el menú principal y el selector de idiomas. */
html body > #site-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  background: #080e0bf7 !important;
  isolation: isolate;
}
html body > #site-header .menu-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  max-width: 100%;
}
html body > #site-header #menu-panel #primary-navigation {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px 14px;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  max-height: none !important;
  overflow: visible !important;
}
html body > #site-header #mobile-menu-button {
  display: none !important;
}
html body > #site-header .language-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px 12px;
  max-width: 100%;
}
html body > #site-header .language-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 2px;
  color: #d9e3dd;
  font: 600 12px/1.4 Arial, Helvetica, sans-serif;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  text-decoration: none;
}
html body > #site-header .language-nav a[aria-current="true"] {
  color: #bdeed3;
  text-decoration: underline;
  text-underline-offset: 5px;
}
html body > #site-header .language-nav a:hover { color: #fff; }

/* Textos extensos y traducciones: sin anchuras rígidas ni cortes. */
.home-rewards .button, .campaign-legal .button,
#pledge-dialog .button, .merch-card button {
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.5;
  height: auto;
}
.home-rewards h3, .merch-card h3, .campaign-legal h2,
.campaign-legal h3, #pledge-title { overflow-wrap: anywhere; }
.campaign-legal, .campaign-organizer, .contact-mail,
#pledge-summary { overflow-wrap: anywhere; }
.campaign-countdown { font-variant-numeric: tabular-nums; }
.fundraising-figures dd { font-variant-numeric: tabular-nums; }
.fundraising-update time { white-space: nowrap; }
.translation-notice {
  max-width: 1000px;
  margin: 24px auto;
  padding: 18px 22px;
  border: 1px solid #45665a;
  border-radius: 7px;
  background: #0b1411ed;
  color: #e0e8e3;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.translation-notice a { color: #bdeed3; }

/* El formulario conserva el modal y el proceso de pago existentes. */
html body dialog#pledge-dialog {
  position: fixed;
  inset: 0;
  z-index: 2000;
  width: min(620px, calc(100% - 24px));
  max-width: calc(100% - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 28px;
  overflow-y: auto;
  background: #0b1510;
  color: #f4f6f4;
  border: 1px solid #89ba9f;
  border-radius: 12px;
  text-align: left;
}
html body dialog#pledge-dialog::backdrop { background: #000c; }
html body dialog#pledge-dialog form { position: static; inset: auto; }
html body dialog#pledge-dialog h2 {
  margin: 12px 44px 24px 0;
  font: 700 28px/1.3 Arial, Helvetica, sans-serif;
  letter-spacing: normal;
}
html body dialog#pledge-dialog #pledge-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  color: #f4f6f4;
  border: 0;
  border-radius: 4px;
  font-size: 26px;
  cursor: pointer;
}
html body dialog#pledge-dialog label {
  display: block;
  margin: 16px 0;
  text-align: left;
  line-height: 1.6;
}
html body dialog#pledge-dialog input:not([type="checkbox"]),
html body dialog#pledge-dialog select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin-top: 6px;
  padding: 12px;
  background: #101c16;
  color: #fff;
  border: 1px solid #8ca498;
  border-radius: 4px;
  font: inherit;
}
html body dialog#pledge-dialog select {
  padding-right: 30px;
  text-overflow: ellipsis;
}
html body dialog#pledge-dialog input[readonly] {
  background: #17231c;
  color: #d9e3dd;
}
html body dialog#pledge-dialog .check {
  padding-left: 28px;
  position: relative;
}
html body dialog#pledge-dialog .check input {
  position: absolute;
  left: 0;
  top: 5px;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #206a48;
}
html body dialog#pledge-dialog p { line-height: 1.7; }
html body dialog#pledge-dialog a { color: #bdeed3; }
html body dialog#pledge-dialog .button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  margin: 16px 0;
  padding: 14px 16px;
}
html body dialog#pledge-dialog #copy-reward,
html body dialog#pledge-dialog #pledge-edit {
  min-height: 44px;
  max-width: 100%;
  padding: 10px 14px;
  background: #101c16;
  color: #e0e8e3;
  border: 1px solid #8ca498;
  border-radius: 4px;
  line-height: 1.5;
  cursor: pointer;
}
#pledge-summary { white-space: pre-line; }
#pledge-spanish-name { display: block; margin-top: 8px; }
#copy-status { min-height: 1.7em; }

@media (min-width: 768px) and (max-width: 1000px) {
  html body > #site-header .menu-panel { align-items: center; }
  html body > #site-header #menu-panel #primary-navigation,
  html body > #site-header .language-nav { justify-content: center; }
}

/* Sin JS, se muestran los enlaces. Con JS, se activa la hamburguesa. */
@media (max-width: 767.98px) {
  html body > #site-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 16px !important;
  }
  html body > #site-header .brand {
    justify-self: start;
    max-width: 180px;
    margin: 0 !important;
    transform: none !important;
  }
  html body > #site-header .menu-panel {
    grid-column: 1 / -1;
    width: 100%;
    align-items: stretch;
    gap: 12px;
    padding: 12px 0 4px;
    border-top: 1px solid #31554d;
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  html.has-js body > #site-header #mobile-menu-button {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    justify-self: end;
    gap: 5px;
    width: 48px;
    height: 48px;
    padding: 10px;
    background: #0a1716;
    color: #eef1eb;
    border: 1px solid #49726c;
    border-radius: 5px;
    cursor: pointer;
  }
  html body > #site-header #mobile-menu-button span {
    display: block;
    width: 23px;
    height: 2px;
    background: currentColor;
    transition: transform .18s, opacity .18s;
  }
  html body > #site-header #mobile-menu-button[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  html body > #site-header #mobile-menu-button[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  html body > #site-header #mobile-menu-button[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  html body > #site-header #menu-panel #primary-navigation {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start;
    gap: 0 !important;
    width: 100%;
    padding: 0;
  }
  html body > #site-header #menu-panel #primary-navigation a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 44px !important;
    padding: 10px 8px !important;
    font-size: 12px !important;
    line-height: 1.5;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  html body > #site-header .language-nav {
    justify-content: flex-start;
    gap: 4px 16px;
    padding: 8px;
    border-top: 1px solid #31554d;
  }
  html body > #site-header .language-nav a { min-height: 44px; }
  html body .home-rewards {
    grid-template-columns: minmax(0, 1fr);
  }
  html body .fundraising-figures {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  html body .fundraising-figures dd {
    font-size: clamp(16px, 4.8vw, 24px) !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  html body .fundraising-figures dt {
    font-size: 11px;
    overflow-wrap: anywhere;
  }
  .translation-notice { margin: 20px 16px; padding: 16px; }
}

@media (max-width: 360px) {
  html body dialog#pledge-dialog { padding: 20px 16px; }
  html body dialog#pledge-dialog h2 { font-size: 24px; }
  html body #apoya .fundraising-panel { padding: 24px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
/* Referencia accesible en las instrucciones de aportación. */
#pledge-reference { display: block; margin: 8px 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#copy-reference { min-height: 44px; max-width: 100%; padding: 10px 14px; background: #101c16; color: #e0e8e3; border: 1px solid #8ca498; border-radius: 4px; font: inherit; line-height: 1.5; cursor: pointer; }
#copy-reference-status { min-height: 1.7em; }
