/* =====================================================================
   Cabecera y menu publico - Iglesia del Puente
   ---------------------------------------------------------------------
   Hoja unica para la cabecera. Se carga la ultima en las ocho paginas
   publicas, asi que es la que manda: aqui no hay !important porque no hay
   con quien competir. Si algo de la cabecera no sale como esperas, esta
   en este archivo y en ninguno mas.

   Antes estas mismas reglas vivian repartidas entre styles.css,
   redesign-option-2.css, public-polish.css y esta, cada una pisando a la
   anterior. Averiguar cual ganaba costaba mas que el cambio en si.

   Orden: primero lo comun, luego escritorio (>=821px), luego movil.
   ===================================================================== */

html{scrollbar-gutter:stable}

/* ---------------------------------------------------------- lo comun -- */

.site-header{
  position:sticky;
  top:0;
  z-index:1000;
  width:100%;
  height:82px;
  overflow:visible;
  background:#fff;
  border:0;
  border-bottom:1px solid #dedfd9;
  box-shadow:none;
  backdrop-filter:none;
  font-family:Arial,Helvetica,sans-serif;
}

.header-inner{
  box-sizing:border-box;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
  max-width:1320px;
  height:82px;
  margin:0 auto;
  padding:10px 28px;
  gap:16px;
  overflow:visible;
}

.brand{
  display:flex;
  flex:0 0 auto;
  align-items:center;
  gap:12px;
  min-width:0;
  color:#171717;
  text-decoration:none;
}

.brand img{
  display:block;
  flex:0 0 58px;
  width:58px;
  height:58px;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  object-fit:contain;
}

.brand strong{
  display:block;
  margin:0;
  color:#171717;
  font-size:.95rem;
  font-weight:700;
  line-height:1.1;
  letter-spacing:.01em;
}

.brand span{
  display:block;
  margin-top:2px;
  color:#666963;
  font-size:.67rem;
  font-weight:400;
  line-height:1.2;
}

/* El boton tiene que ser contenedor de sus dos rayas, que van absolutas. */
.menu-toggle{
  position:relative;
  z-index:1701;
  flex:0 0 auto;
  width:44px;
  height:44px;
  border:1px solid var(--o2-line);
  border-radius:0;
  background:#fff;
  box-shadow:none;
  font-size:1.4rem;
  cursor:pointer;
}

body.menu-open{overflow:hidden}

/* -------------------------------------------- escritorio (>=821px) -- */

@media(min-width:821px){
  .menu-toggle{display:none}

  #mainMenu{
    position:static;
    display:flex;
    flex:1 1 auto;
    align-items:center;
    justify-content:center;
    width:auto;
    max-height:none;
    margin:0;
    padding:0;
    gap:8px;
    overflow:visible;
    border:0;
    background:transparent;
    box-shadow:none;
    opacity:1;
    visibility:visible;
    transform:none;
    pointer-events:auto;
  }

  #mainMenu > a{
    box-sizing:border-box;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:38px;
    margin:0;
    padding:8px 14px;
    border:0;
    border-radius:999px;
    background:transparent;
    color:#27231d;
    font-family:Arial,Helvetica,sans-serif;
    font-size:.84rem;
    font-weight:750;
    line-height:1.2;
    text-decoration:none;
    white-space:nowrap;
    box-shadow:none;
  }

  #mainMenu > a:hover,
  #mainMenu > a:focus{
    background:#fff1cc;
    color:#171717;
  }

  #mainMenu > a[aria-current="page"]{
    background:transparent;
    color:#c99100;
  }
}

/* ------------------------------------------------ movil (<=820px) -- */

@media(max-width:820px){
  .site-header{height:74px}
  .header-inner{height:74px;padding:8px 16px}
  .brand img{flex-basis:52px;width:52px;height:52px}
  .brand span{display:none}

  body.menu-open{overflow:hidden}

  .menu-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:46px;
    height:46px;
    border:1px solid var(--public-line);
    border-radius:8px;
    background:#fff;
    color:#171717;
    box-shadow:0 10px 24px rgba(25,20,10,.10);
    cursor:pointer;
    font-size:0;
  }

  .menu-toggle::before,
  .menu-toggle::after{
    content:'';
    position:absolute;
    width:20px;
    height:2px;
    border-radius:99px;
    background:#171717;
    transition:transform .18s ease,box-shadow .18s ease;
  }

  .menu-toggle::before{
    transform:translateY(-5px);
    box-shadow:0 5px 0 #171717;
  }

  .menu-toggle::after{transform:translateY(5px)}
  .menu-toggle.active::before{transform:rotate(45deg);box-shadow:none}
  .menu-toggle.active::after{transform:rotate(-45deg)}

  /* El panel se encoge hasta lo que miden las palabras en vez de ocupar el
     80% de la pantalla. Esquinas rectas, linea de 1px y sombra suave: el
     mismo lenguaje que el resto del rediseno. */
  #mainMenu{
    display:grid;
    grid-template-columns:minmax(0,1fr);
    position:absolute;
    top:calc(100% + 10px);
    right:12px;
    left:auto;
    width:auto;
    max-width:calc(100vw - 24px);
    max-height:min(520px,calc(100svh - 106px));
    overflow-y:auto;
    z-index:1700;
    align-items:stretch;
    justify-items:stretch;
    justify-content:start;
    align-content:start;
    gap:0;
    padding:6px;
    border:1px solid var(--public-line);
    border-radius:0;
    background:#fff;
    box-shadow:0 12px 28px rgba(25,20,10,.12);
    opacity:0;
    visibility:hidden;
    transform:translateY(-8px) scale(.985);
    transform-origin:top right;
    pointer-events:none;
    transition:opacity .18s ease,transform .18s ease,visibility .18s ease;
    backdrop-filter:none;
    text-align:left;
  }

  #mainMenu.open{
    opacity:1;
    visibility:visible;
    transform:translateY(0) scale(1);
    pointer-events:auto;
  }

  #mainMenu > a{
    box-sizing:border-box;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    gap:12px;
    grid-column:1 / -1;
    justify-self:stretch;
    width:100%;
    max-width:none;
    min-height:44px;
    margin:0;
    padding:11px 22px 11px 12px;
    border:0;
    border-radius:0;
    background:transparent;
    color:#20221f;
    font-size:.94rem;
    font-weight:750;
    line-height:1.2;
    text-align:left;
    text-decoration:none;
    /* "normal" en vez de "nowrap": con un rotulo corriente el panel mide
       lo mismo (el ancho lo fija el texto mas largo), pero si alguien
       escribe un apartado larguisimo corta de linea en vez de dejar el
       menu con scroll horizontal. */
    white-space:normal;
  }

  /* Los iconos van en SVG dentro de este archivo, no con una fuente de
     iconos: noticias.php, quienes-somos.php, recursos.php y las paginas
     legales no cargan Material Symbols, y alli una fuente dejaria escrita
     la palabra "home" en vez del dibujo. Asi tampoco se anade ni una
     descarga mas. El punto es el icono por defecto: si manana se anade un
     apartado nuevo desde el panel, sale un punto discreto y no un hueco. */
  #mainMenu > a::before{
    content:'';
    flex:0 0 auto;
    width:20px;
    height:20px;
    background-repeat:no-repeat;
    background-position:center;
    background-size:20px 20px;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href="#inicio"]::before,
  #mainMenu > a[href="index.php"]::before,
  #mainMenu > a[href="/"]::before,
  #mainMenu > a[href="./"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.4 11.4 12 4.3l8.6 7.1'/%3E%3Cpath d='M5.8 10.2v9.5h12.4v-9.5'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href*="predicaciones.php"]::before,
  #mainMenu > a[href$="#predicaciones"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 7.2C10 5.9 7.6 5.4 5 5.6v12.2c2.6-.2 5 .3 7 1.6 2-1.3 4.4-1.8 7-1.6V5.6c-2.6-.2-5 .3-7 1.6Z'/%3E%3Cpath d='M12 7.2v12.2'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href$="#eventos"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.8' y='5.6' width='16.4' height='14' rx='1.2'/%3E%3Cpath d='M8.2 3.6v4M15.8 3.6v4M3.8 10.4h16.4'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href$="#ubicacion"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20.8s6.6-5.4 6.6-10.4a6.6 6.6 0 1 0-13.2 0c0 5 6.6 10.4 6.6 10.4Z'/%3E%3Ccircle cx='12' cy='10.2' r='2.4'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href*="noticias.php"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5.4h11.4v13.2a1.8 1.8 0 0 0 1.8 1.8H6.8A1.8 1.8 0 0 1 5 18.6Z'/%3E%3Cpath d='M16.4 9h2.8v9.6a1.8 1.8 0 0 1-1.8 1.8'/%3E%3Cpath d='M7.6 8.8h6.2M7.6 12h6.2M7.6 15.2h4'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href*="quienes-somos.php"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9.2' cy='9' r='3'/%3E%3Cpath d='M3.6 19.4c0-3.1 2.5-5.2 5.6-5.2s5.6 2.1 5.6 5.2'/%3E%3Cpath d='M16 6.6a3 3 0 0 1 0 5.6'/%3E%3Cpath d='M17.4 14.8c1.8.7 3 2.3 3 4.6'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href*="recursos.php"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.6 7.4h5.6l2 2.6h9.2v9.6H3.6Z'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href$="#donaciones"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20s-7.2-4.4-7.2-9.3a4 4 0 0 1 7.2-2.4 4 4 0 0 1 7.2 2.4c0 4.9-7.2 9.3-7.2 9.3Z'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href$="#galeria"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.8' y='5.4' width='16.4' height='13.2' rx='1.2'/%3E%3Ccircle cx='9' cy='10' r='1.6'/%3E%3Cpath d='m4.6 17 4.6-4.4 3.4 3.2 2.8-2.4 3.8 3.6'/%3E%3C/svg%3E");
  }

  #mainMenu > a[href$="#app"]::before{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8912a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='7' y='3.4' width='10' height='17.2' rx='1.8'/%3E%3Cpath d='M10.8 17.6h2.4'/%3E%3C/svg%3E");
  }

  #mainMenu > a:hover,
  #mainMenu > a:focus,
  #mainMenu > a[aria-current="page"]{
    background:#f6f0df;
    color:#171717;
    border-bottom:0;
  }

  #mainMenu > a::after{content:none}
}

/* ------------------------------------------- pantallas muy estrechas -- */

@media(max-width:520px){
  /* El ancho ya lo decide el contenido; aqui solo se evita que el panel
     llegue a tocar el borde en pantallas muy estrechas. */
  #mainMenu{
    right:12px;
    max-width:calc(100vw - 24px);
  }
}
