/* =============================================================================
   search.css — the search index
   Shared by the signed-in app shell and the public site shell.
   ============================================================================= */

/* --- Page frame --------------------------------------------------------- */
.page--search {
  padding-bottom: 4rem;
}

.search-page {
  max-width: 720px;
  margin: 0 auto;
}

.search-page--public {
  padding: 2.5rem var(--gutter) 6rem;
}

@media (min-width: 768px) {
  .search-page--public {
    padding: 4rem var(--gutter) 8rem;
  }
}

.search-page__header {
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.search-page__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 400;
  font-variation-settings:
    "opsz" 144,
    "WONK" 1;
  line-height: 1.04;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 0.6rem;
}

.search-page__sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-muted);
}

/* --- The field ---------------------------------------------------------- */
.search-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  border-bottom: 1px solid var(--rule);
}

/* The page's one moment: a rule that draws from the left on focus. */
.search-form::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--oxblood-text);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 220ms ease;
  pointer-events: none;
}

.search-form:focus-within::after {
  transform: scaleX(1);
}

.search-form__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--ink-muted);
  transition: color 180ms ease;
}

.search-form:focus-within .search-form__icon {
  color: var(--oxblood-text);
}

.search-form__input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 1rem 0;
  font-family: var(--font-title);
  font-size: clamp(1.35rem, 4.5vw, 1.9rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-form__input::placeholder {
  color: var(--ink-muted);
  opacity: 1;
}

.search-form__input::-webkit-search-cancel-button,
.search-form__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-form__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.search-form__clear:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.search-form__clear svg {
  width: 16px;
  height: 16px;
}

/* --- Inline status ------------------------------------------------------ */
.search-status {
  margin-top: 1rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.search-status.is-error {
  color: var(--danger);
}

/* --- Results ------------------------------------------------------------ */
.search-results {
  min-height: 8rem;
}

.search-results[aria-busy="true"] {
  opacity: 0.55;
  transition: opacity .15s ease;
}

.search-summary {
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.search-summary strong {
  color: var(--ink);
  font-weight: 600;
}

/* Cards keep the field's left and right edges; the hover ground still
   spans the full column. */
.search-feed .post {
  padding-left: 0;
  padding-right: 0;
}

.search-more {
  padding: 1.25rem 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-muted);
}

/* --- Empty and no-result states ----------------------------------------- */
.search-empty {
  padding: 2.5rem 0 1rem;
}

.search-empty--start {
  padding-top: 2.75rem;
}

.search-empty__kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--oxblood-text);
  margin-bottom: 0.75rem;
}

.search-empty--error .search-empty__kicker {
  color: var(--danger);
}

.search-empty__body {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 48ch;
}

.search-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.35rem;
  margin-top: 1.1rem;
}

.search-topic {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-title);
  font-size: 1.08rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color .15s ease;
}

.search-topic:hover {
  color: var(--oxblood-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

/* --- Recent searches ---------------------------------------------------- */
.search-recents {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.search-recents[hidden] {
  display: none;
}

.search-recents__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.search-recents__title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.search-recents__clear {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 0;
  background: none;
  padding: 0.25rem 0;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--oxblood-text);
  cursor: pointer;
}

.search-recents__list {
  list-style: none;
}

.search-recent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--rule);
}

.search-recent__link {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0;
  font-family: var(--font-title);
  font-size: 1.05rem;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s ease;
}

.search-recent__link:hover {
  color: var(--oxblood-text);
}

.search-recent__remove {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}

.search-recent__remove:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

/* --- Public footer ------------------------------------------------------ */
.search-page__footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.search-page__cta {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-muted);
  text-align: center;
}

/* The Write FAB must never cover results. */
body[data-active="search"] .fab {
  display: none;
}

@media (min-width: 768px) {
  .search-empty {
    padding-top: 3rem;
  }
}
