/* Sidebar — brand floating pills (no accordion)
   Custom Block title = header pill; content <ul><li><a> = link pills.
   Icons injected by js/journal.js from label/URL. */

body.mestro-theme .mestro-sidebar {
  --sb-pill-h: 2.85rem;
  --sb-radius: 999px;
  --sb-gap: 0.4rem;
  --sb-shadow: 0 8px 22px color-mix(in oklab, var(--mestro-indigo) 18%, transparent);
  --sb-shadow-soft: 0 4px 14px color-mix(in oklab, var(--mestro-indigo) 12%, transparent);
  display: grid;
  gap: 0 !important;
  width: 100%;
  min-width: 0;
  justify-items: stretch;
}

body.mestro-theme .mestro-sidebar .pkp_block,
body.mestro-theme .mestro-sidebar .block {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

/* Block-to-block spacing uses margins, not grid gap: OJS may reset the aside's display. */
body.mestro-theme .mestro-sidebar .pkp_block + .pkp_block,
body.mestro-theme .mestro-sidebar .block + .block {
  margin-top: 1.25rem !important;
}

/* Group header pill (Custom Block title) */
body.mestro-theme .mestro-sidebar .pkp_block > .title,
body.mestro-theme .mestro-sidebar .block > .title,
body.mestro-theme .mestro-sidebar .pkp_block > h2.title,
body.mestro-theme .mestro-sidebar .block > h2.title {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: var(--sb-pill-h) !important;
  margin: 0 0 var(--sb-gap) !important;
  padding: 0.55rem 1.25rem !important;
  border: 0 !important;
  border-radius: var(--sb-radius) !important;
  background: var(--mestro-indigo) !important;
  color: #fff !important;
  font-family: var(--mestro-font-display) !important;
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
  line-height: 1.2 !important;
  text-align: center !important;
  box-shadow: var(--sb-shadow) !important;
}

/* Kill default OJS block title/content spacing that widens title→links */
body.mestro-theme .mestro-sidebar .pkp_block > .title + .content,
body.mestro-theme .mestro-sidebar .block > .title + .content,
body.mestro-theme .mestro-sidebar .pkp_block > h2.title + .content {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

body.mestro-theme .mestro-sidebar .pkp_block > .content,
body.mestro-theme .mestro-sidebar .block > .content {
  display: grid !important;
  gap: var(--sb-gap) !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.mestro-theme .mestro-sidebar .block_custom > .content,
body.mestro-theme .mestro-sidebar .block_custom > .content:hover {
  transform: none !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.mestro-theme .mestro-sidebar .block_custom > .content > ul {
  display: grid !important;
  gap: var(--sb-gap) !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

body.mestro-theme .mestro-sidebar .block_custom > .content > ul > li {
  margin: 0 !important;
  padding: 0 !important;
}

/* Link pills */
body.mestro-theme .mestro-sidebar .mestro-sidebar__link,
body.mestro-theme .mestro-sidebar .block_custom:not(.mestro-sidebar__visitors) > .content > ul > li > a {
  display: grid !important;
  grid-template-columns: 2.05rem minmax(0, 1fr) !important;
  align-items: center !important;
  column-gap: 0.7rem !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: var(--sb-pill-h) !important;
  margin: 0 !important;
  padding: 0.55rem 1rem 0.55rem 0.7rem !important;
  border: 0 !important;
  border-radius: var(--sb-radius) !important;
  background: #fff !important;
  color: var(--mestro-indigo) !important;
  font-family: var(--mestro-font-display) !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em !important;
  text-decoration: none !important;
  box-shadow: var(--sb-shadow-soft) !important;
  transition: background 0.2s var(--mestro-ease), color 0.2s var(--mestro-ease) !important;
  transform: none !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__link:hover,
body.mestro-theme .mestro-sidebar .mestro-sidebar__link:focus,
body.mestro-theme .mestro-sidebar .block_custom:not(.mestro-sidebar__visitors) > .content > ul > li > a:hover,
body.mestro-theme .mestro-sidebar .block_custom:not(.mestro-sidebar__visitors) > .content > ul > li > a:focus {
  background: color-mix(in oklab, var(--mestro-orange) 10%, #fff) !important;
  color: var(--mestro-indigo) !important;
  transform: none !important;
  text-decoration: none !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__link:focus-visible {
  outline: 2px solid var(--mestro-orange) !important;
  outline-offset: 2px !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  width: 2.05rem !important;
  height: 2.05rem !important;
  min-width: 2.05rem !important;
  border-radius: 50% !important;
  border: 1.5px solid color-mix(in oklab, var(--mestro-orange) 55%, #ffd4a8) !important;
  background: color-mix(in oklab, var(--mestro-orange) 12%, #fff) !important;
  color: var(--mestro-orange) !important;
  line-height: 0 !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__icon svg {
  display: block !important;
  width: 1.05rem !important;
  height: 1.05rem !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__label {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
  line-height: 1.25 !important;
  color: inherit !important;
}

/* Hide legacy accordion chrome if old markup appears */
body.mestro-theme .mestro-sidebar .mestro-sidebar__chevron,
body.mestro-theme .mestro-sidebar .sidebar-panel-body,
body.mestro-theme .mestro-sidebar .sidebar-picture-container,
body.mestro-theme .mestro-sidebar .mestro-sidebar__panel {
  display: none !important;
}

/* Keywords (OJS Keyword Cloud) — title pill + cloud/chips card */
body.mestro-theme .mestro-sidebar .block_Keywordcloud > .title {
  display: flex !important;
}

body.mestro-theme .mestro-sidebar .block_Keywordcloud > .content {
  display: block !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.mestro-theme .mestro-sidebar .mestro-kw {
  border: 0 !important;
  border-radius: 1.15rem !important;
  background: #fff !important;
  box-shadow: var(--sb-shadow-soft) !important;
  overflow: hidden !important;
}

body.mestro-theme .mestro-sidebar .mestro-kw__head {
  display: none !important;
}

body.mestro-theme .mestro-sidebar .mestro-kw__body {
  padding: 0.85rem 0.9rem 1rem !important;
}

body.mestro-theme .mestro-sidebar .mestro-kw__cloud {
  min-height: 10rem !important;
}

body.mestro-theme .mestro-sidebar .mestro-kw__chips {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.4rem !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.mestro-theme .mestro-sidebar .mestro-kw__chip {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 1.85rem !important;
  padding: 0.2rem 0.7rem !important;
  border-radius: 999px !important;
  border: 1px solid color-mix(in oklab, var(--mestro-indigo) 14%, #e4e7f2) !important;
  background: color-mix(in oklab, var(--mestro-indigo) 4%, #fff) !important;
  color: var(--mestro-indigo) !important;
  font-size: 0.78rem !important;
  font-weight: 650 !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

body.mestro-theme .mestro-sidebar .mestro-kw__chip:hover,
body.mestro-theme .mestro-sidebar .mestro-kw__chip:focus {
  background: color-mix(in oklab, var(--mestro-orange) 12%, #fff) !important;
  color: var(--mestro-indigo) !important;
  border-color: color-mix(in oklab, var(--mestro-orange) 40%, #e4e7f2) !important;
  transform: none !important;
}
body.mestro-theme .mestro-sidebar .mestro-sidebar__visitors > .content {
  display: block !important;
  padding: 0.75rem 0.85rem !important;
  border-radius: 1.15rem !important;
  background: #fff !important;
  box-shadow: var(--sb-shadow-soft) !important;
  transition: none !important;
  transform: none !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__visitors-note,
body.mestro-theme .mestro-sidebar .mestro-sidebar__visitors .content p {
  margin: 0 !important;
  font-size: 0.88rem !important;
  line-height: 1.55 !important;
  color: var(--mestro-ink-mid) !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__flagcounter {
  display: flex !important;
  justify-content: center !important;
  margin: 0 !important;
  line-height: 0 !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__flagcounter a {
  display: inline-block !important;
  line-height: 0 !important;
  color: inherit !important;
  text-decoration: none !important;
  box-shadow: none !important;
  background: transparent !important;
  min-height: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  transform: none !important;
  filter: none !important;
  transition: none !important;
  opacity: 1 !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__visitors > .content:hover,
body.mestro-theme .mestro-sidebar .mestro-sidebar__visitors > .content:focus-within {
  background: #fff !important;
  box-shadow: var(--sb-shadow-soft) !important;
  transform: none !important;
  filter: none !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__flagcounter a:hover,
body.mestro-theme .mestro-sidebar .mestro-sidebar__flagcounter a:focus,
body.mestro-theme .mestro-sidebar .mestro-sidebar__visitors a:hover,
body.mestro-theme .mestro-sidebar .mestro-sidebar__visitors a:focus {
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  filter: none !important;
  opacity: 1 !important;
  color: inherit !important;
  text-decoration: none !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__visitors .content img,
body.mestro-theme .mestro-sidebar .mestro-sidebar__flagcounter img {
  display: block !important;
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  margin: 0 auto !important;
  border: 0 !important;
  transform: none !important;
  filter: none !important;
  transition: none !important;
}

body.mestro-theme .mestro-sidebar .mestro-sidebar__visitors img:hover {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
}
