:root {
    --primary-cost: #FF9500;
    --primary-cost-dark: #e68600;
    --icon-green: #2ECC71;
}

.page-header {
    text-align: center;
    padding: 60px 20px 30px;
    position: relative;
    z-index: 2;
}

/* =======================================================
   GRID DE COSTUMBRES (Glassmorphism adaptado)
   ======================================================= */
.cost-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 0 40px 60px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.cost-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--glass-shine), var(--card-shadow);
    cursor: pointer;
}

[data-theme="dark"] .cost-card {
    box-shadow: var(--glass-shine), 0 0 25px rgba(255, 149, 0, 0.15);
    border-color: rgba(255, 149, 0, 0.3);
}

.cost-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-cost);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 0 30px rgba(255, 149, 0, 0.2);
}

.cost-portada {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 1px solid var(--glass-border);
    background: #e2e8f0;
}

.cost-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.cost-title {
        color: var(--text-main);
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 0 15px;
    line-height: 1.3;
}

.cost-excerpt {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 25px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-leer {
    background: var(--primary-cost);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    border: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cost-card:hover .btn-leer {
    background: var(--primary-cost-dark);
    box-shadow: 0 8px 15px rgba(255, 149, 0, 0.4);
    transform: translateY(-2px);
}

/* =======================================================
   MODAL DE LECTURA 
   ======================================================= */
.lectura-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lectura-modal.activo {
    display: flex;
    opacity: 1;
}

.lectura-contenedor {
    background: var(--bg-card);
    width: 90%;
    max-width: 850px;
    max-height: 90vh;
    border-radius: 24px;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.lectura-modal.activo .lectura-contenedor {
    transform: translateY(0);
}

.lectura-header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

[data-theme="dark"] .lectura-header {
    background: rgba(30, 41, 59, 0.95);
}

.btn-cerrar-modal {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    margin-left: auto;
}

.btn-cerrar-modal:hover {
    background: #ef4444;
    color: white;
}

.lectura-body {
    padding: 40px;
    color: var(--text-main);
}

.lectura-body > img {
    width: 100%;
    max-height: 450px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.lectura-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--text-main);
    text-align: center;
}

.lectura-texto {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-main);
    white-space: pre-line;
}

/* =======================================================
   GALERÍA Y LIGHTBOX (ACTUALIZADO: Hacia abajo y grandes)
   ======================================================= */
.galeria-costumbre {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 25px;
}

.galeria-costumbre img {
    width: 100%;
    height: auto;
    max-height: 450px;
    object-fit: cover;
    border-radius: 16px;
    cursor: zoom-in;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.galeria-costumbre img:hover {
    transform: scale(1.02);
}

/* Lightbox para Zoom y Paneo */
.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-modal.activo {
    display: flex;
    opacity: 1;
}

.lightbox-img-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    transition: transform 0.3s ease-out;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-img.zoomed {
    cursor: grab;
    transition: none; /* Desactivar transición durante el arrastre para fluidez */
}

.lightbox-img.zoomed:active {
    cursor: grabbing;
}

.btn-cerrar-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

.btn-cerrar-lightbox:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Botones Adelante/Atras en el Lightbox */
.btn-nav-lightbox {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

.btn-nav-lightbox:hover {
    background: rgba(255, 255, 255, 0.4);
}

.btn-nav-lightbox.prev {
    left: 20px;
}

.btn-nav-lightbox.next {
    right: 20px;
}

/* Botón Volver */
.btn-volver-container {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
}

.btn-volver {
    background: transparent;
    color: var(--text-main);
    border: 2px solid var(--glass-border);
    padding: 12px 30px;
    font-size: 1.05rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.4s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-volver:hover {
    background: var(--text-main);
    color: var(--bg-main);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .page-header { padding: 40px 20px 10px; }
    .cost-grid { padding: 10px 20px 40px; grid-template-columns: 1fr; }
    .lectura-body { padding: 25px 20px; }
    .lectura-title { font-size: 1.8rem; }
    .lectura-texto { font-size: 1.05rem; }
}