/* =========================================================
   Sonic City Connections — Across Sonic City v1.0.9
   Uses OceanWP's native related-post HTML and Sonic City's
   existing Related Wiki Articles / You Might Also Like CSS.
   ========================================================= */

.scx-across-panel[hidden],
.scx-across [data-scx-card][hidden]{
  display: none !important;
}

.scx-related-heading-row{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
}

.scx-related-heading-row > .related-posts-title{
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0 !important;
}

.scx-across-nav{
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.scx-across-tab{
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(2,18,111,.14);
  border-radius: 6px;
  background: rgba(2,18,111,.05);
  color: #02126f;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}

.scx-across-tab span{
  min-width: 18px;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(2,18,111,.10);
  color: inherit;
  font-size: 9px;
  line-height: 1;
  text-align: center;
}

.scx-across-tab:hover{
  border-color: rgba(2,18,111,.25);
  background: rgba(2,18,111,.09);
  transform: translateY(-1px);
}

.scx-across-tab.is-active{
  border-color: #02126f;
  background: #02126f;
  color: #fff;
}

.scx-across-tab.is-active span{
  background: rgba(255,255,255,.18);
}

.scx-across-tab:focus-visible{
  outline: 2px solid #feeb4a;
  outline-offset: 2px;
}

.scx-across-body{
  padding: 0;
}

/* Generic fallback for supported templates that do not already carry the
   single-post / single-wiki selectors in Global CSS. On News articles the
   existing #related-posts rules remain the primary source of styling. */
.scx-native-related-section{
  clear: both;
  width: 100%;
  min-width: 0;
  margin-top: 22px;
  padding: 16px;
  box-sizing: border-box;
  background: linear-gradient(180deg,#ffffff 0%,#f4f7ff 100%);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
}

.scx-native-related-section .related-posts-title{
  margin: 0 0 14px;
  padding: 0 0 10px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.scx-native-related-section .related-posts-title .text{
  color: #02126f;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.scx-native-related-section .scx-across-body,
.scx-native-related-section .scx-across-panel,
.scx-native-related-section .oceanwp-row{
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.scx-native-related-section .oceanwp-row{
  display: grid !important;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 12px;
  margin: 0 !important;
}

/* OceanWP's native .col/.span_1_of_5 rules are percentage widths intended
   for a floated row. Across Sonic City uses CSS Grid, so those percentages
   must be fully neutralised or each card becomes a percentage of a grid cell. */
.scx-native-related-section .oceanwp-row > article.related-post{
  display: block;
  float: none !important;
  clear: none !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  box-sizing: border-box;
}

.scx-native-related-section article.related-post{
  float: none;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 18px rgba(0,0,0,.05);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.scx-native-related-section article.related-post:hover{
  transform: translateY(-2px);
  border-color: rgba(2,18,111,.22);
  box-shadow: 0 14px 26px rgba(0,0,0,.09);
}

.scx-native-related-section .related-post-media{
  margin: 0;
}

.scx-native-related-section .related-thumb{
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(145deg,#02126f,#1720d2);
}

.scx-native-related-section .related-thumb img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scx-native-related-section .related-post-title{
  margin: 10px 12px 8px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 900;
  text-align: center;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word;
}

.scx-native-related-section .related-post-title a{
  display: block;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word;
}

.scx-native-related-section .related-post-title a{
  color: #111;
  text-decoration: none !important;
  text-underline-offset: 0;
}

.scx-native-related-section .related-post-title a:hover{
  color: #0099ff;
  text-decoration: none !important;
}

.scx-native-related-section time.published,
.scx-related-topic-meta,
.scx-related-special-meta{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 12px 12px;
  color: rgba(17,17,17,.72);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 800;
  text-align: center;
}

.scx-related-topic-meta{
  flex-wrap: wrap;
}

.scx-related-topic-meta span,
.scx-related-topic-meta time{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
}

.scx-native-related-section time.published i,
.scx-related-topic-meta i{
  color: #02126f;
  font-size: 13px;
}

.scx-related-special-meta del{
  opacity: .62;
}

.scx-card-fallback{
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: rgba(255,255,255,.9);
  font-size: 30px;
}

[data-scx-legacy-hidden="1"]{
  display: none !important;
}

.scx-ocean-slot,
.scx-related-replacement{
  clear: both;
  width: 100%;
  margin: 0;
}

/* OceanWP already gives #related-posts its own outer spacing. */
.scx-related-replacement > #related-posts{
  margin-top: 22px;
}

.single-post article[id^="post-"] > .scx-related-replacement{
  padding-right: 16px;
  padding-left: 16px;
}

.single-post .scx-ocean-slot,
.single-yada_wiki .scx-ocean-slot,
.single-shop_item .scx-ocean-slot,
.single-sonic_event .scx-ocean-slot,
.single-sonic_music_archive .scx-ocean-slot{
  position: relative;
  z-index: 1;
}

body.single-yada_wiki:not(.postid-25850) article[id^="post-"] > .scx-ocean-slot{
  width: 100%;
  margin-top: 0;
  padding-right: 16px;
  padding-left: 16px;
  box-sizing: border-box;
}

/* The module sits outside the Wiki entry-content so OceanWP's native card
   widths cannot collapse inside the long article layout. The established
   related-section rule adds a 22px top margin, but the Wiki article shell is
   transparent outside entry-content, exposing the checkerboard background.
   Remove only that Wiki-module margin so it attaches directly to the article. */
body.single-yada_wiki:not(.postid-25850)
#related-news-posts.scx-native-related-section{
  margin-top: 0 !important;
}

.scx-footer-fallback{
  width: min(90%,1180px);
  margin: 22px auto;
}

.scx-footer-fallback > .scx-across{
  margin-top: 0;
}

.single-yada_wiki article[id^="post-"] > .scx-across,
.single-shop_item article[id^="post-"] > .scx-across,
.single-sonic_music_archive article[id^="post-"] > .scx-across,
.single-sonic_event article[id^="post-"] > .scx-across{
  margin-right: 16px;
  margin-left: 16px;
}

#bbpress-forums .scx-across{
  margin: 18px 0 0;
}

@media (max-width: 1024px){
  .scx-native-related-section .oceanwp-row{
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
}

@media (max-width: 768px){
  .scx-native-related-section{
    padding: 14px;
  }

  .scx-related-heading-row{
    align-items: stretch;
    flex-direction: column;
  }

  .scx-across-nav{
    justify-content: flex-start;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .scx-across-tab{
    flex: 0 0 auto;
  }

  .scx-native-related-section .oceanwp-row{
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .single-post article[id^="post-"] > .scx-related-replacement{
    padding-right: 12px;
    padding-left: 12px;
  }


  body.single-yada_wiki:not(.postid-25850) article[id^="post-"] > .scx-ocean-slot{
    padding-right: 12px;
    padding-left: 12px;
  }

  .scx-footer-fallback{
    width: calc(100% - 24px);
  }

  .single-yada_wiki article[id^="post-"] > .scx-across,
  .single-shop_item article[id^="post-"] > .scx-across,
  .single-sonic_music_archive article[id^="post-"] > .scx-across,
  .single-sonic_event article[id^="post-"] > .scx-across{
    margin-right: 12px;
    margin-left: 12px;
  }
}

@media (max-width: 420px){
  .scx-native-related-section .oceanwp-row{
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce){
  .scx-native-related-section article.related-post,
  .scx-across-tab{
    transition: none;
  }
}
