/* /styles/brain-dump-rail.css */
/* === Brain Dump: RIGHT RAIL list/grid only === */
/* Updated to support BOTH #rightRail (Profile) and #artistRightCol (Art Studio) */

/* Neutralize foreign rail layouts when any right-rail grid exists */
:is(#rightRail, #artistRightCol):has(.rc-rail-grid),
.apoth-main #rightRail,
#mainContainer.apoth-main #rightRail {
  display: block !important;
}

/* Align the rail chip grid with the top of the first section */
:is(#rightRail, #artistRightCol) #journalButtons {
  margin-top: 3.25rem !important; /* visually matches card top */
}

/* Ensure right-rail rail-grid is actually a grid even without .rc-wrap */
:is(#rightRail, #artistRightCol) .rc-rail-grid {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  gap: 0.75rem !important;
  row-gap: 0.75rem !important;
  column-gap: 0.75rem !important;
  grid-auto-rows: 8px;
  align-items: start !important;
}

/* If there is an intermediate wrapper between the rail grid and the chips,
   give THAT wrapper spacing so pills never touch. */
:is(#rightRail, #artistRightCol) .rc-rail-grid > :is(div, section, nav, article):has(.hub-btn, .vm-link) {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.75rem !important;
  align-items: flex-start !important;
}

/* Bootstrap btn-group wrapper also needs spacing when used for chips */
:is(#rightRail, #artistRightCol) .rc-rail-grid > .btn-group:has(.hub-btn, .vm-link) {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.75rem !important;
}

/* --- Right rail: neutralize Bootstrap btn-group compaction everywhere --- */
:is(#rightRail, #artistRightCol) .btn-group:has(.hub-btn, .vm-link) {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: flex-start !important;
  gap: 0.75rem !important;
}

/* Kill Bootstrap’s negative margin joiners that remove spacing */
:is(#rightRail, #artistRightCol) .btn-group > .btn:not(:first-child),
:is(#rightRail, #artistRightCol) .btn-group > .btn-group:not(:first-child) {
  margin-left: 0 !important;
}

/* Avoid double spacing: inside btn-group, use container gap only */
:is(#rightRail, #artistRightCol) .btn-group .hub-btn,
:is(#rightRail, #artistRightCol) .btn-group .vm-link,
:is(#rightRail, #artistRightCol) .btn-group .btn {
  margin: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  white-space: nowrap !important;
}

/* Provide minimal external whitespace so pills never touch even if a grid isn't applied yet */
:is(#rightRail, #artistRightCol) .rc-rail-grid .hub-btn {
  margin: 0.375rem !important;
}

/* Desktop: 3-up rail cards */
@media (min-width: 992px){
  .rc-wrap .rc-rail-grid > .rc-card {
    grid-column: span 4;
  }
}

/* HARD STOP: right-rail buttons never stretch full width */
/* Applied to BOTH #rightRail and #artistRightCol */
:is(#rightRail, #artistRightCol) .journal-pill,
:is(#rightRail, #artistRightCol) .hub-btn,
:is(#rightRail, #artistRightCol) .btn.hub-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  justify-self: start !important;
  background: #fff !important;
  border: 1px solid var(--brand-gold, #b08a48) !important;
  border-radius: 0.5rem !important;
  color: #000 !important;
  font-family: var(--bs-body-font-family,"Montserrat",system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial) !important;
  font-size: 0.84rem !important;
  line-height: 1.2 !important;
  min-height: 30px !important;
  margin: 0.375rem !important;
  box-sizing: border-box !important;
}

/* Brain Dump pills as direct children of the rail grid:
   enforce 2-up on mobile (span 6) and 3-up on lg+ (span 4). */
:is(#rightRail, #artistRightCol) #journalButtons > .journal-pill {
  grid-column: span 6 !important;
}
@media (min-width: 992px){
  :is(#rightRail, #artistRightCol) #journalButtons > .journal-pill {
    grid-column: span 4 !important;
  }
}

/* Unified brick grid for any lists rendered in the right rail */
:is(#rightRail, #artistRightCol) ul,
:is(#rightRail, #artistRightCol) .vm-list {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  padding: 0 !important;
  gap: 0.75rem !important;
  row-gap: 0.75rem !important;
  column-gap: 0.75rem !important;
  align-items: start !important;
  grid-auto-flow: row dense !important;
}

/* Items: 2-up on mobile (span 6), 3-up on lg+ (span 4) */
:is(#rightRail, #artistRightCol) ul > li,
:is(#rightRail, #artistRightCol) .vm-list > li {
  list-style: none;
  margin: 0;
  padding: 0;
  grid-column: span 6 !important;
  break-inside: avoid;
}
@media (min-width: 992px){
  :is(#rightRail, #artistRightCol) ul > li,
  :is(#rightRail, #artistRightCol) .vm-list > li {
    grid-column: span 4 !important;
  }
}

/* Links/pills inside rail items: never stretch; spacing from grid only */
:is(#rightRail, #artistRightCol) ul > li > .vm-link,
:is(#rightRail, #artistRightCol) ul > li > .hub-btn,
:is(#rightRail, #artistRightCol) .vm-list > li > .vm-link,
:is(#rightRail, #artistRightCol) .vm-list > li > .hub-btn {
  display: inline-flex !important;
  width: auto !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  justify-self: start !important;
  margin: 0.375rem !important;
}

/* Any UL inside right rail becomes a 12-col grid */
.apoth-main #rightRail .rc-wrap ul {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  padding: 0 !important;
  gap: 0.75rem !important;
  row-gap: 0.75rem !important;
  column-gap: 0.75rem !important;
  align-items: start !important;
  grid-auto-flow: row dense !important;
}

/* Items inside those ULs: 2-up mobile, 3-up on lg+ */
.apoth-main #rightRail .rc-wrap ul > li {
  list-style: none;
  margin: 0;
  padding: 0;
  grid-column: span 6 !important;
  break-inside: auto;
}
@media (min-width: 992px){
  .apoth-main #rightRail .rc-wrap ul > li {
    grid-column: span 4 !important;
  }
}

/* Prevent stretch for links/buttons in those items */
.apoth-main #rightRail .rc-wrap ul > li > .vm-link,
.apoth-main #rightRail .rc-wrap ul > li > .hub-btn {
  display: inline-flex !important;
  width: auto !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  justify-self: start !important;
}

/* FINAL WORD: enforce the 0.75rem spacing on any right-rail grid */
:is(#rightRail, #artistRightCol) :is(.rc-rail-grid, ul, .vm-list),
.apoth-main #rightRail :is(.rc-rail-grid, ul, .vm-list) {
  row-gap: 0.75rem !important;
  column-gap: 0.75rem !important;
  gap: 0.75rem !important;
}

/* Rail cards: width hygiene */
:is(#rightRail, #artistRightCol) .rc-card {
  width: auto;
  max-width: 100%;
}

/* FINAL LOCKS: prevent any stretch inside the right rail */
:is(#rightRail, #artistRightCol) :is(.journal-pill, .hub-btn, .btn.hub-btn, .btn, .vm-link) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  justify-self: start !important;
  margin: 0.375rem !important;
  box-sizing: border-box !important;
}

/* Safety: if a plain list/container lands without our grid, keep it non-fullwidth */
:is(#rightRail, #artistRightCol) :is(ol, ul):not(.vm-list) {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  gap: 0.75rem !important;
  padding: 0 !important;
  align-items: start !important;
  grid-auto-flow: row dense !important;
}
:is(#rightRail, #artistRightCol) :is(ol, ul):not(.vm-list) > li {
  list-style: none;
  margin: 0;
  padding: 0;
  grid-column: span 6 !important;
  break-inside: avoid;
}
@media (min-width: 992px){
  :is(#rightRail, #artistRightCol) :is(ol, ul):not(.vm-list) > li {
    grid-column: span 4 !important;
  }
}