/* Reader discovery: search modal, /search/ page and the end-of-article rail. */

body.rx-s-lock { overflow: hidden; }

/* ------------------------------------------------------------------ modal */

.rx-s {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(16px, 6vh, 64px) 16px 16px;
}
.rx-s[hidden] { display: none; }
.rx-s__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(3px);
}
.rx-s__dialog {
  position: relative;
  width: min(1040px, calc(var(--rx-vw, 100vw) - 20px));
  max-width: calc(var(--rx-vw, 100vw) - 20px);
  max-height: calc(var(--rx-vh, 100vh) - 20px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #101010;
  border: 1px solid var(--border-primary, #2c2c2c);
  border-radius: 16px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .65);
  overflow: hidden;
  animation: rx-s-rise .2s cubic-bezier(.2, .8, .2, 1);
}
@keyframes rx-s-rise {
  from { transform: translateY(10px); opacity: .6; }
  to { transform: none; opacity: 1; }
}
.rx-s__sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.rx-s__top {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px 14px 22px;
  border-bottom: 1px solid #222;
}
.rx-s__icon { color: #7c7c7c; display: inline-flex; }
.rx-s__top input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--text-title, #fff); font-size: 17px; letter-spacing: -.01em; padding: 6px 0;
}
.rx-s__top input::placeholder { color: #767676; }
.rx-s__esc {
  border: 1px solid #333; border-radius: 7px; padding: 4px 8px;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: #9a9a9a; background: none; cursor: pointer;
}
.rx-s__esc:hover { color: #fff; border-color: #4a4a4a; }

.rx-s__body {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.rx-s__left {
  padding: 16px 18px 0 22px;
  border-right: 1px solid #222;
  display: flex; flex-direction: column; min-width: 0;
}
.rx-s__rails { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.rx-s__rail-row { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.rx-s__rail-name {
  flex: 0 0 52px; padding-top: 6px;
  font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase; color: #7e7e7e; font-weight: 700;
}
.rx-s__rail { display: flex; gap: 6px; flex-wrap: wrap; }
.rx-s__chip {
  border: 1px solid #333; border-radius: 999px; background: transparent;
  padding: 5.5px 10.5px; color: #b9b9b9; font-size: 11px; font-weight: 500; line-height: 1.2;
  white-space: nowrap; cursor: pointer;
  transition: color .16s, border-color .16s, background .16s;
}
.rx-s__chip:hover, .rx-s__chip:focus-visible { color: var(--primary, #FACE48); border-color: var(--primary, #FACE48); }
.rx-s__chip.is-active { background: var(--primary, #FACE48); border-color: var(--primary, #FACE48); color: #111; }
.rx-s__chip-n { opacity: .55; margin-left: 5px; font-size: 10.5px; font-variant-numeric: tabular-nums; }

.rx-s__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 2px 0 9px; border-bottom: 1px solid #222;
}
.rx-s__label { font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase; color: #7e7e7e; font-weight: 700; }
.rx-s__count { font-size: 11px; color: #7e7e7e; font-variant-numeric: tabular-nums; }

.rx-s__results {
  overflow-y: auto; flex: 1; margin-right: -8px; padding: 6px 8px 12px 0;
  max-height: 390px; min-height: 120px; scrollbar-width: thin;
}
.rx-s__results::-webkit-scrollbar { width: 6px; }
.rx-s__results::-webkit-scrollbar-thumb { background: #2f2f2f; border-radius: 6px; }
.rx-s__state { padding: 24px 8px; color: #9a9a9a; font-size: 13px; }
.rx-s__state a { color: var(--primary, #FACE48); }
.rx-s__row {
  display: grid; grid-template-columns: 52px 1fr; gap: 11px; align-items: center;
  padding: 9px 10px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; color: inherit; text-decoration: none;
  transition: background .14s, border-color .14s;
}
.rx-s__row:hover { background: var(--bg-surface-l-1, #161616); }
/* Selected result reuses the article Essentials panel: tinted surface, hairline
   gold border, rounded 3px inset marker. */
.rx-s__row.is-selected {
  background: linear-gradient(to bottom, color-mix(in srgb, var(--primary, #FACE48) 5%, transparent), transparent 70%), var(--bg-surface, #141414);
  border-color: color-mix(in srgb, var(--primary, #FACE48) 22%, transparent);
  position: relative;
}
.rx-s__row.is-selected::after {
  content: ""; position: absolute; left: -1px; top: 11px; bottom: 11px; width: 3px;
  border-radius: 999px; background: var(--primary, #FACE48); pointer-events: none;
}
.rx-s__thumb {
  width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #232323; display: block;
}
.rx-s__thumb--empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: #6f6f6f;
  background: repeating-linear-gradient(135deg, #1c1c1c 0 6px, #171717 6px 12px);
}
.rx-s__rowbody { min-width: 0; }
.rx-s__type {
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--primary, #FACE48); font-weight: 700;
}
.rx-s__type span { color: #777; font-weight: 600; letter-spacing: .06em; }
.rx-s__title { font-size: 14px; font-weight: 700; line-height: 1.3; margin: 3px 0; color: #f2f2f2; }
.rx-s__title mark {
  background: color-mix(in srgb, var(--primary, #FACE48) 16%, transparent);
  color: #ffe28a; border-radius: 3px; padding: 0 1px;
}
.rx-s__meta {
  font-size: 11px; color: #8b8b8b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.rx-s__preview {
  padding: 16px 18px; display: flex; flex-direction: column; min-width: 0; background: #0e0e0e;
}
.rx-s__media {
  position: relative; border-radius: 10px; overflow: hidden; border: 1px solid #262626;
  background: #1a1a1a; aspect-ratio: 16 / 9;
}
.rx-s__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rx-s__noimg {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 9px; letter-spacing: .16em; color: #666; text-transform: uppercase;
  background: repeating-linear-gradient(135deg, #191919 0 10px, #151515 10px 20px);
}
.rx-s__badge {
  position: absolute; left: 10px; top: 10px;
  background: rgba(10, 10, 10, .82); border: 1px solid #333; border-radius: 999px;
  padding: 3px 9px; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: #e8e8e8;
}
.rx-s__prevbody { padding-top: 13px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.rx-s__eyebrow {
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--primary, #FACE48); font-weight: 700; margin-bottom: 5px;
}
.rx-s__ptitle { font-size: clamp(18px, 2vw, 23px); font-weight: 900; line-height: 1.16; margin-bottom: 8px; color: #fff; }
.rx-s__psum { font-size: 12.5px; line-height: 1.5; color: #a9a9a9; margin: 0 0 12px; }
.rx-s__sections { border-top: 1px solid #222; padding-top: 10px; margin-top: auto; }
.rx-s__sections-lab {
  font-size: 9px; letter-spacing: .15em; text-transform: uppercase; color: #7e7e7e; font-weight: 700; margin-bottom: 6px;
}
.rx-s__sections ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rx-s__sections a {
  display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: #c9c9c9;
  padding: 3px 0; line-height: 1.3; text-decoration: none;
}
.rx-s__sections a::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--primary, #FACE48);
  flex: 0 0 4px; transform: translateY(-2px);
}
.rx-s__sections a:hover { color: var(--primary, #FACE48); }
.rx-s__cta {
  margin-top: 12px; display: inline-flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid #3a3a3a; border-radius: 8px; padding: 9px 12px;
  font-size: 12px; font-weight: 600; color: #f0f0f0; text-decoration: none;
}
.rx-s__cta:hover { border-color: var(--primary, #FACE48); color: var(--primary, #FACE48); }
.rx-s__cta span { color: var(--primary, #FACE48); }

.rx-s__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border-top: 1px solid #222; padding: 9px 18px 9px 22px; background: #0d0d0d;
}
.rx-s__hints { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10.5px; color: #7d7d7d; }
.rx-s__hints span { display: inline-flex; align-items: center; gap: 5px; }
.rx-s__hints kbd {
  font: inherit; font-size: 9.5px; color: #b9b9b9; border: 1px solid #2f2f2f; border-radius: 4px;
  padding: 1px 4px; background: #151515;
}
.rx-s__seeall { font-size: 11px; color: #b9b9b9; text-decoration: none; border-bottom: 1px solid #3c3c3c; }
.rx-s__seeall:hover { color: var(--primary, #FACE48); border-color: var(--primary, #FACE48); }
.rx-s.is-start .rx-s__rails { display: none; }
.rx-s.is-start .rx-s__results { max-height: min(520px, calc(var(--rx-vh, 100vh) - 210px)); }

.rx-s__popular { padding: 4px 8px 12px 2px; }
.rx-s__popular-lab {
  font-size: 9px; letter-spacing: .15em; text-transform: uppercase; color: #7e7e7e; font-weight: 700; margin-bottom: 7px;
}

/* ----------------------------------------------------- end-of-article rail */

.rx-related { margin-top: 56px; }
.rx-related h2 {
  font-size: clamp(22px, 2.6vw, 30px); color: var(--text-title, #fff); margin: 0 0 6px;
}
.rx-related__sub { font-size: 12.5px; color: var(--text-subtle, #8f8f8f); margin: 0 0 16px; }
.rx-related__chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.rx-related__chip {
  border: 1px solid #333; border-radius: 999px; background: transparent; padding: 6px 12px;
  color: #b9b9b9; font-size: 11.5px; font-weight: 500; cursor: pointer;
}
.rx-related__chip:hover, .rx-related__chip:focus-visible { color: var(--primary, #FACE48); border-color: var(--primary, #FACE48); }
.rx-related__chip.is-active { background: var(--primary, #FACE48); border-color: var(--primary, #FACE48); color: #111; }
.rx-related__chip-n { opacity: .55; margin-left: 5px; font-size: 10.5px; }
.rx-related__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.rx-related__card {
  background: var(--bg-surface, #141414); border: 1px solid #222; border-radius: 14px;
  overflow: hidden; color: inherit; text-decoration: none; display: block;
  transition: border-color .2s, transform .2s;
}
.rx-related__card:hover { border-color: #3d3d3d; transform: translateY(-2px); }
.rx-related__card[hidden] { display: none; }
.rx-related__img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #1d1d1d; }
.rx-related__noimg {
  aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center;
  font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: #636363;
  background: repeating-linear-gradient(135deg, #191919 0 10px, #151515 10px 20px);
}
.rx-related__body { padding: 13px 14px 15px; }
.rx-related__lab {
  font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--primary, #FACE48);
  font-weight: 700; margin-bottom: 6px;
}
.rx-related__title { font-size: 15px; line-height: 1.28; font-weight: 800; color: var(--text-title, #fff); margin: 0 0 8px; }
.rx-related__meta { font-size: 11.5px; color: var(--text-subtle, #8f8f8f); }
.rx-related--narrow { margin-top: 40px; }
.rx-related--narrow h2 { font-size: clamp(20px, 2vw, 25px); }
.rx-related--narrow .rx-related__sub { font-size: 11.5px; margin-bottom: 12px; }
.rx-related--narrow .rx-related__chips { margin-bottom: 14px; }
.rx-related--narrow .rx-related__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rx-related--narrow .rx-related__body { padding: 10px 11px 12px; }
.rx-related--narrow .rx-related__title { font-size: 13.5px; line-height: 1.3; }
.rx-related--narrow .rx-related__img { aspect-ratio: 16 / 9; }
.rx-related__more { margin-top: 20px; text-align: right; }
.rx-related__more a { font-size: 12.5px; color: #d8d8d8; text-decoration: none; border-bottom: 1px solid var(--primary, #FACE48); padding-bottom: 2px; }
.rx-related__more a:hover { color: var(--primary, #FACE48); }

/* ------------------------------------------------------------ /search/ page */

.rx-page { max-width: 1040px; margin: 0 auto; padding: clamp(120px, 15vh, 170px) 24px 90px; }
.rx-page h1 { font-size: clamp(28px, 4vw, 40px); color: var(--text-title, #fff); margin: 0 0 18px; }
.rx-page__form { display: flex; gap: 10px; margin-bottom: 18px; }
.rx-page__form input {
  flex: 1; min-width: 0; background: var(--bg-surface, #141414); border: 1px solid #333; border-radius: 10px;
  padding: 12px 14px; color: #fff; font-size: 16px; outline: none;
}
.rx-page__form input:focus { border-color: var(--primary, #FACE48); }
.rx-page__form button {
  background: var(--primary, #FACE48); color: #111; border: 0; border-radius: 10px;
  padding: 0 18px; font-weight: 700; cursor: pointer;
}
.rx-page__chips { display: flex; gap: 7px; flex-wrap: wrap; margin: 14px 0 8px; }
.rx-page__chip {
  border: 1px solid #333; border-radius: 999px; padding: 6px 12px; font-size: 11.5px;
  color: #b9b9b9; text-decoration: none; background: transparent;
}
.rx-page__chip:hover { color: var(--primary, #FACE48); border-color: var(--primary, #FACE48); }
.rx-page__chip.is-active { background: var(--primary, #FACE48); border-color: var(--primary, #FACE48); color: #111; }
.rx-page__count { font-size: 12px; color: var(--text-subtle, #8f8f8f); margin: 10px 0 4px; }
.rx-page__list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.rx-page__row {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start;
  padding: 12px 12px; border-radius: 12px; border: 1px solid transparent; text-decoration: none; color: inherit;
}
.rx-page__row:hover { background: var(--bg-surface, #141414); border-color: #262626; }
.rx-page__thumb { display: block; }
.rx-page__row img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; display: block; }
.rx-page__row .rx-s__thumb--empty { width: 64px; height: 64px; }
.rx-page__rowtitle { display: block; font-size: 16px; font-weight: 700; color: #f2f2f2; line-height: 1.3; margin: 2px 0 4px; text-decoration: none; }
.rx-page__rowtitle:hover { color: var(--primary, #FACE48); }
.rx-page__rowmeta { display: block; font-size: 12px; color: #8b8b8b; }
.rx-page__sections { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.rx-page__sections a { display: inline-block; margin-right: 14px; font-size: 11.5px; color: #b9b9b9; text-decoration: none; border-bottom: 1px dotted #444; }
.rx-page__sections a:hover { color: var(--primary, #FACE48); }
.rx-page__empty { color: #9a9a9a; padding: 24px 0; }
.rx-page__intro { color: var(--text-body, #cfcfcf); margin: 0 0 22px; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 880px) {
  .rx-s { padding: 10px; }
  .rx-s__body { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .rx-s__preview { display: none; }
  .rx-s__left { border-right: 0; padding-right: 16px; }
  .rx-s__top { padding: 13px 14px 12px 16px; }
  .rx-s__top input { font-size: 16px; }
  .rx-s__results { max-height: calc(var(--rx-vh, 100vh) - 330px); }
  .rx-s__rail-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .rx-s__rail-name { flex-basis: auto; padding-top: 0; }
  .rx-related__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .rx-related__grid { grid-template-columns: 1fr; }
  .rx-page { padding: 110px 18px 70px; }
  .rx-page__row { grid-template-columns: 52px 1fr; }
  .rx-page__row img, .rx-page__row .rx-s__thumb--empty { width: 52px; height: 52px; }
}
