/* ============================================================
   ARAPY THEME — HEADER & OFFCANVAS
   ============================================================ */

/* ─── HEADER ────────────────────────────────────────────── */
.arapy-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;                          /* en lugar de width:100% */
    z-index: 1000;
    background: transparent;
    padding: 22px 48px;
    transition: background 0.4s ease, padding 0.4s ease, box-shadow 0.4s ease;
    /* Crítico: evita que el contenido interno desborde */
    box-sizing: border-box;
}

.arapy-header.is-scrolled {
    background: rgba(31, 44, 112, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 14px 48px;
    box-shadow: 0 1px 0 rgba(0, 200, 224, 0.15);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;                       /* ocupa todo el ancho disponible */
    max-width: var(--container-max, 1280px);
    margin: 0 auto;
    /* Sin position, sin transform, sin z-index aquí */
}

/* ─── BRANDING ──────────────────────────────────────────── */
.site-branding {
    display: flex;
    align-items: center;
    /* Sin z-index ni position que interfieran */
    flex-shrink: 0;
}

.site-branding .custom-logo-link img {
    height: 44px;
    width: auto;
    display: block;
    transition: opacity 0.25s ease;
}

.site-branding .custom-logo-link:hover img {
    opacity: 0.82;
}

.site-title-link {
    font-family: var(--font-display, 'Bebas Neue', sans-serif);
    font-size: 1.85rem;
    letter-spacing: 3px;
    color: #ffffff;
    text-decoration: none;
    line-height: 1;
    transition: opacity 0.25s ease;
    white-space: nowrap;
}

.site-title-link .title-accent { color: var(--color-primary, #00c8e0); }
.site-title-link:hover { opacity: 0.85; color: #ffffff; }

/* ─── BOTÓN HAMBURGUESA ─────────────────────────────────── */
.menu-toggle {
    /* Reset completo para evitar herencias problemáticas */
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    margin: 0;                         /* sin margin */
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Sin position, sin z-index aquí — el header ya tiene z-index */
}

.menu-toggle:focus-visible {
    outline: 2px solid var(--color-primary, #00c8e0);
    outline-offset: 4px;
    border-radius: 4px;
}

.menu-toggle .bar {
    display: block;
    width: 32px;
    height: 2.5px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.25s ease;
    transform-origin: center;
    /* Sin margin, sin position */
}

.menu-toggle.is-active .bar:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}
.menu-toggle.is-active .bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.menu-toggle.is-active .bar:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

.menu-toggle:hover .bar {
    background-color: var(--color-primary, #00c8e0);
}

/* ─── OVERLAY ───────────────────────────────────────────── */
.offcanvas-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    z-index: 998;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.offcanvas-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ─── OFFCANVAS MENU ────────────────────────────────────── */
.offcanvas-menu {
    position: fixed;
    inset: 0;
    width: 100%;                       /* explícito */
    max-width: 100vw;                  /* nunca desborda */
    overflow: hidden;                  /* sin scroll interno */
    background: rgba(4, 10, 22, 0.97);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s ease, visibility 0.45s ease;
    z-index: 999;
}

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

/* ─── TEXTO GIGANTE DE FONDO ────────────────────────────── */
.offcanvas-bg-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display, 'Bebas Neue', sans-serif);
    font-size: clamp(80px, 14vw, 200px);
    font-weight: 900;
    color: rgba(255, 255, 255, 0.04);
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    /* Recortar para no crear scroll horizontal */
    max-width: 100vw;
    overflow: hidden;
    transition: opacity 0.35s ease, transform 0.35s ease;
    letter-spacing: 6px;
    z-index: 1;
    will-change: opacity, transform;
}

.offcanvas-bg-text.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
    color: rgba(0, 200, 224, 0.06);
}

/* ─── NAVEGACIÓN DEL OFFCANVAS ──────────────────────────── */
.main-navigation {
    position: relative;
    z-index: 2;
    text-align: center;
    /* Limitar ancho para evitar desborde en móvil */
    width: 100%;
    padding: 0 24px;
    box-sizing: border-box;
}

.offcanvas-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.offcanvas-nav li {
    margin: 16px 0;
    opacity: 0;
    transform: translateY(35px);
    transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.offcanvas-nav li.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.offcanvas-nav a {
  font-family: var(--font-display, 'Bebas Neue', sans-serif);
  font-size: clamp(2.8rem, 4vw, 5rem);
  color: #ffffff;
  text-decoration: none;
  letter-spacing: 4px;
  line-height: 1.1;
  display: inline-block;
  transition: color 0.25s ease, letter-spacing 0.25s ease, transform 0.25s ease;
  will-change: color, letter-spacing;
  font-weight: 900;
  text-transform: uppercase;
}

.offcanvas-nav a:hover {
    color: var(--color-primary, #00c8e0);
    letter-spacing: 7px;
    transform: scale(1.02);
}

/* Footer del offcanvas */
.offcanvas-footer {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 28px;
    opacity: 0;
    transition: opacity 0.4s ease 0.3s;
    z-index: 2;
    white-space: nowrap;
}

.offcanvas-menu.is-open .offcanvas-footer { opacity: 1; }

.offcanvas-social a {
    font-size: 0.65rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(232, 237, 245, 0.45);
    transition: color 0.25s ease;
    text-decoration: none;
}

.offcanvas-social a:hover { color: var(--color-primary, #00c8e0); }

/* ─── FIX CLAVE: body con offcanvas abierto ─────────────── */
body.offcanvas-open {
    overflow: hidden;
    /* padding-right lo inyecta el JS dinámicamente */
}

/* ─── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 768px) {
    .arapy-header {
        padding: 16px 20px;
    }

    .arapy-header.is-scrolled {
        padding: 12px 20px;
    }

    .offcanvas-nav a {
        font-size: clamp(2rem, 10vw, 3.2rem);
        letter-spacing: 2px;
    }

    .offcanvas-nav a:hover {
        letter-spacing: 3px;
    }

    .offcanvas-footer {
        width: calc(100% - 48px);
        justify-content: center;
        flex-wrap: wrap;
        gap: 16px;
        bottom: 24px;
    }
}

/* ─── ACCESIBILIDAD ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .offcanvas-nav li,
    .offcanvas-bg-text,
    .menu-toggle .bar,
    .arapy-header,
    .offcanvas-menu {
        transition: none !important;
        animation: none !important;
    }
}