* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary-dark: #0a1b26;
    --secondary-dark: #0f2836;
    --text-primary: #e9eff3;
    --text-secondary: #9db1c0;
    --border-dark: #1d3f57;
    --accent-orange: #e87e49;
    --accent-orange-hover: #f2996a;
    --nav-pad-x: 1.5rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--primary-dark);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

header { animation: fadeIn 0.8s ease-out; }

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    header { animation: none; }
}

/* ============ TOP NAV ============ */
.top-nav {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(10, 27, 38, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-dark);
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem var(--nav-pad-x);
    display: flex;
    align-items: center;
    column-gap: 1.5rem;
}

.logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    height: 52px;
}
.logo svg { height: 100%; width: auto; display: block; }

.nav-links {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    gap: 1.4rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    transition: color 0.3s ease;
    position: relative;
    padding-bottom: 4px;
    white-space: nowrap;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--accent-orange);
    transition: width 0.3s ease, left 0.3s ease;
}
.nav-links a:hover { color: var(--accent-orange); }
.nav-links a:hover::after { width: 100%; left: 0; }

.nav-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-primary);
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-toggle:hover span { background-color: var(--accent-orange); }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.lang-switcher { position: relative; }

.lang-trigger {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    position: relative;
    background: transparent;
    border: 1px solid var(--border-dark);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.4rem 0.65rem;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.25s ease;
}
.lang-trigger:hover { border-color: var(--accent-orange); }
.lang-chevron { transition: transform 0.25s ease; flex-shrink: 0; }
.lang-trigger[aria-expanded="true"] .lang-chevron { transform: rotate(180deg); }

.lang-flag-strip {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 3px;
}
.lang-trigger[data-lang="es"] .lang-flag-strip,
.lang-option[data-lang="es"]::after { background: linear-gradient(to right, #c60b1e, #ffc400, #c60b1e); }
.lang-trigger[data-lang="en"] .lang-flag-strip,
.lang-option[data-lang="en"]::after { background: linear-gradient(to right, #3c3b6e, #b22234 35%, #ffffff 65%, #b22234); }
.lang-trigger[data-lang="fr"] .lang-flag-strip,
.lang-option[data-lang="fr"]::after { background: linear-gradient(to right, #0055a4, #ffffff, #ef4135); }
.lang-trigger[data-lang="pt"] .lang-flag-strip,
.lang-option[data-lang="pt"]::after { background: linear-gradient(to right, #009739, #fedd00, #002776); }

.lang-menu {
    list-style: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 90px;
    background-color: var(--secondary-dark);
    border: 1px solid var(--border-dark);
    padding: 0.3rem;
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    z-index: 1100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.lang-menu.open { display: flex; }

.lang-option {
    position: relative;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.45rem 0.6rem 0.6rem;
    margin-bottom: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.lang-option::after {
    content: '';
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 2px;
    height: 3px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}
.lang-option:hover {
    border-color: var(--border-dark);
    background-color: rgba(255,255,255,0.03);
    color: var(--text-primary);
}
.lang-option:hover::after { opacity: 1; }
.lang-option.active { background-color: var(--accent-orange); color: var(--primary-dark); }
.lang-option.active::after { opacity: 1; }

/* Compact mode */
.nav-container.is-compact { flex-wrap: wrap; }
.nav-container.is-compact .logo { order: 1; }
.nav-container.is-compact .nav-right { order: 2; margin-left: auto; }
.nav-container.is-compact .nav-toggle { display: flex; }
.nav-container.is-compact .nav-links {
    order: 3;
    flex: 1 1 100%;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin-top 0.35s ease;
}
.nav-container.is-compact .nav-links a {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.6rem 0;
    font-size: 1rem;
}
.nav-container.is-compact .nav-links.open {
    max-height: 500px;
    opacity: 1;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-dark);
}

/* ============ HERO ============ */
header {
    margin-top: 80px;
    padding: 8rem 2rem 6rem;
    /* Texto a la izquierda: el acrobata esta en el centro de la foto, asi que
       centrar el texto lo tapaba con el subtitulo y los iconos. */
    text-align: left;
    background-color: var(--secondary-dark);
    /* Foto ya virada en frio en el propio archivo: no lleva capa de color encima.
       Si algun dia se vuelve a la foto sin virar, hay que reponer el
       background-blend-mode que habia aqui. */
    background-image: url('../img/hero-bordeaux-azul.jpg');
    background-size: cover;
    background-position: center 51%;
    position: relative;
    overflow: hidden;
}
header::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Velo vertical para la legibilidad + refuerzo por la izquierda, donde va
       el texto. La derecha queda mas limpia para que se vea la figura. */
    background:
        linear-gradient(to right, rgba(10,27,38,0.55) 0%, rgba(10,27,38,0.30) 42%, rgba(10,27,38,0.10) 70%, rgba(10,27,38,0.05) 100%),
        linear-gradient(to bottom, rgba(10,27,38,0.42), rgba(10,27,38,0.80));
    z-index: 1;
}
header::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(232,126,73,0.03) 2px, rgba(232,126,73,0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(232,126,73,0.03) 2px, rgba(232,126,73,0.03) 4px);
    z-index: 1;
}
header h1, header .subtitle, header .hero-social {
    position: relative;
    z-index: 2;
    /* Mas ancha que la columna de 1000 px del resto de la pagina, a proposito:
       empuja el texto hacia la izquierda y abre hueco con la figura, que esta
       en el centro de la foto. */
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}
header h1 {
    font-size: 3.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}
header .subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Credito del fotografo, esquina inferior derecha del hero */
.photo-credit {
    position: absolute;
    right: 1.5rem;
    bottom: 1rem;
    z-index: 3;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    opacity: 0.6;
    text-decoration: none;
    transition: color 0.3s ease, opacity 0.3s ease;
}
.photo-credit:hover { color: var(--accent-orange); opacity: 1; }
@media (max-width: 480px) {
    .photo-credit { right: 1rem; bottom: 0.7rem; font-size: 0.65rem; }
}

/* Hero social icons — round buttons with subtle border */
.hero-social {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    margin-top: 2rem;
}

.hero-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(233, 239, 243, 0.3);
    background-color: rgba(10, 27, 38, 0.4);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.hero-social a:hover {
    border-color: var(--accent-orange);
    background-color: rgba(232, 126, 73, 0.12);
    transform: translateY(-3px);
}

.hero-social svg { width: 22px; height: 22px; }
.hero-social .hs-stroke { stroke: var(--text-primary); fill: none; transition: stroke 0.3s ease; }
.hero-social .hs-fill { fill: var(--text-primary); transition: fill 0.3s ease; }
.hero-social a:hover .hs-stroke { stroke: var(--accent-orange); }
.hero-social a:hover .hs-fill { fill: var(--accent-orange); }

/* ============ SECTIONS ============ */
main { position: relative; }

.service-section {
    width: 100%;
    padding: 5rem 2rem;
    border-bottom: 1px solid var(--border-dark);
    position: relative;
}
.service-section:nth-of-type(odd) { background-color: var(--primary-dark); }
.service-section:nth-of-type(even) { background-color: var(--secondary-dark); }
.service-inner { max-width: 1000px; margin: 0 auto; }
.service-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-orange);
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    display: block;
}
.service-section h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}
.service-inner > p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
    /* El contenedor se ensancha, pero el párrafo no: por encima de unos
       70 caracteres por línea la lectura se vuelve incómoda. */
    max-width: 70ch;
}
.sub-services {
    display: grid;
    /* 260px (antes 220) evita que a 1000px entren 4 columnas y las 6
       tarjetas de Talleres queden en filas de 4 + 2. Mantiene 3 + 3. */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 2.5rem;
}
.sub-services article {
    padding: 1.75rem;
    border: 1px solid var(--border-dark);
    background-color: rgba(255, 255, 255, 0.02);
    transition: border-color 0.3s ease, transform 0.3s ease;
}
.sub-services article:hover { border-color: var(--accent-orange); transform: translateY(-3px); }
.sub-services h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}
.sub-services p { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.7; }

.media-frame {
    margin-top: 2rem;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border-dark);
    background-color: var(--secondary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
    overflow: hidden;
    transition: border-color 0.3s ease;
}
.media-frame:hover { border-color: var(--accent-orange); }
.media-frame img, .media-frame iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    display: block;
}
.media-frame.cinematic { aspect-ratio: 21 / 9; margin-top: 2.5rem; }

/* About */
.about-section {
    width: 100%;
    padding: 5rem 2rem 4rem;
    text-align: center;
    background-color: var(--primary-dark);
    border-bottom: 1px solid var(--border-dark);
}
.about-inner { max-width: 820px; margin: 0 auto; }
.about-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}
.about-section p { font-size: 1.05rem; line-height: 1.8; color: var(--text-secondary); }

/* Documentales */
.documentales-highlight {
    max-width: none;
    padding: 7rem 2rem;
    background: linear-gradient(135deg, #0f2836 0%, #16405c 100%);
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border-dark);
}
.documentales-highlight::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(232,126,73,0.04) 2px, rgba(232,126,73,0.04) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(232,126,73,0.04) 2px, rgba(232,126,73,0.04) 4px);
}
.documentales-highlight::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(232,126,73,0.08) 0%, transparent 60%);
}
.documentales-inner {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}
.documentales-tag {
    display: inline-block;
    padding: 0.4rem 1rem;
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}
.documentales-highlight h2 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}
.documentales-highlight p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    /* El .media-frame usa los 900px completos; el texto se queda en un
       ancho de lectura cómodo y centrado. */
    max-width: 70ch;
    margin: 0 auto;
}

/* Social & Contact */
.social-section { padding: 6rem 2rem; background-color: var(--primary-dark); }
.social-section h2 {
    font-size: 2.25rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 3rem;
    letter-spacing: -0.02em;
}
.social-links {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.75rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}
.btn {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-align: center;
    padding: 1.1rem 0.75rem;
    border: 1px solid var(--border-dark);
    background-color: var(--secondary-dark);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(232,126,73,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.btn:hover {
    border-color: var(--accent-orange);
    background-color: rgba(232,126,73,0.05);
    transform: scale(1.03);
    box-shadow: 0 8px 24px rgba(232,126,73,0.2);
}
.btn:hover::before { opacity: 1; }

.social-icon, .social-icon-fill { width: 26px; height: 26px; flex-shrink: 0; }
.social-icon { stroke: var(--text-primary); transition: stroke 0.3s ease; }
.social-icon-fill { fill: var(--text-primary); transition: fill 0.3s ease; }
.btn:hover .social-icon { stroke: var(--accent-orange); }
.btn:hover .social-icon-fill { fill: var(--accent-orange); }

/* Text column: name on top, @handle below */
.social-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
}

.social-name {
    /* Escala con el ancho de ventana para que el texto no se corte al
       reducir el navegador. El valor central (vw) manda en la franja
       intermedia; los extremos fijan el tamaño mín. y máx. */
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.social-handle {
    font-size: clamp(0.6rem, 1.17vw, 0.78rem);
    font-weight: 400;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.btn:hover .social-handle { color: var(--accent-orange); }

.contact-btn {
    background-color: var(--accent-orange);
    color: var(--primary-dark);
    border-color: var(--accent-orange);
    font-weight: 600;
}
.contact-btn:hover { background-color: var(--accent-orange-hover); border-color: var(--accent-orange-hover); }
.contact-btn .social-icon-fill { fill: var(--primary-dark); }
.contact-btn:hover .social-icon-fill { fill: var(--primary-dark); }

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--primary-dark);
    color: var(--text-secondary);
    border-top: 1px solid var(--border-dark);
}
footer p { font-size: 0.9rem; font-weight: 300; }

/* Responsive */
@media (max-width: 768px) {
    header { padding: 6rem 1.5rem 4rem; }
    header h1 { font-size: 2.25rem; }
    header .subtitle { font-size: 1.05rem; }
    .service-section { padding: 3.5rem 1.5rem; }
    .service-section h2 { font-size: 1.6rem; }
    .documentales-highlight { padding: 5rem 1.5rem; }
    .documentales-highlight h2 { font-size: 1.9rem; }
    .social-section { padding: 4rem 1.5rem; }
    .social-section h2 { font-size: 1.75rem; }
    .social-links { gap: 0.6rem; }
    .btn { flex: 0 0 auto; padding: 0.9rem 1.1rem; font-size: 0.9rem; gap: 0; }
    .social-text { display: none; }
    .social-icon, .social-icon-fill { width: 24px; height: 24px; }
}
@media (max-width: 480px) {
    header h1 { font-size: 1.9rem; }
    .btn { padding: 0.8rem 0.9rem; }
}
@media (max-width: 420px) {
    :root { --nav-pad-x: 1rem; }
    .nav-container { padding-top: 0.75rem; padding-bottom: 0.75rem; }
    .logo { height: 36px; }
    .nav-toggle { width: 36px; height: 36px; gap: 4px; }
    .nav-toggle span { width: 18px; }
    .lang-trigger { padding: 0.3rem 0.5rem; gap: 0.25rem; font-size: 0.72rem; }
    .lang-chevron { width: 8px; height: 8px; }
}

/* ============ HERO · comportamiento al estrecharse ============ */
/* Se anaden al final a proposito: deben ganar a las media queries de arriba.

   Con `background-size: cover`, entre 1440 y 850 px la imagen se ajusta por
   ancho y solo sobra por arriba y abajo: `background-position` en el eje X no
   tiene ningun efecto. Para poder desplazar la figura hay que ampliar la imagen
   primero — de ahi el zoom progresivo. */

@media (max-width: 1200px) {
    header { background-size: 130% auto; background-position: 34% 51%; }
}
@media (max-width: 1000px) {
    header { background-size: 155% auto; background-position: 26% 51%; }
}
@media (max-width: 900px) {
    header { background-size: 175% auto; background-position: 22% 51%; }
}

/* Por debajo de 850 px la figura ya no cabe al lado del texto sin ampliarla
   tanto que pierde nitidez. Se cambia de estrategia: recorte vertical propio,
   texto centrado, y la figura colocada DEBAJO del bloque de texto (no detras,
   que es lo que pasaria centrando ambos). */
@media (max-width: 850px) {
    header {
        text-align: center;
        padding: 5rem 1.5rem 4rem;
        min-height: 620px;
        background-image: url('../img/hero-bordeaux-azul-narrow.jpg');
        background-size: cover;
        background-position: center 8%;
    }
    header::before {
        background: linear-gradient(to bottom,
            rgba(10,27,38,0.62) 0%,
            rgba(10,27,38,0.38) 40%,
            rgba(10,27,38,0.58) 100%);
    }
    header .hero-social { justify-content: center; }
}
