/* ====================
   Fuente personalizada Malacitana Sans
   ==================== */
@font-face {
    font-family: 'Malacitana Sans';
    src: url('../fonts/Malacitana-Sans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Malacitana Sans';
    src: url('../fonts/Malacitana-Sans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Malacitana Sans';
    src: url('../fonts/Malacitana-Sans-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Malacitana Sans';
    src: url('../fonts/Malacitana-Sans-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Malacitana Sans';
    src: url('../fonts/Malacitana-Sans-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* ====================
   Variables CSS para temas (light y dark)
   =================== */
:root {
    /* Variables base */
    --bs-link-color: #0d6efd;
    --bs-link-hover-color: #0a58ca;
    --bs-border-color: #dee2e6;
}

[data-bs-theme="light"] {
    /* Fondo mejorado: Blanco humo suave para reducir fatiga visual */
    --bs-body-bg: #f8f9fa;
    --bs-body-color: #212529;

    /* Enlaces */
    --bs-link-color: #0d6efd;
    --bs-link-hover-color: #0a58ca;
    --bs-border-color: #dee2e6;

    /* Footer */
    --footer-bg-invert: #e0e0e0;
    --footer-color-invert: #121212;
    --footer-border-invert: #aaffff;

    /* Highlight principal */
    --pi-highlight: #fd7e14;

    /* Elementos UI mejorados (Light Mode) */
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    /* Sombra suave */
    --navbar-bg: #212529;
    --navbar-color: #ffffff;
    --navbar-backdrop: none;
}

[data-bs-theme="dark"] {
    --bs-body-bg: #121212;
    --bs-body-color: #e0e0e0;

    --bs-link-color: #80b3ff;
    --bs-link-hover-color: #a3cdfd;
    --bs-border-color: #333;

    --footer-bg-invert: #212529;
    --footer-color-invert: #fff;
    --footer-border-invert: #002525;

    /* Highlight principal */
    --pi-highlight: #fd7e14;
    /* Mantener naranja o cambiar si se desea "invertir" */

    /* Elementos UI (Dark Mode) */
    --card-bg: #1e1e1e;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --navbar-bg: #e0e0e0;
    --navbar-color: #121212;
    --navbar-backdrop: none;

    /* Contrast Fixes */
    --bs-secondary-color: #adb5bd;
    /* Lighter gray for better contrast on dark bg */
}

/* Override text-muted explicitly for Dark Mode if needed, though --bs-secondary-color usually handles it in BS5.3 */
[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .text-body-secondary {
    color: #adb5bd !important;
}

/* ====================
   Estilos globales básicos
   ==================== */
html {
    font-size: 100%;
    /* 16px por defecto */
    scroll-behavior: smooth;
}

body {
    margin: 0;
    /* Uso de la fuente Malacitana Sans */
    font-family: 'Malacitana Sans', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    /* Un poco más de aire */
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* Prevent horizontal scroll on mobile */
}

img {
    max-width: 100%;
    height: auto;
}

/* ====================
   Contenedor principal
   ==================== */
/* Main margin override to reduce gap globally */
main {
    margin-top: 60px;
    /* Reduced to sit right after navbar */
    padding-top: 0;
    margin-bottom: clamp(3rem, 5vw, 4rem);
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
    color: var(--bs-body-color);
}

/* Tarjetas o contenedores con fondo (Opcional si usas <article> o divs específicos) */
article,
.card-style {
    background-color: var(--card-bg, transparent);
    border-radius: 8px;
    box-shadow: var(--card-shadow, none);
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Diseño grid para contenido principal */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18.75rem, 1fr));
    gap: 3rem;
    /* Más espacio entre columnas */
    align-items: start;
    /* Alinear al inicio para usar sticky */
}

.carousel-content {
    position: sticky;
    top: 8rem;
    /* Espacio desde el top al hacer scroll (ajustado por el navbar) */
    height: fit-content;
}

/* ====================
   Responsividad
   ==================== */
@media (max-width: 50rem) {

    /* Breakpoint aumentado */
    main {
        max-width: 95%;
        padding: 0.75rem;
    }

    .grid-container {
        grid-template-columns: 1fr;
    }

    .carousel-content {
        position: static;
        /* No sticky en móvil */
    }

    .content-card {
        padding: 1.25rem;
        /* Menos padding en pantallas pequeñas */
    }

    .hero-logo {
        max-width: 200px;
        /* Logo más pequeño en móvil */
    }
}

/* ====================
   Navbar principal (Glassmorphism)
   ==================== */
#main-navbar {
    background-color: var(--navbar-bg);
    backdrop-filter: var(--navbar-backdrop, none);
    -webkit-backdrop-filter: var(--navbar-backdrop, none);

    color: var(--navbar-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    border-bottom: 0.03125rem solid var(--bs-border-color);
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

/* Enlaces y marca (logo/título) dentro del navbar */
#main-navbar .navbar-brand,
#main-navbar .nav-link {
    color: var(--navbar-color);
    transition: color 0.6s ease;
}

#main-navbar .nav-link:hover,
#main-navbar .nav-link:focus {
    color: var(--bs-link-color);
    text-decoration: underline;
}

/* Botón toggle para menú responsive */
/* Botón toggle para menú responsive */
#main-navbar .navbar-toggler {
    border-color: var(--navbar-color);
    opacity: 0.5;
    transition: border-color 0.6s ease;
}

#main-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

[data-bs-theme="dark"] #main-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ====================
   Footer fijo abajo
   ==================== */
footer.site-footer {
    font-size: 0.75rem;
    padding: 0 0.5rem;
    line-height: 1.5rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;

    /* Invertir colores para footer */
    background-color: var(--footer-bg-invert);
    color: var(--footer-color-invert);
    border-top: 1px solid var(--footer-border-invert);

    /* Transiciones */
    transition: background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease;
}

footer.site-footer a {
    color: var(--bs-link-color);
    text-decoration: none;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

footer.site-footer a:hover,
footer.site-footer a:focus {
    text-decoration: underline;
    color: var(--bs-link-hover-color);
    outline: none;
}

/* ====================
   Responsividad
   ==================== */
@media (max-width: 30rem) {
    main {
        max-width: 95%;
        padding: 0.75rem;
    }

    .grid-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ====================
   Transiciones globales
   ==================== */
html,
body,
main,
#main-navbar,
footer,
.navbar-nav .nav-link {
    transition: background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease;
}

/* ====================
   Imágenes y Efectos
   ==================== */
.img-grayscale {
    filter: grayscale(100%);
    transition: filter 0.5s ease, transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border-radius: 8px;
    /* Redondeo suave */
}

/* Hover: Color, Zoom y Sombra profunda */
.img-grayscale:hover,
.img-grayscale:focus {
    filter: grayscale(0%);
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

.ancla-fija {
    scroll-margin-top: 6rem;
    /* Ajustado para compensar navbar */
}

/* ====================
   Carousel Styles
   ==================== */
.carousel-container {
    position: relative;
    width: 100%;
    max-width: 1600px;
    margin: auto;
    overflow: hidden;
    border-radius: 12px;
    /* Redondeo del carrusel */
    box-shadow: var(--card-shadow);
}

.carousel-slide {
    display: flex;
    /* Ancho dinámico establecido por JS */
    transition: transform 0.6s ease;
}

.carousel-image {
    width: 100%;
    flex-shrink: 0;
    opacity: 1;
    transition: opacity 0.6s ease;
    object-fit: cover;
    height: 500px;
    /* Altura constante para evitar saltos */
}

@media (max-width: 768px) {
    .carousel-image {
        height: 300px;
        /* Más pequeño en móviles */
    }
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    font-size: 2rem;
    padding: 0 12px;
    cursor: pointer;
    user-select: none;
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    /* Fondo semitransparente para mejor visibilidad */
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.prev-btn {
    left: 15px;
}

.next-btn {
    right: 15px;
}

.carousel-thumbnails {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    /* Permitir que bajen si no caben */
    padding: 0 10px;
}

.thumbnail-container {
    position: relative;
    width: 60px;
    height: 40px;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: all 0.3s;
    display: block;
}

.thumbnail-container.active .thumbnail {
    opacity: 1;
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 0%;
    background-color: var(--bs-primary);
}

/* ====================
   Lightbox Styles
   ==================== */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.lightbox-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    animation-name: zoom;
    animation-duration: 0.3s;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

@keyframes zoom {
    from {
        transform: translate(-50%, -50%) scale(0)
    }

    to {
        transform: translate(-50%, -50%) scale(1)
    }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 2001;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    text-decoration: none;
    cursor: pointer;
}

@media only screen and (max-width: 700px) {
    .lightbox-modal-content {
        width: 100%;
    }
}

/* ====================
   New Visual Styles (Hero & Cards)
   ==================== */
.hero-section {
    padding: 2rem 0 3rem;
}

.hero-logo {
    max-width: 280px;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.5s ease;
}

.hero-logo:hover {
    transform: scale(1.02);
}

.hero-title {
    font-weight: 700;
    color: var(--bs-body-color);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

/* Content Cards */
.content-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

[data-bs-theme="dark"] .content-card {
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.content-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}

.card-title-custom {
    color: var(--bs-primary);
    font-weight: 600;
    border-left: 4px solid var(--pi-highlight);
    padding-left: 1rem;
    margin-bottom: 1rem;
}

/* Animations */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Back to Top Button */
#btn-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    z-index: 1000;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    padding: 0;
    font-size: 24px;
    line-height: 1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, transform 0.3s;
}

#btn-back-to-top:hover {
    transform: translateY(-3px);
}

/* Gallery Styles */
.hover-opacity-100:hover {
    opacity: 1 !important;
}

.transition-opacity {
    transition: opacity 0.3s ease;
}