/* Page Rechercher — academic catalog search */

.page-recherche {
  --recherche-bg: #f6f1e8;
  --recherche-surface: rgba(255, 252, 247, 0.72);
  --recherche-surface-strong: rgba(255, 252, 247, 0.92);
  --recherche-border: rgba(90, 82, 73, 0.14);
  --recherche-border-strong: rgba(90, 82, 73, 0.26);
  --recherche-text: #2f2a25;
  --recherche-text-soft: #5f584f;
  --recherche-text-faint: #8a8177;
  --recherche-accent: #8b7355;
  --recherche-shadow: 0 14px 40px rgba(44, 38, 31, 0.05);
  --recherche-card-bg: rgba(255, 255, 255, 0.55);
  --recherche-card-hover: rgba(255, 255, 255, 0.78);
  --recherche-tag-bg: rgba(139, 115, 85, 0.09);
  --recherche-tag-text: #65594c;
  --recherche-radius: 6px;

  max-width: 1240px;
  margin: 0 auto;
  padding: 4.5rem 1.25rem 5rem;
  color: var(--recherche-text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Hero (aligned with poem/all hero-section) ─── */

.page-recherche .hero-section {
  width: 100%;
  max-width: min(44rem, 94vw);
  margin: 0 auto clamp(2rem, 4vh, 2.75rem);
  text-align: center;
}

.page-recherche .hero-title {
  font-family: 'Crimson Pro', 'Lora', serif;
  font-size: clamp(1.45rem, 3.8vw, 2.65rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 clamp(0.85rem, 2vh, 1.15rem);
  line-height: 1.28;
  color: var(--recherche-text);
}

.page-recherche .hero-subtitle {
  font-family: 'Lora', serif;
  font-size: clamp(0.98rem, 1.85vw, 1.125rem);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--recherche-text-soft);
}

/* ─── Catalogue layout ─── */

.recherche-catalog {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

/* ─── Query panel (unified search + filters) ─── */

.recherche-query-panel {
  padding: 1.5rem 1.6rem 1.6rem;
  border: 1px solid var(--recherche-border);
  border-radius: var(--recherche-radius);
  background: rgba(255, 255, 255, 0.42);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.recherche-query-panel__full {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.recherche-query-panel__label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a7268;
  font-weight: 600;
}

.recherche-query-panel__input {
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--recherche-border-strong);
  border-radius: calc(var(--recherche-radius) - 2px);
  background: var(--recherche-surface-strong);
  font: inherit;
  font-size: 1.05rem;
  color: var(--recherche-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.recherche-query-panel__input:focus,
.recherche-query-panel__input:focus-visible {
  outline: none;
  border-color: var(--recherche-border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* ─── Filter grid ─── */

.recherche-query-panel__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.recherche-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.recherche-field__label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a7268;
  font-weight: 600;
}

.recherche-field__input,
.recherche-field__select {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(90, 82, 73, 0.18);
  border-radius: calc(var(--recherche-radius) - 2px);
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
  color: #2f2a25;
}

.recherche-field__input:focus,
.recherche-field__select:focus,
.recherche-field__input:focus-visible,
.recherche-field__select:focus-visible {
  outline: none;
  border-color: rgba(90, 82, 73, 0.18);
  box-shadow: none;
}

/* ─── Extra criteria (details/summary) ─── */

.recherche-query-panel__more {
  border-top: 1px solid rgba(90, 82, 73, 0.1);
  padding-top: 0.85rem;
}

.recherche-query-panel__more-toggle {
  cursor: pointer;
  list-style: none;
  font-size: 0.88rem;
  color: #5a5249;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-color: rgba(90, 82, 73, 0.3);
}

.recherche-query-panel__more-toggle::-webkit-details-marker {
  display: none;
}

.recherche-query-panel__grid--extra {
  margin-top: 0.85rem;
}

/* ─── Actions ─── */

.recherche-query-panel__actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(90, 82, 73, 0.1);
}

.recherche-query-panel__submit {
  flex-shrink: 0;
  min-height: 2.85rem;
  padding: 0.65rem 1.35rem;
  border: 1px solid rgba(60, 52, 44, 0.55);
  border-radius: calc(var(--recherche-radius) - 1px);
  background: #342f2b;
  color: #f6f1e9;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.recherche-query-panel__submit:hover {
  background: #26221f;
}

.recherche-query-panel__submit:focus-visible {
  outline: 2px solid #5a5249;
  outline-offset: 2px;
}

.recherche-query-panel__reset {
  font-size: 0.88rem;
  color: var(--recherche-text-soft);
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-color: rgba(90, 82, 73, 0.3);
}

.recherche-query-panel__dialog-open {
  display: none;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  border: 1px solid rgba(90, 82, 73, 0.28);
  border-radius: var(--recherche-radius);
  background: rgba(255, 252, 247, 0.9);
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--recherche-text);
}

.recherche-query-panel__dialog-open:focus-visible {
  outline: 2px solid #5a5249;
  outline-offset: 2px;
}

/* ─── Results header ─── */

.recherche-results-shell {
  padding-top: 0;
}

.recherche-results-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(90, 82, 73, 0.12);
  margin-bottom: 0.5rem;
}

.recherche-results-head__title {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
  line-height: 1.2;
  color: var(--recherche-text);
  font-weight: 600;
}

.recherche-count {
  margin: 0;
  font-size: 0.88rem;
  color: var(--recherche-text-faint);
  white-space: nowrap;
}

/* ─── Active filter chips ─── */

.recherche-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
  margin-top: 0.75rem;
}

.recherche-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.25rem 0.72rem;
  border: 1px solid rgba(139, 115, 85, 0.22);
  background: rgba(139, 115, 85, 0.08);
  color: var(--recherche-tag-text);
  text-decoration: none;
  font-size: 0.82rem;
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.recherche-chip:hover {
  background: rgba(139, 115, 85, 0.15);
  border-color: rgba(139, 115, 85, 0.35);
}

.recherche-chip__remove {
  font-size: 1rem;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.recherche-chip:hover .recherche-chip__remove {
  opacity: 0.85;
}

/* ─── Result cards ─── */

.recherche-notices {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.6rem;
}

.recherche-notice {
  padding: 1.35rem 1.4rem;
  background: var(--recherche-card-bg);
  border: 1px solid var(--recherche-border);
  border-radius: var(--recherche-radius);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.recherche-notice:hover {
  background: var(--recherche-card-hover);
  border-color: rgba(90, 82, 73, 0.22);
  box-shadow: 0 4px 16px rgba(44, 38, 31, 0.04);
}

.recherche-notice__inner {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.recherche-notice__title {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  margin: 0;
  line-height: 1.3;
}

.recherche-notice__title-link {
  color: var(--recherche-text);
  text-decoration: none;
}

.recherche-notice__title-link:hover {
  text-decoration: underline;
  text-decoration-color: rgba(43, 43, 43, 0.35);
  text-underline-offset: 0.12em;
}

.recherche-notice__author {
  font-size: 0.95rem;
  margin: 0;
  color: var(--recherche-text-soft);
  line-height: 1.5;
}

.recherche-notice__author a {
  color: inherit;
  text-decoration: none;
}

.recherche-notice__author a:hover {
  text-decoration: underline;
}

.recherche-notice__sep {
  margin: 0 0.15rem;
  color: var(--recherche-text-faint);
}

.recherche-notice__date {
  color: var(--recherche-text-faint);
}

/* ─── Tags (form, period, themes) ─── */

.recherche-notice__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.15rem;
}

.recherche-notice__tag {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--recherche-tag-text);
  background: var(--recherche-tag-bg);
  border-radius: 3px;
  letter-spacing: 0.01em;
}

.recherche-notice__tag--theme {
  background: rgba(139, 115, 85, 0.07);
  border: 1px solid rgba(139, 115, 85, 0.12);
}

/* ─── Incipit / excerpt ─── */

.recherche-notice__incipit {
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1.7;
  color: var(--recherche-text-soft);
  margin: 0.25rem 0 0.15rem;
  max-width: 44rem;
  padding: 0.5rem 0 0.5rem 0.9rem;
  border-left: 2px solid rgba(139, 115, 85, 0.22);
}

/* ─── Read link ─── */

.recherche-notice__read {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--recherche-accent);
  text-decoration: none;
  margin-top: 0.2rem;
  transition: gap 0.2s ease;
}

.recherche-notice__read:hover {
  gap: 0.6rem;
  text-decoration: underline;
  text-decoration-color: rgba(139, 115, 85, 0.4);
  text-underline-offset: 0.15em;
}

.recherche-notice__arrow {
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.recherche-notice:hover .recherche-notice__arrow {
  opacity: 0.85;
  transform: translateX(2px);
}

/* ─── Empty state ─── */

.recherche-empty {
  padding: 2rem 1.4rem;
  max-width: 48rem;
  background: var(--recherche-card-bg);
  border: 1px solid var(--recherche-border);
  border-radius: var(--recherche-radius);
}

.recherche-empty__eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.73rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--recherche-text-faint);
}

.recherche-empty__lead {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--recherche-text-soft);
}

.recherche-empty__list {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.8;
}

.recherche-empty__list a {
  color: var(--recherche-accent);
  text-decoration: underline;
  text-decoration-color: rgba(139, 115, 85, 0.3);
  text-underline-offset: 0.14em;
}

.recherche-empty__list a:hover {
  text-decoration-color: rgba(139, 115, 85, 0.7);
}

/* ─── Dialog ─── */

.recherche-dialog {
  border: none;
  padding: 0;
  max-width: 100%;
  width: min(100%, 460px);
  background: #faf7f2;
  border-radius: var(--recherche-radius);
  box-shadow: 0 0 0 1px rgba(90, 82, 73, 0.15);
}

.recherche-dialog::backdrop {
  background: rgba(40, 36, 32, 0.35);
}

.recherche-dialog__inner {
  padding: 1rem 1.1rem 1.5rem;
  max-height: 100vh;
  overflow: auto;
}

.recherche-dialog__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(90, 82, 73, 0.12);
}

.recherche-dialog__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.recherche-dialog__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #5a5249;
  padding: 0.25rem 0.5rem;
}

.recherche-dialog__close:focus-visible {
  outline: 2px solid #5a5249;
  outline-offset: 2px;
}

.recherche-filters-secondary--dialog {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.recherche-filters-actions--dialog {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  margin-top: 1rem;
}

body.recherche-dialog-open {
  overflow: hidden;
}

/* ─── Pagination ─── */

.pagination--editorial {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--recherche-border);
}

.pagination-info {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--recherche-text-faint);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pagination-nav {
  font-size: 0.9rem;
  color: var(--recherche-accent);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(139, 115, 85, 0.2);
  border-radius: var(--recherche-radius);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pagination-nav:hover {
  background: rgba(139, 115, 85, 0.06);
  border-color: rgba(139, 115, 85, 0.35);
}

.pagination-numbers-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  font-size: 0.88rem;
  color: var(--recherche-text-soft);
  text-decoration: none;
  border-radius: var(--recherche-radius);
  transition: background 0.15s ease;
}

.pagination-number:hover {
  background: rgba(139, 115, 85, 0.08);
}

.pagination-number--current {
  background: #342f2b;
  color: #f6f1e9;
  font-weight: 600;
}

.pagination-ellipsis {
  padding: 0 0.3rem;
  color: var(--recherche-text-faint);
}

/* ─── Responsive ─── */

@media (min-width: 1024px) {
  .page-recherche .hero-section {
    max-width: min(52rem, 94vw);
    margin-bottom: clamp(2.25rem, 4.5vh, 3rem);
  }
}

@media (max-width: 1100px) {
  .recherche-query-panel__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .recherche-query-panel__dialog-open {
    display: inline-flex;
  }
}

@media (max-width: 768px) {
  .page-recherche .hero-section {
    margin-bottom: clamp(1.35rem, 3.5vh, 1.85rem);
  }
}

@media (max-width: 720px) {
  .page-recherche {
    padding-top: 3.2rem;
    padding-bottom: 4rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .recherche-query-panel {
    padding: 1rem;
  }

  .recherche-query-panel__grid {
    display: none;
  }

  .recherche-query-panel__more {
    display: none;
  }

  .recherche-query-panel__dialog-open {
    display: inline-flex;
  }

  .recherche-query-panel__actions {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .recherche-query-panel__submit,
  .recherche-query-panel__dialog-open {
    min-height: 2.75rem;
  }

  .recherche-results-head {
    flex-direction: column;
    align-items: start;
    gap: 0.35rem;
  }

  .recherche-count {
    white-space: normal;
  }

  .recherche-notice {
    padding: 1.1rem 1rem;
  }

  .recherche-notice__incipit {
    padding-left: 0.85rem;
    font-size: 0.92rem;
  }

  .recherche-notice__title {
    font-size: 1.15rem;
  }

  .recherche-notice__read {
    min-height: 2.75rem;
  }

  .recherche-chip {
    min-height: 2.25rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.84rem;
  }

  .pagination--editorial {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
  }

  .pagination-controls {
    justify-content: center;
  }

  .pagination-nav {
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
  }

  .pagination-numbers-wrap {
    display: none;
  }

  .recherche-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
  }

  .recherche-dialog__inner {
    padding: 1rem 1.15rem 2rem;
    max-height: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .recherche-dialog__body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .recherche-dialog__head {
    flex-shrink: 0;
  }

  .recherche-dialog__close {
    min-width: 2.75rem;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .recherche-filters-secondary--dialog .recherche-field__input,
  .recherche-filters-secondary--dialog .recherche-field__select {
    min-height: 3rem;
    font-size: 1rem;
  }

  .recherche-filters-actions--dialog {
    padding-bottom: env(safe-area-inset-bottom, 0.5rem);
  }

  .recherche-filters-actions--dialog .recherche-query-panel__submit {
    flex: 1;
    min-height: 3rem;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .page-recherche {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .recherche-query-panel {
    padding: 0.85rem;
  }

  .recherche-notice {
    padding: 1rem 0.85rem;
  }

  .recherche-notice__tags {
    gap: 0.25rem;
  }

  .recherche-notice__tag {
    font-size: 0.74rem;
    padding: 0.15rem 0.45rem;
  }

  .recherche-notice__incipit {
    font-size: 0.88rem;
    line-height: 1.6;
  }

  .recherche-empty {
    padding: 1.5rem 1rem;
  }
}
