/* ==========================================================================
   components/topic-nav.css — STORY-GRID LOCKED (NO CONTAINER MATH)
   Logic:
   - The topic nav must be a DIRECT CHILD of .story-layout--toc grid.
   - On widescreen, it is forced into grid column 1 (article column ~980px).
   - On <=980px, the story grid collapses to 1 column, so nav becomes full width.
   - No dedicated container class.
   - No bleed utilities.
   ========================================================================== */


/* ==========================================================================
   1) Default widget styles (reusable)
   ========================================================================== */

.topic-nav-surface{
  position: relative;
  padding: 46px 0;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.topic-nav-bg{
  position: absolute;
  inset: 0;
  z-index: 0;
}

.topic-nav-bg img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.85) brightness(.65);
}

/* Card (layout-only: NO BORDER in default; outer surface owns framing on story pages) */
.topic-nav-card{
  position: relative;
  z-index: 2;

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;

  padding: 18px 22px;
  border-radius: 20px;

  /* IMPORTANT: no inner frame */
  border: 0;
  outline: 0;
  box-shadow: none;

  background: linear-gradient(
    180deg,
    rgba(12,14,18,.92),
    rgba(8,10,14,.92)
  );

  backdrop-filter: blur(10px);

  min-width: 0;
  box-sizing: border-box;
}

/* Breadcrumbs */
.crumbs{
  flex: 1 1 auto;
  min-width: 0;
}

.crumbs-list{
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;

  margin: 0;
  padding: 0;

  white-space: nowrap;
  overflow: hidden;
}

.crumbs-list a{
  color: rgba(232,237,245,.9);
  text-decoration: none;

  display: inline-block;
  max-width: 26ch;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.crumbs-list a:hover{
  color: var(--text);
}

.crumbs-list .sep{
  opacity: .55;
}

/* Pager */
.pager{
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
}

.pager-back{
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  color: rgba(232,237,245,.9);
  text-decoration: none;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}

.pager-back:hover{
  transform: translateY(-1px);
  border-color: rgba(215,188,161,.35);
  background: rgba(215,188,161,.08);
}

.pager-edges{
  display: flex;
  gap: 10px;
  min-width: 0;
}

.pager-prev,
.pager-next{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;

  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.02);
  color: rgba(232,237,245,.92);
  text-decoration: none;

  min-width: 0;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}

.pager-prev:hover,
.pager-next:hover{
  transform: translateY(-1px);
  border-color: rgba(215,188,161,.35);
  background: rgba(215,188,161,.08);
}

.pager .meta{
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pager .kicker{
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(170,180,195,.8);
}

.pager .title{
  font-size: 13px;
  color: rgba(232,237,245,.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 20ch;
}

.pager .arrow{
  opacity: .85;
}


/* ==========================================================================
   2) STORY PAGE VARIANT (grid-attached)
   - OUTER SURFACE owns the ONLY visible border
   - INNER CARD has NO border/inset stroke
   ========================================================================== */

/* Story pages: surface becomes the framed container */
body.story .topic-nav-surface--story{
  position: relative;
  padding: 14px var(--pad);     /* tighter: brings card closer to border */
  margin-top: 18px;

  border: 1px solid var(--line);
  border-radius: 22px;

  background: transparent;
  overflow: visible;
  min-width: 0;
  box-sizing: border-box;
}

/* Kill any decorative dividers/pseudo frames from base surface */
body.story .topic-nav-surface--story::before,
body.story .topic-nav-surface--story::after{
  content: none !important;
}

/* Background image is a soft underlay only (no framing) */
body.story .topic-nav-surface--story .topic-nav-bg{
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;

  border-radius: 0;
  overflow: visible;
  opacity: .25;                 /* a bit subtler since the surface is framed */
  pointer-events: none;
}

/* Put the whole section into the ARTICLE grid column on widescreen */
@media (min-width: 981px){
  body.story .story-layout--toc > .topic-nav-surface--story{
    grid-column: 1 / 2;
  }
}

/* Card fills the framed surface; reduce padding so it doesn’t “fight” the frame */
body.story .topic-nav-surface--story .topic-nav-card{
  width: 100%;
  margin: 0;
  box-sizing: border-box;

  padding: 14px 18px;           /* slightly tighter than default */
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;  /* IMPORTANT: no inset “fake border” */
}

/* <=860: stack controls */
@media (max-width: 860px){
  .topic-nav-card{
    flex-wrap: wrap;
    gap: 14px;
  }

  .crumbs-list{
    white-space: normal;
    flex-wrap: wrap;
  }

  .crumbs-list a{
    max-width: none;
  }

  .pager-edges{
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* Small screens: keep normal page padding (still safe) */
@media (max-width: 640px){
  body.story .topic-nav-surface--story{
    padding: 12px var(--pad);
  }

  body.story .topic-nav-surface--story .topic-nav-card{
    width: 100%;
    margin: 0;
  }
}
