/* --- Variables de Color y Tipografía (nuestro panel de control) --- */
:root {
    --color-background: #0d0d0d;
    --color-surface: #1e1e1e;
    --color-primary: #e6c34d;
    --color-primary-alpha: rgba(230, 195, 77, 0.2);
    --color-glow: #FFA500;
    --text-color: #EFE5D8;
    --border-color: #5C3A3A;
    --card-item-bg: rgba(22, 12, 30, 0.94);
    --font-title: "'Cinzel', serif";
    --font-body: "'Source Sans Pro', sans-serif";
}

/* --- Reseteo Básico y Estilos Globales con la Nueva Tipografía --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    background-color: var(--color-background); 
    color: var(--text-color); 
    font-family: var(--font-body); 
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7; 
}
body:not(.homepage) { 
    background-image: url('../images/noise.png'), url('../images/background.jpg');
    background-size: auto, cover; 
    background-position: 0 0, center;
    background-attachment: fixed; 
}
a { color: var(--color-primary); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: white; }

/* --- NUEVOS ESTILOS DE TÍTULOS TIPO "DRAGONIC" --- */
h1, h2, h3, h4, h5, h6 { 
    font-family: var(--font-title); 
    color: var(--color-primary); 
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
}
.content-container h1 { font-size: 2.8rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 1rem; }
h2 { font-size: 2rem; font-weight: 700; margin-top: 3rem; }
h3 { font-size: 1.5rem; font-weight: 600; }
.card-content h2 { border: none; padding-bottom: 0; } 
.hero-content h1 { border: none; padding-bottom: 0; }

/* Estructura para Homepage (LA ORIGINAL Y CORRECTA, SIN TOCAR) */
body.homepage { display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
.homepage .site-header { grid-row: 1 / 2; grid-column: 1 / 2; position: relative; z-index: 100; }
.homepage .hero-parallax { grid-row: 1 / 2; grid-column: 1 / 2; }
.homepage .main-content { grid-row: 2 / 3; grid-column: 1 / 2; z-index: 5; }

/* --- Header y Menú con Tipografía Mejorada --- */
.site-header { padding: 2rem 0; top: 0; pointer-events: none; }
body:not(.homepage) .site-header { top: 2rem; position: relative; z-index: 100; }
.header-container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: center; align-items: center; }
.main-nav { background: rgba(20, 20, 20, 0.5); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 12px; box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: all; }
.main-nav > ul { list-style: none; display: flex; gap: 0; align-items: center; }
.main-nav a { font-family: var(--font-title); font-weight: 700; text-transform: uppercase; letter-spacing: 2px; font-size: 0.9rem; color: var(--text-color); padding: 1.2rem 1.5rem; position: relative; display: flex; align-items: center; gap: 0.5rem; transition: background-color 0.3s ease; }
.main-nav > ul > li { border-right: 1px solid rgba(255, 255, 255, 0.1); }
.main-nav > ul > li:last-child { border-right: none; }
.main-nav > ul > li > a:hover { background-color: var(--color-primary-alpha); color: white; }
.main-nav > ul > li:first-child > a { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.main-nav > ul > li:last-child > a { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }
.lang-flag { width: 18px; height: auto; vertical-align: middle; }

/* --- LÓGICA DE DROPDOWN (RESTAURADA Y CORREGIDA) --- */
.has-dropdown { position: relative; }
.dropdown { 
    display: none; 
    flex-direction: column; 
    position: absolute; 
    top: 100%; 
    left: 0; 
    background: rgba(30, 30, 30, 0.9); 
    backdrop-filter: blur(15px); 
    -webkit-backdrop-filter: blur(15px); 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    list-style: none; 
    min-width: 100%; 
    padding: 0.5rem 0; 
    box-shadow: 0 8px 16px rgba(0,0,0,0.5); 
    z-index: 10; 
    border-radius: 0 0 8px 8px; 
}
.language-selector .dropdown { left: auto; right: 0; }
/* ¡LA LÍNEA MÁGICA QUE FALTABA! */
.has-dropdown:hover .dropdown { display: flex; }

.dropdown li { width: 100%; }
.dropdown a { 
    font-family: var(--font-body); 
    font-weight: 600; 
    text-transform: none; 
    letter-spacing: 0.5px; 
    font-size: 0.95rem; 
    padding: 0.8rem 1.5rem; 
    white-space: nowrap;
}
.dropdown a:hover {
    background-color: var(--color-primary);
    color: #000;
}

/* --- Hero y Contenido --- */
.hero-parallax { position: relative; height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; color: white; background-image: url('../images/hero-background.jpg'); background-size: cover; background-position: center; background-attachment: fixed; }
.hero-parallax::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to top, var(--color-background) 0%, rgba(0,0,0,0.5) 50%); }
.hero-content { position: relative; z-index: 2; animation: fadeIn 2s ease-in-out; display: flex; flex-direction: column; align-items: center; padding: 1rem; }
.hero-content h1 {
    font-size: 5rem; font-weight: 900; letter-spacing: 4px; 
    background: linear-gradient(145deg, #fefde8 20%, #e6c34d 50%, #ab8b2c 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-fill-color: transparent;
    text-shadow: 0px 4px 5px rgba(0, 0, 0, 0.9); animation: titleBreathe 8s ease-in-out infinite;
}
.hero-content p {
    font-family: var(--font-body); font-size: 1.5rem; font-weight: 400; color: var(--color-primary); text-transform: uppercase; 
    letter-spacing: 3px; margin-top: 1rem; text-shadow: 0px 2px 3px rgba(0, 0, 0, 0.8); opacity: 0; 
    animation: fadeInSubtitle 2s ease-out 0.5s forwards;
}

.scroll-down-indicator { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 2; color: white; font-size: 2rem; animation: bounce 2s infinite; }
.card-grid-container { max-width: 1200px; margin: 0 auto; padding: 2rem; text-align: center; }
.site-footer { text-align: center; padding: 2rem; color: #888; border-top: 2px solid var(--border-color); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 45px; justify-content: center; }
a.card { text-decoration: none; }
.card { background-color: var(--card-item-bg); border: 1px solid var(--border-color); border-radius: 6px; box-shadow: 0 10px 20px rgba(0,0,0,0.65), inset 0 2px 3px rgba(255,255,255,0.04); transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.35s ease-out; position: relative; overflow: hidden; }
.card::after { content: ""; position: absolute; top: -4px; left: -4px; right: -4px; bottom: -4px; background: linear-gradient(60deg, var(--color-glow), var(--color-primary) 50%, var(--border-color) 100%); z-index: -1; border-radius: 8px; opacity: 0; transition: opacity 0.4s ease-out, transform 0.4s ease-out; transform: scale(0.98); }
.card:hover { transform: translateY(-15px) scale(1.05); box-shadow: 0 18px 35px rgba(0,0,0,0.7); }
.card:hover::after { opacity: 1; transform: scale(1); }
.card img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%); mask-image: linear-gradient(to bottom, black 60%, transparent 100%); transition: transform 0.4s ease, filter 0.4s ease; }
.card:hover img { transform: scale(1.1); filter: blur(2px) brightness(0.7); }
.card-content { position: relative; z-index: 2; padding: 6rem 1rem; height: 100%; display: flex; justify-content: center; align-items: center; }
.card-content h2 { font-size: 2em; font-weight: 900; color: var(--text-color); text-shadow: 2px 2px 0px #000, 0 0 10px var(--color-glow); transition: transform 0.35s ease-out, text-shadow 0.35s ease-out; }
.card:hover .card-content h2 { transform: translateY(-10px); text-shadow: 2px 2px 0px #000, 0 0 15px var(--color-glow), 0 0 25px var(--color-glow); }
.content-container { max-width: 900px; margin: 4rem auto; padding: 2rem; background: rgba(30, 30, 30, 0.8); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); }
.content-container h1 { font-size: 2.8rem; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.2); padding-bottom: 1rem; margin-bottom: 2rem; }
.content-container h2 { font-size: 2rem; margin-top: 2.5rem; }
.content-container p { margin-bottom: 1rem; color: var(--text-color); }
.content-container .content-image { max-width: 100%; height: auto; border: 25px solid transparent; padding: 15px; border-image: url('../images/image-frame.png') 30 stretch; box-shadow: 0 10px 20px rgba(0,0,0,0.5); }
table { width: 100%; border-collapse: collapse; margin: 2rem 0; }
table th, table td { padding: 0.8rem 1rem; border: 1px solid rgba(255, 255, 255, 0.2); text-align: left; }
table thead { background-color: var(--color-primary); }
table thead th { font-family: var(--font-title); color: #000; font-weight: 700; text-transform: none; }
table tbody tr:nth-child(even) { background-color: rgba(0,0,0,0.2); }
#scrollTopBtn { display: none; position: fixed; bottom: 20px; right: 30px; z-index: 101; border: 1px solid rgba(255, 255, 255, 0.2); outline: none; background-color: rgba(230, 195, 77, 0.8); color: var(--color-background); cursor: pointer; padding: 0; border-radius: 50%; width: 50px; height: 50px; font-size: 2rem; line-height: 50px; box-shadow: 0 4px 8px rgba(0,0,0,0.4); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); transition: background-color 0.3s ease, transform 0.3s ease; }
#scrollTopBtn:hover { background-color: white; transform: scale(1.1); }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translate(-50%, 0); } 40% { transform: translate(-50%, -20px); } 60% { transform: translate(-50%, -10px); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes titleBreathe { 0% { text-shadow: 0px 4px 5px rgba(0, 0, 0, 0.9), 0 0 10px rgba(230, 195, 77, 0); } 50% { text-shadow: 0px 4px 15px rgba(0, 0, 0, 0.9), 0 0 30px rgba(230, 195, 77, 0.4); } 100% { text-shadow: 0px 4px 5px rgba(0, 0, 0, 0.9), 0 0 10px rgba(230, 195, 77, 0); } }
@keyframes fadeInSubtitle { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
::-webkit-scrollbar { width: 12px; background-color: var(--color-background); }
::-webkit-scrollbar-track { background: var(--color-background); border-left: 1px solid var(--border-color); }
::-webkit-scrollbar-thumb { background-color: var(--color-primary); border-radius: 6px; border: 2px solid var(--color-background); }
::-webkit-scrollbar-thumb:hover { background-color: #ffde7a; box-shadow: 0 0 5px #ffde7a; }
.animated-card { opacity: 0; transform: translateY(40px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.animated-card.is-visible { opacity: 1; transform: translateY(0); }
.animated-card:nth-child(1).is-visible { transition-delay: 0.1s; } .animated-card:nth-child(2).is-visible { transition-delay: 0.2s; }
.animated-card:nth-child(3).is-visible { transition-delay: 0.3s; } .animated-card:nth-child(4).is-visible { transition-delay: 0.4s; }

/* === BLOQUE DEL BUSCADOR (CON ESTILOS, SIN POSICIONAMIENTO ABSOLUTO) === */

#search-container {
    width: 100%;
    max-width: 600px;
    position: relative;
    margin-top: 2.5rem; /* Ajusta la separación si es necesario */
}
#search-form { position: relative; }
.search-icon { position: absolute; top: 50%; left: 20px; transform: translateY(-50%); color: rgba(239, 229, 216, 0.5); font-size: 1.2rem; pointer-events: none; transition: color 0.3s ease-in-out; }
#search-input { width: 100%; padding: 15px 20px 15px 55px; font-family: var(--font-body); font-size: 1.1rem; color: var(--text-color); background-color: rgba(0, 0, 0, 0.4); border: 2px solid rgba(230, 195, 77, 0.4); border-radius: 50px; outline: none; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); transition: all 0.3s ease-in-out; }
#search-input::placeholder { color: rgba(239, 229, 216, 0.5); }
#search-input:focus { background-color: rgba(0, 0, 0, 0.6); border-color: var(--color-primary); box-shadow: 0 0 15px var(--color-primary); }
#search-form:focus-within .search-icon { color: var(--color-primary); }
#search-results { display: none; position: absolute; top: 110%; left: 0; width: 100%; background: rgba(30, 30, 30, 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5); max-height: 300px; overflow-y: auto; z-index: 1000; }
#search-results a, .no-results { display: block; padding: 12px 20px; color: var(--text-color); text-align: left; text-decoration: none; transition: background-color 0.2s ease, color 0.2s ease; }
.no-results { color: #999; font-style: italic; cursor: default; }
#search-results a:hover { background-color: var(--color-primary); color: #000; }
#search-results a:not(:last-child) { border-bottom: 1px solid rgba(255, 255, 255, 0.1); }