/* Movimento Duchenne | Patch 035 | Frontend refinements (034 + requested changes).
   Loads after portal020.css and the institutional theme CSS.
   No editor/admin styles or access/authentication changes. */

/* Eliminate legacy spacing around the protected-area shell. */
body .mdr20-shell {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Preserve horizontal padding configured by the theme. */
body .md-main--internal {
  padding-top: 10px !important;
  padding-bottom: 20px !important;
}

body .md-site-header {
  border-bottom: 1px solid #ddd !important;
}

/* A contained, viewport-aware sidebar. The inner menu keeps its own scroll. */
body .mdr20-shell .mdr-sidebar.mdr20-sidebar {
  top: 0 !important;
  height: 100% !important;
  max-height: 100svh !important;
  overflow: auto !important;
}

@media (min-width: 901px) {
  body .mdr20-shell .mdr20-sidebar .mdr20-menu-body {
    min-height: 0 !important;
    max-height: calc(100svh - 200px) !important;
    overflow-y: auto !important;
  }
}

/* Make "Sair" visibly actionable rather than a low-contrast text link. */
body .mdr20-shell .mdr20-actions a:last-child {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px !important;
  border: 1px solid #cbd2d8 !important;
  border-radius: 7px !important;
  background: #f4f5f6 !important;
  color: #394550 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.2;
  text-decoration: none !important;
  box-shadow: none;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
body .mdr20-shell .mdr20-actions a:last-child::before {
  content: "\21AA";
  font-size: 15px;
  line-height: 1;
}
body .mdr20-shell .mdr20-actions a:last-child:hover,
body .mdr20-shell .mdr20-actions a:last-child:focus-visible {
  background: #e6e9ec !important;
  border-color: #b9c3cb !important;
  color: #26343e !important;
  box-shadow: none;
}

/* References: real collapsible card rather than a loose heading with a rule. */
body .mdr20-shell .mdr20-article details.mdr19-references {
  margin: 34px 0 20px !important;
  padding: 0 !important;
  border: 1px solid #d6e2eb !important;
  border-radius: 9px !important;
  background: #f7fafc !important;
  box-shadow: 0 2px 10px rgba(31, 74, 109, .035);
  overflow: hidden;
}
body .mdr20-shell .mdr19-references > summary {
  padding: 17px 19px !important;
  color: #285c80 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: background .15s ease;
}
body .mdr20-shell .mdr19-references > summary:hover {
  background: #eef5f9;
}
body .mdr20-shell .mdr19-references[open] > summary {
  border-bottom: 1px solid #dfe9f0;
  background: #f1f7fa;
}
body .mdr20-shell .mdr19-references .mdr19-references-inner {
  padding: 17px 20px 21px !important;
  border-top: 0 !important;
  background: #fff;
}

/* Medium desktop/tablet header: breathing room between menu entries.
   Below 901px the theme's mobile navigation remains in charge. */
@media (min-width: 901px) and (max-width: 1240px) {
  body .md-menu {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center;
    justify-content: center;
    column-gap: clamp(12px, 1.55vw, 20px) !important;
    row-gap: 9px !important;
    max-width: 100%;
  }
  body .md-menu > li {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  body .md-menu > li > a,
  body .md-menu > li > details > summary {
    padding-left: 2px !important;
    padding-right: 2px !important;
  }
}

@media (max-width: 600px) {
  body .mdr20-shell .mdr20-actions { gap: 12px; }
  body .mdr20-shell .mdr20-actions a:last-child {
    min-height: 38px;
    padding: 8px 12px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body .mdr20-shell .mdr20-actions a:last-child,
  body .mdr20-shell .mdr19-references > summary {
    transition: none !important;
  }
}

/* Landing cards: compact body copy without changing any Gutenberg content. */
body .mdr20-shell.mdr19-landing .mdr19-topic p {
  font-size: 13px !important;
  line-height: 1.5 !important;
}
