/* AC14 Folletos — Frontend */

.ac14-folletos-wrap { position: relative; container-type: inline-size; }

/* Rejilla de N columnas (por defecto 6). Todas las portadas tienen la misma altura (la de un A4 de 1 columna): 1 bloque = 1 columna,
   2 bloques = 2 columnas con esa misma altura. La portada se ve siempre entera (los huecos se rellenan con la misma imagen difuminada). */
.ac14-folletos-grid {
    --ac14-fol-n: 6;
    --ac14-fol-gap: 20px;
    --ac14-fol-u: calc((100cqw - (var(--ac14-fol-n) - 1) * var(--ac14-fol-gap)) / var(--ac14-fol-n));
    --ac14-fol-h: calc(var(--ac14-fol-u) * 297 / 210);
    display: grid;
    gap: var(--ac14-fol-gap);
    grid-auto-flow: dense;
    align-items: start;
    grid-template-columns: repeat(var(--ac14-fol-n), minmax(0, 1fr));
}
.ac14-folletos-cols-1 { --ac14-fol-n: 1; }
.ac14-folletos-cols-2 { --ac14-fol-n: 2; }
.ac14-folletos-cols-3 { --ac14-fol-n: 3; }
.ac14-folletos-cols-4 { --ac14-fol-n: 4; }
.ac14-folletos-cols-5 { --ac14-fol-n: 5; }
.ac14-folletos-cols-6 { --ac14-fol-n: 6; }

.ac14-folletos-grid > .ac14-folleto-card { min-width: 0; }
.ac14-folletos-grid > .ac14-folleto-card.ac14-bloques-2 { grid-column: span 2; }
.ac14-folletos-cols-1 > .ac14-folleto-card.ac14-bloques-2 { grid-column: span 1; }

@media (max-width: 1280px) {
    .ac14-folletos-cols-6 { --ac14-fol-n: 5; }
}
@media (max-width: 1024px) {
    .ac14-folletos-cols-6, .ac14-folletos-cols-5 { --ac14-fol-n: 4; }
}

/* Móvil / tablet pequeña: slider horizontal (se desliza con el dedo; flechas a los lados) */
.ac14-folletos-flecha { display: none; }
@media (max-width: 768px) {
    .ac14-folletos-grid,
    .ac14-folletos-grid[class*="ac14-folletos-cols-"] {
        --ac14-fol-n: 2;
        --ac14-fol-gap: 12px;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 4px 2px 10px;
    }
    .ac14-folletos-grid::-webkit-scrollbar { display: none; }
    .ac14-folletos-grid { display: flex; }
    .ac14-folletos-grid > .ac14-folleto-card { flex: 0 0 var(--ac14-fol-u); width: var(--ac14-fol-u); scroll-snap-align: start; }
    .ac14-folletos-grid > .ac14-folleto-card.ac14-bloques-2 { flex-basis: calc(2 * var(--ac14-fol-u) + var(--ac14-fol-gap)); width: calc(2 * var(--ac14-fol-u) + var(--ac14-fol-gap)); }
    .ac14-folletos-flecha {
        position: absolute; top: 34%; width: 36px; height: 36px; margin-top: -18px;
        display: flex; align-items: center; justify-content: center; padding: 0;
        border: 1px solid #e5e7eb; border-radius: 50%; background: #fff; color: #1a1a1a;
        box-shadow: 0 2px 10px rgba(0,0,0,.18); cursor: pointer; z-index: 3;
        transition: opacity .15s;
    }
    .ac14-folletos-flecha[hidden] { display: none; }
    .ac14-folletos-flecha[disabled] { opacity: 0; pointer-events: none; }
    .ac14-folletos-flecha--prev { left: -4px; }
    .ac14-folletos-flecha--next { right: -4px; }
    .ac14-folletos-flecha svg { width: 18px; height: 18px; }
}

/* --- Tarjeta base --- */
.ac14-folleto-card {
    position: relative;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.ac14-folleto-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

/* --- Tarjeta destacada --- */
.ac14-folleto-card.ac14-destacado {
    border: 2px solid #cf2e2e;
    box-shadow: 0 4px 18px rgba(230, 57, 70, 0.18);
    background: linear-gradient(160deg, #fecdca 0%, #fff 60%);
}

.ac14-folleto-card.ac14-destacado:hover {
    box-shadow: 0 8px 28px rgba(230, 57, 70, 0.28);
}

/* Ribbon destacado */
.ac14-destacado-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    overflow: hidden;
    width: 80px;
    height: 80px;
    pointer-events: none;
}

.ac14-destacado-ribbon span {
    position: absolute;
    top: 18px;
    left: -22px;
    display: block;
    width: 100px;
    padding: 4px 0;
    background: #cf2e2e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transform: rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* --- Imagen: celda de la misma altura en todas (proporción de la portada cuadrada); la portada se ve entera --- */
.ac14-folleto-imagen { position: relative; background: #f1f1f1 center / cover no-repeat; height: var(--ac14-fol-h); overflow: hidden; }
/* La portada se ve siempre entera (sin recortar); si no tiene la proporción del hueco, los laterales se rellenan con la misma imagen difuminada */
.ac14-folleto-imagen::before { content: ""; position: absolute; inset: -24px; background: inherit; filter: blur(20px) saturate(1.15); transform: scale(1.1); }

.ac14-folleto-imagen img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.ac14-folleto-imagen a {
    position: relative;
    z-index: 1;
    display: block;
    height: 100%;
    line-height: 0;
}

.ac14-folleto-imagen a:hover img {
    opacity: 0.92;
    transition: opacity 0.2s;
}

/* --- Info --- */
.ac14-folleto-info {
    padding: 10px 12px 12px;
    flex: 1 1 auto;
}

.ac14-folleto-titulo {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 3px;
    color: #1a1a1a;
    line-height: 1.3;
}

.ac14-folleto-fecha {
    font-size: 11px;
    color: #999;
    margin: 0 0 10px;
}

/* --- Botones --- */
.ac14-folleto-botones {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ac14-btn {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

.ac14-btn:hover {
    opacity: 0.82;
    transform: translateY(-1px);
}

.ac14-btn-pvm  { background: #2b6cb0; color: #fff !important; }
.ac14-btn-sinp { background: #276749; color: #fff !important; }
.ac14-btn-pvp  { background: #744210; color: #fff !important; }

.ac14-btn-catalogo { background: #cf2e2e; color: #fff !important; margin-bottom: 5px; }

.ac14-btn-ferrobox {
    background: transparent !important;
    border: 1.5px solid currentColor;
}

.ac14-btn-ferrobox.ac14-btn-pvm  { color: #2b6cb0 !important; }
.ac14-btn-ferrobox.ac14-btn-sinp { color: #276749 !important; }
.ac14-btn-ferrobox.ac14-btn-pvp  { color: #744210 !important; }

/* --- Aviso no logueado --- */
.ac14-folletos-aviso {
    padding: 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
}

/* --- Fecha expiración --- */
.ac14-folleto-expira {
    font-size: 11px;
    color: #c05621;
    margin: 0 0 8px;
    font-weight: 600;
}

/* --- Separador botones Ferrobox --- */
.ac14-botones-ferrobox {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #e0e0e0;
}

/* Arrastrar con el ratón (PC) */
@media (hover: hover) and (pointer: fine) {
    .ac14-arrastrable { cursor: grab; }
    .ac14-arrastrable img { -webkit-user-drag: none; user-select: none; }
}
.ac14-arrastrando { cursor: grabbing !important; user-select: none; }
.ac14-arrastrando * { pointer-events: none; }
/* En escritorio la rejilla no se desliza: sin cursor de mano */
@media (min-width: 769px) { .ac14-folletos-grid.ac14-arrastrable { cursor: auto; } }
