:root {
  --primary: #005348; --primary-dark: #003d35; --secondary: #FF8200; --secondary-dark: #e07200;
  --gray-light: #f5f5f5; --gray-medium: #efefef; --gray-dark: #484848; --text-dark: #404040;
  --radius: 14px; --shadow: 0 6px 24px rgba(0,0,0,.08);
}
html { scroll-behavior: smooth; }
body { font-family: 'Open Sans', system-ui, sans-serif; color: var(--text-dark); background: #fff; padding-bottom: 0; }
h1, h2, h3, h4, h5, h6 { font-family: 'Montserrat', sans-serif; font-weight: 700; color: var(--primary); }
a { color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-secondary { background: var(--secondary); border-color: var(--secondary); color: #fff; font-weight: 600; }
.btn-secondary:hover { background: var(--secondary-dark); border-color: var(--secondary-dark); color: #fff; }
.text-secondary { color: var(--secondary) !important; }
.bg-light { background: var(--gray-light) !important; }
.bg-primary-soft { background: #e8f1ef; }
.section-title { font-size: 1.6rem; margin-bottom: 1.5rem; position: relative; padding-bottom: .6rem; }
.section-title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 56px; height: 4px; background: var(--secondary); border-radius: 2px; }

/* Header */
.site-header { background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 1020; }
.site-header .nav-link { font-family: 'Montserrat', sans-serif; font-weight: 600; color: var(--primary); }
.site-header .nav-link:hover { color: var(--secondary); }

/* Hero: foto de fondo (si la hay) bajo un velo degradado semitransparente de marca, al estilo de la home de EDECA.
   El velo es casi opaco a la izquierda, donde va el texto, y se abre hacia la derecha para dejar ver la imagen. */
.hero { position: relative; overflow: hidden; color: #fff; padding: 4rem 0; background: var(--primary) linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.hero::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to right, rgba(0,83,72,.97) 0%, rgba(0,83,72,.92) 38%, rgba(0,61,53,.72) 72%, rgba(0,61,53,.60) 100%); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at 85% 20%, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 55%); }
.hero > .container-xl { position: relative; z-index: 2; }
.hero-foto { background-image: var(--hero-img); background-size: cover; background-position: center 40%; }
/* Hero de la home: la foto no se estira a todo el ancho; se ajusta a la altura y se alinea a la derecha, el verde rellena el resto */
.hero-foto:not(.hero-uni) { background-image: none; }
.hero-fondo { position: absolute; inset: -24px; z-index: 0; background: var(--hero-img) center 30% / cover no-repeat; filter: blur(18px) saturate(.85); opacity: .9; }
.hero-foto:not(.hero-uni)::before { background: linear-gradient(to right, rgba(0,83,72,.90) 0%, rgba(0,83,72,.86) 38%, rgba(0,61,53,.66) 72%, rgba(0,61,53,.55) 100%); }
.hero-foto:not(.hero-uni)::after { left: auto; right: 0; width: auto; height: 100%; bottom: auto; aspect-ratio: 1920 / 905; max-width: 58%; background: var(--hero-img) right center / cover no-repeat; z-index: 0; -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28%); mask-image: linear-gradient(to right, transparent 0, #000 28%); }
@media (max-width: 767.98px) { .hero-foto:not(.hero-uni)::after { background-size: cover; background-position: 70% center; -webkit-mask-image: none; mask-image: none; } }
.hero h1 { color: #fff; font-size: clamp(1.6rem, 3.2vw, 2.6rem); max-width: 900px; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.hero .lead { max-width: 760px; opacity: .92; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.hero-uni { padding: 3rem 0; }
/* En las fichas el velo pasa del verde Serca al color de la universidad. */
.hero-uni::before { background: linear-gradient(to right, rgba(0,83,72,.96) 0%, rgba(0,83,72,.90) 40%, color-mix(in srgb, var(--uni-color, var(--primary-dark)) 78%, transparent) 78%, color-mix(in srgb, var(--uni-color, var(--primary-dark)) 68%, transparent) 100%); }
.hero-logo { background: #fff; padding: 10px 18px; border-radius: 10px; max-height: 84px; max-width: 100%; width: auto; object-fit: contain; margin-bottom: 1.2rem; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.hero-logo-small { position: absolute; right: 24px; top: 24px; background: #fff; padding: 8px 14px; border-radius: 10px; max-height: 64px; max-width: min(100%, 360px); width: auto; object-fit: contain; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
/* Logos en blanco sobre transparente (USAL): sin recuadro, directamente sobre el velo. */
.hero-logo.logo-claro, .hero-logo-small.logo-claro, .banda-uni img.logo-claro { background: transparent; padding: 0; box-shadow: none; border-radius: 0; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.hero-logo.logo-claro { max-height: 76px; }
.hero-logo-small.logo-claro { max-height: 58px; }
.banda-uni img.logo-claro { max-height: 54px; max-width: 220px; }

/* Bandas de universidad en portada: foto con velo translúcido en el color de cada universidad. */
.banda-uni { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 300px; padding: 1.8rem 1.8rem 1.6rem; border-radius: var(--radius); overflow: hidden; color: #fff; text-decoration: none; background: var(--uni-color, var(--primary)) var(--banda-img, none) center / cover no-repeat; box-shadow: 0 6px 24px rgba(0,0,0,.14); transition: box-shadow .2s; }
.banda-uni::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.22), rgba(0,0,0,.22)), linear-gradient(to top, color-mix(in srgb, var(--uni-color) 96%, transparent) 0%, color-mix(in srgb, var(--uni-color) 78%, transparent) 55%, color-mix(in srgb, var(--uni-color) 50%, transparent) 100%); transition: opacity .25s; }
.banda-uni.sin-foto::before { background: linear-gradient(135deg, rgba(255,255,255,.10) 0%, rgba(0,0,0,0) 45%, rgba(0,0,0,.22) 100%); }
.banda-uni:hover { color: #fff; box-shadow: 0 12px 32px rgba(0,0,0,.22); }
.banda-uni:hover::before { opacity: .9; }
.banda-uni > * { position: relative; z-index: 1; }
.banda-uni img { align-self: flex-start; max-height: 60px; max-width: 200px; object-fit: contain; background: #fff; padding: 8px 14px; border-radius: 10px; margin-bottom: auto; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.banda-uni h2 { color: #fff; font-size: 1.35rem; margin: 1.4rem 0 .35rem; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.banda-uni p { color: rgba(255,255,255,.88); margin-bottom: .8rem; max-width: 34ch; }
.banda-uni .card-cta { color: #fff; }
.banda-uni .card-cta i { color: #fff; }
.migas { font-size: .85rem; opacity: .85; margin-bottom: .8rem; }
.migas a { color: #fff; text-decoration: none; }
.badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.badge-tipo, .badge-modalidad, .badge-plazas { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; padding: .35rem .7rem; border-radius: 999px; }
.badge-tipo { background: var(--secondary); color: #fff; }
.badge-modalidad { background: rgba(255,255,255,.18); color: #fff; }
.ficha .badge-modalidad, .col-lg-8 > .badge-modalidad { background: var(--gray-medium); color: var(--gray-dark); }
.badge-plazas { background: #fff3e6; color: #b35a00; }
.hero .badge-plazas { background: #fff; }

/* Cards */
.card-universidad { display: flex; flex-direction: column; height: 100%; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem; text-decoration: none; color: var(--text-dark); border-top: 5px solid var(--uni-color, var(--primary)); transition: transform .15s, box-shadow .15s; }
.card-universidad:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,.12); color: var(--text-dark); }
.card-universidad img { max-height: 70px; max-width: 220px; object-fit: contain; align-self: flex-start; margin-bottom: 1rem; }
.card-universidad h2 { font-size: 1.3rem; }
.card-cta { color: var(--secondary); font-weight: 700; font-size: .9rem; margin-top: auto; }

/* Ventajas */

/* Ficha */
.ficha h2 { font-size: 1.35rem; margin-top: 2rem; }
.ficha .contenidos li { margin-bottom: .5rem; }
.especialidad { background: var(--gray-light); border-radius: 10px; padding: .8rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.docente { background: var(--gray-light); border-left: 4px solid var(--secondary); padding: 1rem 1.2rem; border-radius: 0 10px 10px 0; margin-bottom: 1rem; }
.docente h3 { font-size: 1rem; margin-bottom: .3rem; }
.accordion-button { font-family: 'Montserrat', sans-serif; font-weight: 600; color: var(--primary); }
.accordion-button:not(.collapsed) { background: #e8f1ef; color: var(--primary); }

/* Formulario */
.form-sticky { position: sticky; top: calc(var(--header-h, 74px) + var(--tabs-h, 0px) + 12px); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; border-top: 0; overflow: hidden; }
.form-sticky::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 30%, var(--uni-color, var(--secondary)) 100%); }

/* Pestañas de la ficha: cuelgan del hero y se fijan bajo la cabecera al hacer scroll (la altura de la cabecera la mide site.js). */
.tabs-ficha { position: sticky; top: var(--header-h, 74px); z-index: 1010; background: rgba(245,245,245,.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(0,0,0,.07); }
.tabs-ficha__lista { display: flex; gap: .25rem 1.6rem; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.tabs-ficha__lista::-webkit-scrollbar { display: none; }
.tabs-ficha__lista a { display: inline-block; padding: .95rem 0 .8rem; font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: .95rem; color: var(--gray-dark); text-decoration: none; border-bottom: 3px solid transparent; transition: color .15s, border-color .15s; }
.tabs-ficha__lista a:hover { color: var(--primary); }
.tabs-ficha__lista a.active { color: var(--primary); border-bottom-color: var(--secondary); }
.seccion-ficha { scroll-margin-top: calc(var(--header-h, 74px) + var(--tabs-h, 52px) + 20px); }
#formulario { scroll-margin-top: calc(var(--header-h, 74px) + var(--tabs-h, 52px) + 20px); }
.form-lead .form-control, .form-lead .form-select { border-radius: 8px; }
.form-lead .form-control:focus, .form-lead .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(0,83,72,.15); }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Gracias */
.gracias i { font-size: 4rem; color: var(--primary); margin-bottom: 1rem; }

/* Legal */
.legal { max-width: 900px; }
.legal h2 { font-size: 1.25rem; margin-top: 2rem; }

/* Footer */
.site-footer { background: var(--primary-dark); color: #d7e5e2; padding: 3rem 0 2rem; margin-top: 3rem; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer h6 { color: var(--secondary); font-family: 'Montserrat', sans-serif; text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }

/* Cookies */
.cookie-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1050; background: var(--gray-dark); color: #fff; border-radius: 12px; padding: 1rem 1.2rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: .9rem; }
.cookie-banner a { color: #ffd6ad; }
.cookie-banner[hidden] { display: none; }

/* Móvil */
.mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: #fff; display: flex; gap: .6rem; padding: .6rem 1rem; box-shadow: 0 -4px 16px rgba(0,0,0,.1); }
@media (max-width: 991px) {
  body:has(.mobile-bar) { padding-bottom: 72px; }
  body:has(.mobile-bar) .cookie-banner { bottom: 90px; }
  .form-sticky { position: static; }
  .tabs-ficha__lista { gap: .25rem 1.1rem; padding: 0 .25rem; }
  .tabs-ficha__lista a { font-size: .88rem; padding: .8rem 0 .65rem; }
  /* El gutter de 3rem del row g-5 desborda 12px el contenedor en móvil. */
  .row.g-5 { --bs-gutter-x: 1.5rem; }
  .hero-programa { padding-bottom: 3rem; }
  .hero-logo-small { position: static; display: block; margin-top: 1rem; }
  /* En móvil el velo va de arriba abajo, como en EDECA. */
  .hero::before { background: linear-gradient(to bottom, rgba(0,83,72,.94) 0%, rgba(0,83,72,.88) 45%, rgba(0,61,53,.78) 100%); }
  .hero-uni::before { background: linear-gradient(to bottom, rgba(0,83,72,.94) 0%, rgba(0,83,72,.88) 40%, color-mix(in srgb, var(--uni-color, var(--primary-dark)) 82%, transparent) 100%); }
  .banda-uni { min-height: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  .banda-uni, .banda-uni::before, .card-universidad { transition: none; }
}


/* Formulario lateral compacto de las fichas (estilo panel fijo, cabe entero en la ventana) */
.form-sticky { padding: calc(1.1rem + 5px) 1.25rem 1rem; }
.form-sticky h2 { font-size: 1.15rem; margin-bottom: .75rem; }
.form-lead-compacta .form-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.form-lead-compacta .mb-3 { margin-bottom: .6rem !important; }
.form-lead-compacta .form-control, .form-lead-compacta .form-select { padding: .5rem .8rem; font-size: .95rem; }
.form-lead-compacta .form-control::placeholder { color: #7a7a7a; }
.form-lead-compacta .form-check { margin-bottom: .7rem !important; }
.form-lead-compacta .form-check-label { font-size: .74rem; line-height: 1.3; color: var(--gray-dark); }
.form-lead-compacta .btn { padding: .6rem 1rem; font-size: 1rem; }
.form-lead-compacta .small.text-muted { font-size: .68rem; line-height: 1.3; margin-top: .5rem !important; }
.form-lead-compacta .alert { padding: .5rem .75rem; font-size: .8rem; margin-bottom: .6rem; }

/* Logo de la Fundación General de la USAL: muy apaisado, se muestra un 20 % más grande */
.hero-logo.logo-claro[src*="logo-fusal"] { max-height: 109px; }
.hero-logo-small.logo-claro[src*="logo-fusal"] { max-height: 84px; max-width: min(100%, 520px); }
.banda-uni img.logo-claro[src*="logo-fusal"] { max-height: 78px; max-width: 317px; }

/* Margen lateral mayor cuando el contenedor es fluido (portátiles y tablets) */
@media (max-width: 1199.98px) { .container-xl { padding-left: 24px; padding-right: 24px; } }
@media (min-width: 768px) and (max-width: 1199.98px) { .hero-foto:not(.hero-uni)::after { max-width: 50%; background-position: 65% center; } }

/* Logo de la ficha de universidad a la derecha del hero */
.hero-logo-derecha { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); margin: 0; }
.hero-logo-derecha.logo-claro { max-height: 72px; max-width: min(34%, 320px); }
.hero-logo-derecha.logo-claro[src*="logo-fusal"] { max-height: 90px; max-width: min(38%, 400px); }
.hero-uni .container-xl:has(.hero-logo-derecha) h1, .hero-uni .container-xl:has(.hero-logo-derecha) .lead { max-width: 56%; }
@media (max-width: 767.98px) {
  .hero-logo-derecha { position: static; transform: none; display: block; margin-bottom: 1rem; }
  .hero-uni .container-xl:has(.hero-logo-derecha) h1, .hero-uni .container-xl:has(.hero-logo-derecha) .lead { max-width: none; }
}
/* Home con foto: el título y el subtítulo no invaden la zona de la foto (la cabeza de la chica queda hacia el 60 % del ancho). */
@media (min-width: 768px) { .hero-foto:not(.hero-uni) h1 { max-width: min(900px, 55%); } .hero-foto:not(.hero-uni) .lead { max-width: min(760px, 55%); } }
/* Texto explicativo bajo el título de un grupo de programas en la ficha de universidad. */
.grupo-texto { margin: -.6rem 0 1.3rem; max-width: 760px; color: var(--gray-dark); }
/* Ficha de programa: el logo flota a la derecha (va antes de las migas en el HTML) y el título lo rodea,
   así en portátil el texto no queda debajo del logo y sigue a todo el ancho por debajo de él. */
@media (min-width: 768px) {
  .hero-uni .container-xl { display: flow-root; }
  .hero-logo-small { position: static; float: right; margin: .35rem 0 14px 28px; }
  /* Títulos largos: menos cuerpo para que no ocupen medio hero. */
  .hero h1.h1-largo { font-size: clamp(1.45rem, 2.6vw, 2.15rem); }
  .hero h1.h1-muy-largo { font-size: clamp(1.3rem, 2.2vw, 1.85rem); }
}
/* En móvil el logo va debajo de las etiquetas, como antes. */
@media (max-width: 767.98px) {
  .hero-uni .container-xl:has(.hero-logo-small) { display: flex; flex-direction: column; align-items: flex-start; }
  .hero-uni .container-xl:has(.hero-logo-small) > * { width: 100%; }
  .hero-logo-small { order: 10; width: auto; }
}
