/* ==========================================================================
   Chapiens — estilos de las páginas propias de la web (buscador).
   Reutiliza fuentes y colores del diseño del libro (design/static/css/sapiens.css)
   para que el paso del buscador al índice sea continuo.
   ========================================================================== */

@font-face {
  font-family: "Clarendon BT";
  src: url("/static/fonts/ClarendonBT-Roman.otf") format("opentype");
  font-display: block;
}

@font-face {
  font-family: "DIN Next LT Pro";
  src: url("/static/fonts/DINNextLTPro-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: block;
}

@font-face {
  font-family: "Baskerville BE";
  src: url("/static/fonts/BaskervilleBE-Regular.otf") format("opentype");
  font-display: block;
}

:root {
  --fuente-titulo: "Clarendon BT", Georgia, serif;
  --fuente-rotulo: "DIN Next LT Pro", "Helvetica Neue", Arial, sans-serif;
  --fuente-texto: "Baskerville BE", Georgia, serif;

  --rojo: #e30613;  /* solo páginas de hortaliza: la web lo sustituye por su color */
  --azul: #0074c7;  /* acento de la portada: azul Sapiens (#0095ff) oscurecido para leerse sobre blanco */
  --negro: #111111;
  --gris-oscuro: #3c3c3b;
  --gris-medio: #9d9d9c;
  --gris-linea: #e4e4e4;
  --circuito: #e2ded6;
  --fondo: #fbfaf7;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--fondo);
  color: var(--negro);
  font-family: var(--fuente-texto);
  -webkit-font-smoothing: antialiased;
}

.oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- Portada ---------- */

.portada {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 24px;
  text-align: center;
}

.portada__marca {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: clamp(3rem, 11vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.01em;
}

.portada__titulo {
  margin: 1em 0 0;  /* deja aire bajo el trazo descendente de la «p» de Chapiens */
  padding: 0.3em 0.6em 0.22em;  /* algo menos abajo: las mayúsculas de DIN se ven centradas */
  background: var(--azul);
  font-family: var(--fuente-rotulo);
  font-weight: 700;
  font-size: 1.14rem;  /* como .subtitulo del libro (DIN Bold 12 pt) */
  line-height: 1.17;
  text-transform: uppercase;
  color: #fff;
}

.portada__lema {
  margin: 1.6em 0 2.4em;
  font-size: 1.1rem;
  color: var(--gris-oscuro);
}

/* ---------- Barra de búsqueda ---------- */

.buscador {
  display: flex;
  align-items: center;
  width: min(560px, 100%);
  padding: 6px 6px 6px 24px;
  background: #fff;
  border: 1px solid var(--gris-linea);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.buscador:focus-within {
  border-color: var(--negro);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.08);
}

.buscador__campo {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--fuente-texto);
  font-size: 1.1rem;  /* mismo tamaño que .portada__lema */
  color: var(--negro);
}

.buscador__campo::placeholder {
  color: var(--gris-medio);
}

.buscador__boton {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--azul);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.buscador__boton:hover {
  transform: translateX(2px);
}

.buscador__boton:focus-visible {
  outline: 2px solid var(--negro);
  outline-offset: 2px;
}

.buscador--ocupado {
  opacity: 0.55;
  pointer-events: none;
}

/* ---------- Avisos ---------- */

.aviso {
  margin: 1.2em 0 0;
  font-family: var(--fuente-rotulo);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.aviso--error {
  color: var(--azul);
}

.aviso--espera {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  color: var(--gris-oscuro);
}

.aviso--espera[hidden] {
  display: none;
}

.punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--azul);
  animation: latido 1s ease-in-out infinite;
}

@keyframes latido {
  50% { opacity: 0.2; transform: scale(0.7); }
}

/* ---------- Sugerencias ---------- */

.sugerencias {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 2em 0 0;
  padding: 0;
  list-style: none;
}

.sugerencias a {
  display: block;
  padding: 6px 14px;
  border: 1px solid var(--gris-linea);
  background: #fff;
  border-radius: 999px;
  font-family: var(--fuente-rotulo);
  font-size: 0.8rem;
  color: var(--gris-oscuro);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.sugerencias a:hover {
  border-color: var(--azul);
  color: var(--azul);
}

.enlace {
  font-family: var(--fuente-rotulo);
  color: var(--rojo);
  text-decoration: none;
}

/* ---------- Fondo de circuitos (circuitos.js) ---------- */

.circuitos {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* despeja el centro para que el buscador se lea limpio */
  -webkit-mask-image: radial-gradient(ellipse 42% 40% at 50% 50%, transparent 35%, #000 100%);
  mask-image: radial-gradient(ellipse 42% 40% at 50% 50%, transparent 35%, #000 100%);
}

.portada {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .punto { animation: none; }
  .buscador__boton:hover { transform: none; }
}
