/* ============================================
   AJAX PAGE TRANSITION ANIMATIONS
   Pérez Gómez Theme - Barba.js Integration
   ============================================ */

/* ---- Main Content Container ---- */
.pg-main-content {
    position: relative;
    min-height: 50vh;
}

/* ============================================
   TRANSITION STATES
   ============================================ */

/* Leave animation: content fading out and sliding up */
.pg-main-content.pg-is-leaving {
    animation: pgLeave 0.45s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

/* Enter animation: content fading in and sliding up from below */
.pg-main-content.pg-is-entering {
    animation: pgEnter 0.6s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

/* ============================================
   KEYFRAMES
   ============================================ */

@keyframes pgLeave {
    0% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
        filter: blur(2px);
    }
}

@keyframes pgEnter {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   LOADING PROGRESS BAR
   A subtle bar at the top while fetching
   ============================================ */

.pg-loading-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
    z-index: 99999;
    pointer-events: none;
    transition: width 0.3s ease;
    will-change: width;
}

.pg-loading-bar.pg-is-loading {
    animation: pgLoadingBar 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.pg-loading-bar.pg-is-done {
    width: 100% !important;
    opacity: 0;
    transition: width 0.15s ease, opacity 0.3s ease 0.15s;
}

@keyframes pgLoadingBar {
    0%   { width: 0; }
    20%  { width: 30%; }
    50%  { width: 60%; }
    80%  { width: 80%; }
    100% { width: 90%; }
}

/* ============================================
   PAGE OVERLAY (optional subtle overlay during transition)
   ============================================ */

.pg-page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0);
    z-index: 9998;
    pointer-events: none;
    transition: background 0.3s ease;
}

.pg-page-overlay.pg-is-active {
    background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   PERFORMANCE HINTS
   ============================================ */

.pg-main-content {
    will-change: auto;
}

.pg-main-content.pg-is-leaving,
.pg-main-content.pg-is-entering {
    will-change: opacity, transform, filter;
}

/* ============================================
   LINK HOVER STATES (visual feedback for AJAX links)
   ============================================ */

/* During transition, disable pointer events on main content */
.pg-is-transitioning .pg-main-content {
    pointer-events: none;
}

/* ============================================
   REDUCED MOTION ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .pg-main-content.pg-is-leaving,
    .pg-main-content.pg-is-entering {
        animation-duration: 0.01ms !important;
    }

    .pg-loading-bar.pg-is-loading {
        animation-duration: 0.01ms !important;
    }
}

/* ============================================
   DEFAULT HEADER/FOOTER STYLES (fallback)
   Only used when Elementor header/footer
   is NOT configured.
   ============================================ */

.pg-default-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.pg-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

.pg-site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.pg-nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.pg-nav-list a {
    color: #374151;
    font-weight: 500;
    transition: color 0.2s ease;
}

.pg-nav-list a:hover {
    color: #6366f1;
}

.pg-default-footer {
    background: #f8f5f1;
    padding: 0 59px;
}

.pg-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(57, 47, 41, 0.15);
    color: #392f29;
    font-family: 'Mona Sans', 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.pg-footer-brand,
.pg-footer-rights,
.pg-footer-privacy {
    white-space: nowrap;
}

.pg-footer-privacy {
    color: #392f29;
    transition: opacity 0.2s ease;
}

.pg-footer-privacy:hover {
    opacity: 0.6;
}

/* Footer responsive */
@media (max-width: 1024px) {
    .pg-default-footer {
        padding: 0 30px;
    }
}

@media (max-width: 768px) {
    .pg-default-footer {
        padding: 0 24px;
    }

    .pg-footer-inner {
        justify-content: center;
        gap: 12px;
        font-size: 8px;
        padding: 10px 0;
    }
}

/* ============================================
   BASIC CONTENT STYLES (fallback)
   ============================================ */

.pg-content-area {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.pg-entry-title {
    margin-top: 0;
}

.pg-entry-title a {
    transition: color 0.2s ease;
}

.pg-entry-title a:hover {
    color: #6366f1;
}

.pg-article + .pg-article {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid #e5e7eb;
}

/* 404 page */
.pg-404-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.pg-404-title {
    font-size: 6rem;
    font-weight: 800;
    color: #e5e7eb;
    margin: 0;
    line-height: 1;
}

.pg-404-subtitle {
    font-size: 1.5rem;
    color: #374151;
    margin: 0.5rem 0;
}

.pg-404-text {
    color: #6b7280;
    margin-bottom: 2rem;
}

.pg-404-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #6366f1;
    color: #fff !important;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.15s ease;
}

.pg-404-button:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}
