/* Drawer lateral de la wiki en movil/tablet (<982px) - ticket 259496
   Diseno alineado con www.galpon.org (naranja corporativo #e95420) */

.galpon-wiki-topbar,
.galpon-wiki-backdrop,
.galpon-wiki-drawer-header {
  display: none;
}

@media (max-width: 981px) {
  /* ---- Topbar: logo izquierda, hamburguesa naranja derecha ---- */
  .galpon-wiki-topbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 76px;
    background: #ffffff;
    border-bottom: 3px solid #e95420;
    padding: 0 10px;
    z-index: 995;
  }

  .galpon-wiki-logo img {
    height: 64px;
    width: auto;
    display: block;
  }

  .galpon-wiki-hamburger {
    display: inline-flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 44px;
    height: 40px;
    background: #e95420;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }

  .galpon-wiki-hamburger span {
    display: block;
    width: 20px;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
  }

  .galpon-wiki-hamburger:focus-visible {
    outline: 3px solid #202122;
    outline-offset: 2px;
  }

  /* ---- Drawer: panel blanco desde la derecha ---- */
  #mw-panel {
    position: fixed !important;
    top: 50% !important;
    left: auto !important;
    right: 16px !important;
    bottom: auto !important;
    transform: translate(calc(100% + 32px), -50%) !important;
    visibility: hidden !important;
    width: 300px !important;
    max-width: 85vw !important;
    max-height: 90vh !important;
    background: #ffffff !important;
    z-index: 1000 !important;
    transition: transform 0.25s ease, visibility 0s linear 0.25s !important;
    overflow-y: auto !important;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.35) !important;
    padding: 0 !important;
    border-radius: 8px !important;
  }

  body.galpon-drawer-open #mw-panel {
    transform: translate(0, -50%) !important;
    visibility: visible !important;
  }

  /* Cabecera del drawer: titulo + boton de cierre */
  .galpon-wiki-drawer-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    background: #c34113;
    padding: 0 8px 0 16px;
    position: sticky;
    top: 0;
  }

  .galpon-wiki-drawer-title {
    color: #ffffff;
    font-weight: bold;
    font-size: 15px;
  }

  .galpon-wiki-drawer-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    width: 44px;
    height: 44px;
    cursor: pointer;
    border-radius: 4px;
  }

  .galpon-wiki-drawer-close:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: -3px;
  }

  /* ---- Fondo atenuado ---- */
  .galpon-wiki-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.galpon-drawer-open .galpon-wiki-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.galpon-drawer-open {
    overflow: hidden;
  }

  /* ---- Contenido del drawer: enlaces grandes y con contraste ---- */
  #mw-panel .portal {
    padding: 6px 0 !important;
    border-bottom: 1px solid #eeeeee;
  }

  #mw-panel .portal h3 {
    display: block !important;
    font-size: 13px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #a33203 !important;
    font-weight: bold !important;
    margin: 0 !important;
    padding: 10px 16px 4px !important;
    border: none !important;
    background: transparent !important;
  }

  #mw-panel .portal ul {
    padding: 0 !important;
    margin: 0 !important;
  }

  #mw-panel .portal li {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
  }

  #mw-panel .portal a {
    display: block !important;
    padding: 14px 20px !important;
    min-height: 44px;
    color: #202122 !important;
    font-size: 16px !important;
    text-decoration: none !important;
    background: transparent !important;
    border: none !important;
  }

  #mw-panel .portal a:hover,
  #mw-panel .portal a:focus-visible {
    background: #f3e0d8 !important;
    color: #a33203 !important;
  }

  #mw-panel .portal a:focus-visible {
    outline: 3px solid #e95420;
    outline-offset: -3px;
  }

  /* El logo ya esta en la topbar: evitar duplicado en el drawer */
  #mw-panel #p-logo {
    display: none !important;
  }

  /* Dejar sitio a la topbar fija y cabecera Vector */
  body {
    padding-top: 76px !important;
  }

  .mw-body,
  #mw-data-after-content,
  #mw-head-base,
  #left-navigation {
    margin-left: 0 !important;
  }

  #mw-page-base {
    height: 6em !important;
  }

  #mw-head {
    top: 76px !important;
  }

  #left-navigation {
    left: 0.5em !important;
  }

  #right-navigation {
    right: 0.5em !important;
  }
}
