/*
Theme Name: GRAFCAN Child Theme GeneratePress v.33
Theme URI: https://generatepress.com
Description: Child Theme para migración Grafcan (Ex-Divi) a GeneratePress.
Author: Tu Nombre / AI Assistant
Template: generatepress
Version: 1.2.0
Text Domain: grafcan-child
*/

/* ==========================================================================
   0. TIPOGRAFÍA LOCAL (Fuentes Corporativas)
   ========================================================================== */
@font-face {
    font-family: 'League Spartan';
    src: url('fonts/LeagueSpartan-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Overpass';
    src: url('fonts/Overpass-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Overpass';
    src: url('fonts/Overpass-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Overpass Mono';
    src: url('fonts/OverpassMono-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ==========================================================================
   1. VARIABLES CORPORATIVAS
   ========================================================================== */
:root {
    /* Colores */
    --grafcan-blue-dark: #1f3864;    /* Azul oscuro */
    --grafcan-blue-light: #8dc8e0;   /* Azul claro */
    --grafcan-grey-bg: #f7f8f9;      /* Fondos */
    --grafcan-text: #55555e;         /* Texto */
    --grafcan-white: #ffffff;
    --grafcan-border: rgba(0, 0, 0, 0.1);
    
    /* Fuentes Asignadas */
    --font-headings: 'League Spartan', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Overpass', 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono: 'Overpass Mono', monospace;
}

/* ==========================================================================
   2. ESTILOS GENERALES
   ========================================================================== */
body {
    color: var(--grafcan-text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headings);
    color: var(--grafcan-blue-dark);
    font-weight: 600;
    text-transform: none;
    line-height: 1.2em;
}

h1 { font-size: 42px; margin-bottom: 20px; }
h2 { font-size: 35px; margin-bottom: 20px; }
h3 { font-size: 29px; margin-bottom: 20px; }
h4 { font-size: 24px; }

a {
    color: var(--grafcan-blue-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover { color: var(--grafcan-blue-dark); }

hr {
    background-color: var(--grafcan-border);
    height: 1px;
    margin: 40px 0;
    border: 0;
}

/* ==========================================================================
   3. HEADER Y NAVEGACIÓN (CORREGIDO)
   ========================================================================== */
/* Fondo del header forzado con !important para sobrescribir a GP */
.site-header {
    background-image: url('/files/Grafcan-Curvas-Topograficas-Header.png') !important;
    background-color: #004d80;
    background-repeat: no-repeat !important;
    background-position: center bottom !important;
    background-size: cover !important;
    border-bottom: none;
    position: relative;
    z-index: 50;
}

/* Logo */
.site-logo { padding: 15px 0; }

/* Buscador (Header Widget) */
.header-widget { 
    float: right; 
    max-width: 50%; 
    margin-top: 15px; 
}
.header-widget .search-form { display: flex; }
.header-widget .search-field {
    border-radius: 20px 0 0 20px;
    border: 1px solid #ddd;
    padding: 8px 15px;
    font-family: var(--font-body);
}
.header-widget .search-submit {
    border-radius: 0 20px 20px 0;
    background-color: var(--grafcan-blue-light);
    color: white;
    border: none;
    padding: 0 15px;
}

/* Menú Principal */
.main-navigation {
    background-color: var(--grafcan-blue-dark);
    font-family: var(--font-headings);
    clear: both;
    width: 100%;
    position: relative;
    z-index: 40;
}

.main-navigation .main-nav ul li a {
    color: var(--grafcan-white);
    font-weight: 500;
    font-size: 15px;
    text-transform: uppercase;
}

.main-navigation .main-nav ul li:hover > a, 
.main-navigation .main-nav ul li[class*="current-menu-"] > a {
    background-color: rgba(255,255,255,0.1);
    color: var(--grafcan-blue-light);
}

/* Submenús desplegables del menú principal */
.main-navigation ul ul {
    background-color: var(--grafcan-white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-top: 3px solid var(--grafcan-blue-light);
}
.main-navigation ul ul li a {
    color: var(--grafcan-text);
    font-family: var(--font-body);
    font-size: 14px;
    text-transform: none;
    border-bottom: 1px solid #eee;
}
.main-navigation ul ul li:hover > a {
    background-color: #f9f9f9;
    color: var(--grafcan-blue-dark);
}

/* --- SUBMENÚ CONTEXTUAL (CORRECCIÓN FLEXBOX) --- */
/* Contenedor de la barra azul clara */
.grafcan-submenu-wrapper {
    background-color: var(--grafcan-blue-light) !important;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    width: 100%;
    clear: both;
    display: block;
    position: relative;
    z-index: 30;
}

.grafcan-submenu-wrapper .grid-container {
    margin-left: auto;
    margin-right: auto;
}

/* Forzar la lista a horizontal */
.grafcan-secondary-nav ul,
.grafcan-secondary-nav .grafcan-submenu-items,
.grafcan-secondary-nav .menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex; /* Clave para horizontalidad */
    justify-content: center; /* Centrado */
    flex-wrap: wrap;
}

.grafcan-secondary-nav li {
    margin: 0;
    float: none; /* Evitar floats de WP */
    display: inline-block;
}

.grafcan-secondary-nav li a {
    display: block;
    padding: 15px 20px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    transition: background 0.3s;
}

.grafcan-secondary-nav li a:hover,
.grafcan-secondary-nav li.current-menu-item a {
    background-color: rgba(255,255,255,0.2);
}

/* ==========================================================================
   4. HERO SLIDER
   ========================================================================== */
.hero-slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    margin-bottom: 40px;
}

.hero-slider-section {
    position: relative;
    height: 400px;
    width: 100%;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    z-index: 1;
    display: flex;
    align-items: flex-end;
}
.hero-slide.active { opacity: 1; z-index: 2; }

.hero-slide-content {
    width: 100%;
    background: rgba(31, 56, 100, 0.85);
    color: #fff;
    padding: 20px;
    text-align: center;
    position: relative;
    bottom: 40px;
}

.hero-slide-text h2 {
    font-family: var(--font-headings);
    color: #fff;
    font-size: 24px;
    margin: 0 0 5px 0;
    text-transform: uppercase;
    font-weight: 700;
}

.hero-slide-text p {
    font-family: var(--font-body);
    margin: 0;
    font-size: 16px;
    color: #ddd;
}

.hero-slider-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 10px;
}

.hero-slider-dot {
    width: 12px;
    height: 12px;
    background-color: rgba(255,255,255,0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s;
}
.hero-slider-dot.active {
    background-color: #fff;
    transform: scale(1.2);
}

/* ==========================================================================
   5. TABLAS DE DATOS (Concursos, Encomiendas...) - [RECUPERADO]
   ========================================================================== */
.greswd-table-responsive {
    overflow-x: auto;
    margin-bottom: 30px;
    border: 1px solid #eee;
}

.greswd-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
}

.greswd-table th {
    background-color: var(--grafcan-blue-dark);
    color: #fff;
    font-family: var(--font-headings);
    font-weight: bold;
    padding: 12px;
    text-align: left;
}

.greswd-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    color: #666;
}

.greswd-table tr:nth-child(even) { background-color: #f9f9f9; }
.greswd-table tr:hover { background-color: #f1f7fa; }

/* Formularios de filtros */
.div_mostrar_concursos form, 
.div_mostrar_encomiendas form,
.div_mostrar_empleo form {
    background: #f2f2f2;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-family: var(--font-body);
}

/* ==========================================================================
   6. SECCIÓN "PROYECTOS" (Grid SVG) - [RECUPERADO]
   ========================================================================== */
.proyectos-contenido {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    text-align: center;
    padding: 40px 0;
}

.proyectos-elemento a.apartados-proyectos {
    display: block;
    padding: 20px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 5px;
    transition: all 0.3s ease;
    height: 100%;
    color: var(--grafcan-blue-dark);
    font-family: var(--font-headings);
}

.proyectos-elemento a.apartados-proyectos:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-5px);
    border-color: var(--grafcan-blue-light);
}

.proyectos-elemento svg {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    fill: var(--grafcan-blue-dark);
}

.proyectos-elemento p.b {
    font-weight: bold;
    margin: 0;
    line-height: 1.2;
}

.separador-proyectos hr {
    border-top: 2px solid var(--grafcan-blue-light);
    opacity: 0.5;
}

/* ==========================================================================
   7. ELEMENTOS UI (Volver arriba, Lightbox)
   ========================================================================== */
.generate-back-to-top,
.generate-back-to-top:visited {
    background-color: var(--grafcan-blue-light);
    color: #fff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    line-height: 50px;
    bottom: 20px;
    right: 20px;
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.3s, background-color 0.3s;
}
.generate-back-to-top:hover { background-color: var(--grafcan-blue-dark); }
.generate-back-to-top__show { opacity: 1; }

/* Lightbox */
.bigimage, .gridareaproyimg, .bigimage-slider_noticias {
    cursor: zoom-in;
    transition: opacity 0.2s;
}

.gridareaproyimg-wrapper, 
.bigimage-wrapper-slider_noticias {
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    cursor: zoom-out;
}

.gridareaproyimg-wrapper p, 
.cerrar-message {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 18px;
    font-family: var(--font-headings);
    font-weight: bold;
    color: #333;
    background: #fff;
    padding: 5px 15px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* ==========================================================================
   8. FOOTER (CORREGIDO)
   ========================================================================== */
.site-footer {
    background-color: #4b4b4b; /* Gris oscuro */
    color: #ddd;
    padding-top: 40px;
    font-family: var(--font-body);
    clear: both;
}

.footer-widgets-container { margin-bottom: 0; }

.footer-widgets h4.widget-title {
    color: var(--grafcan-blue-light);
    font-family: var(--font-headings);
    font-size: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.footer-widgets a { color: #ccc; }
.footer-widgets a:hover { color: #fff; }

/* --- SELLOS DE CALIDAD --- */
.footer-sellos-container {
    background-color: #fff; /* Fondo blanco */
    padding: 20px 0;
    width: 100%;
    border-top: 5px solid var(--grafcan-blue-light); /* Detalle estético */
}

.sellos-certificados ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.sellos-certificados li { margin: 0; }

.sellos-certificados img {
    max-height: 60px; /* Altura controlada */
    width: auto;
    transition: filter 0.3s;
    filter: grayscale(100%);
}
.sellos-certificados img:hover { filter: grayscale(0%); }

/* --- COPYRIGHT Y MENÚ LEGAL --- */
.site-info {
    background-color: var(--grafcan-blue-dark);
    color: #fff;
    padding: 15px 0;
    text-align: center;
}

.grafcan-copyright {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
}

.legal-menu-items {
    list-style: none;
    margin: 0 0 0 15px;
    padding: 0;
    display: inline-flex;
}

.legal-menu-items li {
    padding: 0 10px;
    border-left: 1px solid rgba(255,255,255,0.3);
}
.legal-menu-items li:first-child { border-left: none; }
.legal-menu-items a { color: #fff; }

/* Redes Sociales (Estilos auxiliares si usas Widget HTML) */
.social-icons-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 10px;
}
.social-icons-list img { width: 32px; height: 32px; }

/* ==========================================================================
   9. RESPONSIVE (Móvil)
   ========================================================================== */
@media (max-width: 768px) {
    .hero-slider-section { height: 300px; }
    .hero-slide-content { bottom: 0; padding: 15px; }
    .hero-slide-text h2 { font-size: 18px; }
    
    /* Ocultar submenú escritorio en móvil */
    .hide-on-mobile { display: none !important; }
    
    /* Header */
    .site-header { background-position: center top !important; }
    
    /* Footer */
    .sellos-certificados ul { flex-direction: column; }
    .grafcan-copyright { flex-direction: column; }
    
    .legal-menu-items {
        margin: 10px 0 0 0;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-top: 10px;
    }
    .legal-menu-items li { border: none; padding: 0 5px; }
    
    /* Tablas responsive (Cards) */
    .greswd-table th, .greswd-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .greswd-table th { display: none; }
    
    .greswd-table tr {
        margin-bottom: 20px;
        display: block;
        border: 1px solid #ddd;
    }
    
    .greswd-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border-bottom: 1px solid #eee;
    }
    
    .greswd-table td:before {
        content: attr(data-th);
        position: absolute;
        left: 10px;
        width: 45%;
        text-align: left;
        font-weight: bold;
        color: var(--grafcan-blue-dark);
    }
}