/* =========================================
   FRONT PAGE: MEMOS / RECENT NEWS
   File: assets/css/front-page/front-page-memos.css

   Styles output of returnMemoListItem_v3()
========================================= */

/* -----------------------------------------
   Block container
----------------------------------------- */

#mdmRecentNewsBlock .mdm-block-inner{
  /* keep consistent with other blocks */
}

#mdmRecentNewsBlock #memos_block{
  padding-left: 0;
  padding-right: 0;
}

/* Optional: make the memo list feel like a single “surface” */
#mdmRecentNewsBlock .memo-block .container-fluid{
  padding-left: 0;
  padding-right: 0;
}

#mdmRecentNewsBlock #memo_list_newest{
  margin-left: 0;
  margin-right: 0;
}

/* -----------------------------------------
   Visitor category filter
----------------------------------------- */

#mdmRecentNewsBlock .mdm-news-category-filter{
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  margin: 0 0 .38rem auto;
}

#mdmRecentNewsBlock .mdm-news-category-filter.has-error .mdm-news-category-trigger{
  border-color: rgba(179,25,31,.38);
  box-shadow: 0 10px 24px rgba(179,25,31,.08);
}

#mdmRecentNewsBlock .mdm-news-category-trigger{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 42px;
  padding: .62rem .8rem;
  border: 1px solid rgba(18,20,23,.14);
  border-radius: 12px;
  background: var(--mdm-white);
  color: var(--mdm-gray-900);
  box-shadow: 0 5px 12px rgba(18,20,23,.06);
  font-size: .86rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

#mdmRecentNewsBlock .mdm-news-category-trigger:not(:disabled):hover{
  border-color: rgba(179,25,31,.34);
  box-shadow: 0 8px 18px rgba(18,20,23,.09);
  transform: translateY(-1px);
}

#mdmRecentNewsBlock .mdm-news-category-trigger:focus-visible,
#mdmRecentNewsBlock .mdm-news-category-panel button:focus-visible{
  outline: 3px solid rgba(179,25,31,.22);
  outline-offset: 2px;
}

#mdmRecentNewsBlock .mdm-news-category-trigger:disabled{
  cursor: wait;
  opacity: .62;
}

#mdmRecentNewsBlock .mdm-news-category-trigger[aria-expanded="true"] .mdm-news-category-chevron{
  transform: rotate(180deg);
}

#mdmRecentNewsBlock .mdm-news-category-chevron{
  font-size: .72rem;
  transition: transform 140ms ease;
}

#mdmRecentNewsBlock .mdm-news-category-panel{
  position: absolute;
  top: calc(100% + .55rem);
  right: 0;
  width: min(620px, calc(100vw - 4rem));
  padding: 1rem;
  border: 1px solid rgba(18,20,23,.13);
  border-radius: 16px;
  background: var(--mdm-white);
  box-shadow: 0 22px 48px rgba(18,20,23,.18);
}

#mdmRecentNewsBlock .mdm-news-category-panel[hidden]{
  display: none !important;
}

#mdmRecentNewsBlock .mdm-news-category-panel-head,
#mdmRecentNewsBlock .mdm-news-category-panel-footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#mdmRecentNewsBlock .mdm-news-category-panel-head{
  padding-bottom: .82rem;
  border-bottom: 1px solid var(--mdm-gray-150);
}

#mdmRecentNewsBlock .mdm-news-category-panel-title{
  margin: 0;
  color: var(--mdm-gray-900);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -.01em;
}

#mdmRecentNewsBlock .mdm-news-category-panel-copy{
  margin: .12rem 0 0;
  color: var(--mdm-gray-600);
  font-size: .8rem;
  font-weight: 650;
}

#mdmRecentNewsBlock .mdm-news-category-actions{
  display: flex;
  align-items: center;
  gap: .4rem;
}

#mdmRecentNewsBlock .mdm-news-category-actions button,
#mdmRecentNewsBlock .mdm-news-category-cancel{
  padding: .38rem .52rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--mdm-gray-700);
  font-size: .78rem;
  font-weight: 850;
}

#mdmRecentNewsBlock .mdm-news-category-actions button:hover,
#mdmRecentNewsBlock .mdm-news-category-cancel:hover{
  background: var(--mdm-gray-100);
  color: var(--mdm-gray-900);
}

#mdmRecentNewsBlock .mdm-news-category-options{
  min-width: 0;
  margin: 0;
  padding: .9rem 0;
  border: 0;
}

#mdmRecentNewsBlock #mdmNewsCategoryOptions{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .48rem;
  max-height: 260px;
  padding: .08rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#mdmRecentNewsBlock .mdm-news-category-option{
  position: relative;
  display: block;
  min-width: 0;
  cursor: pointer;
}

#mdmRecentNewsBlock .mdm-news-category-option input{
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

#mdmRecentNewsBlock .mdm-news-category-option span{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  min-height: 42px;
  padding: .58rem .68rem;
  border: 1px solid var(--mdm-gray-150);
  border-radius: 11px;
  background: rgba(255,255,255,.82);
  color: var(--mdm-gray-800);
  font-size: .84rem;
  font-weight: 800;
  line-height: 1.2;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

#mdmRecentNewsBlock .mdm-news-category-option span::after{
  content: "\2713";
  display: inline-grid;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid rgba(18,20,23,.18);
  border-radius: 7px;
  color: transparent;
  font-size: .72rem;
  line-height: 1;
}

#mdmRecentNewsBlock .mdm-news-category-option:hover span{
  border-color: rgba(179,25,31,.26);
  background: rgba(179,25,31,.035);
}

#mdmRecentNewsBlock .mdm-news-category-option input:focus-visible + span{
  outline: 3px solid rgba(179,25,31,.2);
  outline-offset: 2px;
}

#mdmRecentNewsBlock .mdm-news-category-option input:checked + span{
  border-color: rgba(179,25,31,.34);
  background: rgba(179,25,31,.07);
  color: var(--mdm-gray-900);
  box-shadow: inset 3px 0 0 var(--mdm-red);
}

#mdmRecentNewsBlock .mdm-news-category-option input:checked + span::after{
  border-color: var(--mdm-red);
  background: var(--mdm-red);
  color: var(--mdm-white);
}

#mdmRecentNewsBlock .mdm-news-category-panel-footer{
  min-height: 44px;
  padding-top: .82rem;
  border-top: 1px solid var(--mdm-gray-150);
}

#mdmRecentNewsBlock .mdm-news-category-error{
  color: var(--mdm-red);
  font-size: .8rem;
  font-weight: 850;
}

#mdmRecentNewsBlock .mdm-news-category-panel-buttons{
  display: flex;
  align-items: center;
  gap: .42rem;
  margin-left: auto;
}

#mdmRecentNewsBlock .mdm-news-category-apply{
  min-height: 38px;
  padding: .55rem .78rem;
  border: 1px solid var(--mdm-red);
  border-radius: 10px;
  background: var(--mdm-red);
  color: var(--mdm-white);
  font-size: .8rem;
  font-weight: 900;
  box-shadow: 0 7px 14px rgba(179,25,31,.2);
}

#mdmRecentNewsBlock .mdm-news-category-apply:hover{
  filter: brightness(.94);
}

/* -----------------------------------------
   Tabs (reuse the same visual language as other nav-tabs)
----------------------------------------- */

#mdmRecentNewsBlock #memo_selector_tab_block{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .6rem;
  border-bottom: 1px solid var(--mdm-gray-150);
}

#mdmRecentNewsBlock #memo_selector_tabs.nav{
  flex: 1 1 auto;
  border-bottom: 0;
  gap: .35rem;
}

#mdmRecentNewsBlock #memo_selector_tabs .nav-link{
  border: 0 !important;
  border-radius: 14px 14px 0 0;
  padding: .50rem .78rem;
  font-weight: 900;
  letter-spacing: -.01em;
  color: var(--mdm-gray-600);
  background: transparent;
}

#mdmRecentNewsBlock #memo_selector_tabs .nav-link:hover{
  background: var(--mdm-gray-100);
  color: var(--mdm-gray-900);
}

#mdmRecentNewsBlock #memo_selector_tabs .nav-link.active,
#mdmRecentNewsBlock #memo_selector_tabs .nav-item.active .nav-link{
  color: var(--mdm-red);
  background: rgba(179,25,31,.06);
  box-shadow: inset 0 -2px 0 rgba(179,25,31,.30);
}

/* -----------------------------------------
   Memo list rows
----------------------------------------- */

/* Each item from PHP: <div class="memo"> ... */
#mdmRecentNewsBlock #memo_list_newest > .memo{
  margin: 0 !important;
  padding: .72rem .15rem;
}

/* dotted separators like sidebar list */
#mdmRecentNewsBlock #memo_list_newest > .memo + .memo{
  border-top: 1px dotted rgba(18, 20, 23, .12);
}

#mdmRecentNewsBlock #memo_list_newest > .mdm-news-loading{
  padding-top: 1.15rem;
  padding-bottom: 1.15rem;
}

#mdmRecentNewsBlock .mdm-news-loading .memo-details{
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--mdm-gray-600) !important;
  font-size: .9rem;
  font-weight: 750;
}

#mdmRecentNewsBlock .mdm-news-loading i{
  color: var(--mdm-red);
}

/* make the inner col behave */
#mdmRecentNewsBlock #memo_list_newest > .memo > .col-12{
  padding-left: 0;
  padding-right: 0;
}

#mdmRecentNewsBlock .mdm-news-row{
  align-items: start;
  display: grid;
  gap: .56rem 1rem;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}

#mdmRecentNewsBlock .mdm-news-row-content{
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

#mdmRecentNewsBlock .mdm-observation-type-pill{
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: .64rem;
  font-weight: 800;
  grid-column: 2;
  grid-row: 1;
  justify-content: center;
  letter-spacing: .01em;
  line-height: 1;
  max-width: 120px;
  min-height: 24px;
  overflow: hidden;
  padding: .34rem .58rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#mdmRecentNewsBlock .mdm-news-theme-snapshot{
  display: grid;
  gap: .38rem;
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 0;
  width: 100%;
}

#mdmRecentNewsBlock .mdm-news-theme{
  align-items: center;
  background: linear-gradient(105deg, rgba(179,25,31,.045), #fff 42%);
  border: 1px solid rgba(18,20,23,.09);
  border-left: 3px solid rgba(179,25,31,.72);
  border-radius: 9px;
  box-shadow: 0 3px 10px rgba(18,20,23,.035);
  display: flex;
  flex-wrap: wrap;
  gap: .42rem .85rem;
  justify-content: space-between;
  padding: .48rem .62rem .48rem .58rem;
}

#mdmRecentNewsBlock .mdm-news-theme-title{
  align-items: center;
  color: var(--mdm-gray-900);
  display: inline-flex;
  flex: 1 1 360px;
  font-size: .75rem;
  font-weight: 800;
  gap: .4rem;
  line-height: 1.3;
  min-width: 0;
}

#mdmRecentNewsBlock .mdm-news-theme-label{
  background: rgba(179,25,31,.1);
  border: 1px solid rgba(179,25,31,.16);
  border-radius: 999px;
  color: #a8171c;
  flex: 0 0 auto;
  font-size: .57rem;
  letter-spacing: .05em;
  line-height: 1;
  padding: .25rem .38rem;
  text-transform: uppercase;
}

#mdmRecentNewsBlock .mdm-news-theme-metrics{
  align-items: center;
  color: var(--mdm-gray-600);
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  font-size: .65rem;
  gap: .3rem .38rem;
  line-height: 1.3;
}

#mdmRecentNewsBlock .mdm-news-theme-metric{
  align-items: center;
  background: #fff;
  border: 1px solid rgba(18,20,23,.09);
  border-radius: 999px;
  display: inline-flex;
  gap: .3rem;
  padding: .27rem .43rem;
  white-space: nowrap;
}

#mdmRecentNewsBlock .mdm-news-theme-metric span{
  color: var(--mdm-gray-600);
  font-weight: 700;
}

#mdmRecentNewsBlock .mdm-news-theme-metric strong{
  color: var(--mdm-gray-900);
  font-weight: 800;
}

#mdmRecentNewsBlock .mdm-news-theme-direction{
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-weight: 800;
  gap: .25rem;
  padding: .27rem .43rem;
  white-space: nowrap;
}

#mdmRecentNewsBlock .mdm-news-theme-direction.is-up{
  background: rgba(21,128,61,.08);
  border-color: rgba(21,128,61,.14);
  color: #15803d;
}

#mdmRecentNewsBlock .mdm-news-theme-direction.is-down{
  background: rgba(185,28,28,.075);
  border-color: rgba(185,28,28,.14);
  color: #b91c1c;
}

#mdmRecentNewsBlock .mdm-news-theme-direction.is-neutral{
  background: rgba(71,85,105,.07);
  border-color: rgba(71,85,105,.13);
  color: #475569;
}

#mdmRecentNewsBlock .mdm-news-theme-direction-icon{
  fill: none;
  height: 12px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  width: 16px;
}

/* subtle hover row highlight (similar vibe to rankings hover) */
#mdmRecentNewsBlock #memo_list_newest > .memo:hover{
  background: var(--mdm-gray-100);
  border-radius: 12px;
}

/* prevent hover background from looking “broken” with dotted line */
#mdmRecentNewsBlock #memo_list_newest > .memo + .memo:hover{
  margin-top: 0; /* keep alignment stable */
}

/* -----------------------------------------
   Title row: number + headline link
----------------------------------------- */

#mdmRecentNewsBlock .memo p.title{
  align-items: baseline;
  display: flex;
  gap: .35rem;
  margin: 0;
  max-width: 100%;
  min-width: 0;
  white-space: normal;
}

/* the numeric prefix */
#mdmRecentNewsBlock .memo .number{
  font-weight: 900;
  letter-spacing: 0;
  font-size: .92rem;
  color: rgba(18,20,23,.55);
  flex: 0 0 auto;
}

/* the headline, linked or plain */
#mdmRecentNewsBlock .memo p.title > a,
#mdmRecentNewsBlock .memo p.title > span:not(.number){
  display: block;
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 0;

  font-weight: 900;
  letter-spacing: 0;
  font-size: 1.02rem;
  line-height: 1.15;

  color: var(--mdm-gray-900);
  text-decoration: none;

  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

/* match rankings: underline-on-hover */
#mdmRecentNewsBlock .memo:hover p.title a{
  text-decoration: underline;
  text-decoration-color: rgba(18,20,23,.25);
  text-underline-offset: 2px;
}

/* -----------------------------------------
   Meta block: source + posted line
----------------------------------------- */

#mdmRecentNewsBlock .memo .meta{
  margin-top: .28rem;
}

/* Source row: <p class="fetch-source"> <a>Site</a> | </p> */
#mdmRecentNewsBlock .memo .meta p.fetch-source{
  margin: 0;
  font-size: .86rem;
  font-weight: 700;
  color: var(--mdm-gray-600);
}

/* source link */
#mdmRecentNewsBlock .memo .meta p.fetch-source a{
  color: var(--mdm-gray-700);
  text-decoration: none;
  font-weight: 800;
}

#mdmRecentNewsBlock .memo .meta p.fetch-source a:hover{
  color: var(--mdm-gray-900);
  text-decoration: underline;
  text-decoration-color: rgba(18,20,23,.22);
  text-underline-offset: 2px;
}

/* The pipe after site_name is literally in markup as " | "
   So just soften it visually */
#mdmRecentNewsBlock .memo .meta p.fetch-source{
  opacity: .95;
}

#mdmRecentNewsBlock .memo .meta .memo-category{
  color: var(--mdm-red);
  font-weight: 900;
}

/* Posted line: <p class="memo-details text-muted">Posted on ...</p> */
#mdmRecentNewsBlock .memo .meta p.memo-details{
  margin: .18rem 0 0 0;
  font-size: .82rem;
  font-weight: 650;
  color: rgba(18,20,23,.55) !important; /* override bootstrap .text-muted */
  letter-spacing: -.005em;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -----------------------------------------
   "Featured" variant (posts vs post_link)
----------------------------------------- */

/* Your PHP uses: <div class="memo featured"> for posts */
#mdmRecentNewsBlock #memo_list_newest > .memo.featured{
  position: relative;
}

/* subtle publication accent like ticker symbol / rankings rank chip vibe */
#mdmRecentNewsBlock #memo_list_newest > .memo.featured::before{
  content: "";
  position: absolute;
  left: 0;
  top: .65rem;
  bottom: .65rem;
  width: 3px;
  border-radius: 999px;
  background: rgba(179,25,31,.40);
}

/* pad content so accent doesn't collide */
#mdmRecentNewsBlock #memo_list_newest > .memo.featured > .col-12{
  padding-left: .35rem;
}

/* -----------------------------------------
   Mobile tweaks
----------------------------------------- */

@media (max-width: 767.98px){
  #mdmRecentNewsBlock .mdm-news-category-filter{
    display: none;
  }
}

@media (max-width: 575.98px){

  #mdmRecentNewsBlock #memo_list_newest > .memo{
    padding: .68rem .10rem;
  }

  #mdmRecentNewsBlock .memo p.title a{
    font-size: 1.0rem;
  }

  #mdmRecentNewsBlock .mdm-news-row{
    align-items: flex-start;
    gap: .5rem .65rem;
  }

  #mdmRecentNewsBlock .mdm-observation-type-pill{
    font-size: .6rem;
    max-width: 92px;
    min-height: 22px;
    padding: .3rem .45rem;
  }

  #mdmRecentNewsBlock .mdm-news-theme{
    align-items: flex-start;
    flex-direction: column;
  }

  #mdmRecentNewsBlock .mdm-news-theme-title{
    flex-basis: auto;
  }

  #mdmRecentNewsBlock .mdm-news-theme-metrics{
    width: 100%;
  }

  /* posted line can wrap too */
  #mdmRecentNewsBlock .memo .meta p.memo-details{
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}

/* -----------------------------------------
   News pagination
----------------------------------------- */

#mdmRecentNewsBlock #more_memos{
  margin-top: .75rem;
}

#mdmRecentNewsBlock #more_memos .more-memos-btn{
  border-radius: 14px;
  font-weight: 900;
  letter-spacing: -.01em;
  padding: .70rem 1.02rem;
  border: 1px solid var(--mdm-gray-150);
  background: var(--mdm-white);
  box-shadow: 0 10px 16px rgba(18,20,23,.06);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}

#mdmRecentNewsBlock #more_memos .more-memos-btn:hover{
  background: rgba(255,255,255,.70);
  border-color: rgba(18,20,23,.12);
  box-shadow: 0 14px 24px rgba(18,20,23,.08);
  transform: translateY(-1px);
}

#mdmRecentNewsBlock #more_memos .more-memos-btn:focus-visible{
  outline: 3px solid rgba(179,25,31,.25);
  outline-offset: 2px;
}

#mdmRecentNewsBlock #more_memos .more-memos-btn i{
  color: var(--mdm-red);
  margin-right: .35rem;
}
