/* Anuncio animado: nueva carrera en Computadoras y Semiconductores.
   Prototipo standalone. Todas las clases y variables llevan el prefijo anuncio-semis-. */

:root {
  --anuncio-semis-oro: #fdb913;
  --anuncio-semis-oro-claro: #ffd052;
  --anuncio-semis-pulso: #ffe08a;
  --anuncio-semis-fondo: #001a33;
  --anuncio-semis-fondo-2: #00264d;
  --anuncio-semis-azul: #003d7a;
  --anuncio-semis-chip: #06305f;
  --anuncio-semis-texto-sub: #d6e4f5;
  --anuncio-semis-texto-firma: #8fa9c7;
  --anuncio-semis-fuente: 'Open Sans', sans-serif;
  --anuncio-semis-transicion: .15s;
  --anuncio-semis-z: 2147483000;
  /* Fondo unico: lo usan el overlay y el cobertor, para que el relevo sea imperceptible. */
  --anuncio-semis-bg:
    radial-gradient(ellipse 80% 60% at 50% 38%, var(--anuncio-semis-azul) 0%, rgba(0, 61, 122, 0) 70%),
    linear-gradient(180deg, var(--anuncio-semis-fondo) 0%, var(--anuncio-semis-fondo-2) 100%);
}

/* Cobertor de primer pintado. El <head> lo activa (clase anuncio-pendiente) y este CSS
   bloquea el primer pintado, asi la pagina nunca se ve ni se puede pulsar antes del
   anuncio. anuncio.js (o el cierre de emergencia del tag) quita la clase. */
html:is(.anuncio-pendiente, .anuncio-abierto) {
  overflow: hidden;
}

html.anuncio-pendiente::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: var(--anuncio-semis-z);
  background: var(--anuncio-semis-bg);
  pointer-events: auto;
}

.anuncio-semis:focus {
  outline: none;
}

.anuncio-semis {
  position: fixed;
  inset: 0;
  z-index: var(--anuncio-semis-z);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  overflow: hidden auto;
  max-width: 100vw;
  color: #fff;
  font-family: var(--anuncio-semis-fuente);
  background: var(--anuncio-semis-bg);
  pointer-events: auto;
  will-change: opacity, transform;
}

.anuncio-semis[hidden] {
  display: none !important;
}

.anuncio-semis *,
.anuncio-semis *::before,
.anuncio-semis *::after {
  box-sizing: border-box;
}

/* ---------- Escenario SVG ---------- */

.anuncio-semis-stage {
  flex: 0 0 auto;
  width: 100%;
  height: clamp(190px, 34vh, 440px);
  margin-bottom: clamp(8px, 2vh, 24px);
}

.anuncio-semis-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.anuncio-semis-trace,
.anuncio-semis-pulse,
.anuncio-semis-chip-line {
  fill: none;
  stroke-linejoin: round;
}

.anuncio-semis-trace,
.anuncio-semis-chip-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.anuncio-semis-trace,
.anuncio-semis-via,
.anuncio-semis-chip-line {
  stroke: var(--anuncio-semis-oro);
}

.anuncio-semis-trace {
  stroke-width: 2.5;
  stroke-opacity: .72;
}

.anuncio-semis-pulse {
  stroke: var(--anuncio-semis-pulso);
  stroke-width: 4;
  stroke-dasharray: .1 2;
  stroke-dashoffset: .1;
  opacity: 0;
}

.anuncio-semis-via {
  fill: var(--anuncio-semis-fondo);
  stroke-width: 2.5;
}

.anuncio-semis-chip-fill {
  fill: var(--anuncio-semis-chip);
}

.anuncio-semis-chip-line {
  stroke-width: 3;
}

.anuncio-semis-die {
  fill: var(--anuncio-semis-oro);
  opacity: .9;
}

/* Origen de la escala animada desde JS. */
.anuncio-semis-via,
.anuncio-semis-die {
  transform-box: fill-box;
  transform-origin: center;
}

/* ---------- Contenido ---------- */

.anuncio-semis-content {
  flex: 0 1 auto;
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 56px) clamp(16px, 4vh, 40px);
  text-align: center;
  overflow-wrap: break-word;
}

.anuncio-semis-label {
  margin: 0 0 .9em;
  color: var(--anuncio-semis-oro);
  font-size: clamp(.78rem, 1.5vw, 1rem);
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.anuncio-semis-title {
  margin: 0 0 .45em;
  color: #fff;
  font-size: clamp(1.75rem, 4.8vw, 3.4rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.01em;
}

.anuncio-semis-sub {
  margin: 0 auto .9em;
  max-width: 46rem;
  color: var(--anuncio-semis-texto-sub);
  font-size: clamp(.95rem, 2vw, 1.3rem);
  font-weight: 400;
  line-height: 1.45;
}

.anuncio-semis-sign {
  margin: 0 auto .9em;
  max-width: 42rem;
  color: var(--anuncio-semis-texto-firma);
  font-size: clamp(.72rem, 1.3vw, .9rem);
  line-height: 1.5;
}

.anuncio-semis-note {
  margin: 0 auto clamp(16px, 3vh, 30px);
  max-width: 42rem;
  color: var(--anuncio-semis-texto-sub);
  font-size: clamp(.82rem, 1.6vw, 1.05rem);
  line-height: 1.45;
}

/* Revelado por palabra: la mascara recorta, el hijo sube. */
.anuncio-semis-w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: .12em 0;
  margin: -.12em 0;
}

.anuncio-semis-w > span {
  display: inline-block;
  will-change: transform, opacity;
}

/* ---------- Botones ---------- */

/* Dos columnas iguales (misma altura en todas las filas); una sola en movil. */
.anuncio-semis-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 22rem));
  grid-auto-rows: 1fr;
  gap: 14px;
  justify-content: center;
}

.anuncio-semis-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-wrap: anywhere;
  padding: .75em 1.4em;
  border: 2px solid var(--anuncio-semis-oro);
  border-radius: 3px;
  font: 700 1rem/1.2 var(--anuncio-semis-fuente);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--anuncio-semis-transicion), color var(--anuncio-semis-transicion);
}

.anuncio-semis-btn--primary {
  background: var(--anuncio-semis-oro);
  color: var(--anuncio-semis-fondo);
}

.anuncio-semis-btn--primary:hover,
.anuncio-semis-btn--primary:focus-visible {
  background: var(--anuncio-semis-oro-claro);
  color: var(--anuncio-semis-fondo);
  text-decoration: none;
}

.anuncio-semis-btn--ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, .55);
}

.anuncio-semis-btn--ghost:hover,
.anuncio-semis-btn--ghost:focus-visible {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-color: #fff;
  text-decoration: none;
}

.anuncio-semis-btn:focus-visible,
.anuncio-semis-skip:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.anuncio-semis-skip {
  position: absolute;
  top: clamp(10px, 2vh, 22px);
  right: clamp(10px, 2vw, 24px);
  z-index: 2;
  padding: .55em 1.1em;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 3px;
  background: rgba(0, 26, 51, .55);
  color: #fff;
  font: 600 .85rem/1 var(--anuncio-semis-fuente);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}

.anuncio-semis-skip:hover {
  background: rgba(255, 255, 255, .15);
}

/* ---------- Temporizador ---------- */

.anuncio-semis-timer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  pointer-events: none;
}

.anuncio-semis-timer-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--anuncio-semis-oro);
  transform-origin: left center;
}

/* ---------- Movil ---------- */

@media (max-width: 639px) {
  .anuncio-semis {
    justify-content: flex-start;
  }

  .anuncio-semis-stage {
    height: clamp(150px, 26vh, 260px);
    margin-top: clamp(44px, 8vh, 70px);
  }

  .anuncio-semis-content {
    padding-bottom: 20px;
  }

  .anuncio-semis-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Movimiento reducido: tarjeta estatica ---------- */

@media (prefers-reduced-motion: reduce) {
  .anuncio-semis-btn {
    transition: none;
  }

  .anuncio-semis-timer {
    display: none;
  }
}
