/**
 * MyStream styling for Scolta's result cards and search-as-you-type dropdown.
 *
 * Loaded after the package's scolta.css, which is never edited. Two techniques
 * only: override the documented custom properties, and style the app's own
 * mystream-* classes on the markup its renderers emit. No selector here is
 * more specific than one class.
 *
 * A plain stylesheet under public/ rather than a Vite entry, matching how
 * public/vendor/scolta/scolta.css is already served. It has to load after that
 * file to win the custom-property redeclarations at the same specificity, and
 * a static file with an explicit link makes that ordering something you can
 * read rather than something the bundler decides.
 *
 * The app had never themed Scolta at all, so the first block does that job
 * too: the search UI arrived in the package's neutral greys on a teal site.
 * Colours are Tailwind's teal and gray scales, the ones the layout already
 * uses, written literally because this file is outside the Tailwind build.
 */

:root {
  --scolta-primary: #0f766e;
  --scolta-primary-hover: #115e59;
  --scolta-accent: #14b8a6;
  --scolta-bg: #f8fafc;
  --scolta-card-bg: #ffffff;
  --scolta-text: #111827;
  --scolta-text-muted: #6b7280;
  --scolta-text-light: #9ca3af;
  --scolta-border: #e5e7eb;
  --scolta-highlight: #ccfbf1;
  --scolta-badge-bg: #f0fdfa;

  /* Search-as-you-type. The seven documented knobs, nothing more. */
  --scolta-sayt-bg: #ffffff;
  --scolta-sayt-border: #e5e7eb;
  --scolta-sayt-shadow: 0 8px 24px rgba(17, 24, 39, 0.14);
  --scolta-sayt-radius: 12px;
  --scolta-sayt-max-height: 24rem;
  --scolta-sayt-active-bg: #f0fdfa;
  --scolta-sayt-z-index: 60;
}

/* --------------------------------------------------------------------------
 * Post card
 *
 * Laid out like the post cards the feed already draws: round avatar on the
 * left, author line, then the post. Someone scanning search results and
 * someone scanning their feed are looking at the same object.
 * ----------------------------------------------------------------------- */

.mystream-result {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

/* Fixed round box, so the card's height is settled before the avatar arrives
   and nothing below it moves when it does. Matches the 40px avatar the feed's
   post card uses. */
.mystream-result__avatar {
  flex: 0 0 auto;
  display: block;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 9999px;
  background: #e5e7eb;
}

.mystream-result__avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* An avatar that fails to load leaves the grey circle rather than collapsing.
   These are remote DiceBear URLs, so a blocked or offline load is a real path,
   and every card losing its avatar together still reads as a list of posts —
   where cards that individually gained and lost their gutter would not. */
.mystream-result--avatar-failed .mystream-result__avatar {
  background: #e5e7eb;
}

.mystream-result__body {
  min-width: 0;
  flex: 1 1 auto;
}

.mystream-result__title {
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  line-clamp: 1;
  overflow: hidden;
}

.mystream-result__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0 0.4rem;
}

.mystream-result__handle {
  font-size: 0.82rem;
  color: #6b7280;
}

.mystream-result__stars {
  font-size: 0.82rem;
  color: #6b7280;
  white-space: nowrap;
}

/* Hashtags read as hashtags, not as uppercase category chips: this is the one
   place in the rollout where the facet value already carries its own sigil and
   its own convention, and shouting it would look wrong beside the post. */
.mystream-result__badge {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  background: #f0fdfa;
  color: #0f766e;
  white-space: nowrap;
}

.mystream-result__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
  margin: 0;
}

/* --------------------------------------------------------------------------
 * Search-as-you-type dropdown
 *
 * Layout and rhythm only. The dropdown stays absolutely positioned inside
 * .scolta-search-input-wrap, so opening and updating it shifts nothing.
 * ----------------------------------------------------------------------- */

.scolta-sayt {
  padding: 0.25rem 0;
}

.scolta-sayt-option {
  padding: 0.5rem 0.85rem;
  border-bottom: none;
  border-left: 3px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.scolta-sayt-option:hover {
  background: #f8fafc;
}

.scolta-sayt-option-active {
  border-left-color: #14b8a6;
}

.scolta-sayt-kind {
  color: #0f766e;
  font-size: 0.95rem;
}

.scolta-sayt-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
}

/* A recent search is history, not a post: lighter and italic, so the two kinds
   of row are told apart without reading the glyph. */
.scolta-sayt-option-recent .scolta-sayt-kind {
  color: #9ca3af;
}

.scolta-sayt-option-recent .scolta-sayt-title {
  font-weight: 400;
  font-style: italic;
}

.scolta-sayt-excerpt {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.1rem;
}

/* --------------------------------------------------------------------------
 * Suggestion row with an avatar
 *
 * Inner markup emitted by the suggestion renderer in
 * public/js/scolta-rich-results.js for title suggestions. The option element
 * around it stays the bundle's, so the rules below never reach past the row's
 * inside.
 *
 * Title and excerpt carry the scolta-* class as well as the mystream-* one, so
 * they inherit the typography set above and these rules add only layout. Same
 * specificity, resolved by source order — this block is last.
 * ----------------------------------------------------------------------- */

.mystream-sayt {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Fixed round box, sized before the image arrives, so a row settles its height
   at render and the rows under it never move as avatars load. */
.mystream-sayt__avatar {
  flex: 0 0 auto;
  display: block;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 9999px;
  background: #e5e7eb;
}

.mystream-sayt__avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sized, not drawn: a suggestion with no avatar keeps the circle's space so
   every row's title starts on the same line. */
.mystream-sayt__avatar--empty {
  background: none;
}

.mystream-sayt__text {
  min-width: 0;
  flex: 1 1 auto;
}

/* One line each, ellipsised. A suggestion is a pointer, not a summary, and a
   row that wrapped would resize the dropdown on every keystroke. */
.mystream-sayt__title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Overrides the glyph gutter scolta.css gives an excerpt: in this row the
   avatar is the gutter, and the text column is already indented. */
.mystream-sayt__excerpt {
  display: block;
  margin-top: 0.05rem;
  margin-left: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
