/* Home hero for Previsión Bloques 0.2.0.
   Colours and fonts come from theme.json tokens, not hardcoded values, so the hero
   follows the palette if it ever changes. Only loaded on the front page. */

.p-portada {
  position: relative;
  overflow: hidden;
  background: var(--wp--preset--color--accent-1, #087c98);
  color: var(--wp--preset--color--base, #fff);
}

/* Organic brush stroke behind the text, in the spirit of the brand pieces. */
.p-portada-brocha {
  position: absolute;
  left: -14%;
  top: 50%;
  transform: translateY(-50%);
  width: 86%;
  max-width: 1000px;
  height: auto;
  fill: var(--wp--preset--color--base, #fff);
  opacity: .15;
  pointer-events: none;
}

/* Halftone dots, the other recurring texture of the brand. */
.p-portada-trama {
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 340px;
  height: 340px;
  background-image: radial-gradient(var(--wp--preset--color--base, #fff) 1.6px, transparent 1.7px);
  background-size: 17px 17px;
  opacity: .2;
  pointer-events: none;
}
.p-portada-trama-alto {
  right: auto;
  bottom: auto;
  left: -70px;
  top: -70px;
  width: 240px;
  height: 240px;
  opacity: .13;
}

.p-portada-rejilla {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding-block: clamp(36px, 6vw, 80px);
  /* min-width:0 here and on the columns: without it they refuse to go below their
     min-content width and the headline overflows on narrow screens. */
  min-width: 0;
}
.p-portada-rejilla > * { min-width: 0; }

.p-portada-antetitulo {
  margin: 0 0 12px;
  font-size: clamp(11px, 1.25vw, 13px);
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .92;
}

/* The page's only H1: keyword line. Smaller than the H2 tagline and tinted so the white
   tagline stands out. #C9DDE2 on the teal hero is ~3.4:1, enough for text this large
   (24px+ bold); the brand grey #A8A7A7 would be ~2:1. */
.p-portada-marca {
  font-family: var(--wp--preset--font-family--heading, "Red Hat Display", Arial, sans-serif);
  margin: 0 0 6px;
  font-size: clamp(24px, 3.2vw, 38px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: #C9DDE2;
  overflow-wrap: break-word;
}

.p-portada-titular {
  font-family: var(--wp--preset--font-family--heading, "Red Hat Display", Arial, sans-serif);
  margin: 0 0 14px;
  font-size: clamp(34px, 4.8vw, 60px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.02em;
  max-width: 22ch;
  color: var(--wp--preset--color--base, #fff);
  overflow-wrap: break-word;
}

/* Subtitle under the H1: a <p>, never a heading, so the page keeps a single H1.
   Not #A8A7A7: on the teal hero that grey is ~2:1. Same white as the body copy, smaller. */
.p-portada-subtitulo {
  margin: 0 0 26px;
  max-width: 38ch;
  font-size: clamp(15px, 1.6vw, 18px);
  font-weight: 500;
  line-height: 1.45;
  color: var(--wp--preset--color--base, #fff);
  overflow-wrap: break-word;
}

.p-portada-apoyo {
  margin: 0 0 26px;
  max-width: 38ch;
  font-size: clamp(15px, 1.75vw, 20px);
  opacity: .95;
}

/* Specialties: one at a time, each fully out before the next comes in. */
.p-portada-especialidades {
  list-style: none;
  margin: 0 0 30px;
  padding: 0;
  position: relative;
  height: 2.1em;
  overflow: hidden;
  font-size: clamp(17px, 2.25vw, 27px);
  font-weight: 700;
}
.p-portada-especialidades li {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  opacity: 0;
  transform: translateY(.5em);
  animation: p-portada-turno var(--p-duracion, 21s) infinite;
  animation-delay: calc(var(--p-turno, 0) * 3s);
}
.p-portada-especialidades li::before {
  content: "";
  display: inline-block;
  width: .4em;
  height: .4em;
  border-radius: 50%;
  background: currentColor;
  margin-right: .55em;
  vertical-align: .16em;
}


.p-portada-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.p-portada-boton {
  display: inline-block;
  text-decoration: none;
  font-weight: 700;
  padding: 14px 30px;
  border-radius: 999px;
  font-size: clamp(14px, 1.5vw, 16px);
  transition: transform .16s ease, box-shadow .16s ease;
}
.p-portada-boton-solido {
  background: var(--wp--preset--color--base, #fff);
  color: var(--wp--preset--color--accent-1, #087c98);
  box-shadow: 0 6px 20px rgba(10, 48, 60, .24);
}
.p-portada-boton-solido:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(10, 48, 60, .32); }
/* theme.json paints every link with accent-1. On the teal hero that left the outline
   button cyan on teal, far below contrast, so these two need to outrank it. */
.p-portada a.p-portada-boton-linea {
  border: 2px solid rgba(255, 255, 255, .75);
  color: var(--wp--preset--color--base, #fff);
}
.p-portada a.p-portada-boton-linea:hover { background: rgba(255, 255, 255, .14); }
.p-portada a.p-portada-boton-solido { color: var(--wp--preset--color--accent-1, #087c98); }
.p-portada-boton:focus-visible { outline: 3px solid var(--wp--preset--color--base, #fff); outline-offset: 3px; }

/* One organic silhouette; the three photos dissolve inside it. */
.p-portada-retrato {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 470px;
  margin-left: auto;
}
.p-portada-marco {
  position: absolute;
  inset: 0;
  border-radius: 58% 42% 47% 53% / 47% 53% 47% 53%;
  overflow: hidden;
  border: 9px solid var(--wp--preset--color--base, #fff);
  box-shadow: 0 22px 50px rgba(10, 48, 60, .32);
  animation: p-portada-respira 19s ease-in-out infinite;
}
@keyframes p-portada-respira {
  0%, 100% { border-radius: 58% 42% 47% 53% / 47% 53% 47% 53%; }
  50% { border-radius: 46% 54% 56% 44% / 54% 44% 56% 46%; }
}
.p-portada-foto {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: p-portada-releva 18s infinite;
  /* the first starts already revealed, so the hero never shows an empty hole */
  animation-delay: calc(var(--p-releva, 0) * 6s - .7s);
}
@keyframes p-portada-releva {
  0% { opacity: 0; }
  3.5%, 31% { opacity: 1; }
  35%, 100% { opacity: 0; }
}
/* the 18 s rule above is the fallback; the block prints its own timing for 2 to 6 photos */
.p-portada[data-p-fotos="1"] .p-portada-foto,
.p-portada[data-p-fotos="1"] .p-portada-pie-item { animation: none; opacity: 1; }
.p-portada-pie {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  background: var(--wp--preset--color--base, #fff);
  color: var(--wp--preset--color--accent-1, #087c98);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(10, 48, 60, .24);
  white-space: nowrap;
}
.p-portada-pie-sizer { visibility: hidden; display: block; }
.p-portada-pie-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: p-portada-releva 18s infinite;
  animation-delay: calc(var(--p-releva, 0) * 6s - .7s);
  white-space: nowrap;
  pointer-events: none;
}

@media (max-width: 900px) {
  .p-portada-rejilla { grid-template-columns: 1fr; gap: 34px; }
  .p-portada-titular { max-width: none; }
  .p-portada-retrato { max-width: 330px; margin: 0 auto; }
  .p-portada-trama { width: 220px; height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .p-portada-especialidades { height: auto; overflow: visible; }
  .p-portada-especialidades li {
    position: static;
    opacity: 1;
    transform: none;
    animation: none;
    display: block;
    margin-bottom: .22em;
  }
  .p-portada-marco { animation: none; }
  .p-portada-foto { animation: none; opacity: 0; }
  .p-portada-foto:first-child { opacity: 1; }
  .p-portada-pie-item { animation: none; opacity: 0; }
  /* the sizer is the first span of the pill, so :first-of-type would never match an item */
  .p-portada-pie-sizer + .p-portada-pie-item { opacity: 1; }
  .p-portada-boton { transition: none; }
}

/* The player replaces the home composition in place, without an overlay. */
.p-portada [hidden] { display: none !important; }
.p-portada-videos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 480px;
  min-height: 62px;
}
.p-portada .p-portada-video-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 62px;
  padding: 12px 18px;
  border: 2px solid transparent;
  font-family: inherit;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.p-portada .p-portada-video-trigger.p-portada-boton-linea {
  border-color: rgba(255, 255, 255, .75);
  background: transparent;
  color: var(--wp--preset--color--base, #fff);
}
.p-portada .p-portada-video-trigger.p-portada-boton-linea:hover {
  background: rgba(255, 255, 255, .14);
}
.p-portada-video-trigger svg,
.p-portada-volver svg,
.p-portada-video-footer svg { flex: 0 0 22px; width: 22px; height: 22px; }
.p-portada-video-trigger small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 400;
}
.p-portada-player {
  position: relative;
  z-index: 2;
  padding-block: clamp(24px, 4vw, 48px);
}
.p-portada-video-toolbar,
.p-portada-pantalla,
.p-portada-video-status,
.p-portada-video-footer { max-width: 900px; margin-inline: auto; }
.p-portada-video-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.p-portada-video-toolbar h2 {
  margin: 0;
  color: var(--wp--preset--color--base, #fff);
  font-family: var(--wp--preset--font-family--heading, "Red Hat Display", Arial, sans-serif);
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.2;
}
.p-portada-volver {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 999px;
  background: transparent;
  color: var(--wp--preset--color--base, #fff);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.p-portada-volver:hover { background: rgba(255, 255, 255, .14); }
.p-portada-volver:focus-visible,
.p-portada-video-toolbar h2:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.p-portada-pantalla {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #0a303c;
}
.p-portada-pantalla video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.p-portada-video-status { margin-block: 16px 0; color: #fff; font-size: 16px; }
.p-portada-video-footer { display: flex; justify-content: flex-end; margin-top: 20px; }
.p-portada-video-footer a.p-portada-boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 24px;
  text-align: center;
}
.p-portada.is-playing .p-portada-marco,
.p-portada.is-playing .p-portada-foto,
.p-portada.is-playing .p-portada-especialidades li { animation-play-state: paused; }
@media (max-width: 600px) {
  .p-portada .p-portada-video-trigger { padding: 12px; gap: 8px; }
  .p-portada-video-toolbar { align-items: flex-start; flex-direction: column; gap: 16px; }
  .p-portada-video-footer a.p-portada-boton { width: 100%; }
}
