/* =============================================================================
 * Event Category exposed filter — /calendar sidebar-second
 * Owner: FILTER agent (Phase 5). Gap-fills prod-parity for the D7
 * global_filter "Event Category" checkbox block.
 *
 * Prod markup (D7 global_filter block): section.block.event-category-filter
 *   > h2.block-title "Event Category"  > .block-content > form.global-filter
 *   > #edit-field-event-category.form-checkboxes > .form-item.form-type-checkbox
 *   > label.option  (submit present but style="display:none").
 * Prod's checkbox list is styled entirely by the verbatim prod CSS via the
 * .event-category-filter ancestor + .form-checkboxes/.form-item/.form-type-checkbox
 * classes — the exposed-filter template adds the .event-category-filter wrapper so
 * that cascade reaches beta unchanged. This file only normalizes the DOM that
 * Views adds and prod does not (fieldset chrome, wrong block title, submit button).
 *
 * Beta renders a Views exposed-filter block: correct checkboxes, but (a) a WRONG
 * h2.block-title "Campus Calendar" (the calendar view's default-display title
 * leaks in as the block label), (b) a fieldset whose <legend> the global rule
 * legend{background:#0055b8;color:#fff} paints as a blue bar, and whose
 * .fieldset-wrapper the global rule paints beige, and (c) a visible "Apply"
 * submit button. We suppress the wrong h2, strip the fieldset chrome, promote
 * the "Event Category" legend to the sidebar heading, and hide the submit.
 * ========================================================================== */

/* 1. Suppress the wrong block heading ("Campus Calendar"). */
#block-cs-calendar-category-filter > .block-inner > .block-title {
  display: none;
}

/* 2. Strip the Views fieldset chrome — prod has no fieldset, so the global
 *    legend blue-bar and .fieldset-wrapper beige box must not appear. */
#block-cs-calendar-category-filter fieldset,
#block-cs-calendar-category-filter .fieldset-wrapper {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  background-color: transparent;
}
#block-cs-calendar-category-filter .fieldset-wrapper {
  display: block;
}

/* 3. Promote the "Event Category" legend to the sidebar block heading, matching
 *    the theme's h2.block-title (Roboto Slab, 1.5em, #0055b8, normal weight).
 *    Override the global legend{background:#0055b8;color:#fff} bar. */
#block-cs-calendar-category-filter legend {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 0;
  border: 0;
  background: none;
  background-color: transparent;
}
#block-cs-calendar-category-filter legend .fieldset-legend {
  display: inline;
  font-family: 'Roboto Slab', serif;
  font-size: 1.5em;
  font-weight: normal;
  line-height: normal;
  color: #0055b8;
  background: none;
  padding: 0;
}

/* 4. Prod hides the submit control (global_filter auto-applies); beta prints a
 *    visible "Apply" button. Hide it to match prod. */
#block-cs-calendar-category-filter .form-actions,
#block-cs-calendar-category-filter input[type="submit"] {
  display: none;
}

/* 5. Remove the exposed-form's own top margin so the list/heading sit flush. */
#block-cs-calendar-category-filter form.views-exposed-form {
  margin: 0;
}

/* 6. Match prod's checkbox row pitch (measured 24px @1400px wide). Prod's
 *    .form-checkboxes .form-item{margin:0.4em 0} loses on beta to the calendar
 *    rule .event-category-filter .form-type-checkbox{margin:0} (CSS source
 *    order), collapsing the list. Explicit 0.7em tunes beta's 21-row list
 *    height to prod's (~710 vs 712px). */
#block-cs-calendar-category-filter .form-checkboxes .form-item {
  margin-top: 0.7em;
  margin-bottom: 0.7em;
}

/* 7. Beta's form carries the .views-exposed-form class (it is a real Views
 *    exposed form), which triggers prod's .views-exposed-form label{font-weight:
 *    bold}. Prod's D7 global_filter form never matched that rule, so its labels
 *    are normal weight. Force the checkbox labels back to normal. */
#block-cs-calendar-category-filter .form-checkboxes label,
#block-cs-calendar-category-filter label.option {
  font-weight: normal;
}

/* 8. Match prod's inter-sidebar-block gap above the filter. Measured: prod
 *    leaves 46px between the mini-widget's bottom edge and the "Event Category"
 *    heading; beta left only 38px, so the whole filter block sat ~8px too high
 *    (pixel-diff alignment optimum was dy=-8). Push the block down 8px so the
 *    heading + checkbox list align vertically with prod. (The remaining ~5px is
 *    the mini-widget's own height delta, owned by the WIDGET agent.) */
#block-cs-calendar-category-filter {
  margin-top: 8px;
}
