/* Shared "plegable" (collapsible) widget pattern for the owin6g
   simulations. mobile.js toggles a `mob-active` class on <body>
   whenever the pattern should engage — either because the viewport
   is narrow (<= 720px) or because the page opted in with a
   `mob-always` class on the body. All CSS rules key on
   `body.mob-active`, so a single rule set covers both cases. */

body.mob-active .mob-handle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(120, 135, 165, 0.4);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(60, 75, 110, 0.15);
  font: 600 11.5px/1 -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #16223c;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  min-height: 30px;
}
body.mob-active .mob-handle .mob-chev {
  display: inline-block;
  transition: transform 0.18s ease;
  font-size: 12px; line-height: 1;
  color: #4a5876; margin-left: 3px;
}
body.mob-active .mob-collapsible.is-open > .mob-handle .mob-chev {
  transform: rotate(180deg);
}
body.mob-active .mob-collapsible.is-open > .mob-handle {
  margin-bottom: 6px;
  /* Span full width in flex/grid parents once open. */
  flex: 1 1 100%;
  grid-column: 1 / -1;
  justify-self: start;
  align-self: start;
}
/* Collapsed state: strip the widget's own chrome so only the pill
   shows in its fixed position. */
body.mob-active .mob-collapsible:not(.is-open) {
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  display: block !important;
  gap: 0 !important;
}
body.mob-active .mob-collapsible:not(.is-open) > *:not(.mob-handle) {
  display: none !important;
}
/* Tap-friendly control sizing inside expanded widgets. */
body.mob-active .mob-collapsible.is-open input[type="range"] { min-height: 32px; }
body.mob-active .mob-collapsible.is-open input[type="checkbox"] { width: 18px; height: 18px; }
body.mob-active .mob-collapsible.is-open button { min-height: 32px; }
/* Uniform expanded look — same width, height, chrome regardless of
   which widget the pill belonged to. Only one open at a time is
   enforced in mobile.js. */
body.mob-active .mob-collapsible.is-open {
  width: min(84vw, 320px) !important;
  max-width: min(84vw, 320px) !important;
  max-height: 42vh !important;
  overflow-y: auto !important;
  padding: 12px 14px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  border: 1px solid rgba(120, 135, 165, 0.35) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 28px rgba(60, 75, 110, 0.24) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  -webkit-overflow-scrolling: touch;
  z-index: 25 !important;
  display: block !important;
  color: #16223c !important;
}
body.mob-active .mob-collapsible.is-open > * { color: inherit; }
body.mob-active .mob-collapsible.is-open .mob-handle {
  display: flex !important;
  width: 100%;
  justify-content: space-between;
  margin-bottom: 8px;
  grid-column: 1 / -1;
}
/* Author card had a 3-column grid on desktop — vertical stack here. */
body.mob-active .mob-collapsible.is-open .authors-col { margin: 6px 0 10px; }
body.mob-active .mob-collapsible.is-open .uni-img { display: block; margin: 6px 0; }
