/* ============================================================
   The Tee Family House — css/discover.css
   Styles for the two discovery surfaces built by js/discover.js:
   the archive search + status filters on stories.html, and the
   share bar injected above the pager on every story-<id>.html.

   Both surfaces are injected at runtime, never authored into the
   HTML — stories.html and every story page are written by the
   CMS generator (tools/generate.php) and overwritten on every
   publish, so any markup this unit put there would vanish. That
   is why every selector below describes DOM that discover.js
   creates; nothing here styles generator markup except the one
   `[hidden]` rule the filter needs (see note there).

   Consumes tokens from css/base.css (owned by the brain) — never
   redefines one, and carries no colour literal of its own.
   ============================================================ */

/* ============================================================
   stories.html — the search + filter toolbar
   ============================================================ */

/* Sits between the archive hero and the card grid, inside the
   grid's own .container so it lines up with the cards exactly.
   Wraps to as many rows as it needs: field, then pills, then the
   count line (which claims a full row of its own via flex-basis
   so it always reads as a caption under the controls). */
.discover {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: clamp(28px, 5vh, 48px);
}

.discover-field {
  flex: 1 1 300px;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline-dark);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  transition: border-color 0.2s var(--ease-soft), box-shadow 0.2s var(--ease-soft);
}
/* The whole pill reads as one control, so the focus ring belongs
   on the pill rather than the bare input inside it. */
.discover-field:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--hairline-dark);
}

/* CSS-drawn magnifier: a ring plus a rotated handle, both in
   currentColor. Deliberately not an SVG data-URI — an inline SVG
   would have to hardcode a stroke colour, and this file carries
   no colour literals so it can never drift from base.css. */
.discover-icon {
  position: relative;
  inline-size: 15px;
  block-size: 15px;
  flex: none;
  color: var(--muted-on-dark);
}
.discover-icon::before {
  content: '';
  position: absolute;
  inset: 0 4px 4px 0;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.discover-icon::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  inline-size: 6px;
  block-size: 1.5px;
  background: currentColor;
  transform: rotate(45deg);
}

.discover-input {
  flex: 1 1 auto;
  min-inline-size: 0;
  background: none;
  border: none;
  outline: none;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text-on-dark);
}
.discover-input::placeholder { color: var(--muted-on-dark); opacity: 0.85; }
/* The UA's own search-clear glyph would sit beside ours. */
.discover-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.discover-clear {
  flex: none;
  inline-size: 22px;
  block-size: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted-on-dark);
  background: rgba(255, 255, 255, 0.07);
  transition: color 0.2s, background 0.2s;
}
.discover-clear:hover { color: var(--pink); background: var(--hairline-dark); }
.discover-clear[hidden] { display: none; }

.discover-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.discover-pill {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted-on-dark);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hairline-dark);
  transition: color 0.2s, background 0.2s, border-color 0.2s,
              transform 0.2s var(--ease-soft);
}
.discover-pill:hover { color: var(--pink); border-color: var(--pink); }
.discover-pill:active { transform: scale(0.96); }
.discover-pill.is-active {
  color: var(--night);
  background: var(--pink);
  border-color: var(--pink);
  font-weight: 600;
}

/* flex-basis:100% keeps the count on its own line under the
   controls at every width, so it never competes for space with
   the pills and never re-flows them as the number changes. */
.discover-count {
  flex: 1 0 100%;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted-on-dark);
}

/* The filter's own hide mechanism. `hidden` alone is not enough:
   pages.css sets `.story-card { display: block }`, and an author
   rule always beats the UA sheet's `[hidden] { display: none }`,
   so the attribute would be inert without this. Scoped to cards
   inside the archive grid so it can never affect anything else. */
.archive-grid .story-card[hidden] { display: none; }

.discover-empty { display: none; text-align: center; padding-block: clamp(48px, 9vh, 90px); }
.discover-empty.is-on { display: block; }
.discover-empty-line {
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  color: var(--text-on-dark);
  margin-bottom: 22px;
}
.discover-empty-clear { font-size: 0.92rem; padding: 11px 26px; }

@media (max-width: 620px) {
  .discover-field { max-width: none; flex-basis: 100%; }
  .discover-pills { gap: 7px; }
  .discover-pill { padding: 6px 13px; font-size: 0.78rem; }
}

/* ============================================================
   story-<id>.html — the share bar
   ============================================================ */

/* Injected as the first child of <section class="story-pager">,
   directly above the prev/next row, so it closes the story with
   "pass this on" before offering "read another". It inherits the
   pager section's zone class — .zone-light on 16 cases, .zone-dark
   on Ariel's memorial — hence the paired colour rules below. */
.share-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding-block-end: clamp(26px, 4vh, 40px);
  margin-block-end: clamp(26px, 4vh, 40px);
  border-block-end: 1px solid var(--hairline-light);
}
.zone-dark .share-bar { border-block-end-color: var(--hairline-dark); }

.share-bar-title { font-size: 1.05rem; font-weight: 600; color: var(--ink); margin: 0; }
.zone-dark .share-bar-title { color: var(--text-on-dark); }

.share-bar-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.share-btn { padding: 11px 24px; font-size: 0.92rem; }

/* Copy-link's ✓ state mirrors the donate section's .v3-copy exactly
   (two label spans, swapped by a class) so the button's text is
   never written by JS — both labels keep their own data-en and the
   language engine stays the only thing that touches their text. */
.share-copy .share-copy-done { display: none; }
.share-copy.is-copied .share-copy-label { display: none; }
.share-copy.is-copied .share-copy-done { display: inline; }
.share-copy.is-copied { border-color: var(--pink-deep); color: var(--pink-deep); }
.zone-dark .share-copy.is-copied { border-color: var(--pink); color: var(--pink); }

/* Sharing is overwhelmingly a phone action: below 480px the three
   controls stack full-width so each is a comfortable thumb target
   instead of three cramped pills on one line. */
@media (max-width: 480px) {
  .share-bar-actions { flex-direction: column; align-items: stretch; inline-size: 100%; }
  .share-btn { inline-size: 100%; }
}
