/* ==========================================================================
   Layout global: barra de progreso, header, menú, botón de WhatsApp y footer
   ========================================================================== */

/* ---------- Barra de progreso de lectura ---------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}

/* ---------- Header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.3s;
}

/* El desenfoque va en un pseudo-elemento: backdrop-filter en el propio header
   rompería el menú móvil de pantalla completa (position: fixed). */
.top::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(251, 246, 241, 0.86);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}

.top.is-scrolled {
  box-shadow: 0 10px 30px -22px rgba(42, 26, 23, 0.6);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.top-brand,
.burger {
  position: relative;
  z-index: 2;
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.top-name {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
}

.top-name small {
  display: block;
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Menú (móvil: pantalla completa) ---------- */
.menu {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-h) + 1rem) var(--gut) 2rem;
  background: var(--paper);
  visibility: hidden;
  clip-path: circle(0 at calc(100% - 40px) 32px);
  transition: clip-path 0.7s var(--ease), visibility 0s 0.7s;
}

.menu.is-open {
  visibility: visible;
  clip-path: circle(150% at calc(100% - 40px) 32px);
  transition: clip-path 0.7s var(--ease), visibility 0s;
}

.menu-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.menu-link {
  position: relative;
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 600;
  text-decoration: none;
}

.menu-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.4s var(--ease);
}

.menu-link:hover::after,
.menu-link.is-active::after {
  transform: scaleX(1);
}

.menu-list .btn {
  margin-top: 0.75rem;
}

/* ---------- Burger ---------- */
.burger {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  background: none;
  cursor: pointer;
}

.burger span {
  display: block;
  width: 26px;
  height: 1.5px;
  margin: 3.5px 0;
  background: var(--deep);
  transition: transform 0.4s var(--ease);
}

.burger[aria-expanded="true"] span:first-child {
  transform: translateY(2.5px) rotate(45deg);
}

.burger[aria-expanded="true"] span:last-child {
  transform: translateY(-2.5px) rotate(-45deg);
}

/* ---------- Header en escritorio ---------- */
@media (min-width: 1080px) {
  .burger {
    display: none;
  }

  .menu {
    position: static;
    z-index: auto;
    padding: 0;
    background: none;
    visibility: visible;
    clip-path: none;
    transition: none;
  }

  .menu-list {
    flex-direction: row;
    gap: 2rem;
  }

  .menu-link {
    font-family: var(--sans);
    font-size: 0.93rem;
    font-weight: 500;
  }

  .menu-list .btn {
    margin: 0;
  }
}

/* ---------- Botón flotante de WhatsApp ---------- */
.wa-float {
  position: fixed;
  left: var(--gut);
  right: var(--gut);
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 54px;
  border-radius: var(--r-btn);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 14px 34px -10px rgba(174, 69, 96, 0.75);
  opacity: 0;
  transform: translateY(140%);
  pointer-events: none;
  transition: opacity 0.4s, transform 0.5s var(--ease), background 0.3s;
}

.wa-float.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.wa-float:hover {
  background: var(--deep);
}

@media (min-width: 860px) {
  .wa-float {
    left: auto;
    right: 28px;
    bottom: 28px;
    padding: 0 1.5rem;
  }
}

/* ---------- Footer ---------- */
.footer {
  padding: 3rem 0 calc(6rem + env(safe-area-inset-bottom));
  background: var(--deep-2);
  color: rgba(255, 255, 255, 0.65);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
}

.footer-inner {
  display: grid;
  gap: var(--sp-4);
  justify-items: center;
  text-align: center;
}

.footer-brand {
  font-family: var(--script);
  font-size: 3.2rem;
  line-height: 1;
  color: var(--accent-light);
  text-decoration: none;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}

.footer-nav a {
  color: #fff;
  text-decoration: none;
}

.footer-nav a:hover {
  text-decoration: underline;
}

.footer-credit {
  padding-top: var(--sp-3);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: min(100%, 320px);
}

.footer-credit a {
  color: var(--accent-light);
  text-decoration: none;
}

.footer-credit a:hover {
  text-decoration: underline;
}

@media (min-width: 860px) {
  .footer {
    padding-bottom: 3rem;
  }
}