/* ─── PAGE DE RÉSULTATS DE RECHERCHE (search.php) ─── */
/* Réutilise .section-wrap, .section-top, .hero-search, .gr-icon / .gr-title / .gr-arrow de style.css */

.search-page { background: var(--bg); }

/* En-tête : H1 + champ pré-rempli */
.search-hero { background: var(--green-pale); padding: 40px 0 32px; border-bottom: 1px solid var(--border); }
.search-title {
  font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.15; color: var(--text); margin-bottom: 16px;
  overflow-wrap: anywhere;
}
.search-intro { font-size: 0.95rem; color: var(--muted); line-height: 1.5; margin: -6px 0 16px; }
/* Le formulaire de l'accueil est pensé pour un fond sombre : ici bordure au lieu de l'ombre, aligné à gauche */
.search-hero .hero-search {
  margin: 0; max-width: 560px; box-shadow: none; border: 1.5px solid var(--border);
}
.search-hero .hero-search:focus-within { border-color: var(--green); }
/* 16px évite le zoom automatique d'iOS au focus */
.search-hero .hero-search input { font-size: 16px; min-height: 44px; }
.search-hero .hero-search button { min-height: 44px; }

/* Sections Races / Guides */
.search-section { padding: 36px 0 8px; }
.search-section:last-child { padding-bottom: 56px; }
.search-count { font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 500; color: var(--muted); }

/* ─── Race ou sujet reconnu : colonne de lecture ─── */
.sr-main > * { max-width: 880px; }
.sr-heading { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; margin: 24px 0 12px; }
.sr-main > .sr-heading:first-child { margin-top: 0; }
.sr-tag { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--green); }
.sr-cta {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  background: var(--green); color: var(--white); border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
}
.sr-cta:hover { background: var(--green-mid); color: var(--white); text-decoration: none; }

/* Réponse directe */
.sr-answer { background: var(--white); border: 2px solid var(--green); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.sr-answer-title {
  display: block; margin: 6px 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 800;
  line-height: 1.25; color: var(--text); text-decoration: none; overflow-wrap: anywhere;
}
.sr-answer-title:hover { color: var(--green); text-decoration: none; }
.sr-answer p { font-size: 0.92rem; line-height: 1.55; color: #333; margin: 0 0 12px; }

/* Bloc race : en-tête photo + nom + gabarit, puis guides */
.sr-block { scroll-margin-top: 88px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.sr-block-head { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-bottom: 12px; }
.sr-block-photo {
  width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--green-light);
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
}
.sr-block-photo img { width: 100%; height: 100%; object-fit: cover; }
.sr-block-name {
  display: block; font-family: var(--font-display); font-size: 1.06rem; font-weight: 800;
  color: var(--text); text-decoration: none; overflow-wrap: anywhere;
}
.sr-block-name:hover { color: var(--green); text-decoration: none; }
.sr-block-meta { font-size: 0.82rem; color: var(--muted); }
.sr-block-fiche {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  font-size: 0.85rem; font-weight: 600; color: var(--green); text-decoration: none; white-space: nowrap;
}
.sr-group { margin-top: 14px; } /* pas de trait entre les groupes : le libellé suffit */
.sr-block-head + .sr-group { margin-top: 0; }
.sr-group-label {
  display: block; margin-bottom: 6px; font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}

/* Replié : <details> natif, le résumé sert de bouton ; une fois ouvert, la liste courte laisse place aux groupes */
.sr-block-more summary {
  display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 6px;
  font-size: 0.9rem; font-weight: 600; color: var(--green); cursor: pointer; list-style: none;
}
.sr-block-more summary::-webkit-details-marker { display: none; }
.sr-block-more[open] summary { display: none; }
.sr-block:has(.sr-block-more[open]) .sr-block-short { display: none; }
.sr-block-more[open] .sr-group:first-of-type { margin-top: 0; }

/* Guides en tuiles sans trait : fond clair, 2 colonnes (1 pour les titres complets « is-single ») */
.sr-guides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.sr-guides.is-single { grid-template-columns: minmax(0, 1fr); }
.sr-row {
  display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 10px;
  background: var(--bg); border-radius: 10px; text-decoration: none; color: var(--text);
}
.sr-row:hover, .sr-row.is-hl { background: var(--green-light); text-decoration: none; }
.sr-row:hover .gr-arrow { opacity: 1; }
.sr-row .gr-icon { width: 28px; height: 28px; font-size: 0.95rem; }
.sr-row .gr-title { overflow-wrap: normal; word-break: normal; hyphens: none; }
.sr-row.is-hl .gr-title { font-weight: 700; color: var(--green); }
.sr-guides.is-single .gr-title { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; }
/* Mobile : dans les grilles à 2 colonnes, la flèche cède sa place au libellé (toute la tuile reste cliquable) */
@media (max-width: 600px) {
  .sr-guides:not(.is-single) .sr-row { padding-left: 8px; padding-right: 8px; }
  .sr-guides:not(.is-single) .sr-row .gr-arrow { display: none; }
  .sr-guides:not(.is-single) .sr-row .gr-title { font-size: 0.8125rem; }
}

/* Plus de 6 races : simple liste de noms */
.sr-more-races { font-size: 0.92rem; line-height: 1.8; }
.sr-more-races a { color: var(--green); font-weight: 600; display: inline-block; padding: 10px 0; margin: -10px 0; } /* cible tactile ~40px sans changer l'interligne */

/* Sujet seul : carte Thème + choix de la race */
.sr-theme-card { background: var(--white); border: 2px solid var(--green); border-radius: var(--radius); padding: 16px; }
.sr-theme-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.sr-theme-head .gr-icon { width: 40px; height: 40px; font-size: 1.25rem; }
.sr-theme-name {
  display: block; font-family: var(--font-display); font-size: 1.2rem; font-weight: 800;
  color: var(--text); text-decoration: none;
}
.sr-theme-name:hover { color: var(--green); text-decoration: none; }
.sr-theme-card .sr-cta { margin-top: 12px; }
.sr-pick { margin-top: 16px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.sr-pick label { display: block; margin-bottom: 10px; font-family: var(--font-display); font-size: 1.06rem; font-weight: 800; }
.sr-pick-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.sr-pick select {
  width: 100%; min-width: 0; min-height: 48px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--white);
  font-family: 'Inter', sans-serif; font-size: 16px; color: var(--text);
}
.sr-pick button {
  min-height: 48px; padding: 0 18px; border: none; border-radius: 10px;
  background: var(--green); color: var(--white); font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.sr-pick button:hover { background: var(--green-mid); }
.sr-hint { margin: 10px 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }

/* Thèmes : pastilles compactes nom + nombre de guides */
.search-themes { display: flex; flex-wrap: wrap; gap: 8px; }
.search-theme {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  max-width: 100%; border: 1.5px solid var(--border); border-radius: 999px; background: var(--white);
  text-decoration: none; color: var(--text);
}
.search-theme:hover { border-color: var(--green); text-decoration: none; }
.search-theme-name { font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; }
.search-theme:hover .search-theme-name { color: var(--green); }
.search-theme-count { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }

/* Guides : liste simple, toute la ligne est cliquable */
.search-guides {
  list-style: none; margin: 0; padding: 0;
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius);
}
.search-guides li + li { border-top: 1px solid var(--border); }
.search-guide {
  display: flex; flex-direction: column; gap: 3px; justify-content: center;
  min-height: 44px; padding: 14px 18px; text-decoration: none; color: var(--text);
}
.search-guide:hover { background: var(--green-pale); text-decoration: none; }
.search-guide-title {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700; line-height: 1.3;
  overflow-wrap: anywhere;
}
.search-guide:hover .search-guide-title { color: var(--green); }
.search-guide-label { font-size: 0.82rem; color: var(--muted); }

/* Pagination (the_posts_pagination) */
.search-page .screen-reader-text {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.search-pagination { margin-top: 24px; }
.search-pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.search-pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--white);
  font-size: 0.9rem; font-weight: 600; color: var(--text); text-decoration: none;
}
.search-pagination a.page-numbers:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
.search-pagination .page-numbers.current { background: var(--green); border-color: var(--green); color: var(--white); }
.search-pagination .page-numbers.dots { border: none; background: none; min-width: 24px; padding: 0; }

/* ─── Affiner par sujet : lignes compactes icône + libellé (pas de capsules, réservées aux étiquettes) ─── */
.sr-side-title { font-family: var(--font-display); font-size: 1.06rem; font-weight: 700; margin: 0 0 10px; }
.sr-refine.is-main { margin-top: 28px; }
.sr-refine.is-side { display: none; }
.sr-refine-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.sr-refine-item {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 8px;
  border-radius: 10px; text-decoration: none; color: var(--text);
}
a.sr-refine-item:hover { background: var(--green-light); text-decoration: none; }
.sr-refine-item .gr-icon { width: 28px; height: 28px; font-size: 0.95rem; }
.sr-refine-item .gr-title { font-size: 0.85rem; }
.sr-refine-item.is-active { background: var(--green-light); grid-column: 1 / -1; }
.sr-refine-item.is-active .gr-title { font-weight: 700; color: var(--green); }
.sr-refine-remove {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 4px;
  font-size: 0.82rem; font-weight: 600; color: var(--muted); text-decoration: underline;
}
.sr-refine-remove:hover { color: var(--text); }

/* ─── Colonne droite (grand écran uniquement) ─── */
.sr-side { display: none; }
.sr-pick.is-side { margin-top: 0; padding: 0; border: none; }
.sr-side-races ul { list-style: none; margin: 0 0 20px; padding: 0; }
.sr-side-race {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  min-height: 48px; padding: 4px 6px; border-radius: 10px; text-decoration: none; color: var(--text);
}
.sr-side-race:hover { background: var(--green-light); text-decoration: none; }
.sr-side-photo {
  width: 40px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--green-light);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.sr-side-photo img { width: 100%; height: 100%; object-fit: cover; }
.sr-side-name { font-size: 0.88rem; font-weight: 600; line-height: 1.25; }
.sr-side-size { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

@media (min-width: 1024px) {
  .sr-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
  /* Sous l'en-tête collant du site (68px) : même décalage que les autres colonnes latérales du thème */
  /* Aucune barre de défilement interne : la colonne défile avec la page, et ne reste fixe que si l'écran est assez haut (plus bas) */
  .sr-side { display: block; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
  .sr-refine.is-side { display: block; }
  .sr-refine.is-side .sr-refine-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .sr-refine.is-side .sr-refine-item { min-height: 40px; }
  .sr-refine.is-main, .sr-pick.is-main, .sr-more-races.has-side { display: none; }
  .sr-block .sr-guides:not(.is-single) { grid-template-columns: repeat(4, minmax(0, 1fr)); } /* 4 colonnes : les groupes de 4 guides tiennent sur une ligne */
  /* Races : simples ancres texte, compactes (pas de miniature) */
  .sr-side-photo { display: none; }
  .sr-side-race { grid-template-columns: minmax(0, 1fr) auto; min-height: 32px; padding: 4px 8px; }
  .sr-side-name { font-weight: 500; }
}
/* Colonne fixe seulement si elle tient en entier à l'écran (classe posée par le script de search.php) */
@media (min-width: 1024px) {
  .sr-side.is-sticky { position: sticky; top: 88px; }
  .admin-bar .sr-side.is-sticky { top: 120px; }
}

/* Aucun résultat */
.search-empty-box {
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 28px 32px;
}
.search-empty-box .section-heading-plain {
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; line-height: 1.2;
  margin-bottom: 10px; overflow-wrap: anywhere;
}
.search-empty-box p { font-size: 0.95rem; color: var(--muted); line-height: 1.55; }
.search-empty-box .search-empty-label { margin-top: 20px; font-weight: 600; color: var(--text); }
.search-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.search-chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border-radius: 999px; background: var(--green-light); color: var(--green);
  font-size: 0.88rem; font-weight: 600; text-decoration: none;
}
.search-chip:hover { background: var(--green-hover); text-decoration: none; }
.search-empty-links { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-top: 20px; }
.search-empty-link {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: 0.92rem; font-weight: 600; color: var(--green); text-decoration: none;
}
.search-empty-link:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .search-hero { padding: 24px 0 20px; }
  .search-section { padding: 24px 0 4px; }
  .search-section:last-child { padding-bottom: 40px; }
  .search-guide { padding: 12px 14px; }
  .search-guide-title { font-size: 0.95rem; }
  .search-empty-box { padding: 20px 16px; }
  .search-empty-box .section-heading-plain { font-size: 1.2rem; }
  .search-pagination .prev, .search-pagination .next { padding: 0 10px; }
}

/* ─── Page 404 (404.php réutilise cette feuille) ─── */
.sr-row .gr-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.e404 .sr-row { background: var(--white); border: 1px solid var(--border); } /* tuiles sur fond beige : blanches ici, sinon invisibles */
.e404 .sr-row:hover { background: var(--green-light); }
.e404-more { margin: 24px 0 0; }
.e404-more a { color: var(--green); font-weight: 600; }
