/* ============================================================
   LAYOUT — header, footer, hero y el widget del descargador.
   Estructuras propias de esta web. Los colores y formas salen
   siempre de theme.css.
   ============================================================ */

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 1rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav__link {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  transition: color var(--fast), background var(--fast);
}

.nav__link:hover { color: var(--text); background: var(--surface); }
.nav__link.is-active { color: var(--text); background: var(--surface-2); }

.header__actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--fast), border-color var(--fast);
}

.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

.nav-toggle { display: none; }

/* ---------- Selector de idioma ----------
   Los items son enlaces reales (no un <select> con JS) para que Google los
   rastree y descubra las versiones traducidas. */
.lang {
  position: relative;
}

.lang__toggle {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.lang__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: var(--z-modal);
  display: none;
  min-width: 172px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.lang.is-open .lang__menu { display: block; }

.lang__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.88rem;
  transition: background var(--fast), color var(--fast);
}

.lang__item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.lang__item.is-active {
  color: var(--brand);
  font-weight: 700;
}

@media (max-width: 860px) {
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 14px 20px 22px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    transform: translateY(-130%);
    transition: transform var(--normal);
  }
  .nav.is-open { transform: translateY(0); }
  .nav-toggle { display: grid; }
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(48px, 9vw, 96px) 40px;
  text-align: center;
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 760px;
  margin-inline: auto;
}

.hero__platforms {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

@media (max-width: 620px) {
  .hero {
    padding-block: 32px 24px;
  }
  .hero__inner { gap: 14px; }
  /* Los chips en una sola fila deslizable: ocupan menos alto y el campo de
     texto queda visible sin hacer scroll. */
  .hero__platforms {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    /* Se sale del contenedor para que el scroll llegue de borde a borde. */
    margin-inline: -20px;
    padding-inline: 20px;
    scroll-snap-type: x proximity;
  }
  .hero__platforms::-webkit-scrollbar { display: none; }
  .hero__platforms > * {
    flex-shrink: 0;
    scroll-snap-align: start;
  }
}

/* ---------- Widget del descargador ---------- */
.downloader {
  position: relative;
  max-width: 780px;
  margin-inline: auto;
  padding: 22px;
}

/* Halo de marca detras del widget: lo separa del fondo y dirige la mirada al
   campo, que es la unica accion que importa en la pagina. */
.downloader::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brand), transparent 55%, var(--brand-2));
  opacity: 0.35;
  pointer-events: none;
}

.downloader__form { display: flex; flex-direction: column; gap: 12px; }

.downloader__hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* Resultado */
.result { margin-top: 20px; }

.result__head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.result__thumb {
  width: 168px;
  flex-shrink: 0;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.result__meta { min-width: 0; flex: 1; }

.result__title {
  margin: 6px 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  /* Titulos largos no rompen la tarjeta */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--text-dim);
  font-size: 0.83rem;
}

.result__formats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ---------- Opciones avanzadas de descarga ----------
   Plegadas por defecto: quien solo quiere el video pulsa el boton grande; quien
   quiere MKV o renombrar el archivo, las abre. */
.options {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.options__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.options__summary::-webkit-details-marker { display: none; }

.options__summary::before {
  content: "⚙";
  color: var(--brand);
}

.options__summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--text-dim);
  transition: transform var(--fast);
}

.options[open] .options__summary::after { transform: rotate(180deg); }
.options__summary:hover { color: var(--text); }

.options__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 14px;
  padding: 4px 16px 14px;
}

.options__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.options__label {
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.options__input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--fast), box-shadow var(--fast);
}

.options__input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Nombre + extension fija: el usuario no puede cambiar la extension, porque
   servir un .mp4 llamado .html seria un riesgo de seguridad. */
.options__name {
  display: flex;
  align-items: center;
  gap: 0;
}

.options__name .options__input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}

.options__ext {
  flex-shrink: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-left: 0;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.options__check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0 16px 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
}

.options__check input {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--brand);
  cursor: pointer;
}

.options__hint {
  display: block;
  color: var(--text-dim);
  font-size: 0.78rem;
}

@media (max-width: 620px) {
  .result__head {
    flex-direction: row;
    gap: 12px;
  }
  /* Miniatura pequeña al lado del titulo: se ve mas contenido sin scroll. */
  .result__thumb {
    width: 92px;
    aspect-ratio: 3 / 4;
  }
  .result__title {
    font-size: 0.96rem;
    -webkit-line-clamp: 3;
  }
  .result__formats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  /* El primer boton (mejor calidad) ocupa toda la fila: es el que buscan. */
  .result__formats > .btn:first-child {
    grid-column: 1 / -1;
    min-height: 46px;
  }
  .result__formats > .btn {
    min-height: 42px;
    padding-inline: 10px;
    font-size: 0.85rem;
  }
  .options__grid { grid-template-columns: 1fr; }
  .downloader { padding: 16px; }
}

@media (max-width: 380px) {
  .result__formats { grid-template-columns: 1fr; }
}

/* ---------- Pasos / features ---------- */
.step__num {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
}

.feature__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 1.25rem;
}

/* ---------- Promocion cruzada (SYREL, CAJABOT) ----------
   Se lee como una recomendacion del propio sitio, no como un banner: sin
   bordes chillones ni "publicidad". El acento lo pone cada promo por variable. */
.promo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--promo-accent, var(--brand));
  border-radius: var(--radius);
  transition: border-color var(--fast), transform var(--fast), background var(--fast);
}

.promo:hover {
  transform: translateY(-2px);
  border-color: var(--promo-accent, var(--brand));
  background: var(--surface-2);
}

.promo__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--promo-accent, var(--brand)) 16%, transparent);
  font-size: 1.3rem;
}

.promo__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.promo__title {
  font-weight: 700;
  font-size: 0.96rem;
  line-height: 1.3;
}

.promo__text {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.promo__cta {
  flex-shrink: 0;
  color: var(--promo-accent, var(--brand));
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.promo-row { margin-top: 22px; }

.promo-row__title {
  margin: 0 0 12px;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Promo que aparece justo despues de una descarga: es la de mayor conversion,
   porque llega cuando el usuario acaba de conseguir lo que queria. */
.promo--result {
  margin-top: 16px;
  animation: reveal var(--normal) forwards;
}

@media (max-width: 620px) {
  .promo {
    flex-wrap: wrap;
    gap: 12px;
  }
  .promo__cta { width: 100%; }
}

/* ---------- Slots de anuncios ----------
   Reservan altura para que el contenido no salte al cargar el anuncio: eso
   protege el Core Web Vital de CLS, que es factor de ranking. */
.ad-slot {
  display: grid;
  place-items: center;
  min-height: 96px;
  margin-block: 8px;
  overflow: hidden;
}

.ad-slot--wide { min-height: 120px; }

/* Solo en desarrollo: marca donde caeran los anuncios. En produccion, si no hay
   red configurada, el macro no pinta nada (un recuadro vacio se ve peor que
   ningun anuncio). */
.ad-slot--placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-slot--placeholder::after { content: "Espacio publicitario"; }

/* Los iframes de Adsterra/Monetag no traen estilos responsivos propios. */
.ad-slot iframe,
.ad-slot ins {
  max-width: 100%;
}

/* ---------- FAQ ---------- */
.faq__item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.faq__item + .faq__item { margin-top: 10px; }

.faq__q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.faq__q::after {
  content: "+";
  color: var(--brand);
  font-size: 1.3rem;
  line-height: 1;
  transition: transform var(--fast);
}

.faq__item[open] .faq__q::after { transform: rotate(45deg); }

.faq__a {
  padding: 0 18px 18px;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.93rem;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 40px;
  padding-block: 40px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 32px;
}

@media (max-width: 1000px) {
  .footer__grid { grid-template-columns: repeat(2, 1fr); }
}

.footer__links { display: flex; flex-direction: column; gap: 8px; }

.footer__links a,
.footer__col p {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color var(--fast);
}

.footer__links a:hover { color: var(--brand); }

.footer__title {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.footer__langs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.footer__langs a {
  color: var(--text-dim);
  font-size: 0.84rem;
  transition: color var(--fast);
}

.footer__langs a:hover { color: var(--text); }
.footer__langs a.is-active { color: var(--brand); font-weight: 600; }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.83rem;
}

@media (max-width: 760px) {
  .footer__grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ---------- Paginas de contenido (legal, blog, guias) ---------- */
.prose { max-width: 760px; }
.prose h2 { margin: 34px 0 10px; font-size: 1.25rem; }
.prose h3 { margin: 24px 0 8px; font-size: 1.05rem; }
.prose p, .prose li { color: var(--text-muted); }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--brand); }

/* ---------- Estado vacio ---------- */
.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 56px 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
