/* ==========================================================================
   INDEX.CSS
   Hero de portada (fondo + buscador) separado de la sección de bibliotecas
   (fondo claro) — usada solo en index.html. Requiere base.css cargado antes.
   ========================================================================== */

.hero {
    background: var(--card-bg);
    padding: 4rem 2rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* ==========================================================================
   HERO: título bicolor + separador + subtítulo + buscador, estilo claro
   (referencia: poza-rica.gob.mx)
   ========================================================================== */
.hero-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    animation: fadeInUp 0.8s ease-out;
    max-width: 640px;
}

.hero-title {
    font-family: var(--font-serif);
    color: var(--text-main);
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
}

.hero-title .accent {
    color: var(--primary-color);
}

.hero-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 1rem 0 1.1rem;
}

.hero-divider .line {
    width: 34px;
    height: 2px;
    background: var(--border-color);
}

.hero-divider .line--accent {
    background: var(--primary-color);
}

.hero-divider .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.8rem;
}

.hero-search {
    width: 100%;
    max-width: 420px;
    flex: none;
}

.hero-search form {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 6px 6px 6px 1.1rem;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.hero-search form:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.search-icon {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    margin-right: 0.4rem;
    flex-shrink: 0;
}

.search-icon svg {
    width: 17px;
    height: 17px;
}

.search-input {
    flex: 1;
    padding: 0.65rem 0.4rem;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.95rem;
    min-width: 0;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
}

.search-btn {
    padding: 0.65rem 1.6rem;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.search-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.search-btn:active {
    transform: translateY(0);
}

/* ==========================================================================
   CARRUSEL DE SEDES (fotos + nombre/dirección + "Leer más")
   Ahora de borde a borde (full-bleed) y con el mismo fondo que la sección
   de bibliotecas para que no se note salto de color entre ambas franjas.
   ========================================================================== */
.hero-carousel {
    background: var(--card-bg);
    padding: 0 0 3.5rem;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    display: flex;
    justify-content: center;
}

.carousel {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.carousel-viewport {
    overflow: hidden;
    border-radius: 0;
    box-shadow: none;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
    position: relative;
    min-width: 100%;
    height: 480px;
    flex-shrink: 0;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2.2rem 3rem;
    background: linear-gradient(to top, rgba(45, 14, 14, 0.85), rgba(45, 14, 14, 0));
}

.carousel-caption h3 {
    font-family: var(--font-serif);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.carousel-caption p {
    font-size: 0.9rem;
    color: #f1e4dd;
    font-style: italic;
}

.carousel-readmore {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
    background: #fff;
    color: var(--primary-color);
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.carousel-readmore:hover {
    background: var(--accent-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.carousel-readmore svg {
    width: 14px;
    height: 14px;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    color: var(--primary-color);
    transition: var(--transition-smooth);
}

.carousel-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.06);
}

.carousel-btn--prev {
    left: 24px;
}

.carousel-btn--next {
    right: 24px;
}

.carousel-btn svg {
    width: 20px;
    height: 20px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1rem;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--border-color);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: var(--transition-smooth);
}

.carousel-dot.active {
    background: var(--primary-color);
    width: 22px;
}

/* ==========================================================================
   BIBLIOTECAS DISPONIBLES (sección aparte, mismo fondo que el carrusel
   para que la transición sea continua)
   ========================================================================== */
.libraries-section {
    background: var(--card-bg);
    padding: 3rem 3rem 3.5rem;
}

.libraries {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    animation: fadeIn 0.6s ease-out;
}

.libraries-header {
    max-width: 560px;
    margin-bottom: 2rem;
}

.libraries-header .eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.6rem;
}

.libraries-header h2 {
    font-family: var(--font-serif);
    color: var(--text-main);
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.6rem;
}

.libraries-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.libraries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.6rem;
}

.library-card {
    background: transparent;
    border-radius: var(--radius-md);
    perspective: 1200px;
    cursor: pointer;
}

.library-card-inner {
    position: relative;
    width: 100%;
    height: 380px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.library-card.is-flipped .library-card-inner {
    transform: rotateY(180deg);
}

.library-card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    border-top: 5px solid var(--accent-color);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
}

.library-card-face--back {
    transform: rotateY(180deg);
    justify-content: center;
    align-items: flex-start;
    padding: 1.8rem 1.6rem;
    gap: 0.7rem;
}

.library-card-face--back h3 {
    font-family: var(--font-serif);
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}

.library-back-address {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.library-map-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--transition-smooth);
}

.library-map-link:hover {
    border-bottom-color: var(--primary-color);
}

.library-map-link svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.library-map-link--pending {
    color: var(--text-muted);
    pointer-events: none;
}

.library-photo {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: var(--bg-color);
}

.library-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.library-card:not(.is-flipped):hover .library-photo img {
    transform: scale(1.06);
}

.library-photo--pending {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--bg-color);
    border-bottom: 1px dashed var(--border-color);
}

.library-photo--pending svg {
    width: 28px;
    height: 28px;
    color: var(--border-color);
}

.library-photo--pending span {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.library-body {
    padding: 1.3rem 1.4rem 1.5rem;
}

.library-body h3 {
    font-family: var(--font-serif);
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.library-address {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1.1rem;
}

.library-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-color);
    color: #fff;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.82rem;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.library-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.library-btn svg {
    width: 14px;
    height: 14px;
}

.library-btn--ghost {
    background: var(--bg-color);
    color: var(--primary-color);
    margin-top: 0.3rem;
}

.library-btn--ghost:hover {
    background: var(--primary-color);
    color: #fff;
}

.library-card--pending .library-btn {
    background: var(--border-color);
    color: var(--text-muted);
    opacity: 1;
    pointer-events: none;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 992px) {
    .hero-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 2.2rem 1.4rem 2.6rem;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-search {
        max-width: 100%;
    }

    .hero-search form {
        border-radius: var(--radius-md);
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px;
    }

    .search-icon {
        display: none;
    }

    .search-btn {
        width: 100%;
        border-radius: var(--radius-sm);
    }

    .libraries-section {
        padding: 2.2rem 1.4rem 2.6rem;
    }

    .libraries-header {
        max-width: 100%;
        text-align: center;
    }

    .hero-carousel {
        padding: 0 0 2.6rem;
    }

    .carousel-slide {
        height: 260px;
    }

    .carousel-btn {
        width: 34px;
        height: 34px;
    }

    .carousel-btn svg {
        width: 16px;
        height: 16px;
    }

    .carousel-caption {
        padding: 1.2rem 1.4rem;
    }

    .carousel-caption h3 {
        font-size: 1.1rem;
    }

    .carousel-readmore {
        padding: 0.5rem 1.1rem;
        font-size: 0.8rem;
    }
}