/*
 * CETL styling for the WP FullCalendar plugin (FullCalendar 3.10, "unthemed" mode).
 * Loaded after the plugin's main.css by functions.php, only where the plugin's style is enqueued.
 * Event colors come from each Events Manager category (inline styles) and are left alone.
 *
 * Palette: navy #08244a / #002D72, crimson #AE1140 / #7d0c2e, light blue #eef2f8 / #dfe8f3,
 * grey text #5a6270, borders #dee2e6.
 */

/* main.css forces every element to 12px !important; restore readable sizes inside the calendar */
.wpfc-calendar-wrapper .fc,
.wpfc-calendar-wrapper .fc * {
  font-size: inherit !important;
}
.wpfc-calendar-wrapper .fc {
  font-size: 1rem !important;
  color: #212529;
}

/* ---------- Toolbar ---------- */
.wpfc-calendar-wrapper .fc-toolbar.fc-header-toolbar {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
}
.wpfc-calendar-wrapper .fc-toolbar > div {
  float: none;
}
/* Equal-width sides keep the month title centered over the grid */
.wpfc-calendar-wrapper .fc-toolbar .fc-left { order: 1; flex: 1 1 0; }
.wpfc-calendar-wrapper .fc-toolbar .fc-center { order: 2; flex: 0 1 auto; text-align: center; }
.wpfc-calendar-wrapper .fc-toolbar .fc-right { order: 3; flex: 1 1 0; display: flex; justify-content: flex-end; }
.wpfc-calendar-wrapper .fc-toolbar .fc-clear { display: none; }

.wpfc-calendar-wrapper .fc-toolbar h2 {
  font-family: inherit; /* site sans-serif */
  font-size: 1.6rem !important;
  line-height: 1.2;
  color: #08244a;
  margin: 0 !important;
  float: none !important;
  display: inline-block;
}

/* Buttons: match .btn-primary (navy), crimson accent when pressed/active */
.wpfc-calendar-wrapper .fc button.fc-button {
  height: auto;
  padding: .4rem .85rem;
  font-size: .9rem !important;
  font-weight: 600;
  text-transform: capitalize;
  color: #fff;
  background: #002D72;
  border: 1px solid #002D72;
  border-radius: .25rem;
  box-shadow: none;
  text-shadow: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.wpfc-calendar-wrapper .fc .fc-button-group > .fc-button:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.wpfc-calendar-wrapper .fc .fc-button-group > .fc-button:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left-color: rgba(255, 255, 255, .35);
}
.wpfc-calendar-wrapper .fc button.fc-button:hover,
.wpfc-calendar-wrapper .fc button.fc-button.fc-state-hover {
  background: #0c3975;
  border-color: #0c3975;
  color: #fff;
}
.wpfc-calendar-wrapper .fc button.fc-button.fc-state-active,
.wpfc-calendar-wrapper .fc button.fc-button.fc-state-down {
  background: #AE1140;
  border-color: #AE1140;
  color: #fff;
}
.wpfc-calendar-wrapper .fc button.fc-button:focus-visible {
  outline: 3px solid #AE1140;
  outline-offset: 2px;
}
/* "today" while already on the current month: quiet outline instead of a faded navy block */
.wpfc-calendar-wrapper .fc button.fc-button.fc-state-disabled,
.wpfc-calendar-wrapper .fc button.fc-button:disabled {
  background: #fff;
  border-color: #dee2e6;
  color: #5a6270;
  opacity: 1;
  cursor: default;
}
.wpfc-calendar-wrapper .fc button .fc-icon {
  top: 0;
  margin: 0;
}

/* ---------- Grid ---------- */
.wpfc-calendar-wrapper .fc-unthemed td,
.wpfc-calendar-wrapper .fc-unthemed th,
.wpfc-calendar-wrapper .fc-unthemed thead,
.wpfc-calendar-wrapper .fc-unthemed tbody,
.wpfc-calendar-wrapper .fc-unthemed .fc-row,
.wpfc-calendar-wrapper .fc-unthemed .fc-divider,
.wpfc-calendar-wrapper .fc-unthemed .fc-popover {
  border-color: #dee2e6;
}
.wpfc-calendar-wrapper .fc-view-container {
  border-radius: .35rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(8, 36, 74, .08);
}

/* Weekday header: navy band like the site menu */
.wpfc-calendar-wrapper .fc-head .fc-day-header {
  background: #08244a;
  border-color: #08244a;
  color: #fff;
  font-size: .8rem !important;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .55rem 0;
}
.wpfc-calendar-wrapper .fc-unthemed .fc-head td,
.wpfc-calendar-wrapper .fc-unthemed thead.fc-head {
  border-color: #08244a;
}

/* FullCalendar sizes the month by aspect ratio; with full-title event cards a busy week overflows that box
   and gets its own scrollbar. Let the grid take its natural height and scroll with the page instead. */
.wpfc-calendar-wrapper .fc-scroller.fc-day-grid-container {
  height: auto !important;
  overflow: visible !important;
}
.wpfc-calendar-wrapper .fc-head .fc-head-container,
.wpfc-calendar-wrapper .fc-head-container > .fc-row {
  margin-right: 0 !important;
  border-right-width: 0 !important;
  background: #08244a;
}
.wpfc-calendar-wrapper .fc-body > tr > .fc-widget-content > .fc-day-grid-container > .fc-day-grid > .fc-row,
.wpfc-calendar-wrapper .fc-body .fc-row {
  border-right-width: 0 !important;
  margin-right: 0 !important;
}

/* Day numbers */
.wpfc-calendar-wrapper .fc-basic-view .fc-day-top .fc-day-number {
  font-size: .85rem !important;
  font-weight: 600;
  color: #5a6270;
  padding: .35rem .5rem;
}
.wpfc-calendar-wrapper .fc-basic-view .fc-body .fc-row {
  min-height: 6.5em;
}

/* Days outside the month: grey wash rather than near-invisible numbers */
.wpfc-calendar-wrapper .fc-day-top.fc-other-month {
  opacity: 1;
}
.wpfc-calendar-wrapper .fc-day-top.fc-other-month .fc-day-number {
  color: #9aa1ab;
  font-weight: 400;
}
.wpfc-calendar-wrapper .fc-bg td.fc-other-month {
  background: #f8f9fa;
}

/* Today: light blue cell, crimson badge on the date */
.wpfc-calendar-wrapper .fc-unthemed td.fc-today {
  background: #eef2f8;
  border-style: solid;
}
.wpfc-calendar-wrapper .fc-basic-view .fc-day-top.fc-today .fc-day-number {
  background: #AE1140;
  color: #fff;
  border-radius: 999px;
  min-width: 1.75em;
  line-height: 1.75em;
  padding: 0 .35em;
  margin: .25rem .3rem 0 0;
  text-align: center;
}

/* ---------- Events ---------- */
.wpfc-calendar-wrapper .fc-event {
  border-radius: .25rem;
  font-size: .8rem !important;
  line-height: 1.35;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
  transition: filter .15s ease, box-shadow .15s ease;
}
/* Event "cards": start time on its own line, full title wrapped (up to 3 lines) instead of one cut-off line */
.wpfc-calendar-wrapper .fc-day-grid-event {
  margin: 3px 4px 0;
  padding: 4px 7px 5px;
  font-size: .85rem !important;
}
.wpfc-calendar-wrapper .fc-day-grid-event .fc-content {
  white-space: normal;
  overflow: visible;
}
.wpfc-calendar-wrapper .fc-day-grid-event .fc-time {
  display: block;
  font-size: .75rem !important;
  font-weight: 700;
  letter-spacing: .02em;
  opacity: .92;
}
.wpfc-calendar-wrapper .fc-day-grid-event .fc-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
/* Location line (js/calendar.js) */
.wpfc-calendar-wrapper .cetl-event-location {
  display: block;
  font-size: .75rem !important;
  line-height: 1.3;
  opacity: .9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: .1rem;
}
.wpfc-calendar-wrapper .fc-list-item-title .cetl-event-location {
  font-size: .82rem !important;
  color: #5a6270;
  opacity: 1;
  white-space: normal;
  margin-top: .15rem;
}

/* Multi-day events keep a single line so the bar reads as one span */
.wpfc-calendar-wrapper .fc-day-grid-event.fc-not-start .fc-title,
.wpfc-calendar-wrapper .fc-day-grid-event.fc-not-end .fc-title {
  -webkit-line-clamp: 1;
  line-clamp: 1;
}
/* Hover/focus: lift the card and underline the title so it reads as a link with more behind it */
.wpfc-calendar-wrapper a.fc-event:hover,
.wpfc-calendar-wrapper a.fc-event:focus {
  filter: brightness(.9);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .22);
  transform: translateY(-1px);
  text-decoration: none !important;
}
.wpfc-calendar-wrapper a.fc-event:hover .fc-title,
.wpfc-calendar-wrapper a.fc-event:focus .fc-title {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Hint under the calendar that events open details (text added by functions.php) */
.cetl-calendar-hint {
  margin: .6rem 0 0;
  color: #5a6270;
  font-size: .875rem;
}
.cetl-calendar-hint .cetl-hint-touch { display: none; }
@media (hover: none) {
  .cetl-calendar-hint .cetl-hint-pointer { display: none; }
  .cetl-calendar-hint .cetl-hint-touch { display: inline; }
}
.wpfc-calendar-wrapper a.fc-event:focus-visible {
  outline: 2px solid #08244a;
  outline-offset: 1px;
}

/* "+ more" link and its popover */
.wpfc-calendar-wrapper a.fc-more {
  display: inline-block;
  margin: 2px 6px;
  font-size: .8rem !important;
  font-weight: 600;
  color: #AE1140;
}
.wpfc-calendar-wrapper .fc-more-popover {
  border-radius: .35rem;
  box-shadow: 0 6px 18px rgba(8, 36, 74, .18);
  overflow: hidden;
}
.wpfc-calendar-wrapper .fc-unthemed .fc-popover .fc-header {
  background: #08244a;
  color: #fff;
  padding: .4rem .6rem;
  font-weight: 600;
}
.wpfc-calendar-wrapper .fc-unthemed .fc-popover .fc-header .fc-close {
  color: #fff;
  opacity: .8;
}

/* ---------- List view (listMonth; the default on phones, see js/calendar.js) ---------- */
.wpfc-calendar-wrapper .fc-list-view .fc-scroller {
  height: auto !important;
  overflow: visible !important;
}
.wpfc-calendar-wrapper .fc-list-view {
  border-color: #dee2e6;
  border-radius: .35rem;
  overflow: hidden;
}
.wpfc-calendar-wrapper .fc-list-table td {
  padding: .7rem 1rem;
  vertical-align: top;
}
/* Day headings: navy band, weekday left and date right */
.wpfc-calendar-wrapper .fc-unthemed .fc-list-heading td {
  background: #08244a;
  border-color: #08244a;
  color: #fff;
  padding: .5rem 1rem;
}
.wpfc-calendar-wrapper .fc-list-heading a {
  color: #fff;
  text-decoration: none !important;
}
.wpfc-calendar-wrapper .fc-list-heading-main {
  font-family: inherit; /* site sans-serif */
  font-size: 1rem !important;
  font-weight: 700;
}
.wpfc-calendar-wrapper .fc-list-heading-alt {
  font-size: .85rem !important;
  font-weight: 600;
  color: #dfe8f3 !important;
  padding-top: .1rem;
}
.wpfc-calendar-wrapper .fc-list-heading.cetl-today td {
  background: #AE1140;
  border-color: #AE1140;
}
/* Event rows */
.wpfc-calendar-wrapper .fc-list-item-time {
  color: #5a6270;
  font-size: .85rem !important;
  font-weight: 700;
  white-space: nowrap;
  padding-right: .5rem !important;
}
.wpfc-calendar-wrapper .fc-list-item-marker {
  padding-left: 0 !important;
  padding-right: .25rem !important;
}
.wpfc-calendar-wrapper .fc-list-item-marker .fc-event-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-top: .2rem;
}
.wpfc-calendar-wrapper .fc-list-item-title {
  width: 100%;
}
.wpfc-calendar-wrapper .fc-list-item-title a {
  color: #08244a;
  font-weight: 600;
  line-height: 1.35;
}
.wpfc-calendar-wrapper .fc-unthemed .fc-list-item:hover td {
  background: #eef2f8;
}
.wpfc-calendar-wrapper .fc-list-item:hover .fc-list-item-title a {
  color: #AE1140;
  text-decoration: underline !important;
}
.wpfc-calendar-wrapper .fc-list-empty-wrap2 {
  position: static;
}
.wpfc-calendar-wrapper .fc-unthemed .fc-list-empty {
  background: #f8f9fa;
  color: #5a6270;
  padding: 2.5rem 1rem;
}
@media (max-width: 767px) {
  .wpfc-calendar-wrapper .fc-list-table td { padding: .65rem .6rem; }
  .wpfc-calendar-wrapper .fc-list-item-time { font-size: .78rem !important; }
}

/* Loading overlay */
.wpfc-calendar-wrapper div.wpfc-loading {
  background-color: rgba(255, 255, 255, .85);
}

/* ---------- Event tooltip (Tippy "light-border") ---------- */
.tippy-box[data-theme~='light-border'] {
  border: 1px solid #dee2e6;
  border-top: 3px solid #AE1140;
  border-radius: .35rem;
  box-shadow: 0 8px 24px rgba(8, 36, 74, .18);
  color: #212529;
  font-size: .9rem;
}
.tippy-box[data-theme~='light-border'] .tippy-content {
  padding: .75rem .9rem;
}
.tippy-box[data-theme~='light-border'] .em-item-title,
.tippy-box[data-theme~='light-border'] .em-item-title a {
  font-family: inherit; /* site sans-serif */
  font-size: 1rem;
  line-height: 1.35;
  color: #08244a;
}
/* Featured images arrive full size; keep them a banner, not the whole tooltip */
.tippy-box[data-theme~='light-border'] .em-event-image img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  background: #eef2f8;
  border-radius: .25rem;
  margin-bottom: .6rem;
}
.tippy-box[data-theme~='light-border'] .em-item-meta-line {
  color: #5a6270;
}

/* ---------- Small screens ---------- */
@media (max-width: 767px) {
  .wpfc-calendar-wrapper .fc-toolbar .fc-center {
    order: 0;
    flex-basis: 100%;
  }
  .wpfc-calendar-wrapper .fc-toolbar .fc-left,
  .wpfc-calendar-wrapper .fc-toolbar .fc-right { flex: 1 1 auto; }
  .wpfc-calendar-wrapper .fc-toolbar h2 { font-size: 1.3rem !important; }
  .wpfc-calendar-wrapper .fc-head .fc-day-header {
    font-size: .7rem !important;
    letter-spacing: 0;
  }
  .wpfc-calendar-wrapper .fc-basic-view .fc-body .fc-row { min-height: 4.5em; }
  /* Cells are ~45px wide: show the time and the first words of the title */
  .wpfc-calendar-wrapper .fc-day-grid-event {
    margin: 2px 1px 0;
    padding: 2px 3px;
    font-size: .68rem !important;
  }
  .wpfc-calendar-wrapper .fc-day-grid-event .fc-time { font-size: .62rem !important; }
  .wpfc-calendar-wrapper .fc-day-grid-event .cetl-event-location { display: none; }
  /* Break only between words; a clipped long word reads better than "Teachi / ng" */
  .wpfc-calendar-wrapper .fc-day-grid-event .fc-title {
    -webkit-line-clamp: 3;
    line-clamp: 3;
    font-weight: 600;
    overflow-wrap: normal;
    word-break: normal;
  }
}
