/* =========================================================
   CALENDAR
   The events page (calendar.html) and the Upcoming Events
   agenda on the homepage: FullCalendar 7 with the Bootstrap 5
   theme, restyled in my colors, plus the pop-up that shows an
   event's details. js/calendar.js adds the rck-* class names
   to FullCalendar's parts.
   Loaded after theme.css and site.css.
   ========================================================= */

/* =========================================================
   PAGE LAYOUT
   The yellow area stretches to the bottom of the screen
   even when there are only a few events.
   ========================================================= */

body.calendar-page-body {
  min-height: 100vh;
  min-height: 100dvh; /* phones: the visible height, not counting the browser's address bar */

  display: flex;
  flex-direction: column;
}

/* Main fills everything below the navbar; Bootstrap's .container sets the width */
.calendar-page {
  flex: 1 1 auto;

  display: flex;
  flex-direction: column;

  padding-top: 1rem;
  padding-bottom: 1rem;
}

/* =========================================================
   PAGE HEADING
   ========================================================= */

.calendar-page-header {
  margin-bottom: 0.75rem;
}

.calendar-page-title {
  color: var(--rck-teal);

  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
}

/* =========================================================
   CALENDAR BOX
   Black box with a white border and a hard orange shadow.
   ========================================================= */

.calendar-shell {
  background: var(--rck-black);

  border: 2px solid var(--rck-white);
  border-radius: 16px;

  box-shadow: 7px 7px 0 var(--rck-orange);

  /* Trims the toolbar's and grid's square corners to the rounded border
     (the orange shadow is outside the box, so it isn't affected) */
  overflow: hidden;
}

/* =========================================================
   TOOLBAR
   Prev/next + Today on the left, month title in the middle,
   Month/List on the right.
   ========================================================= */

.rck-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 1rem;

  padding: 0.75rem 1rem;

  background: var(--rck-grey-dark);
  color: var(--rck-white);

  border-bottom: 2px solid var(--rck-white);
}

.rck-toolbar-section {
  display: flex;
  align-items: center;

  gap: 0.4rem;
}

.rck-toolbar-title {
  margin: 0;

  color: var(--rck-yellow);

  font-size: 1.25rem;
}

/* =========================================================
   TOOLBAR BUTTONS
   Teal, orange on hover, yellow for the selected view.
   ========================================================= */

.rck-calendar-button {
  min-height: 2.25rem;

  padding: 0.35rem 0.7rem;

  background: var(--rck-teal);
  color: var(--rck-white);

  border: 2px solid var(--rck-white);
  border-radius: 6px;

  font-size: 0.875rem;
  font-weight: bold;

  line-height: 1;

  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.rck-calendar-button:hover {
  background: var(--rck-orange);
  color: var(--rck-white);

  transform: translateY(-1px);
}

/* Clear outline when tabbing with a keyboard */
.rck-calendar-button:focus-visible {
  outline: 3px solid var(--rck-pink);
  outline-offset: 2px;
}

/* Today button while already on the current month: faded teal
   (Bootstrap would otherwise make disabled buttons blue) */
.rck-calendar-button:disabled {
  background: var(--rck-teal);
  border-color: var(--rck-white);
  color: var(--rck-white);
  opacity: 0.5;
}

/* The selected Month/List button */
.rck-calendar-button.active,
.rck-calendar-button[aria-pressed="true"] {
  background: var(--rck-yellow);
  color: var(--rck-black);
}

/* =========================================================
   MONTH VIEW
   ========================================================= */

/* Sun, Mon, Tue... row */
.rck-day-header {
  background: var(--rck-teal);
  color: var(--rck-white);
}

/* FullCalendar's Bootstrap theme also gives day cells and list date bars
   Bootstrap's bg-body-* classes, which use !important, so my colors need it too */
.rck-day-cell {
  background: var(--rck-black) !important;
  color: var(--rck-white);
}

/* Today's square is pink */
.rck-day-cell-today {
  background: var(--rck-pink) !important;
  color: var(--rck-black);
}

/* =========================================================
   EVENTS (month and list views)
   Teal blocks with white text; orange on hover.
   ========================================================= */

.rck-event {
  cursor: pointer;

  border-radius: 7px;
}

.rck-block-event {
  padding: 2px 5px;
}

/* White text everywhere in an event, and no faded look on past events */
.rck-event,
.rck-event * {
  color: var(--rck-white) !important;
  opacity: 1 !important;
}

.rck-event:hover {
  background: var(--rck-orange) !important;

  transform: translateY(-1px);
}

/* The start time ("1p") in month view, a bit bigger than FullCalendar's tiny default */
.rck-event-time {
  font-size: 1rem;
}

/* Long titles wrap instead of getting cut off */
.rck-event-title {
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
  line-height: 1;
}

/* =========================================================
   LIST VIEW
   ========================================================= */

/* The date bar above each day's events (pink for today) */
.rck-list-day-header {
  background: var(--rck-teal) !important; /* see .rck-day-cell */
  color: var(--rck-white);
}

.rck-list-day-header-today {
  background: var(--rck-pink) !important;
  color: var(--rck-black);
}

.rck-list-event {
  background: var(--rck-black);
  color: var(--rck-white);
}

/* Orange when hovered, tabbed to, or tapped
   (FullCalendar's Bootstrap theme would make the last two light grey) */
.rck-list-event:hover,
.rck-list-event:focus-visible,
.rck-list-event:active {
  background: var(--rck-orange);
}

/* Just wide enough for "10:00am" or "all-day"
   (FullCalendar would give the time up to 200px) */
.rck-list-event-time {
  width: 6rem;
}

/* Long titles wrap instead of getting cut off */
.rck-list-event-title {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* =========================================================
   PHONES
   js/calendar.js switches to the list view below 768px.
   ========================================================= */

@media (max-width: 767px) {
  .calendar-page {
    display: block;

    padding-top: 0.75rem;
    padding-bottom: 1.5rem;
  }

  .calendar-page-title {
    font-size: 2rem;
  }

  .calendar-shell {
    border-radius: 10px;
    box-shadow: 5px 5px 0 var(--rck-orange);
  }

  /* Title gets its own row above the buttons */
  .rck-toolbar {
    flex-wrap: wrap;

    gap: 0.5rem;

    padding: 0.6rem;
  }

  .rck-toolbar-title {
    width: 100%;

    text-align: center;

    order: -1;
  }

  .rck-calendar-button {
    font-size: 0.8rem;
  }
}

/* =========================================================
   EVENT POP-UP
   Bootstrap's modal (calendar.html, index.html), dressed like the calendar
   box. Bootstrap handles opening, closing (X, backdrop, Escape)
   and keyboard focus; js/calendar.js fills in the event.
   ========================================================= */

.event-modal {
  --bs-modal-width: 700px;
  --bs-modal-bg: var(--rck-black);
  --bs-modal-color: var(--rck-white);
  --bs-modal-border-color: var(--rck-white);
  --bs-modal-border-width: 2px;
  --bs-modal-border-radius: 1rem;
  --bs-modal-padding: 1.5rem;
  --bs-modal-header-padding: 1.5rem 1.5rem 0;
  --bs-modal-header-border-width: 0;
}

/* Hard orange shadow, like the calendar box */
.event-modal .modal-content {
  box-shadow: 8px 8px 0 var(--rck-orange);
}

/* Darker than Bootstrap's half-black backdrop (it's added to <body>, outside the modal) */
.modal-backdrop {
  --bs-backdrop-opacity: 0.75;
}

/* Date line (pink) next to the X, then title, location (yellow), description */
.event-modal-date {
  margin: 0;

  color: var(--rck-pink);
}

#event-modal-title {
  margin-bottom: 1rem;
}

.event-modal-location {
  margin-bottom: 1rem;

  color: var(--rck-yellow);
}

.event-modal-description {
  margin-top: 1rem;

  line-height: 1.5;
  font-weight: normal;
}

/* Links in the pop-up (Google Calendar descriptions can include them) */
.event-modal a {
  color: var(--rck-teal);

  font-weight: bold;
}

.event-modal a:visited {
  color: var(--rck-pink);
}

.event-modal a:hover {
  color: var(--rck-yellow);
}

/* Clear yellow outline when tabbing with a keyboard */
.event-modal a:focus-visible {
  outline: 2px solid var(--rck-yellow);
  outline-offset: 2px;
}

.event-modal .btn-close {
  --bs-btn-close-focus-shadow: 0 0 0 2px var(--rck-yellow);
}
