#qdm-cabecera-portal {
  display: block;
  position: relative;
  inset: auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background: #251e31;
  border: 0;
  border-bottom: 1px solid #554455;
  color: #fff8f1;
  font: 600 1rem/1.25 system-ui, -apple-system, "Segoe UI", sans-serif;
}

#qdm-cabecera-portal .qdm-cabecera-interior {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: stretch;
  gap: .35rem;
  width: min(72rem, 100%);
  margin: 0 auto;
  padding: .3rem clamp(1rem, 3.2vw, 2.5rem);
}

#qdm-cabecera-portal a {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  min-width: 0;
  min-height: 44px;
  height: auto;
  max-width: none;
  margin: 0;
  padding: .5rem .85rem;
  border: 0;
  border-radius: .4rem;
  color: #fff8f1;
  background: transparent;
  font: inherit;
  font-size: .94rem;
  text-align: center;
  text-transform: none;
  text-decoration: none;
  letter-spacing: normal;
  line-height: 1.22;
  white-space: normal;
  overflow-wrap: anywhere;
}

#qdm-cabecera-portal .qdm-cabecera-agenda {
  justify-self: start;
  color: #ffe4a8;
  font: 700 1.2rem/1.16 Georgia, "Times New Roman", serif;
  letter-spacing: -.025em;
}

#qdm-cabecera-portal a[aria-current] {
  background: #443346;
  box-shadow: inset 0 -2px #e6bc76;
}

#qdm-cabecera-portal a:hover { background: #513e52; }
#qdm-cabecera-portal a:focus-visible { outline: 3px solid #ffe4a8; outline-offset: -3px; }

@media (max-width: 40rem) {
  #qdm-cabecera-portal .qdm-cabecera-interior {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .2rem;
    padding: .25rem max(.35rem, env(safe-area-inset-right)) .25rem max(.35rem, env(safe-area-inset-left));
  }
  #qdm-cabecera-portal a {
    padding: .42rem .25rem;
    font-size: .875rem;
  }
  #qdm-cabecera-portal .qdm-cabecera-agenda {
    justify-self: stretch;
    font-size: 1rem;
  }
}

@media (forced-colors: active) {
  #qdm-cabecera-portal a[aria-current] { outline: 1px solid LinkText; text-decoration: underline; }
}
@media print {
  #qdm-cabecera-portal { display: none; }
}

/* Los enlaces editoriales conservan su semántica y se distinguen del texto. */
:where(body:has(> #qdm-cabecera-portal)) :where(main,footer,header) a[href]:not(:where(
  .btn,.button,.chip,.pill,.brand,.hero-promo,.qdm-organizer-link,.qdm-date-shortcut,
  .seo-skip,.qdm-skip,.skip,.skip-link,.leaflet-container a,[href="#"]:empty,
  [aria-current="page"],:has(img,picture)
)){
  --qdm-link-surface:color-mix(in srgb,currentColor 8%,transparent);
  --qdm-link-outline:color-mix(in srgb,currentColor 30%,transparent);
  border-radius:.45rem;
  background-color:var(--qdm-link-surface);
  box-shadow:inset 0 0 0 1px var(--qdm-link-outline);
  text-decoration:none;
}
:where(body:has(> #qdm-cabecera-portal)) :where(main,footer,header) :where(p,li,dd,td,h2,h3) a[href]:not(:where(
  .btn,.button,.chip,.pill,.hero-promo,.qdm-organizer-link,.qdm-date-shortcut,.leaflet-container a,:has(img,picture)
)){
  padding:.12em .36em;
  overflow-wrap:anywhere;
  -webkit-box-decoration-break:clone;
  box-decoration-break:clone;
}
#qdm-cabecera-portal a:not([aria-current]){
  box-shadow:inset 0 0 0 1px rgba(255,248,241,.24);
}
:where(body:has(> #qdm-cabecera-portal)) :where(main,header,footer) :where(
  .qdm-link-actions,nav[aria-label="Más planes"],nav[aria-label="Apartados de la guía"],nav[aria-label="Planes del puente"]
){
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
}
body:has(> #qdm-cabecera-portal) :where(
  .qdm-link-actions,nav[aria-label="Más planes"],nav[aria-label="Apartados de la guía"],nav[aria-label="Planes del puente"],footer nav
) a[href]:not(:where(.btn,.button,.chip,.qdm-date-shortcut)){
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  max-width:100%;
  padding:.45rem .8rem;
  box-sizing:border-box;
  font-weight:750;
  line-height:1.27;
  text-align:center;
  text-decoration:none;
  overflow-wrap:anywhere;
}
body:has(> #qdm-cabecera-portal) .qdm-link-actions a[href]{
  border-radius:.65rem;
  background:var(--soft,#f3ebdd);
  color:var(--ink,#302433);
}
body:has(> #qdm-cabecera-portal) .qdm-link-actions a[href]:hover{
  background:var(--card,#fffdf8);
}
:where(body:has(> #qdm-cabecera-portal)) :where(main,footer,header) a[href]:focus-visible{
  outline:2px solid currentColor;
  outline-offset:2px;
}
@media (forced-colors:active){
  :where(body:has(> #qdm-cabecera-portal)) :where(main,footer,header) a[href]{text-decoration:underline}
}

/* Los titulares enlazados ocupan una sola superficie, aunque se dividan en líneas. */
:where(body:has(> #qdm-cabecera-portal)) main :where(h2,h3) a[href]:not(:where(.btn,.button,.chip,:has(img,picture))){
  display:inline-block;
  max-width:100%;
  box-sizing:border-box;
}
body:has(> #qdm-cabecera-portal) .qdm-link-actions{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  margin-top:.75rem;
}
@media (max-width:560px){
  body:has(> #qdm-cabecera-portal) .qdm-link-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  body:has(> #qdm-cabecera-portal) .qdm-link-actions a:last-child:nth-child(odd){grid-column:1/-1}
}
