/* =========================================================
   LAYOUT | Header, navegación y footer
   ========================================================= */

/* === HEADER GENERAL === */

.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  min-height: var(--header-height);
  background: rgba(246, 239, 228, 0.92);
  backdrop-filter: blur(0.75rem);
  border-bottom: 0.0625rem solid rgba(91, 64, 50, 0.08);
}

.header-content {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.25rem);
}

/* Logo izquierda */
.logo {
  order: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

.logo img {
  width: auto;
  height: clamp(3rem, 8vw, 4rem);
}

/* En escritorio permitimos un logo algo mayor */
@media (min-width: 62rem) {
  .logo img {
    height: clamp(4rem, 6vw, 5.25rem);
  }
}

/* Botón hamburguesa, por si lo usas en alguna página */
.nav-toggle {
  order: 3;
  display: block;
  color: var(--color-primary);
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

/* Menú principal */
.site-header nav {
  order: 2;
  position: fixed;
  top: var(--header-height);
  right: -100%;
  width: 100%;
  height: calc(100dvh - var(--header-height));
  background: var(--color-bg);
  transition: var(--transition);
  overflow-y: auto;
  z-index: 899;
}

.site-header nav.active {
  right: 0;
}

.site-header nav ul {
  list-style: none;
  display: grid;
  gap: clamp(1rem, 4vw, 1.5rem);
  padding: clamp(1.5rem, 6vw, 2rem);
}

.site-header nav li {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.2rem);
}

.site-header nav a {
  color: var(--color-primary);
  font-weight: 500;
  opacity: 0.82;
  transition: var(--transition);
}

.site-header nav a.active {
  text-decoration: underline;
  text-underline-offset: 0.35rem;
  text-decoration-thickness: 0.125rem;
}

@media (hover: hover) and (pointer: fine) {
  .site-header nav a:hover {
    opacity: 1;
    transform: translateY(-0.0625rem);
  }
}

/* Usuario siempre a la derecha del todo */
.nav-right {
  order: 4;
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.625rem;
}

#user-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Desktop */
/* Desktop */
@media (min-width: 48rem) {
  .nav-toggle {
    display: none;
  }

  .site-header nav {
    position: static;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    height: auto;
    background: none;
    overflow: visible;
    z-index: auto;
  }

  .site-header nav ul {
    display: flex;
    flex-wrap: nowrap; /* clave: evita que Contacto baje */
    justify-content: center;
    align-items: center;
    gap: clamp(0.45rem, 0.9vw, 1rem);
    padding: 0;
  }

  .site-header nav li {
    flex: 0 0 auto;
    margin: 0;
    font-size: clamp(0.78rem, 0.85vw, 0.95rem);
  }

  .site-header nav a {
    white-space: nowrap;
  }
}
/* Header más compacto cuando el espacio empieza a ir justo */
@media (min-width: 48rem) and (max-width: 76rem) {
  .site-header nav ul {
    gap: 0.55rem;
  }

  .site-header nav li {
    font-size: 0.82rem;
  }

  .logo img {
    height: clamp(3rem, 5vw, 3.6rem);
  }

  .user-avatar {
    gap: 0.3rem;
    padding: 0.25rem 0.35rem;
  }

  .user-points {
    padding: 0.2rem 0.4rem;
    font-size: 0.68rem;
  }

  .user-menu-chevron {
    display: none;
  }
}

/* Móvil: logo izquierda + usuario derecha */
@media (max-width: 47.99rem) {
  .header-content {
    justify-content: space-between;
  }

  .main-nav {
    display: none;
  }

  .nav-right {
    margin-left: auto;
  }

  .logo img {
    height: clamp(3.75rem, 16vw, 4.35rem);
    max-height: none;
  }
}

/* === FOOTER === */

.site-footer {
  margin-top: clamp(3rem, 6vw, 4rem);
  background: var(--color-primary);
  color: var(--color-white);
  padding: clamp(2.5rem, 6vw, 3.25rem) 0 1.25rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: clamp(1.5rem, 4vw, 2rem);
  align-items: start;
}

.footer-logo {
  height: clamp(2.5rem, 5vw, 3rem);
  width: auto;
  margin-bottom: 0.8rem;
}

.site-footer h3 {
  font-family: var(--font-title);
  color: var(--color-white);
  margin-bottom: 0.8rem;
}

.footer-links {
  list-style: none;
  display: grid;
  gap: 0.6rem;
  padding-left: 0;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.9);
  transition: var(--transition);
}

@media (hover: hover) and (pointer: fine) {
  .footer-links a:hover {
    color: var(--color-white);
    text-decoration: underline;
    text-underline-offset: 0.25rem;
  }
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 0.0625rem solid rgba(255, 255, 255, 0.15);
  text-align: center;
  font-size: 0.92rem;
}

.footer-bottom p {
  margin: 0;
}