/* ==========================================================
   LLEBIPC – Layout: header, menú móvil y rejilla de secciones
   ========================================================== */

/* ---------------- Header ---------------- */

.site-header {
  position: relative;
  z-index: 100;
  background: var(--color-teal);
  color: #fff;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: -100px;
  transform: translateX(-50%);
  background: #fff;
  color: var(--color-teal);
  padding: 0.6em 1.2em;
  z-index: 200;
}

.skip-link:focus {
  top: 8px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8vw var(--page-padding);
}

.header-logo {
  display: block;
  flex-shrink: 0;
}

.header-logo img {
  height: 50px;
  width: auto;
}

/* Navegación de escritorio */
.header-nav {
  display: flex;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}

/* En pantallas medianas los enlaces pasan a una segunda línea, como el original */
.nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  column-gap: 4.1vw;
  row-gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-item {
  position: relative;
  font-size: 1rem;
  line-height: 1.8em;
}

.nav-item > a,
.nav-folder-title {
  display: inline-block;
  padding: 0.1em 0;
  color: #fff;
  text-decoration: none;
  font-weight: 300;
  line-height: 1.8em;
  white-space: nowrap;
  background-repeat: repeat-x;
  background-size: 1px 1px;
  background-position: 0 calc(100% - 0.1em);
}

/* Subrayado fino de la página activa y al pasar el ratón */
.nav-item > a[aria-current="page"],
.nav-item > a:hover,
.nav-item > a:focus-visible {
  background-image: linear-gradient(currentColor, currentColor);
}

/* Desplegables (Transparencia, Datos) */
.nav-folder-content {
  display: none;
  position: absolute;
  top: 100%;
  right: -1em;
  box-sizing: content-box;
  min-width: 200px;
  margin: 0;
  padding: 0.5em 1em;
  list-style: none;
  text-align: right;
  background: var(--color-teal);
  z-index: 10;
}

.nav-item--folder:hover .nav-folder-content,
.nav-item--folder:focus-within .nav-folder-content,
.nav-folder-title[aria-expanded="true"] + .nav-folder-content {
  display: block;
}

.nav-folder-content li {
  line-height: 1.3;
}

.nav-folder-content a {
  display: inline-block;
  padding: 0.1em 0;
  line-height: 1.3;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  background-repeat: repeat-x;
  background-size: 1px 1px;
  background-position: 0 calc(100% - 0.1em);
}

.nav-folder-content a:hover,
.nav-folder-content a:focus-visible,
.nav-folder-content a[aria-current="page"] {
  background-image: linear-gradient(currentColor, currentColor);
}

/* Botón hamburguesa (solo móvil) */
.burger {
  display: none;
  position: relative;
  width: 35px;
  height: 35px;
  z-index: 120;
}

.burger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: #fff;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s, background-color 0.25s, top 0.25s;
}

.burger span:nth-child(1) { top: 7px; }
.burger span:nth-child(2) { top: 16px; }
.burger span:nth-child(3) { top: 25px; }

.menu-open .burger span { background: #000; }
.menu-open .burger span:nth-child(1) { top: 16px; transform: rotate(45deg); }
.menu-open .burger span:nth-child(2) { opacity: 0; }
.menu-open .burger span:nth-child(3) { top: 16px; transform: rotate(-45deg); }

/* Menú superpuesto (móvil) */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  padding: 0 var(--page-padding-mobile);
  background: #fff;
  color: #000;
  visibility: hidden;
  opacity: 0;
  overflow-y: auto;
  transition: visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-open .mobile-menu {
  visibility: visible;
  opacity: 1;
}

.mobile-panel {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mobile-panel[hidden] {
  display: none;
}

.mobile-panel li {
  font-size: 2.45rem;            /* 31.9 px, igual que el original */
  line-height: 1;
}

.mobile-panel a,
.mobile-panel button {
  display: inline-flex;
  align-items: center;
  gap: 0.15em;
  padding: 0;
  color: #000;
  font-weight: 300;
  line-height: 1;
  text-decoration: none;
  text-align: left;
}

.mobile-panel svg {
  width: 0.7em;
  height: 0.7em;
  stroke: currentColor;
  stroke-width: 1px;
  fill: none;
}

.mobile-panel .menu-back {
  margin-bottom: 0.4em;
}

body.menu-open {
  overflow: hidden;
}

@media (max-width: 799px) {
  .site-header {
    transition: background-color 0.4s;
  }

  .header-inner {
    padding: 23.5px var(--page-padding-mobile);
  }

  /* Centra los enlaces en el espacio bajo el header, como el original */
  .mobile-menu {
    padding-top: 94px;
  }

  .header-logo img {
    height: 47px;
  }

  .header-nav {
    display: none;
  }

  .burger {
    display: block;
  }

  .menu-open .site-header {
    background: #fff;
  }

  .menu-open .header-logo {
    visibility: hidden;
  }
}

/* ---------------- Rejilla de secciones ----------------
   Reproduce el "Fluid Engine" de Squarespace:
   móvil  -> 8 columnas, filas mínimas de 24 px
   ≥768px -> 24 columnas, filas proporcionales al ancho
   Cada bloque recibe su posición con variables:
   --m (móvil), --d (escritorio), --zm / --zd (capas)        */

.page-section {
  position: relative;
  /* Relleno vertical: --pad en vw (escritorio) o vh (móvil vertical), como el original */
  padding-block: calc(var(--pad, 0) * 1vw);
  background: var(--color-bg);
}

@media screen and (max-width: 767px) and (orientation: portrait) {
  .page-section {
    padding-block: calc(var(--pad, 0) * min(1vh, 9px));
  }
}

/* Temas de color de sección */
.section--sky {
  background: var(--color-sky);
  color: var(--color-accent);
}

.section--teal {
  background: var(--color-teal);
  color: #fff;
}

.section--teal a {
  color: #fff;
}

/* Footer: franja gris oscura con los enlaces legales */
.section--dark {
  background: #1c1c1c;
  color: rgb(250, 250, 250);
}

.fluid {
  --gutter: var(--page-padding-mobile);
  --cell: calc(var(--max-page-width) / 8);
  display: grid;
  grid-template-columns: minmax(var(--gutter), 1fr) repeat(8, minmax(0, var(--cell))) minmax(var(--gutter), 1fr);
  grid-template-rows: repeat(var(--rows-m), minmax(24px, auto));
  overflow-x: clip;
}

.fe-block {
  position: relative;
  grid-area: var(--m);
  z-index: var(--zm, 1);
  display: flex;
  flex-direction: column;
  justify-content: var(--jm, flex-start);
  min-width: 0;
}

.fe-block > :first-child { margin-top: 0; }
.fe-block > :last-child { margin-bottom: 0; }

.fe-block--center { justify-content: center; align-items: center; }

/* La imagen ocupa el bloque sin empujar la altura de las filas */
.fe-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 50%;
}

.fe-img--cover {
  object-fit: cover;
}

@media (min-width: 768px) {
  .fluid {
    --gutter: var(--page-padding);
    --cell: calc(var(--max-page-width) / 24);
    --container: min(var(--max-page-width), calc(100vw - var(--page-padding) * 2));
    grid-template-columns: minmax(var(--gutter), 1fr) repeat(24, minmax(0, var(--cell))) minmax(var(--gutter), 1fr);
    grid-template-rows: repeat(var(--rows-d), minmax(calc(var(--container) * var(--row-scale, 0.0215)), auto));
  }

  .fe-block {
    grid-area: var(--d);
    z-index: var(--zd, 1);
    justify-content: var(--jd, flex-start);
  }
}

/* Pie al final de la ventana en páginas cortas (p. ej. Contacto) */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#page {
  flex: 1 0 auto;
}
