/* ============================================================
   VXG-v2 — vxg-search.css
   Overlay recherche mobile plein écran + panel desktop au focus.
   Chargé APRÈS vxg-v2.css (gagne par ordre à spécificité égale).
   Les styles d'overlay mobile sont verrouillés derrière
   html.vxg-search-ready (posée par vxg-search.js) : sans le JS,
   le comportement actuel du header reste inchangé.
   ============================================================ */

/* ---------- garde-fous [hidden] ---------- */
html .vxg-sp[hidden],
html .vxg-sp-close[hidden],
html .vxg-sp-recent[hidden],
html .vxg-sp-results[hidden]{display:none !important}

/* ---------- éléments partagés (hub + résultats) ---------- */
html .vxg-sp{color:var(--foreground)}

html .vxg-sp-label{margin:0 0 10px;font-size:10px;font-weight:700;letter-spacing:.22em;text-transform:uppercase;color:var(--muted-foreground)}
html .vxg-sp-label-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
html .vxg-sp-label-row .vxg-sp-label{margin-bottom:0}
html .vxg-sp-clear{background:none;border:0;padding:6px 0;font-size:12px;font-weight:600;color:var(--muted-foreground);cursor:pointer}
html .vxg-sp-clear:hover{color:var(--primary-glow)}

html .vxg-sp-section{margin-top:26px}
html .vxg-sp-section:first-child,
html .vxg-sp-discovery > .vxg-sp-section:first-of-type{margin-top:0}
html .vxg-sp-recent{margin-top:0}
html .vxg-sp-recent .vxg-sp-pills{margin-top:10px}

/* Pills (recherches populaires + récentes) */
html .vxg-sp-pills{display:flex;flex-wrap:wrap;gap:8px}
html .vxg-sp-pill{display:inline-flex;align-items:center;min-height:38px;padding:8px 15px;border:1px solid var(--border);border-radius:999px;background:var(--surface);color:var(--foreground);font-size:13px;font-weight:500;line-height:1;text-decoration:none;cursor:pointer;transition:border-color .15s ease,color .15s ease}
html .vxg-sp-pill:hover{border-color:var(--primary);color:var(--primary-glow)}

/* Cartes catégories : même ratio 4/3 que les cartes du catalogue. */
html .vxg-sp-cats-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
html .vxg-sp-cat{position:relative;display:block;width:100%;height:auto;aspect-ratio:4/3;border-radius:14px;overflow:hidden;background:var(--surface);text-decoration:none;isolation:isolate}
html .vxg-sp-cat img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
html .vxg-sp-cat::after{content:"";position:absolute;inset:0;background:linear-gradient(to top,oklch(0 0 0/.9) 0%,oklch(0 0 0/.36) 52%,transparent 100%)}
html .vxg-sp-cat-info{position:absolute;left:11px;right:11px;bottom:10px;z-index:1;display:flex;flex-direction:column;gap:3px}
html .vxg-sp-cat-info strong{font-size:14px;font-weight:700;color:var(--foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html .vxg-sp-cat-info small{font-size:10px;font-weight:600;color:oklch(1 0 0/.7)}
@media (hover:hover) and (pointer:fine){
  html .vxg-sp-cat img{transition:transform .45s cubic-bezier(.2,.8,.2,1)}
  html .vxg-sp-cat:hover img{transform:scale(1.055)}
}

@media (min-width:600px) and (max-width:899px){html .vxg-sp-cats-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (min-width:900px) and (max-width:1023px){html .vxg-sp-cats-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}

/* Rail acteurs — même langage visuel que le rail « En tendance » de /pornstars/. */
html .vxg-sp-models-rail{display:grid;grid-auto-flow:column;grid-auto-columns:148px;gap:14px;overflow-x:auto;padding:4px 2px 10px;scroll-snap-type:x mandatory;scrollbar-width:none;-webkit-mask-image:linear-gradient(90deg,#000 92%,transparent);mask-image:linear-gradient(90deg,#000 92%,transparent)}
html .vxg-sp-models-rail::-webkit-scrollbar{display:none}
html .vxg-sp-model{position:relative;display:block;width:148px;aspect-ratio:3/4;border:1px solid var(--border);border-radius:14px;overflow:hidden;background:var(--surface);scroll-snap-align:start;text-decoration:none;transition:transform .25s ease,border-color .25s ease}
html .vxg-sp-model img,
html .vxg-sp-model-ph{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:top center}
html .vxg-sp-model-ph{display:grid;place-items:center;background:linear-gradient(160deg,color-mix(in oklab,var(--primary) 14%,var(--surface)),var(--surface) 60%);color:oklch(1 0 0/.42);font-family:Outfit,Inter,sans-serif;font-size:30px;font-weight:800;text-transform:uppercase}
html .vxg-sp-model-shade{position:absolute;inset:0;background:linear-gradient(180deg,transparent 40%,oklch(0 0 0/.86) 100%);pointer-events:none}
html .vxg-sp-model-name{position:absolute;left:10px;right:10px;bottom:8px;z-index:1;display:block;color:#fff;font-size:13px;font-weight:700;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 1px 6px rgba(0,0,0,.8)}
html .vxg-sp-model-rank,
html .vxg-sp-model-delta{position:absolute;top:8px;z-index:2;padding:3px 7px;border-radius:7px;background:oklch(0 0 0/.72);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);color:#fff;font-size:11px;font-weight:800;font-variant-numeric:tabular-nums}
html .vxg-sp-model-rank{left:8px}
html .vxg-sp-model-delta{right:8px}
html .vxg-sp-model-delta.up{color:var(--success)}
html .vxg-sp-model-delta.down{color:var(--primary-glow)}
@media (hover:hover) and (pointer:fine){html .vxg-sp-model:hover{transform:translateY(-3px);border-color:color-mix(in oklab,var(--primary) 45%,transparent)}}

/* ---------- résultats live (remplis par vxg-search.js) ---------- */
html .vxg-sp-group{margin-top:20px}
html .vxg-sp-group:first-child{margin-top:0}
html .vxg-sp-rows{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none}
html .vxg-sp-row{display:flex;align-items:center;gap:12px;min-height:44px;padding:6px 8px;border-radius:10px;color:var(--foreground);font-size:14px;text-decoration:none;cursor:pointer}
html .vxg-sp-row:hover,
html .vxg-sp-row[aria-selected="true"]{background:oklch(1 0 0 / 5%)}
html .vxg-sp-row-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
html .vxg-sp-row-meta{flex:none;margin-left:auto;font-size:12px;color:var(--muted-foreground)}
html .vxg-sp-row--model img{width:36px;height:36px;border-radius:50%;object-fit:cover;flex:none}
html .vxg-sp-row--cat img,
html .vxg-sp-row--video img{width:64px;height:36px;border-radius:6px;object-fit:cover;flex:none}
html .vxg-sp-ico{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;background:var(--surface-elevated);color:var(--muted-foreground);flex:none}
html .vxg-sp-ico svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2}
html mark.vxg-sp-hl{background:transparent;color:var(--primary-glow);font-weight:700}
html .vxg-sp-empty{padding:32px 12px;text-align:center;font-size:14px;color:var(--muted-foreground)}
html .vxg-sp-empty a{color:var(--primary-glow);font-weight:600}

/* ---------- bouton fermer ---------- */
html .vxg-sp-close{display:none;align-items:center;justify-content:center;width:40px;height:40px;border:0;border-radius:50%;background:var(--surface);color:var(--foreground);cursor:pointer}
html .vxg-sp-close svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2}

/* ============================================================
   MOBILE (<1024) — overlay plein écran
   Actif uniquement avec vxg-search.js (html.vxg-search-ready).
   Remplace la barre translateY de vxg-v2.css (1709-1717).
   ============================================================ */
@media (max-width:1023px){
  /* .search vit DANS .header dont le contexte d'empilement est plafonné
     (vxg-v2.css:1693 pose z-index:130 !important sur .header.header-fixed) :
     sans remonter le header, chips sticky (z:135) et bottomnav (z:200)
     passent DEVANT l'overlay. !important requis pour battre le 130. */
  html.vxg-search-ready .header.search-open{z-index:300 !important}

  /* L'ancien theme gardait le formulaire hors champ avec translateY().
     Sur mobile, il doit etre totalement absent tant que .search-open n'est pas pose. */
  html.vxg-search-ready .header .search{position:fixed;inset:0;width:100%;max-width:100%;height:100vh;height:100dvh;max-height:none;margin:0;padding:0;background:var(--background);border-bottom:0;box-shadow:none;transform:none!important;transition:none;z-index:250;display:none!important;visibility:hidden;pointer-events:none;flex-direction:column}
  html.vxg-search-ready .header:not(.search-open) .search.search-visible{display:none!important;visibility:hidden!important;pointer-events:none!important;transform:none!important}
  html.vxg-search-ready .header.search-open .search{display:flex!important;visibility:visible;pointer-events:auto;transform:translateY(0)!important}

  /* Barre input sticky en haut */
  html.vxg-search-ready .header .search form{position:sticky;top:0;z-index:2;width:100%;max-width:none;margin:0;padding:12px 62px 12px 16px;background:var(--background);border-bottom:1px solid var(--border)}
  html.vxg-search-ready .header .search .search-inner{width:100%}
  html.vxg-search-ready .header .search input{width:100%;font-size:16px;min-height:44px}

  /* Bouton fermer dans la barre */
  html.vxg-search-ready .header.search-open .search .vxg-sp-close{display:flex;position:absolute;top:12px;right:12px;z-index:3}

  /* Contenu scrollable (hub ou résultats) */
  html.vxg-search-ready .header .search .vxg-sp{flex:1;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:20px 16px calc(28px + env(safe-area-inset-bottom))}
}

/* ============================================================
   DESKTOP (≥1024) — bandeau fixe sous le header, accolé à la sidebar
   ============================================================ */
@media (min-width:1024px){
  html .header .search{position:relative}

  /* Fallbacks sans JS. vxg-search.js remplace ces valeurs par les bords
     réellement mesurés du header et de la sidebar. */
  html{--vxg-search-panel-top:var(--vxg-header-h,64px);--vxg-search-panel-left:var(--vxg-sidebar-mini,80px)}
  html body.vxg-sidebar-open{--vxg-search-panel-left:var(--vxg-drawer-w,var(--vxg-sidebar-open,288px))}

  /* Scrim : assombrit et floute la page derrière le panel (header au-dessus, z160) */
  html.vxg-sp-open body::after{content:"";position:fixed;inset:0;z-index:150;background:oklch(0 0 0/.55);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}

  /* Le panel occupe exactement l'espace de contenu : sous le bord réel du
     header, à droite du bord réel de la sidebar, jusqu'au viewport. */
  html .header .search .vxg-sp{position:fixed;top:var(--vxg-search-panel-top);left:var(--vxg-search-panel-left);right:0;width:auto;transform:none;z-index:1;max-height:calc(100dvh - var(--vxg-search-panel-top));overflow-y:auto;overscroll-behavior:contain;padding:28px clamp(24px,3vw,48px) 30px;background:var(--surface-elevated);border:0;border-bottom:1px solid var(--border);border-radius:0;box-shadow:0 28px 70px -18px oklch(0 0 0/.9)}

  /* Respiration : labels plus lisibles, sections séparées par un filet */
  html .header .search .vxg-sp-label{font-size:11px;margin-bottom:14px}
  html .header .search .vxg-sp-section{margin-top:24px;padding-top:22px;border-top:1px solid oklch(1 0 0/7%)}
  html .header .search .vxg-sp-discovery > .vxg-sp-section:first-of-type,
  html .header .search .vxg-sp-recent{margin-top:0;padding-top:0;border-top:0}
  html .header .search .vxg-sp-recent[hidden] + .vxg-sp-section{margin-top:0;padding-top:0;border-top:0}
  html .header .search .vxg-sp-pills{gap:9px}
  html .header .search .vxg-sp-cats-grid{grid-template-columns:repeat(auto-fit,minmax(180px,240px));gap:12px;justify-content:start}
  html .header .search .vxg-sp-models-rail{gap:14px}
  html .header .search .vxg-sp-row{min-height:48px}

  /* Fermeture au clavier/clic extérieur : pas de bouton */
  html .header .search .vxg-sp-close{display:none !important}
}

/* Catégories populaires : une seule rangée sur tous les formats.
   Le parent réductible contient le scroll : le rail ne peut jamais élargir
   le panneau ni la page. */
html .header .search .vxg-sp-cats{width:100%;max-width:100%;min-width:0;overflow:hidden}
html .header .search .vxg-sp-cats-grid{
  display:flex;grid-template-columns:none;width:100%;max-width:100%;min-width:0;gap:12px;
  overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;
  scroll-snap-type:x proximity;scroll-padding-inline:0;scrollbar-width:none;
  padding:2px 16px 8px 0;justify-content:flex-start
}
html .header .search .vxg-sp-cats-grid::-webkit-scrollbar{display:none}
html .header .search .vxg-sp-cat{flex:0 0 168px;width:168px;min-width:0;aspect-ratio:4/3;scroll-snap-align:start}
@media (max-width:1023px){
  html .header .search .vxg-sp-cats-grid{gap:10px}
  html .header .search .vxg-sp-cat{flex-basis:clamp(152px,44vw,176px);width:clamp(152px,44vw,176px)}
}
