/* ============ ERMITAS ============ */

.ermitas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    max-width: 1160px;
    margin: 2.5rem auto 0;
    padding: 0 5vw;
}

.ermita-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--crema);
    border: 1px solid var(--linea);
    border-radius: 20px;
    box-shadow: 0 8px 24px -14px rgba(34, 31, 24, 0.2);
    transition:
        transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 0.45s ease,
        border-color 0.35s ease;
}
.ermita-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 26px 48px -24px rgba(34, 31, 24, 0.32);
    border-color: var(--oro);
}

/* ----- Foto ----- */
.ermita-foto {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(
        150deg,
        var(--verde-claro),
        var(--verde-oscuro) 80%
    );
}
.ermita-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ermita-card:hover .ermita-foto img {
    transform: scale(1.06);
}
.ermita-foto::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 55%,
        rgba(20, 14, 10, 0.35)
    );
    pointer-events: none;
}
.ermita-foto-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(
        circle at 30% 20%,
        var(--verde-claro),
        var(--verde-oscuro) 75%
    );
}
.ermita-foto-fallback svg {
    width: 58px;
    height: 58px;
    stroke: var(--oro-suave);
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.9;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

/* ----- Cuerpo ----- */
.ermita-cuerpo {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.5rem 1.5rem 1.6rem;
}
.ermita-cuerpo h3 {
    margin: 0 0 0.3rem;
    color: var(--verde-oscuro);
    font-family: var(--display);
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.2;
}
.ermita-location,
.ermita-contact {
    color: var(--tinta-sub);
    font-size: 0.9rem;
}
.ermita-location {
    margin-bottom: 0.35rem;
}
.ermita-map {
    color: var(--bronce);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    width: fit-content;
}
.ermita-map:hover {
    text-decoration: underline;
}
.ermita-contact {
    margin-top: 0.7rem;
    line-height: 1.6;
}
.ermita-contact a {
    color: var(--bronce);
    font-weight: 600;
    text-decoration: none;
}
.ermita-contact a:hover {
    text-decoration: underline;
}

/* ----- Horarios ----- */
.ermita-schedules {
    display: grid;
    gap: 0.6rem;
    margin-top: 1.15rem;
}
.ermita-horario {
    display: grid;
    gap: 0.2rem;
    padding: 0.7rem 0.85rem;
    border-left: 3px solid var(--oro);
    background: var(--oro-suave);
    border-radius: 0 10px 10px 0;
}
.ermita-horario strong {
    color: var(--verde-oscuro);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}
.ermita-horario span {
    color: var(--tinta-sub);
    font-size: 0.88rem;
    line-height: 1.5;
}
.ermita-empty {
    color: var(--tinta-sub);
    font-size: 0.9rem;
}

/* ----- Botón ver más ----- */
.ermitas-ver-mas {
    display: flex;
    justify-content: center;
    margin-top: 2.4rem;
}
.ermitas-ver-mas-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 2.2rem;
    border-radius: 999px;
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--verde-oscuro);
    background: var(--crema);
    border: 1px solid var(--oro);
    box-shadow: 0 12px 24px -14px rgba(34, 31, 24, 0.3);
    text-decoration: none;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease,
        background 0.3s ease,
        color 0.3s ease;
}
.ermitas-ver-mas-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 34px -16px rgba(34, 31, 24, 0.4);
    background: var(--verde-oscuro);
    color: var(--crema);
}

/* ----- Mapa ----- */
.ermitas-mapa-wrap {
    max-width: 1160px;
    margin: 0 auto 2.6rem;
}
.ermitas-mapa-titulo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--verde-oscuro);
    margin: 0 0 1rem;
}
.ermitas-mapa-titulo svg {
    width: 24px;
    height: 24px;
    stroke: var(--bronce);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ermitas-mapa {
    width: 100%;
    height: 420px;
    border-radius: 20px;
    border: 1px solid var(--linea);
    box-shadow: 0 16px 38px -22px rgba(34, 31, 24, 0.35);
    z-index: 0;
}
.ermitas-mapa-leyenda {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.2rem;
    margin: 0.9rem 0 0;
    font-size: 0.82rem;
    color: var(--tinta-sub);
}
.leyenda-punto {
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}
.leyenda-parroquia {
    background: var(--rojo, #b3222b);
}
.leyenda-ermita {
    background: var(--verde, #1d6f4c);
}

/* Marcadores Leaflet */
.marcador-parroquia svg,
.marcador-ermita svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}
.marcador-parroquia svg path:first-child {
    fill: var(--rojo, #b3222b);
    stroke: #fff;
    stroke-width: 2;
}
.marcador-ermita svg path:first-child {
    fill: var(--verde, #1d6f4c);
    stroke: #fff;
    stroke-width: 2;
}
.marcador-parroquia svg path:nth-child(2),
.marcador-ermita svg path:nth-child(2) {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
}

/* ----- Página pública ----- */
.sub-body .ermitas-grid {
    margin-top: 0;
    padding: 0;
    max-width: 1160px;
}

/* ----- Móvil ----- */
@media (max-width: 640px) {
    .ermitas-carousel {
        padding: 0 0.4rem;
        overflow: visible;
        max-width: 100%;
    }
    .ermitas-track-wrap {
        overflow: visible;
        -webkit-overflow-scrolling: auto;
    }
    .ermitas-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
        padding: 0;
        display: grid;
        max-width: 100%;
    }
    .ermita-foto {
        aspect-ratio: 16 / 9;
    }
    .ermita-cuerpo {
        padding: 1.1rem 1rem 1.2rem;
    }
    .ermita-cuerpo h3 {
        font-size: 1.35rem;
        line-height: 1.2;
    }
    .ermita-location,
    .ermita-contact,
    .ermita-map,
    .ermita-horario span,
    .ermita-empty {
        font-size: 0.82rem;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .ermita-contact {
        line-height: 1.5;
    }
    .ermita-horario {
        padding: 0.65rem 0.75rem;
    }
    .ermita-horario strong {
        letter-spacing: 0.06em;
    }
    .ermitas-carousel .ermitas-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
        padding-bottom: 0.5rem;
        flex-wrap: nowrap;
        max-width: 100%;
    }
    .ermitas-carousel .ermita-card {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }
    .ermitas-carousel-btns {
        display: none;
    }
}

/* ----- Carrusel horizontal con botones (sección de la portada) ----- */
.ermitas-carousel {
    position: relative;
    max-width: 1160px;
    margin: 2.5rem auto 0;
    padding: 0 5vw;
}
.ermitas-track-wrap {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}
.ermitas-track-wrap::-webkit-scrollbar {
    display: none;
}
.ermitas-carousel .ermitas-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 2rem;
    max-width: none;
    margin: 0;
    padding: 0.4rem 0 1rem;
}
.ermitas-carousel .ermita-card {
    flex: 0 0 auto;
    width: min(340px, 82vw);
    scroll-snap-align: start;
}
.ermitas-carousel-btns {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}
.ermitas-carousel-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--oro);
    background: var(--crema);
    color: var(--verde-oscuro);
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px -4px rgba(14, 58, 43, 0.25);
    transition:
        background 0.2s ease,
        transform 0.2s ease;
}
.ermitas-carousel-btn:hover {
    background: var(--oro-suave);
    transform: scale(1.08);
}
.ermitas-carousel-btn:disabled {
    opacity: 0.32;
    cursor: default;
    transform: none;
}

/* ----- Carrusel → Grid en PC (≥769px) ----- */
@media (min-width: 769px) {
    .ermitas-carousel .ermitas-track-wrap {
        overflow-x: visible;
        scroll-snap-type: none;
    }
    .ermitas-carousel .ermitas-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        flex-wrap: wrap;
        gap: 2rem;
    }
    .ermitas-carousel .ermita-card {
        width: auto;
        scroll-snap-align: none;
    }
    .ermitas-carousel-btns {
        display: none;
    }
}
