/* ── Page heading ────────────────────────────────────────── */
.page-title {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 2rem;
  margin-top: 1.5em;
}

/* ── Search block wrapper ────────────────────────────────── */
.search-block {
  max-width: 560px;
}

/* ── Rubric (instruction line) ───────────────────────────── */
.search-rubric {
  font-size: 1rem;
  color: var(--mid);
  margin-bottom: 0.75rem;
}

/* ── Input row ───────────────────────────────────────────── */
.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
  margin-bottom: 0.5rem;
}

.search-input {
  flex: 1 1 200px;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #b8b0a4;
  border-radius: 3px;
  padding: 0.55rem 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder {
  color: #a09890;
  font-style: italic;
}
.search-input:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(58, 92, 74, 0.15);
}

/* ── Search button ───────────────────────────────────────── */
.btn-search {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #fff;
  background: var(--sage);
  border: none;
  border-radius: 3px;
  padding: 0.55rem 1.3rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-search:hover  { background: #2e4e3c; }
.btn-search:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

/* ── Hints toggle button ─────────────────────────────────── */
.btn-hints {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-hints:hover {
  background: var(--ink);
  color: var(--cream);
}
.btn-hints:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

/* ── Validation error message ────────────────────────────── */
.search-errmsg {
  font-size: 0.88rem;
  color: #b94040;
  min-height: 1.2em;
  margin-bottom: 0.25rem;
}

/* ── Hints panel ─────────────────────────────────────────── */
.search-hints {
  position: relative;
  background: #eee9de;
  border-left: 3px solid var(--sage);
  border-radius: 0 4px 4px 0;
  padding: 1.2rem 1.5rem 1.2rem 1.4rem;
  margin: 1rem 0;
}
/* Hide when the `hidden` attribute is present */
.search-hints[hidden] { display: none; }

.search-hints h3 {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.search-hints ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.search-hints li {
  font-size: 0.92rem;
  color: #3d4e60;
  line-height: 1.55;
  padding-left: 1.1em;
  position: relative;
}
.search-hints li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--sage);
  font-size: 0.8em;
  top: 0.2em;
}

.search-hints em { font-style: italic; }

/* Close button (×) */
.hints-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1;
  color: var(--mid);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  border-radius: 2px;
  transition: color 0.15s;
}
.hints-close:hover { color: var(--ink); }
.hints-close:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ── Pagination row ──────────────────────────────────────── */
.search-pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 0.5rem;
  /* Hidden until results arrive — JS should remove/add a
     class or the hidden attribute as appropriate */
}
.search-pagination[hidden] { display: none; }

.results-text {
  font-size: 0.9rem;
  color: var(--mid);
  flex: 1;
  text-align: center;
}

.btn-page {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sage);
  background: transparent;
  border: 1.5px solid var(--sage);
  border-radius: 3px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-page:hover {
  background: var(--sage);
  color: #fff;
}
.btn-page:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
.btn-page:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

/* ── Results area ────────────────────────────────────────── */
.search-results {
  margin-top: 1.5rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
}
/* Hide the top rule when empty */
.search-results:empty {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.search-results .asearchtitle {
  margin-bottom: 0rem;
  padding-bottom: 0rem;
}
.search-results .asearchdesc {
	padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.search-results .result-item:last-child {
  border-bottom: none;
}
.search-results .result-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.search-results .result-title a {
  color: var(--ink);
}
.search-results .result-title a:hover {
  color: var(--sage);
}

.search-results .result-snippet {
  font-size: 0.92rem;
  color: var(--mid);
  line-height: 1.55;
}

/* Highlight matched terms — class name to match your handler */
.search-results mark {
  background: #f5e0b0;
  color: var(--ink);
  padding: 0 0.15em;
  border-radius: 2px;
}

/* ── Visually hidden (screen-reader only) ────────────────── */
.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;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 500px) {
  .search-row { flex-direction: column; }
  .search-input { flex: 1 1 auto; }
  .btn-search,
  .btn-hints  { width: 100%; text-align: center; }
}
