/* Recherche inline de la page d'accueil — voir home-search.js */

html.cx-hs-lock,
html.cx-hs-lock body{
  overflow:hidden !important;
}

.cx-hs{
  position:fixed;
  inset:0;
  z-index:100002;
  display:none;
  font-family:Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing:antialiased;
  color:#fff;
}

.cx-hs.is-on{
  display:block;
}

.cx-hs-backdrop{
  position:absolute;
  inset:0;
  background:rgba(7,7,11,0.88);
  -webkit-backdrop-filter:blur(18px) saturate(120%);
  backdrop-filter:blur(18px) saturate(120%);
  will-change:opacity;
}

/* ---------- Barre ---------- */

.cx-hs-bar{
  position:fixed;
  display:flex;
  align-items:center;
  box-sizing:border-box;
  padding:0 8px 0 48px;
  border-radius:14px;
  background:rgb(23,23,30);
  border:1px solid rgba(255,255,255,0.1);
  box-shadow:0 12px 40px rgba(0,0,0,0.35);
  overflow:hidden;
  z-index:2;
}

.cx-hs-bar:focus-within{
  border-color:rgba(255,255,255,0.18);
}

.cx-hs-icon{
  position:absolute;
  left:18px;
  top:50%;
  width:18px;
  height:18px;
  transform:translate(0,-50%);
  filter:brightness(0) invert(1);
  opacity:.9;
  pointer-events:none;
  will-change:transform;
}

.cx-hs-input{
  flex:1;
  min-width:0;
  height:100%;
  margin:0;
  padding:0;
  border:0;
  outline:0;
  background:transparent;
  color:#fff;
  font-family:inherit;
  font-size:1.02rem;
  font-weight:500;
  letter-spacing:-0.01em;
  caret-color:#7c4ff0;
  -webkit-appearance:none;
  appearance:none;
}

.cx-hs-input::placeholder{
  color:rgba(255,255,255,0.38);
}

.cx-hs-input::-webkit-search-cancel-button,
.cx-hs-input::-webkit-search-decoration{
  -webkit-appearance:none;
  appearance:none;
  display:none;
}

.cx-hs-close{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  margin:0;
  padding:0;
  border:0;
  border-radius:10px;
  background:transparent;
  color:rgba(255,255,255,0.55);
  cursor:pointer;
  transition:background .2s ease, color .2s ease;
  -webkit-tap-highlight-color:transparent;
}

.cx-hs-close:hover{
  background:rgba(255,255,255,0.08);
  color:#fff;
}

/* ---------- Résultats ---------- */

.cx-hs-scroll{
  position:absolute;
  inset:0;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  padding:var(--cx-hs-results-top, 120px) 16px 48px;
  box-sizing:border-box;
  scrollbar-width:none;
  z-index:1;
}

.cx-hs-scroll::-webkit-scrollbar{
  display:none;
}

.cx-hs-hint{
  max-width:720px;
  margin:0 auto;
  font-size:.9rem;
  color:rgba(255,255,255,0.42);
  text-align:center;
}

.cx-hs-hint:empty{
  display:none;
}

.cx-hs-results{
  max-width:1100px;
  margin:0 auto;
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));
  gap:28px 18px;
}

.cx-hs-card{
  display:block;
  min-width:0;
  color:inherit;
  text-decoration:none;
  -webkit-tap-highlight-color:transparent;
  animation:cx-hs-in .45s cubic-bezier(.22,1,.36,1) both;
  animation-delay:calc(min(var(--i, 0), 12) * 28ms);
}

.cx-hs-poster{
  position:relative;
  aspect-ratio:2 / 3;
  border-radius:10px;
  overflow:hidden;
  background:rgba(255,255,255,0.05);
  transition:transform .3s cubic-bezier(.22,1,.36,1);
  will-change:transform;
}

.cx-hs-poster img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  opacity:0;
  transition:opacity .35s ease;
}

.cx-hs-poster img.is-loaded{
  opacity:1;
}

.cx-hs-poster.is-empty{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:12px;
  box-sizing:border-box;
  font-size:.8rem;
  text-align:center;
  color:rgba(255,255,255,0.5);
}

.cx-hs-title{
  margin-top:10px;
  font-size:.88rem;
  font-weight:600;
  line-height:1.3;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.cx-hs-meta{
  margin-top:3px;
  font-size:.76rem;
  color:rgba(255,255,255,0.42);
}

@media (hover:hover){
  .cx-hs-card:hover .cx-hs-poster{
    transform:translateY(-4px);
  }
}

.cx-hs-card:focus-visible{
  outline:none;
}

.cx-hs-card:focus-visible .cx-hs-poster{
  box-shadow:0 0 0 2px #7c4ff0;
}

/* Squelettes */

.cx-hs-card.is-loading{
  animation:none;
}

.cx-hs-card.is-loading .cx-hs-poster,
.cx-hs-line{
  background:linear-gradient(100deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 70%);
  background-size:300% 100%;
  animation:cx-hs-shimmer 1.3s linear infinite;
}

.cx-hs-line{
  height:10px;
  margin-top:12px;
  border-radius:5px;
  width:80%;
}

.cx-hs-line.short{
  width:40%;
  margin-top:8px;
}

@keyframes cx-hs-in{
  from{ opacity:0; transform:translateY(8px); }
  to{ opacity:1; transform:none; }
}

@keyframes cx-hs-shimmer{
  from{ background-position:100% 0; }
  to{ background-position:0 0; }
}

@media (max-width:600px){
  .cx-hs-bar{
    padding-left:44px;
    border-radius:12px;
  }
  .cx-hs-icon{
    left:16px;
  }
  .cx-hs-input{
    font-size:16px; /* pas de zoom auto iOS */
  }
  .cx-hs-results{
    grid-template-columns:repeat(3, minmax(0, 1fr));
    gap:20px 10px;
  }
  .cx-hs-title{
    font-size:.78rem;
    margin-top:8px;
  }
  .cx-hs-meta{
    font-size:.7rem;
  }
}

@media (prefers-reduced-motion: reduce){
  .cx-hs-card,
  .cx-hs-card.is-loading .cx-hs-poster,
  .cx-hs-line{
    animation:none;
  }
}
