/* ==========================================
   NUESTRO ARSENAL — MACHINES SHOWCASE
   ========================================== */

.maquinas-section {
    background: var(--warg-bg-white);
    padding: 80px 48px;
    position: relative;
    overflow: hidden;
}


.maquinas-inner {
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.maquinas-section .section-header {
    text-align: center;
    margin-bottom: 60px;
}

.maquinas-section .section-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--warg-font-display);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--warg-blue-vibrant);
    margin-bottom: 16px;
}

.maquinas-section .section-badge svg {
    width: 18px;
    height: 18px;
    fill: var(--warg-blue-vibrant);
}

.maquinas-section .section-title {
    font-family: var(--warg-font-display);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--warg-text-primary);
    line-height: 1.1;
    margin-bottom: 12px;
}

.maquinas-section .section-subtitle {
    font-family: var(--warg-font-body);
    font-size: 1.05rem;
    color: var(--warg-text-body);
    max-width: 550px;
    margin: 0 auto;
}

/* ---- MACHINE GRID ---- */

.maquinas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ---- MACHINE CARD ---- */

.maquina-card {
    position: relative;
    background: var(--warg-bg-white);
    overflow: visible;
    cursor: pointer;
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
    /* Use outline instead of box-shadow so clip-path doesn't cut it */
    outline: 1px solid rgba(27, 117, 188, 0.08);
    outline-offset: -1px;
    transition: transform 0.35s ease, outline-color 0.35s ease, filter 0.35s ease;
    filter: drop-shadow(0 2px 6px rgba(10, 43, 78, 0.06));
}

.maquina-card:hover {
    transform: translateY(-6px);
    outline-color: rgba(27, 117, 188, 0.6);
    filter:
        drop-shadow(0 0 8px rgba(27, 117, 188, 0.35))
        drop-shadow(0 0 20px rgba(27, 117, 188, 0.15))
        drop-shadow(0 8px 16px rgba(10, 43, 78, 0.1));
}

/* Corner cut accents — both diagonal corners */
.maquina-card::before,
.maquina-card::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: var(--warg-blue-vibrant);
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.maquina-card::before {
    top: 0;
    right: 0;
    clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.maquina-card::after {
    bottom: 0;
    left: 0;
    clip-path: polygon(0 0, 0 100%, 100% 100%);
}

.maquina-card:hover::before,
.maquina-card:hover::after {
    opacity: 1;
}

/* Image container */
.maquina-img-wrap {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: linear-gradient(180deg, var(--warg-bg-gray), rgba(10, 43, 78, 0.06));
}

.maquina-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.maquina-card:hover .maquina-img-wrap img {
    transform: scale(1.08);
}

/* Spotlight glow on hover */
.maquina-img-wrap::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(27, 117, 188, 0.12), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.maquina-card:hover .maquina-img-wrap::after {
    opacity: 1;
}

/* Card info bar */
.maquina-info {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(27, 117, 188, 0.08);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.maquina-info > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.maquina-card:hover .maquina-info {
    border-top-color: rgba(27, 117, 188, 0.35);
    box-shadow: 0 -4px 12px rgba(27, 117, 188, 0.08);
}

.maquina-name {
    font-family: var(--warg-font-display);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--warg-text-primary);
}

.maquina-tag {
    font-family: var(--warg-font-body);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--warg-blue-vibrant);
    background: rgba(27, 117, 188, 0.12);
    padding: 4px 10px;
    white-space: nowrap;
}

.maquina-expand-icon {
    width: 20px;
    height: 20px;
    color: rgba(10, 43, 78, 0.25);
    transition: var(--warg-transition);
    flex-shrink: 0;
}

.maquina-card:hover .maquina-expand-icon {
    color: var(--warg-blue-vibrant);
}

/* ==========================================
   HERO TRANSITION — FULLSCREEN IMMERSIVE
   ========================================== */

/* Overlay: covers entire viewport */
.maquina-hero-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0s linear 0.7s;
}

.maquina-hero-overlay.active {
    pointer-events: all;
    visibility: visible;
    transition: visibility 0s linear 0s;
}

/* Dark backdrop — on CLOSE: fades LAST (delayed) so page doesn't show through */
.maquina-hero-backdrop {
    position: absolute;
    inset: 0;
    background: #050f1e;
    opacity: 0;
    transition: opacity 0.35s ease 0.25s;
}

/* On OPEN: backdrop fades in immediately */
.maquina-hero-overlay.active .maquina-hero-backdrop {
    opacity: 1;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Flying image — starts at card position, animates to left half */
.maquina-hero-image {
    position: absolute;
    will-change: transform, width, height, top, left;
    transition: all 0.65s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.maquina-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 24px;
    filter: drop-shadow(0 20px 60px rgba(0, 0, 0, 0.6));
}

/* Spotlight glow under machine in fullscreen */
.maquina-hero-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 50%;
    background: radial-gradient(ellipse, rgba(27, 117, 188, 0.3), transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.maquina-hero-overlay.active .maquina-hero-image::after {
    opacity: 1;
}

/* Scan line effect on image area */
.maquina-hero-image::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--warg-blue-vibrant), transparent);
    z-index: 3;
    opacity: 0;
    transition: opacity 0.3s ease 0.5s;
}

.maquina-hero-overlay.active .maquina-hero-image::before {
    opacity: 1;
    animation: heroScanLine 2s ease-in-out 0.6s forwards;
}

@keyframes heroScanLine {
    0% { top: -2px; }
    100% { top: 100%; }
}

/* Right content panel — slides + fades in from right */
.maquina-hero-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 58%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 60px 56px;
    gap: 24px;
    z-index: 2;
    overflow-y: auto;
    transform: translateX(40px);
    opacity: 0;
    /* CLOSE: fast fade out, no delay */
    transition: transform 0.25s ease, opacity 0.2s ease;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.maquina-hero-content::-webkit-scrollbar {
    display: none;
}

/* OPEN: delayed slide in */
.maquina-hero-overlay.active .maquina-hero-content {
    transform: translateX(0);
    opacity: 1;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.35s,
                opacity 0.5s ease 0.35s;
}

/* Vertical accent line — fixed on overlay, not inside scrollable panel */
.maquina-hero-divider {
    position: absolute;
    left: 42%;
    top: 10%;
    bottom: 10%;
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--warg-blue-vibrant), transparent);
    z-index: 3;
    opacity: 0;
    /* CLOSE: fast */
    transition: opacity 0.2s ease;
}

/* OPEN: delayed */
.maquina-hero-overlay.active .maquina-hero-divider {
    opacity: 1;
    transition: opacity 0.4s ease 0.6s;
}

/* Close button */
.maquina-hero-close {
    position: absolute;
    top: 28px;
    right: 28px;
    width: 48px;
    height: 48px;
    background: rgba(27, 117, 188, 0.1);
    border: 1px solid rgba(27, 117, 188, 0.3);
    color: var(--warg-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    opacity: 0;
    /* CLOSE: fast */
    transition: opacity 0.15s ease, background 0.3s ease;
}

/* OPEN: delayed */
.maquina-hero-overlay.active .maquina-hero-close {
    opacity: 1;
    transition: opacity 0.3s ease 0.5s, background 0.3s ease;
}

.maquina-hero-close:hover {
    background: rgba(27, 117, 188, 0.3);
}

.maquina-hero-close svg {
    width: 22px;
    height: 22px;
}

/* Content elements */
.maquina-hero-label {
    font-family: var(--warg-font-display);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--warg-blue-vibrant);
    display: flex;
    align-items: center;
    gap: 10px;
}

.maquina-hero-label::before {
    content: '';
    width: 32px;
    height: 2px;
    background: var(--warg-blue-vibrant);
}

.maquina-hero-name {
    font-family: var(--warg-font-display);
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--warg-text-light);
    line-height: 1.05;
}

.maquina-hero-desc {
    font-family: var(--warg-font-body);
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.8;
    max-width: 100%;
}

.maquina-hero-products-title {
    font-family: var(--warg-font-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 12px;
}

/* ---- Visual product cards grid ---- */
.maquina-hero-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.maquina-product-card {
    position: relative;
    overflow: hidden;
    cursor: default;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    border: 1px solid rgba(27, 117, 188, 0.15);
    background: rgba(10, 43, 78, 0.5);
    transition: border-color 0.3s ease, transform 0.3s ease;
    /* Staggered entrance */
    opacity: 0;
    transform: translateY(16px);
    animation: productCardIn 0.4s ease forwards;
}

.maquina-product-card:hover {
    border-color: rgba(27, 117, 188, 0.5);
    transform: translateY(-3px);
}

/* Stagger delay set by JS via style */
@keyframes productCardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.maquina-product-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.maquina-product-card:hover img {
    transform: scale(1.1);
}

/* Product name overlay at bottom */
.maquina-product-card-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 10px;
    background: linear-gradient(0deg, rgba(5, 15, 30, 0.9) 0%, transparent 100%);
    font-family: var(--warg-font-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--warg-text-light);
    text-align: center;
}

/* Blue accent dot on hover */
.maquina-product-card::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    background: var(--warg-blue-vibrant);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.maquina-product-card:hover::after {
    opacity: 1;
}

/* CTA inside hero view */
.maquina-hero-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    font-family: var(--warg-font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--warg-text-light);
    background: var(--warg-blue-vibrant);
    padding: 18px 28px;
    margin-top: 12px;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    transition: background 0.3s ease, transform 0.3s ease;
}

.maquina-hero-cta:hover {
    background: #1565a8;
    transform: translateY(-2px);
}

.maquina-hero-cta svg {
    width: 18px;
    height: 18px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

/* ---- Tablet & Mobile shared: hide FLIP, use simple fullscreen scroll ---- */
@media (max-width: 1024px) {
    .maquinas-section {
        padding: 70px 32px;
    }

    .maquinas-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .maquina-card {
        clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    }

    /* HERO: Hide flying image on mobile, use simple overlay scroll */
    .maquina-hero-image {
        display: none !important;
    }

    .maquina-hero-overlay {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
    }

    .maquina-hero-overlay.active {
        display: flex;
    }

    .maquina-hero-backdrop {
        position: fixed;
        inset: 0;
    }

    .maquina-hero-content {
        position: relative;
        width: 100%;
        height: auto;
        top: 0;
        right: 0;
        padding: 60px 32px 40px;
        overflow-y: visible;
        z-index: 2;
        transform: none;
        opacity: 0;
        transition: opacity 0.4s ease 0.15s;
    }

    .maquina-hero-overlay.active .maquina-hero-content {
        opacity: 1;
    }

    /* Show machine image inline inside the content panel via JS-set custom property */
    .maquina-hero-content::before {
        content: '';
        display: block;
        width: 100%;
        height: 35vh;
        background-image: var(--machine-img);
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        margin-bottom: 20px;
        flex-shrink: 0;
        filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.4));
    }

    .maquina-hero-divider {
        display: none;
    }

    .maquina-hero-name {
        font-size: 1.8rem;
    }

    .maquina-hero-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .maquina-hero-close {
        position: fixed;
        top: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        z-index: 20;
    }

    .maquina-hero-cta {
        width: 100%;
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    }
}

/* ---- Mobile landscape (max-width: 768px) ---- */
@media (max-width: 768px) {
    .maquinas-section {
        padding: 60px 24px;
    }

    .maquinas-section .section-header {
        margin-bottom: 40px;
    }

    .maquinas-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .maquina-card {
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    }

    .maquina-info {
        padding: 12px 14px;
    }

    .maquina-name {
        font-size: 0.85rem;
        letter-spacing: 0.5px;
    }

    .maquina-tag {
        font-size: 0.6rem;
        padding: 3px 8px;
    }

    .maquina-hero-content {
        padding: 56px 24px 32px;
    }

    .maquina-hero-name {
        font-size: 1.6rem;
    }

    .maquina-hero-desc {
        font-size: 0.95rem;
    }

    .maquina-hero-cta {
        padding: 16px 24px;
        font-size: 0.9rem;
    }

    .maquina-hero-close svg {
        width: 24px;
        height: 24px;
    }
}

/* ---- Mobile portrait (max-width: 480px) ---- */
@media (max-width: 480px) {
    .maquinas-section {
        padding: 60px 20px;
    }

    .maquinas-section .section-header {
        margin-bottom: 32px;
    }

    .maquinas-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .maquina-card {
        clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    }

    .maquina-img-wrap {
        aspect-ratio: 16/10;
    }

    .maquina-info {
        padding: 14px 16px;
    }

    .maquina-name {
        font-size: 0.9rem;
    }

    .maquina-tag {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    .maquina-hero-content {
        padding: 52px 20px 32px;
        gap: 16px;
    }

    .maquina-hero-content::before {
        height: 30vh;
    }

    .maquina-hero-label {
        font-size: 0.7rem;
    }

    .maquina-hero-name {
        font-size: 1.4rem;
    }

    .maquina-hero-desc {
        font-size: 0.9rem;
    }

    .maquina-hero-products-grid {
        gap: 8px;
    }

    .maquina-product-card-label {
        font-size: 0.6rem;
        padding: 6px 8px;
    }

    .maquina-hero-cta {
        padding: 16px 20px;
        font-size: 0.9rem;
        clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    }

    .maquina-hero-close {
        top: 10px;
        right: 10px;
    }
}
