
/* --- VARIABLES Y BASE --- */
:root {
    --azul: #5693aa;
    --azul-hover: #46798d;
    --azul-activo: #3c687a;
    --texto: #222;
    --gris: #5b5b5b;
    --espacio: 32px;
    --fondo-suave: #f3f8fa;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 60px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 24px 20px;
    text-align: center;
    color: var(--texto);
}

.content-wrapper {
    max-width: 920px;
    margin: 0 auto;
}

/* --- CABECERA --- */
header {
    display: flex;
    justify-content: space-between;   /* logo al borde izquierdo, foto al derecho */
    align-items: center;
    gap: 16px;                        /* solo un mínimo para que no se toquen */
    padding-top: 16px;
    padding-bottom: 8px;
}

.logo {
    width: 460px;
    max-width: 100%;
    order: 1;
}

.cara {
    width: 240px;
    max-width: 100%;
    border-radius: 50%;
    order: 2;
}

/* --- LÍNEAS Y SECCIONES --- */
hr {
    border: 0;
    border-top: 1px solid #ccc;
    width: 60%;
    margin: var(--espacio) auto;
}

.linea-cabecera {
    width: 100%;
    margin: 12px auto 0;
    opacity: 0.2;
    border-top-color: var(--texto);
}

section {
    margin: var(--espacio) 0;
}

/* --- TEXTO GENERAL --- */
h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 2.2em;
    line-height: 1.1;
    color: var(--azul);
    text-align: left;
    margin: 0 0 20px;
}

p {
    margin: 15px auto;
    max-width: 600px;
    line-height: 1.4;
}

p a {
    color: var(--azul);
    font-weight: bold;
    text-decoration: underline;
}

/* Texto a dos columnas, estilo revista */
.columnas {
    columns: 2;
    column-gap: 48px;
    text-align: justify;
    hyphens: auto;
    line-height: 1.65;
}

.columnas p {
    max-width: none;
    margin: 0 0 1em;
    line-height: inherit;
}

.columnas p:last-child {
    margin-bottom: 0;
}

/* Párrafo suelto de una sola columna */
.texto-izquierda {
    text-align: left;
    max-width: 500px;
    margin: 20px auto;
    font-size: 1.1em;
    line-height: 1.5;
}

/* --- VÍDEOS GENERALES --- */
.media {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    margin: 0 auto 36px;
    border-radius: 24px;
    object-fit: cover;
    background: transparent;
}

/* --- HOME: NAVEGACIÓN Y SECCIONES --- */
body.home {
    padding: 0;
}

.contenedor {
    box-sizing: border-box;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e6e6e6;
}

.nav-in {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.nav a {
    padding: 14px 0 12px;
    border-bottom: 2px solid transparent;
    color: var(--texto);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.nav a:hover,
.nav a[aria-current] {
    color: var(--azul);
    border-bottom-color: var(--azul);
}

.home header {
    padding-top: 32px;
}

.intro {
    margin-bottom: 30px;
}

/* Introducción: tres columnas */
.intro-texto {
    columns: 3;
    column-gap: 32px;
    text-align: left;
    hyphens: auto;
}

.intro-texto p {
    max-width: none;
    margin: 0;
    font-size: 0.95em;
    line-height: 1.6;
}

.bloque {
    margin: 0;
    padding: calc(var(--espacio) * 1.25) 0;
}

.bloque.alt {
    background: var(--fondo-suave);
}

/* ==================================================
   BLOQUES DE PSICOTERAPIA
   ================================================== */

/*
   Distribución por defecto:
   Texto a la izquierda y vídeo a la derecha.
*/
.bloque-in {
    display: grid;
    grid-template-columns: 42% minmax(0, 1fr);
    align-items: stretch;
    gap: 32px;
}

/*
   Psicoterapia individual:
   Vídeo a la izquierda y texto a la derecha.
*/
.bloque.invertido .bloque-in {
    grid-template-columns: minmax(0, 1fr) 42%;
}

/* El vídeo conserva su proporción original */
.bloque .media {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: auto;
    object-fit: cover;
    align-self: center;
    margin: 0;
    border-radius: 24px;
}

/*
   Según la posición del scroll (y el zoom), el navegador alinea el vídeo a
   píxeles enteros y puede dejar una línea oscura en los bordes y un halo en las
   esquinas redondeadas. Para taparlo, un marco del color del fondo del bloque
   se superpone al borde del vídeo: sobresale 2 px por fuera y entra 2 px por
   dentro, con la curva interior ligeramente más cerrada que la del vídeo
   (radio 22 frente a 24), de modo que cubre por completo el borde suavizado.
*/
.bloque { --fondo-bloque: #fff; }
.bloque.alt { --fondo-bloque: var(--fondo-suave); }

.bloque .media {
    position: relative;
    isolation: isolate;
}

.bloque .media::after {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: 2;
    border: 4px solid var(--fondo-bloque);
    border-radius: 26px;
    pointer-events: none;
}

.media-video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 24px;
}

/* Bloque completo de texto */
.bloque-texto {
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    text-align: left;
}

/* Título de cada sección */
.bloque-texto h3 {
    font-size: 2em;
    line-height: 1.1;
    margin: 0 0 16px;
}

/* Texto repartido en dos columnas más estrechas */
.bloque-texto .columnas {
    columns: 2;
    column-gap: 24px;
    column-fill: balance;
    text-align: justify;
    hyphens: auto;
    line-height: 1.5;
    flex: 1;
    min-width: 0;
}

.bloque-texto p {
    max-width: none;
    margin: 0 0 1em;
    font-size: 0.92em;
    line-height: inherit;
}

.bloque-texto p:last-child {
    margin-bottom: 0;
}

/* El texto ocupa la altura disponible */
.bloque-in.equilibrado .bloque-texto {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* --- ANIMACIÓN AL HACER SCROLL --- */
.js .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.js .reveal.visible {
    opacity: 1;
    transform: none;
}

.bloque-in > :nth-child(2) {
    transition-delay: 0.15s;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* --- BOTONES --- */
.btn {
    display: inline-block;
    background: var(--azul);
    color: #fff;
    padding: 12px 28px;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: background 0.2s ease,
                box-shadow 0.2s ease,
                transform 0.1s ease;
}

.btn:hover {
    background: var(--azul-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.btn:active {
    background: var(--azul-activo);
    box-shadow: none;
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: 3px solid rgba(86, 147, 170, 0.45);
    outline-offset: 2px;
}

.button-container {
    display: flex;
    justify-content: center;
}

/* --- PIE: LOGO, MATRÍCULAS Y REDES --- */
.pie-columnas {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px 20px;
}

.logo2 {
    display: block;
    width: 80px;
    height: auto;
}

.matriculas {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 0;
    font-size: 12px;
    line-height: 1.2;
}

.matriculas a {
    color: var(--azul);
    text-decoration: none;
    padding: 0 10px;
}

.matriculas a + a {
    border-left: 1px solid #ccc;
}

.redes {
    display: flex;
    gap: 6px;
}

.dev {
    font-size: 11px;
    color: var(--gris);
    white-space: nowrap;
}

.dev a {
    color: inherit;
    text-decoration: none;
}

.dev a:hover {
    text-decoration: underline;
}

/* --- REDES SOCIALES --- */
.boton-redes {
    position: relative;
    width: 60px;
    height: 60px;
}

.redes .boton-redes {
    width: 36px;
    height: 36px;
}

.boton-redes img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    transition: 0.3s;
}

.boton-redes .foto-color {
    opacity: 0;
}

.boton-redes:hover .foto-sepia {
    opacity: 0;
}

.boton-redes:hover .foto-color {
    opacity: 1;
}

/* --- PIE DE PÁGINA --- */
footer {
    padding: 16px 0;
    border-top: 1px solid #e6e6e6;
    color: var(--gris);
    text-align: center;
}

.copyright {
    font-size: 0.7rem;
}

/* ==================================================
   MÓVILES
   ================================================== */
@media (max-width: 768px) {
    :root {
        --espacio: 28px;
    }

    .logo {
        width: 260px;
        min-width: 0;
    }

    .cara {
        width: 130px;
        min-width: 0;
    }

    header {
        gap: 15px;
    }

    .columnas,
    .intro-texto {
        columns: 1;
    }

    /* Una sola columna. El !important anula cualquier reparto en píxeles
       que el script de escritorio hubiera dejado en el atributo style. */
    .bloque-in,
    .bloque.invertido .bloque-in {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 24px;
    }

    .bloque-texto .columnas {
        columns: 1;
    }

    .bloque-texto h3 {
        font-size: 1.8em;
    }

    .bloque {
        overflow-x: clip;
    }

    .bloque .media {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: auto;
    }

    .media-video {
        max-width: 100%;
    }

    .nav-in {
        gap: 20px;
    }

    .pie-columnas {
        flex-direction: column;
        gap: 14px;
    }

    /*
       Orden en móvil de todos los bloques con vídeo: título, vídeo, texto
       (y botón, si lo hay). El contenedor del texto se "disuelve"
       (display: contents) para poder colocar sus piezas junto al vídeo.
       Funciona tanto si el vídeo va antes del texto en el HTML como después.
    */
    .bloque-in > .bloque-texto:first-child,
    .bloque-in > .media:first-child + .bloque-texto {
        display: contents;
    }

    .bloque-in > .bloque-texto:first-child > h3,
    .bloque-in > .media:first-child + .bloque-texto > h3 {
        order: 1;
        margin-bottom: 0;
    }

    .bloque-in > .media {
        order: 2;
    }

    .bloque-in > .bloque-texto:first-child > :not(h3),
    .bloque-in > .media:first-child + .bloque-texto > :not(h3) {
        order: 3;
    }

    .bloque-in > .bloque-texto:first-child > p,
    .bloque-in > .media:first-child + .bloque-texto > p {
        margin-bottom: 0 !important;
    }
}
