/* ─────────────────────────────────────────────────────────────────
 * FDM Discovery — public browse-first faceted UI.
 *
 * Design tokens are CSS custom properties so each FDM site (FDE, FDI,
 * SWGP, Halftime) can override them at the theme level without forking
 * the module. Defaults match the warm-dark/gold-amber spec in the
 * Discovery brief.
 *
 * Animation is restricted to `transform` and `opacity` so every state
 * change is GPU-composited. Layout shifts on hover are explicitly
 * disallowed (we scale + brightness, never re-flow).
 * ───────────────────────────────────────────────────────────────── */

.fdm-discovery {
  --fdm-bg-primary:   #0e0a05;
  --fdm-bg-elevated:  #1a130b;
  --fdm-bg-overlay:   rgba(8, 5, 2, 0.92);
  --fdm-text-primary: #ffffff;
  --fdm-text-muted:   #b8a890;
  --fdm-accent:       #d4a44a;
  --fdm-accent-hover: #e6b75a;
  --fdm-border-subtle:  rgba(212, 164, 74, 0.18);
  --fdm-border-active:  rgba(212, 164, 74, 0.55);
  --fdm-radius-card:    8px;
  --fdm-radius-chip:    999px;
  --fdm-font-display:   'Raleway', system-ui, sans-serif;
  --fdm-font-body:      'Raleway', system-ui, sans-serif;
  --fdm-d-cols:         3;

  position: relative;
  font-family: var(--fdm-font-body);
  font-weight: 700;
  color: var(--fdm-text-primary);
  background: var(--fdm-bg-primary);
  padding: clamp(28px, 4vw, 56px) clamp(20px, 4vw, 56px) 64px;
}
.fdm-discovery *,
.fdm-discovery *::before,
.fdm-discovery *::after { box-sizing: border-box; }

/* ── Header (app-style, left-aligned, dense) ─────────────────── */
.fdm-discovery__header {
  max-width: 1200px;
  margin: 0 auto clamp(20px, 3vw, 32px);
}
.fdm-discovery__titlebar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.fdm-discovery__titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.fdm-discovery__eyebrow {
  display: inline-flex;
  align-items: center;
  color: var(--fdm-accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.fdm-discovery__title {
  font-family: var(--fdm-font-display);
  font-weight: 700;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--fdm-text-primary);
}
.fdm-discovery__notify-anchor {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
/* YouTube subscribe pill — sits next to the notify-me button when the
 * site has a channel URL configured. Uses YouTube red as the brand
 * affordance so it reads as a different action than "Notify me." */
.fdm-discovery__yt-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  background: transparent;
  color: var(--fdm-text-primary);
  border: 1px solid #ff0000;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
  white-space: nowrap;
}
.fdm-discovery__yt-btn:hover,
.fdm-discovery__yt-btn:focus-visible {
  background: #ff0000;
  color: #fff;
  transform: translateY(-1px);
  outline: none;
}
.fdm-discovery__yt-icon { width: 18px; height: 18px; color: #ff0000; flex: 0 0 auto; }
.fdm-discovery__yt-btn:hover .fdm-discovery__yt-icon,
.fdm-discovery__yt-btn:focus-visible .fdm-discovery__yt-icon { color: #fff; }
.fdm-discovery__yt-label { white-space: nowrap; }
@media (max-width: 640px) {
  .fdm-discovery__titlebar { align-items: center; }
  .fdm-discovery__title { font-size: clamp(22px, 7vw, 30px); }
}

/* ── Search bar (the visual hero) ─────────────────────────────── */
.fdm-discovery__searchbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 6px 6px 18px;
  background: var(--fdm-bg-elevated);
  border: 1px solid var(--fdm-border-subtle);
  border-radius: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  will-change: border-color;
}
.fdm-discovery__searchbar:focus-within {
  border-color: var(--fdm-border-active);
  box-shadow: 0 0 0 3px rgba(212, 164, 74, 0.12);
}
.fdm-discovery__searchicon {
  width: 18px; height: 18px;
  color: var(--fdm-text-muted);
  flex: 0 0 auto;
}
.fdm-discovery__input {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fdm-text-primary);
  font: inherit;
  font-size: 16px;
  padding: 14px 4px;
  min-width: 0;
}
.fdm-discovery__input::placeholder { color: var(--fdm-text-muted); }
.fdm-discovery__mode {
  display: inline-flex;
  background: rgba(0,0,0,0.25);
  border-radius: 999px;
  padding: 3px;
  flex: 0 0 auto;
}
.fdm-discovery__mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fdm-text-muted);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}
.fdm-discovery__mode-btn.is-active {
  background: var(--fdm-accent);
  color: var(--fdm-bg-primary);
}

/* ── Notify-me dropdown ───────────────────────────────────────
 * Sits in the title bar's right corner as a utility action —
 * outlined, not filled, so the search bar remains the loud
 * primary affordance. Panel anchors to the button's right edge
 * on desktop, becomes a fixed bottom sheet on mobile.
 * ───────────────────────────────────────────────────────────── */
.fdm-discovery__notify-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  background: var(--fdm-accent);
  color: var(--fdm-bg-primary);
  border: 1px solid var(--fdm-accent);
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(212, 164, 74, 0.28), 0 0 0 1px rgba(212, 164, 74, 0.15);
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  will-change: transform;
}
.fdm-discovery__notify-btn:hover {
  background: var(--fdm-accent-hover);
  border-color: var(--fdm-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(212, 164, 74, 0.36), 0 0 0 1px rgba(212, 164, 74, 0.2);
}
.fdm-discovery__notify-btn[aria-expanded="true"] {
  background: var(--fdm-accent-hover);
  border-color: var(--fdm-accent-hover);
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(212, 164, 74, 0.22);
}
.fdm-discovery__notify-icon { width: 16px; height: 16px; color: var(--fdm-bg-primary); }
.fdm-discovery__notify-label { white-space: nowrap; }
@media (max-width: 720px) {
  /* On smaller widths, drop the notify button to its own line below the
   * title so it stays full-pill (no icon-only) at every breakpoint. */
  .fdm-discovery__titlebar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .fdm-discovery__notify-anchor { align-self: flex-start; }
}

.fdm-discovery__notify-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, 92vw);
  background: var(--fdm-bg-elevated);
  border: 1px solid var(--fdm-border-subtle);
  border-radius: 14px;
  padding: 22px 22px 18px;
  z-index: 30;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(212, 164, 74, 0.06);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 180ms ease, transform 180ms cubic-bezier(.2, .8, .2, 1);
}
.fdm-discovery__notify-panel:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.fdm-discovery__notify-panel::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 24px;
  width: 12px; height: 12px;
  background: var(--fdm-bg-elevated);
  border-left: 1px solid var(--fdm-border-subtle);
  border-top: 1px solid var(--fdm-border-subtle);
  transform: rotate(45deg);
}
.fdm-discovery__notify-x {
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.25);
  color: var(--fdm-text-muted);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 140ms ease, color 140ms ease;
}
.fdm-discovery__notify-x:hover { background: var(--fdm-accent); color: var(--fdm-bg-primary); }
.fdm-discovery__notify-x svg { width: 12px; height: 12px; }

.fdm-discovery__notify-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--fdm-text-primary);
}
.fdm-discovery__notify-sub {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fdm-text-muted);
  line-height: 1.5;
}

.fdm-discovery__notify-push {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: rgba(212, 164, 74, 0.05);
  border: 1px solid var(--fdm-border-subtle);
  border-radius: 10px;
  cursor: pointer;
}
.fdm-discovery__notify-push input { position: absolute; opacity: 0; pointer-events: none; }
.fdm-discovery__notify-track {
  position: relative;
  width: 38px; height: 22px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: background 200ms ease;
}
.fdm-discovery__notify-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--fdm-text-primary);
  transition: transform 200ms cubic-bezier(.2, .8, .2, 1);
}
.fdm-discovery__notify-push input:checked ~ .fdm-discovery__notify-track { background: var(--fdm-accent); }
.fdm-discovery__notify-push input:checked ~ .fdm-discovery__notify-track .fdm-discovery__notify-thumb { transform: translateX(16px); }
.fdm-discovery__notify-push-text { display: flex; flex-direction: column; gap: 2px; }
.fdm-discovery__notify-push-label { font-size: 14px; font-weight: 700; color: var(--fdm-text-primary); }
.fdm-discovery__notify-push-hint { font-size: 12px; font-weight: 500; color: var(--fdm-text-muted); transition: color 160ms ease; }
.fdm-discovery__notify-push-hint.is-error { color: #ff7676; }

.fdm-discovery__notify-email {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fdm-discovery__notify-email input {
  flex: 1 1 200px;
  background: var(--fdm-bg-primary);
  border: 1px solid var(--fdm-border-subtle);
  border-radius: 8px;
  color: var(--fdm-text-primary);
  font: inherit;
  font-size: 14px;
  padding: 12px 14px;
}
.fdm-discovery__notify-email input:focus {
  outline: none;
  border-color: var(--fdm-border-active);
  box-shadow: 0 0 0 3px rgba(212, 164, 74, 0.12);
}
.fdm-discovery__notify-submit {
  appearance: none;
  background: var(--fdm-accent);
  color: var(--fdm-bg-primary);
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 22px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}
.fdm-discovery__notify-submit:hover { background: var(--fdm-accent-hover); transform: translateY(-1px); }
.fdm-discovery__notify-submit[disabled] { opacity: 0.6; cursor: progress; transform: none; }

.fdm-discovery__notify-status {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--fdm-accent);
  line-height: 1.4;
}
.fdm-discovery__notify-status.is-error { color: #ff7676; }

.fdm-discovery__notify-fine {
  margin: 12px 0 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--fdm-text-muted);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

@media (max-width: 600px) {
  .fdm-discovery__notify-panel {
    position: fixed;
    top: auto;
    bottom: 16px;
    left: 16px;
    right: 16px;
    width: auto;
    transform: translateY(0);
  }
  .fdm-discovery__notify-panel:not([hidden]) { transform: translateY(0); }
  .fdm-discovery__notify-panel::before { display: none; }
}

/* ── Filter bar (tabs + sort, one row) ───────────────────────── */
.fdm-discovery__filterbar {
  max-width: 1200px;
  margin: clamp(20px, 3vw, 32px) auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.fdm-discovery__filterbar-end {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

/* ── Stories / Podcasts tabs (segmented control, secondary) ─── */
.fdm-discovery__tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--fdm-bg-elevated);
  border: 1px solid var(--fdm-border-subtle);
  border-radius: 10px;
  position: relative;
  isolation: isolate;
}
.fdm-discovery__tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fdm-text-muted);
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 160ms ease, background 160ms ease;
}
.fdm-discovery__tab:hover { color: var(--fdm-text-primary); }
.fdm-discovery__tab.is-active {
  background: var(--fdm-accent);
  color: var(--fdm-bg-primary);
}
.fdm-discovery__tab-count {
  font-size: 10px;
  letter-spacing: 0.02em;
  opacity: 0.6;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.fdm-discovery__tab.is-active .fdm-discovery__tab-count { opacity: 0.85; }

/* ── Sticky chip rail ─────────────────────────────────────────── */
/* Rail visibility is rooted on the parent .fdm-discovery--kind-*
 * class, not the [hidden] attribute, because some upstream theme
 * resets (Divi has a few) override [hidden] {display:revert}. */
.fdm-discovery__chiprail[data-rail] { display: none; }
.fdm-discovery--kind-stories  .fdm-discovery__chiprail[data-rail="stories"],
.fdm-discovery--kind-podcasts .fdm-discovery__chiprail[data-rail="podcasts"],
.fdm-discovery--kind-all      .fdm-discovery__chiprail[data-rail="stories"] {
  display: block;
}
/* primary_tags rail is shown across every kind — it's the only rail
 * when active, so don't gate it on the parent kind class. */
.fdm-discovery__chiprail[data-rail="all"] {
  display: block;
}

.fdm-discovery__chiprail {
  margin: 16px auto 0;
  padding: 0 4px;
  max-width: 1200px;
}
.fdm-discovery__chiprail-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  padding: 4px 0 8px;
  /* Smooth open/close. Expanded height is fed from JS as --fdm-rail-full-h
   * so transition has explicit endpoints to interpolate between. Default
   * fallback is generous enough to handle any rail when JS hasn't run yet.
   */
  max-height: var(--fdm-rail-full-h, 9999px);
  overflow: hidden;
  transition: max-height 320ms cubic-bezier(0.4, 0, 0.2, 1);
}
.fdm-discovery__chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--fdm-border-subtle);
  border-radius: var(--fdm-radius-chip);
  color: var(--fdm-text-muted);
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  scroll-snap-align: start;
  flex: 0 0 auto;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.fdm-discovery__chip:hover {
  color: var(--fdm-text-primary);
  border-color: var(--fdm-border-active);
}
.fdm-discovery__chip.is-active {
  background: var(--fdm-accent);
  border-color: var(--fdm-accent);
  color: var(--fdm-bg-primary);
}
.fdm-discovery__chip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  color: var(--fdm-accent);
}
.fdm-discovery__chip-icon img,
.fdm-discovery__chip-icon svg { width: 100%; height: 100%; }
.fdm-discovery__chip.is-active .fdm-discovery__chip-icon { color: var(--fdm-bg-primary); }
.fdm-discovery__chip-count {
  font-size: 11px;
  opacity: 0.7;
  letter-spacing: 0.04em;
}

/* Top Stories chip — gold accent so it reads as "curated" not "facet".
 * Stays gold-tinted even when inactive; when toggled on it inverts like
 * the rest of the chip rail but keeps its accent border. */
.fdm-discovery__chip--top {
  color: var(--fdm-accent);
  border-color: var(--fdm-accent);
  background: rgba(0, 0, 0, 0);
}
.fdm-discovery__chip--top:hover {
  color: var(--fdm-accent);
  border-color: var(--fdm-accent);
  background: rgba(255, 255, 255, 0.04);
}
.fdm-discovery__chip--top.is-active {
  background: var(--fdm-accent);
  color: var(--fdm-bg-primary);
  border-color: var(--fdm-accent);
}
.fdm-discovery__chip--top::before {
  content: "★";
  font-size: 11px;
  margin-right: 2px;
  line-height: 1;
}

/* Chip rail collapse: when is-collapsed, the rail's max-height drops to
 * the JS-measured single-row value (--fdm-rail-collapsed-h) and a soft
 * gradient fades chips in the partially-visible second row out to nothing.
 * The transition on max-height makes the open/close feel continuous. */
.fdm-discovery__chiprail.is-collapsed .fdm-discovery__chiprail-inner {
  max-height: var(--fdm-rail-collapsed-h, 60px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
}

/* Toggle is a plain text link that lives on the right side of the
 * count-row (the count itself sits on the left). Only one wrap is
 * un-hidden at a time — JS gates which one based on the active rail. */
.fdm-discovery__chiprail-toggle-wrap {
  display: flex;
  justify-content: flex-end;
}
.fdm-discovery__chiprail-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
  background: transparent;
  border: 0;
  color: var(--fdm-text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 140ms ease;
}
.fdm-discovery__chiprail-toggle:hover {
  color: var(--fdm-text-primary);
}
.fdm-discovery__chiprail-toggle-icon {
  display: inline-block;
  transition: transform 220ms ease;
}
.fdm-discovery__chiprail-toggle[aria-expanded="true"] .fdm-discovery__chiprail-toggle-icon {
  transform: rotate(180deg);
}

/* ── Sort dropdown (inline in filterbar) ─────────────────────── */
.fdm-discovery__sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fdm-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}
.fdm-discovery__sort-label { color: var(--fdm-text-muted); }
.fdm-discovery__sort select {
  background: var(--fdm-bg-elevated);
  color: var(--fdm-text-primary);
  border: 1px solid var(--fdm-border-subtle);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  padding: 8px 28px 8px 12px;
}
.fdm-discovery__sort select:focus {
  outline: none;
  border-color: var(--fdm-border-active);
}
.fdm-discovery__clear {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fdm-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 4px;
}
.fdm-discovery__clear:hover { color: var(--fdm-accent-hover); }

/* ── Result count (slim line above grid) ─────────────────────── */
.fdm-discovery__count-row {
  max-width: 1200px;
  margin: 16px auto 12px;
  padding: 0 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.fdm-discovery__count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fdm-text-muted);
}
.fdm-discovery__count [data-role="shown"],
.fdm-discovery__count [data-role="total"] {
  color: var(--fdm-accent);
  font-variant-numeric: tabular-nums;
}

/* ── Grid ─────────────────────────────────────────────────────── */
.fdm-discovery__grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(var(--fdm-d-cols), minmax(0, 1fr));
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px) { .fdm-discovery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (max-width: 600px) { .fdm-discovery__grid { grid-template-columns: 1fr; } }

.fdm-discovery__card { contain: content; }
.fdm-discovery__card-trigger {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.fdm-discovery__card-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--fdm-radius-card);
  overflow: hidden;
  background: var(--fdm-bg-elevated);
  isolation: isolate;
}
.fdm-discovery__card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.001);
  transition: transform 320ms ease, filter 320ms ease;
  will-change: transform, filter;
}
.fdm-discovery__card-trigger:hover .fdm-discovery__card-thumb img,
.fdm-discovery__card-trigger:focus-visible .fdm-discovery__card-thumb img {
  transform: scale(1.04);
  filter: brightness(1.08);
}
.fdm-discovery__card-play {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  color: var(--fdm-accent);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  transform: scale(0.94);
  pointer-events: none;
}
.fdm-discovery__card-play svg { width: 56px; height: 56px; filter: drop-shadow(0 6px 24px rgba(0,0,0,0.35)); }
.fdm-discovery__card-trigger:hover .fdm-discovery__card-play,
.fdm-discovery__card-trigger:focus-visible .fdm-discovery__card-play { opacity: 1; transform: scale(1); }
.fdm-discovery__card-body {
  display: block;
  padding: 14px 4px 0;
}
.fdm-discovery__card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.3;
  margin-bottom: 6px;
}
@media (max-width: 600px) { .fdm-discovery__card-title { font-size: 16px; } }
.fdm-discovery__card-meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: 6px;
  row-gap: 1px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fdm-text-muted);
  opacity: 0.65;
  line-height: 1.35;
  margin-top: 2px;
}
.fdm-discovery__card-meta > * { display: inline-flex; align-items: center; }
.fdm-discovery__card-meta > * + *::before {
  content: "•";
  margin-right: 6px;
  opacity: 0.55;
}
.fdm-discovery__card-fund { color: var(--fdm-accent); }
.fdm-discovery__card-snippet {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(212, 164, 74, 0.06);
  border-left: 2px solid var(--fdm-accent);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--fdm-text-muted);
}
.fdm-discovery__card-snippet mark {
  background: rgba(212, 164, 74, 0.32);
  color: var(--fdm-text-primary);
  padding: 0 2px;
  border-radius: 2px;
}

/* AI tags render inline in .fdm-discovery__card-meta (no pill). They
 * inherit the meta row's font/size/case so the row reads as one band. */
.fdm-discovery__card-tag {
  display: inline-flex;
  align-items: center;
  background: transparent;
  padding: 0;
  border: 0;
  border-radius: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  white-space: nowrap;
}

/* Top Story pill — editorial flag, surfaces in accent color so it
 * registers separately from the kind tag. Suppresses the meta-row
 * dot separator since the pill provides its own visual boundary. */
.fdm-discovery__card-tag--top {
  background: var(--fdm-accent);
  color: #0e0a05;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  opacity: 1;
}
.fdm-discovery__card-meta > .fdm-discovery__card-tag--top + *::before {
  content: none !important;
  margin-right: 0 !important;
}

/* ── Footer (sort + load more) ────────────────────────────────── */
/* Centered pair: load-more is the primary CTA, sort sits to its left
 * as the secondary control. Both share the same pill chrome so they
 * read as a matched set instead of two unrelated UI fragments. */
.fdm-discovery__footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 40px auto 0;
  padding: 0 16px;
  flex-wrap: wrap;
}
.fdm-discovery__sort--footer {
  opacity: 1;
  margin: 0;
}
.fdm-discovery__footer .fdm-discovery__loadmore { margin: 0; }
/* Match the load-more pill exactly: same border, radius, padding, and
 * type scale. Native browser chevron is killed via appearance:none so
 * we can position a custom SVG chevron with controlled distance from
 * the right edge. box-sizing pinned to border-box so the 14px padding
 * resolves to the same outer height as load-more's 14px padding. */
.fdm-discovery__sort--footer select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
  background-color: transparent;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%23d4a44a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1.5 6 6.5 11 1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 12px 8px;
  border: 1px solid var(--fdm-border-active);
  border-radius: 999px;
  padding: 14px 48px 14px 24px;
  color: var(--fdm-text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
}
.fdm-discovery__sort--footer select:hover { border-color: var(--fdm-accent); }
.fdm-discovery__sort--footer select:focus {
  outline: none;
  border-color: var(--fdm-accent);
}
/* Pin both pills to the same min-width so the pair reads as a matched
 * set even when "MOST RECENT" / "OLDEST" change the natural width. */
.fdm-discovery__footer .fdm-discovery__loadmore-btn,
.fdm-discovery__sort--footer select {
  box-sizing: border-box;
  min-width: 220px;
}
.fdm-discovery__footer .fdm-discovery__loadmore-btn { text-align: center; }
@media (max-width: 600px) {
  .fdm-discovery__footer .fdm-discovery__loadmore-btn,
  .fdm-discovery__sort--footer select { min-width: 0; }
}
@media (max-width: 600px) {
  .fdm-discovery__footer { gap: 14px; }
  .fdm-discovery__sort--footer select {
    padding: 12px 42px 12px 18px;
    background-position: right 16px center;
  }
}

/* ── Load more / empty ────────────────────────────────────────── */
.fdm-discovery__loadmore { text-align: center; margin: 40px auto 0; }
.fdm-discovery__loadmore-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--fdm-border-active);
  color: var(--fdm-text-primary);
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 32px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.fdm-discovery__loadmore-btn:hover {
  background: var(--fdm-accent);
  color: var(--fdm-bg-primary);
  transform: translateY(-1px);
}
.fdm-discovery__empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--fdm-text-muted);
  font-size: 16px;
}

/* ── Lightbox ─────────────────────────────────────────────────── */
.fdm-discovery__lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
}
.fdm-discovery__lightbox[hidden] { display: none; }
.fdm-discovery__lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: var(--fdm-bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fdm-fade 200ms ease both;
}
.fdm-discovery__lightbox-modal {
  position: relative;
  width: min(1200px, 100%);
  max-height: 90vh;
  background: var(--fdm-bg-elevated);
  border: 1px solid var(--fdm-border-subtle);
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  animation: fdm-pop 240ms cubic-bezier(.2,.8,.2,1) both;
  /* Set a baseline so children inherit the right color even if the parent
   * theme has aggressive `*` color rules. Specific overrides below force
   * the headline/desc to pop with !important to defeat themes that scope
   * their text colors via body or .et_pb_section selectors. */
  color: var(--fdm-text-primary);
}
.fdm-discovery__lightbox-x {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  border: 0;
  color: var(--fdm-text-primary);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 160ms ease, transform 160ms ease;
}
.fdm-discovery__lightbox-x:hover { background: var(--fdm-accent); color: var(--fdm-bg-primary); transform: scale(1.06); }
.fdm-discovery__lightbox-x svg { width: 16px; height: 16px; }

.fdm-discovery__player {
  aspect-ratio: 16 / 9;
  background: #000;
}
.fdm-discovery__player iframe { width: 100%; height: 100%; border: 0; display: block; }

.fdm-discovery__lightbox-meta {
  padding: 22px 28px 18px;
  overflow-y: auto;
}
.fdm-discovery__lightbox-title {
  font-family: var(--fdm-font-display);
  font-size: clamp(20px, 2.4vw, 26px);
  margin: 0 0 8px;
  line-height: 1.2;
  color: var(--fdm-text-primary) !important;
  font-weight: 700;
}
.fdm-discovery__lightbox-funds {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.fdm-discovery__lightbox-funds .fdm-discovery__chip {
  font-size: 11px; padding: 6px 12px;
}
.fdm-discovery__lightbox-desc {
  color: var(--fdm-text-muted) !important;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fdm-discovery__lightbox-desc.is-expanded {
  -webkit-line-clamp: unset;
  display: block;
}

.fdm-discovery__postroll {
  border-top: 1px solid var(--fdm-border-subtle);
  padding: 18px 28px 22px;
  background: rgba(212, 164, 74, 0.04);
}
.fdm-discovery__postroll h4 {
  margin: 0 0 10px;
  font-size: 16px;
}
.fdm-discovery__postroll-form {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.fdm-discovery__postroll-form input {
  flex: 1 1 220px;
  background: var(--fdm-bg-primary);
  border: 1px solid var(--fdm-border-subtle);
  color: var(--fdm-text-primary);
  font: inherit;
  font-size: 14px;
  padding: 12px 14px;
  border-radius: 8px;
}
.fdm-discovery__postroll-form button {
  appearance: none;
  background: var(--fdm-accent);
  color: var(--fdm-bg-primary);
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 22px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}
.fdm-discovery__postroll-form button:hover { background: var(--fdm-accent-hover); transform: translateY(-1px); }
.fdm-discovery__postroll-status {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--fdm-text-muted);
}

@keyframes fdm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fdm-pop  { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .fdm-discovery * {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
