/* Árbol de materias de la portada. */
#section-especialidades.home-subjects { box-sizing:border-box; flex:0 0 auto; overflow:visible; width:min(100%,1120px); margin:0 auto; padding:24px 20px 12px; }
#section-especialidades .home-subject-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); align-items:start; gap:8px 20px; }
#section-especialidades .home-subject-group { display:contents; }
#section-especialidades .home-subject-heading { min-width:0; margin:0; padding:0; line-height:1.3; }
#section-especialidades .home-subject-heading--psychology { grid-column:1; grid-row:1; }
#section-especialidades .home-subject-heading--logopedia { grid-column:2; grid-row:1; }
#section-especialidades .home-subject-heading--evaluaciones { grid-column:3; grid-row:1; }
#section-especialidades .home-subject-heading--formacion { grid-column:4; grid-row:1; }
#section-especialidades .home-subject-trigger { display:flex; flex-direction:column; align-items:center; gap:12px; box-sizing:border-box; width:100%; margin:0; padding:0; border:0; border-radius:12px; background:transparent; color:#007f8a; font:inherit; text-align:center; text-decoration:none; cursor:pointer; }
#section-especialidades .home-subject-art { display:block; width:100%; aspect-ratio:8/5; overflow:hidden; border-radius:12px; background:#f5fbfc; }
#section-especialidades .home-subject-art img { display:block; width:100%; height:100%; object-fit:cover; animation:alas-subject-breathe 7s ease-in-out infinite; }
#section-especialidades .home-subject-name { color:#007f8a; font:700 clamp(17px,1.7vw,22px)/1.3 Arial,sans-serif; letter-spacing:.02em; text-transform:uppercase; }
#section-especialidades .home-subject-chevron { display:block; width:8px; height:8px; margin-top:-4px; border:solid currentColor; border-width:0 2px 2px 0; transform:rotate(45deg); transition:transform .2s; }
#section-especialidades [aria-expanded="true"] .home-subject-chevron { margin-top:4px; transform:rotate(225deg); }
#section-especialidades .home-subject-trigger:hover .home-subject-name,
#section-especialidades .home-subject-trigger[aria-expanded="true"] .home-subject-name { color:#145da0; }
#section-especialidades .home-subject-trigger:focus-visible,
#section-especialidades .home-subject-branch:focus-visible { outline:3px solid #145da0; outline-offset:5px; }
#section-especialidades .home-subject-branches { grid-column:1/-1; grid-row:2; box-sizing:border-box; min-width:0; width:calc(100% + 24px); margin-left:-12px; padding:12px 32px 16px; border:1px solid #b8d9df; border-radius:16px; background:#f5fbfc; box-shadow:0 6px 16px -3px rgba(35,54,65,.24); animation:alas-subject-reveal .22s ease-out; }
#section-especialidades .home-subject-branches[hidden] { display:none !important; }
#section-especialidades .home-branches-title { margin:0 0 12px; color:#145da0; font:600 20px/1.3 Arial,sans-serif; text-align:center; text-transform:none; }
#section-especialidades .home-branch-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:stretch; gap:20px; }
#section-especialidades .home-subject-branch { display:flex; flex-direction:column; align-items:center; gap:12px; min-width:0; margin:0; padding:10px; border:1px solid transparent; border-radius:12px; background:#fff; color:#145da0; text-align:center; text-decoration:none; transition:transform .2s,box-shadow .2s,border-color .2s; }
#section-especialidades .home-subject-branch:hover { border-color:#80c4cc; box-shadow:0 6px 18px #004b5514; transform:translateY(-3px); }
#section-especialidades .home-subject-branch img { display:block; width:100%; aspect-ratio:8/5; height:auto; object-fit:cover; border-radius:8px; }
#section-especialidades .home-branch-name { margin:0; color:#145da0; font:600 18px/1.35 Arial,sans-serif; text-transform:none; }
@keyframes alas-subject-breathe { 0%,100% { transform:scale(1.005); } 50% { transform:scale(1.025); } }
@keyframes alas-subject-reveal { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }
@media(max-width:700px) {
 #section-especialidades.home-subjects { padding:16px 20px 8px; }
 #section-especialidades .home-subject-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 16px; }
 #section-especialidades .home-subject-heading--evaluaciones { grid-column:1; grid-row:2; }
 #section-especialidades .home-subject-heading--formacion { grid-column:2; grid-row:2; }
 #section-especialidades.has-open-branch .home-subject-heading--evaluaciones,
 #section-especialidades.has-open-branch .home-subject-heading--formacion { grid-row:3; }
 #section-especialidades .home-subject-trigger { gap:10px; }
 #section-especialidades .home-subject-name { font-size:16px; }
 #section-especialidades .home-subject-branches { padding:12px 22px 14px; }
 #section-especialidades .home-branches-title { margin-bottom:12px; font-size:18px; }
 #section-especialidades .home-branch-grid { gap:8px; }
 #section-especialidades .home-subject-branch { gap:10px; padding:6px; }
 #section-especialidades .home-branch-name { font-size:14px; }
}
@media(prefers-reduced-motion:reduce) {
 #section-especialidades *,#section-especialidades *::before,#section-especialidades *::after { animation:none!important; transition:none!important; }
}

/* La materia abierta y sus áreas comparten un fondo continuo. */
#section-especialidades .home-subject-name { display:inline-flex; align-items:center; justify-content:center; gap:8px; }
#section-especialidades .home-subject-heading--psychology,
#section-especialidades .home-subject-heading--logopedia { position:relative; z-index:1; align-self:stretch; }
#section-especialidades .home-subject-heading--psychology { --subject-fill:#f5fbfc; --subject-border:#b8d9df; }
#section-especialidades .home-subject-heading--logopedia { --subject-fill:#fff3f6; --subject-border:#edcbd5; }
#section-especialidades .home-subject-trigger[aria-controls] { height:100%; }
#section-especialidades .home-subject-trigger[aria-expanded="true"] { position:relative; isolation:isolate; overflow:visible; }
#section-especialidades .home-subject-trigger[aria-expanded="true"]::before { content:""; position:absolute; z-index:-1; top:-12px; right:-12px; bottom:-9px; left:-12px; border:1px solid var(--subject-border); border-bottom:0; border-radius:16px 16px 0 0; background:var(--subject-fill); pointer-events:none; }
#section-especialidades #home-psychology-branches { border-top-left-radius:0; }
#section-especialidades #home-logopedia-branches { background:#fff3f6; border-color:#edcbd5; }
#section-especialidades #home-logopedia-branches .home-subject-branch:hover { border-color:#dda3b7; box-shadow:0 6px 18px #8e405b14; }
@media(max-width:700px) {
 #section-especialidades #home-logopedia-branches { border-top-right-radius:0; }
}

/* En móvil, la segunda fila conserva su separación superior. */
@media (max-width: 700px) {
 #section-especialidades .home-subject-heading--evaluaciones,
 #section-especialidades .home-subject-heading--formacion { margin-top: 24px; }
}
