/* --- VARIABLES GLOBALES Y RESET --- */
:root {
    --bg-primary: #fdfdfd;
    --bg-secondary: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #5f5f64;
    --accent-primary: #0d2149;
    --accent-awakening: #00a9b8;
    --accent-her: #ff6b6b;
    --border-light: #e5e5e6;
    --shadow-subtle: rgba(0, 0, 0, 0.06);
    --shadow-medium: rgba(0, 0, 0, 0.12);
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Lora', serif;
    --focus-outline: 2px solid #8ec5fc;
    --focus-offset: 3px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accesibilidad: skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip-link:focus {
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    background: #fff;
    color: #000;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow-subtle);
    outline: var(--focus-outline);
}

/* --- UTILIDADES GENERALES --- */
.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem);
}

strong {
    font-weight: 600;
    color: var(--accent-primary);
}

section {
    padding: clamp(1.75rem, 4vw, 3rem) 0;
    scroll-margin-top: 80px;
}

/* --- ENCABEZADO PRINCIPAL --- */
header {
    background: linear-gradient(135deg, #0a1833, var(--accent-primary), #1a3a5c);
    color: var(--bg-secondary);
    text-align: center;
    padding: 4rem 1.5rem 2.5rem;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(0, 169, 184, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

.main-title {
    font-family: var(--font-heading);
    font-size: clamp(2.3rem, 5.5vw, 3.8rem);
    font-weight: 600;
    letter-spacing: -2px;
    background: linear-gradient(120deg, #e0c3fc, #8ec5fc, #ffffff, #ffd6e8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.1rem;
    animation: gradient-shift 12s ease infinite;
    background-size: 300% 300%;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.subtitle {
    font-size: clamp(1.05rem, 2.1vw, 1.25rem);
    font-weight: 300;
    max-width: 800px;
    margin: 0 auto 1.75rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
}

.author-info {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 2rem;
    max-width: 600px;
    margin: 0 auto;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.author-info p {
    margin-bottom: 0.4rem;
}

/* Barra de progreso de lectura */
.reading-progress { position: sticky; top: 0; width: 100%; height: 4px; background: rgba(13,33,73,0.08); z-index: 50; }
.reading-progress .bar { height: 100%; width: 0%; background: linear-gradient(90deg, #8ec5fc, #e0c3fc); transition: width 0.15s ease; }

/* Navegación sticky */
.site-nav { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,0.85); backdrop-filter: saturate(120%) blur(8px); border-bottom: 1px solid var(--border-light); }
.nav-list { list-style: none; display: flex; gap: 0.75rem; padding: 0.5rem 0; justify-content: center; }
.nav-link { color: var(--text-secondary); text-decoration: none; font-weight: 500; padding: 0.4rem 0.75rem; border-radius: 999px; transition: color 0.2s ease, background 0.2s ease; }
.nav-link:hover, .nav-link:focus { color: var(--accent-primary); background: rgba(13,33,73,0.06); outline: none; }
.nav-link.active { color: #fff; background: var(--accent-primary); }

/* --- SECCIÓN INTRODUCTORIA --- */
.intro-section {
    background: var(--bg-secondary);
    text-align: center;
    padding: 3.25rem 0;
}

.intro-section h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    color: var(--accent-primary);
    margin-bottom: 1.25rem;
    letter-spacing: -1px;
}

.intro-section p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
}

.author-note {
    margin-top: 1.25rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    background: #fffef7;
    border: 1px solid #f0e6c5;
    color: #5a4b1f;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    box-shadow: 0 4px 14px rgba(90, 75, 31, 0.06);
}

/* --- SECCIONES DE CASOS DE ESTUDIO --- */
.movie-section {
    padding: 4rem 0;
}

.awakening-section {
    background: linear-gradient(135deg, #eaf6f6 0%, #d4e7e7 100%);
}

.her-section {
    background: linear-gradient(135deg, #fff0f0 0%, #ffe4e1 100%);
}

.movie-section h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.7rem, 2.6vw, 2.2rem);
    color: var(--accent-primary);
    text-align: center;
    margin-bottom: 1.75rem;
    letter-spacing: -1px;
}

.study-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 768px) {
    .study-layout {
        grid-template-columns: 1fr 1.3fr;
        gap: 2.5rem;
    }
    
    .study-layout.reverse {
        grid-template-columns: 1.3fr 1fr;
    }
    
    .study-layout.reverse .visual-container {
        order: 2;
    }
}

/* --- CONTENEDORES VISUALES CSS PURO --- */
.visual-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 240px;
}

/* Visual para Despertares: Estructura que contiene algo atrapado */
.consciousness-box {
    width: 180px;
    height: 180px;
    border: 4px solid var(--accent-awakening);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(45deg, rgba(0, 169, 184, 0.05), rgba(0, 169, 184, 0.15));
    box-shadow: 0 10px 30px rgba(0, 169, 184, 0.2);
    position: relative;
    overflow: hidden;
}

.consciousness-box::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 2px dashed var(--accent-awakening);
    border-radius: 8px;
    opacity: 0.6;
}

.trapped-mind {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, var(--accent-awakening), transparent);
    border-radius: 50%;
    animation: pulse-trapped 3s ease-in-out infinite;
}

@keyframes pulse-trapped {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Visual para Her: Forma orgánica y fluida */
.digital-consciousness {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.1), rgba(255, 107, 107, 0.25));
    border-radius: 50% 40% 60% 30%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    animation: morph-consciousness 8s ease-in-out infinite;
    box-shadow: 0 15px 35px rgba(255, 107, 107, 0.2);
}

@keyframes morph-consciousness {
    0%, 100% { border-radius: 50% 40% 60% 30%; }
    25% { border-radius: 60% 30% 50% 40%; }
    50% { border-radius: 40% 60% 30% 50%; }
    75% { border-radius: 30% 50% 40% 60%; }
}

.network-nodes {
    width: 72px;
    height: 72px;
    position: relative;
}

.network-nodes::before,
.network-nodes::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-her);
    border-radius: 50%;
}

.network-nodes::before {
    top: 20px;
    left: 20px;
    animation: node-pulse 2s ease-in-out infinite;
}

.network-nodes::after {
    bottom: 20px;
    right: 20px;
    animation: node-pulse 2s ease-in-out infinite 1s;
}

@keyframes node-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* --- CONTENIDO DE ANÁLISIS --- */
.analysis-content h3 {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    color: var(--accent-primary);
    margin-bottom: 1.25rem;
}

.analysis-content > p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

.concept-block {
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-awakening);
    padding: 1.1rem;
    margin-bottom: 1rem;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 10px var(--shadow-subtle);
    transition: transform 0.3s ease;
}

.her-section .concept-block {
    border-left-color: var(--accent-her);
}

.concept-block:hover {
    transform: translateX(5px);
}

.concept-block h4 {
    font-family: var(--font-main);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 0.8rem;
}

.concept-block p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --- SECCIÓN DE SÍNTESIS --- */
.synthesis-section {
    background: var(--bg-secondary);
    padding: 4rem 0;
    text-align: center;
}

.synthesis-section h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.9rem, 3.2vw, 2.4rem);
    color: var(--accent-primary);
    margin-bottom: 2rem;
    letter-spacing: -1px;
}

.synthesis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.synthesis-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 1.75rem;
    box-shadow: 0 8px 20px var(--shadow-subtle);
    transition: all 0.3s ease;
}

.synthesis-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px var(--shadow-medium);
}

.synthesis-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 1.25rem;
}

.synthesis-card h4 {
    font-family: var(--font-main);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.synthesis-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

blockquote {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: clamp(1.1rem, 2.6vw, 1.4rem);
    color: var(--text-secondary);
    max-width: 800px;
    margin: 1.5rem auto 0;
    padding-left: 1.5rem;
    border-left: 3px solid var(--accent-primary);
    line-height: 1.6;
}

/* --- FOOTER --- */
footer {
    background: linear-gradient(135deg, var(--text-primary), #2a2a2e);
    color: rgba(255, 255, 255, 0.8);
    padding: 3rem 0;
    text-align: center;
}

footer h4 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--bg-secondary);
    margin-bottom: 1.5rem;
}

footer p {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
    font-size: 1.05rem;
}

/* --- VISIBILIDAD PARA ANIMACIONES --- */
.intro-section,
.movie-section,
.synthesis-card,
blockquote,
footer {
    visibility: hidden;
}

/* Separador sutil entre secciones del contenido */
main section + section { border-top: 1px solid var(--border-light); }

/* Detalles/Notas técnicas */
details.note { background: #fafafa; border: 1px solid var(--border-light); border-radius: 8px; padding: 0.75rem 1rem; margin: 0.5rem 0 1.25rem; }
details.note > summary { cursor: pointer; font-weight: 600; color: var(--accent-primary); outline: none; }
details.note[open] { background: #fff; box-shadow: 0 6px 20px var(--shadow-subtle); }
details.note > p { margin-top: 0.75rem; color: var(--text-secondary); }

/* Botón volver arriba */
.back-to-top { position: fixed; right: 1rem; bottom: 1rem; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-light); background: #fff; color: var(--accent-primary); box-shadow: 0 8px 24px var(--shadow-subtle); display: grid; place-items: center; font-size: 1.1rem; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-2px); }

/* Focus visible */
:focus-visible { outline: var(--focus-outline); outline-offset: var(--focus-offset); }
a, button { -webkit-tap-highlight-color: transparent; }

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 0 1.5rem;
    }
    
    section {
        padding: 2.25rem 0;
    }
    
    .consciousness-box,
    .digital-consciousness {
        width: 150px;
        height: 150px;
    }
    
    .synthesis-card { padding: 1.5rem; }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 0 1rem;
    }
    
    blockquote {
        padding-left: 1rem;
        font-size: 1.1rem;
    }
}

/* Preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Estilos para impresión académica */
@media print {
    .reading-progress, .site-nav, .back-to-top { display: none !important; }
    header { padding: 2rem 0; background: #fff; color: #000; }
    .main-title { -webkit-text-fill-color: initial; background: none; color: #000; }
    footer { background: #fff; color: #000; }
}