/* ==========================================================================
   Mortgage Mom Radio: engagement components (v1.11.0-engagement.0)
   Header search, episode next-step rail, "Watch on YouTube" secondary link,
   related-episodes shelf link, next live show module, newsletter slide-in.
   Brand tokens only (screen.css :root). Loaded after screen.css.
   ========================================================================== */

/* ---------- Header search ----------
   v1.11.0-release.0: integrated into the Option D header. Icon-only 40px
   circle as in the approved mockup (ink-soft on a hairline border). Desktop:
   sits between .nav (margin-left:auto) and .header__actions, spaced by the
   row gap. 1100px and below: .nav and .header__actions are hidden, so the
   search takes the auto margin and sits directly left of the menu button. */
.header__search {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--ink-soft);
  cursor: pointer; flex-shrink: 0;
  transition: border-color .15s ease, color .15s ease;
}
.header__search:hover { border-color: var(--red); color: var(--red); }
.header .header__search:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 999px; }
.header__search-icon { flex: 0 0 auto; }
@media (max-width: 1100px) {
  .header__inner > .header__search { margin-left: auto; }
  .header__inner > .header__search ~ .nav__toggle { margin-left: 0; }
}
@media (max-width: 600px) {
  .header__search { width: 38px; height: 38px; }
}

/* ---------- Episode next-step rail ---------- */
.ep-next {
  max-width: 720px;
  margin: 2.25rem auto;
  padding: 1.4rem 1.5rem 1.5rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  border-radius: var(--radius);
}
.ep-next--inline { max-width: none; margin: 1.6rem 0 2rem; }
.post__body .ep-next__title,
.ep-next__title {
  font-family: var(--font-display);
  font-size: 1.35rem; line-height: 1.2;
  margin: 0 0 1rem;
}
.ep-next__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.post__body a.ep-next__card,
.ep-next__card {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 40px 14px 16px;
  min-height: 84px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.ep-next__card:hover { border-color: var(--red); transform: translateY(-1px); }
.ep-next__card:focus-visible { outline: 2px solid var(--red-deep); outline-offset: 2px; }
.ep-next__kicker {
  font: 600 12px/1.3 var(--font-body);
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--red-deep);
}
.ep-next__label { font: 600 16px/1.35 var(--font-body); color: var(--ink); }
.ep-next__arrow {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--red); font-size: 18px; line-height: 1;
}
.post__body a.ep-next__card--primary,
.ep-next__card--primary { background: var(--red); border-color: var(--red); }
.ep-next__card--primary .ep-next__kicker { color: var(--cream); }
.ep-next__card--primary .ep-next__label,
.ep-next__card--primary .ep-next__arrow { color: var(--white); }
.ep-next__card--primary:hover { background: var(--red-deep); border-color: var(--red-deep); }
@media (max-width: 720px) {
  .ep-next { padding: 1.1rem 1rem 1.1rem; }
  .ep-next__grid { grid-template-columns: 1fr; }
  .ep-next__card { min-height: 0; }
}

/* ---------- "Watch on YouTube" secondary link under the player ---------- */
.post__body .ep-yt-alt {
  margin: -1.2rem 0 1.6rem;
  font-size: .9rem;
  color: var(--ink-soft);
}
.post__body .ep-yt-alt a { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }
.post__body .ep-yt-alt a:hover { color: var(--red); }

/* ---------- Related episodes: shelf link ---------- */
.related__more { text-align: center; margin-top: 2rem; }

/* ---------- Next live show module ---------- */
.mmr-live {
  max-width: 720px;
  margin: 2.5rem auto;
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--radius);
}
.mmr-live-wrap .mmr-live { max-width: none; }
.mmr-live-wrap--home { margin-top: 8px; margin-bottom: 8px; }
.mmr-live-wrap--page { padding-bottom: 8px; }
.mmr-live__inner {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 12px 18px;
  padding: 14px 18px;
}
.mmr-live__dot {
  width: 10px; height: 10px; flex: 0 0 10px;
  border-radius: 50%; background: var(--red-bright);
  box-shadow: 0 0 0 4px rgba(255, 66, 66, .22);
}
.mmr-live--now .mmr-live__dot { animation: mmr-live-pulse 1.4s ease-in-out infinite; }
@keyframes mmr-live-pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 66, 66, .08); } }
.mmr-live__text {
  flex: 1 1 260px;
  margin: 0;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  font-size: 15px; line-height: 1.4;
}
.mmr-live__label {
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--orange);
}
.mmr-live__when { font-weight: 700; color: var(--white); }
.mmr-live__where { color: rgba(250, 246, 241, .78); }
.mmr-live__actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mmr-live__link {
  font-size: 14px; font-weight: 600; color: var(--cream);
  border-bottom: 1.5px solid rgba(250, 246, 241, .5);
}
.mmr-live__link:hover { color: var(--white); border-color: var(--white); }

.mmr-cal { position: relative; }
.mmr-cal__btn {
  list-style: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--red); color: var(--white);
  font: 600 14px/1 var(--font-body);
  cursor: pointer; user-select: none;
}
.mmr-cal__btn::-webkit-details-marker { display: none; }
.mmr-cal__btn::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.mmr-cal[open] .mmr-cal__btn::after { transform: translateY(1px) rotate(-135deg); }
.mmr-cal__btn:hover { background: var(--red-deep); }
.mmr-cal__btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.mmr-cal__menu {
  position: absolute; z-index: 20; left: 0; top: calc(100% + 6px);
  min-width: 220px; margin: 0; padding: 6px;
  list-style: none;
  background: var(--white); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 30px -14px rgba(26, 22, 20, .45);
}
.mmr-cal__menu a {
  display: block; padding: 10px 12px; border-radius: 8px;
  font-size: 14.5px; font-weight: 500; color: var(--ink);
}
.mmr-cal__menu a:hover, .mmr-cal__menu a:focus-visible { background: var(--paper); color: var(--red-deep); }
@media (max-width: 520px) {
  .mmr-live__inner { padding: 14px 16px; }
  .mmr-live__actions { width: 100%; }
}

/* ---------- Newsletter slide-in ---------- */
.mm-slidein {
  position: fixed;
  z-index: 9000;
  right: 20px; bottom: 20px;
  width: 360px;
  padding: 18px 18px 16px;
  background: var(--cream);
  color: var(--ink);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px -18px rgba(26, 22, 20, .45);
  transform: translateY(calc(100% + 32px));
  opacity: 0;
  transition: transform .32s cubic-bezier(.2, .9, .3, 1), opacity .2s ease;
}
.mm-slidein[hidden] { display: none; }
.mm-slidein.is-open { transform: none; opacity: 1; }
.mm-slidein__close {
  position: absolute; top: 6px; right: 6px;
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-soft);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.mm-slidein__close:hover { background: var(--paper); color: var(--ink); }
.mm-slidein__close:focus-visible { outline: 2px solid var(--red-deep); outline-offset: 1px; }
.mm-slidein__title { margin: 0 34px 12px 0; font-size: 15px; line-height: 1.4; }
.mm-slidein__title strong { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.mm-slidein__sub { color: var(--ink-soft); }
.mm-slidein__form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.mm-slidein__form input[type="email"] {
  flex: 1 1 160px; min-width: 0;
  height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--white); color: var(--ink);
  font: 400 15px/1 var(--font-body);
}
.mm-slidein__form input[type="email"]:focus { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); }
.mm-slidein__form button[type="submit"] {
  height: 42px; padding: 0 18px;
  border: 0; border-radius: 999px;
  background: var(--red); color: var(--white);
  font: 600 14px/1 var(--font-body); cursor: pointer;
}
.mm-slidein__form button[type="submit"]:hover { background: var(--red-deep); }
.mm-slidein__form .signup-form__error { flex-basis: 100%; margin: 0; font-size: 13px; }
.mm-slidein__success { display: none; flex-basis: 100%; margin: 0; font-size: 14px; font-weight: 600; color: var(--red-deep); }
.mm-slidein__form.success .mm-slidein__success { display: block; }
.mm-slidein__form.success input,
.mm-slidein__form.success button { display: none; }

@media (max-width: 600px) {
  .mm-slidein {
    left: 0; right: 0; bottom: 0;
    width: auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 14px 14px 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .mm-slidein__close { top: 2px; right: 2px; width: 32px; height: 32px; font-size: 22px; }
  .mm-slidein__title { margin: 0 32px 8px 0; font-size: 13.5px; line-height: 1.3; }
  .mm-slidein__title strong { display: inline; font-size: 15px; margin-right: 4px; }
  .mm-slidein__form { flex-wrap: nowrap; }
  .mm-slidein__form input[type="email"] { height: 40px; flex: 1 1 auto; }
  .mm-slidein__form button[type="submit"] { height: 40px; padding: 0 14px; }
  .mm-slidein__form .signup-form__error,
  .mm-slidein__form .mm-slidein__success { position: absolute; left: 12px; bottom: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .mm-slidein { transition: none; }
  .ep-next__card { transition: none; }
  .ep-next__card:hover { transform: none; }
  .mmr-live--now .mmr-live__dot { animation: none; }
}

/* ---------- /episodes/ shelf anchors: clear the sticky header ---------- */
.lib-shelf[id] { scroll-margin-top: 110px; }
@media (max-width: 960px) { .lib-shelf[id] { scroll-margin-top: 90px; } }
