/* ==========================================================================
   db-calendar.css · Daelim Belefic child theme
   --------------------------------------------------------------------------
   Styles the events month calendar on News & Events (section S22).
   (WordPress copy: the grid's th/td rules are written ".db-calendar table.db-calendar__grid td" so they outrank
   Divi's post-content table styles.) Divi has
   no calendar module, so the calendar is a [db_calendar] shortcode placed in
   a Code module; the shortcode's PHP output and the static build produce the
   same markup, and db-calendar.js adds month switching. Only needed on pages
   that show the calendar.

   Expected markup (root: .db-calendar[data-calendar])
     .db-calendar__head      black bar: a.db-calendar__nav--prev, h3.db-calendar__title, a.db-calendar__nav--next
     .db-calendar__body      wraps the two views below (fades when the month changes)
       table.db-calendar__grid   month grid: th weekday heads; td per day with
                                 span.db-calendar__num and a.db-calendar__chip per event
                                 (td.is-out = days of the previous/next month, td.is-today)
       ol.db-calendar__agenda    list view: li.db-calendar__item (stamp + range, link,
                                 location) or li.db-calendar__empty

   Layout by width
     1024px and up   full grid: 7 equal columns, 142px tall day cells, chips
                     show date range / title / location
     768–1023px      smaller cells (100px); chips show the title only (2 lines max)
     767px and below the grid is hidden and the agenda list shows instead
                     (the agenda is also what reads first without JavaScript)
   ========================================================================== */

.db-calendar { --cal-line: var(--c-grey-300); color: var(--c-text); }

/* ---- header: black bar, "‹ SEPTEMBER 2026 ›" in white 36px/850 caps, 16 x 27 arrows,
        1px white-at-50% line underneath ---- */
.db-calendar__head {
  display: flex; align-items: center; justify-content: center; gap: calc(var(--sp-24) - 14px);
  padding-block: var(--sp-24); background-color: var(--c-black); color: var(--c-white);
  box-shadow: inset 0 -1px 0 var(--c-white-50);
}
.db-calendar__title {
  margin: 0; font-size: var(--fs-28); line-height: var(--lh-heading); font-weight: var(--fw-black); text-transform: uppercase;
  min-width: 0; text-align: center;
}
/* month arrows: 44px hit area; nudge 3px outward on hover; dimmed and inert at the first/last month */
.db-calendar__nav {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  color: var(--c-white); cursor: pointer; transition: translate var(--dur-instant) var(--ease-enter);
}
.db-calendar__nav svg { display: block; width: 16px; height: 27px; }
.db-calendar__nav--prev svg { scale: -1 1; } /* both arrow SVGs point right; the previous arrow is mirrored */
.db-calendar__nav:hover { color: var(--c-white); }
.db-calendar__nav--prev:not([aria-disabled="true"]):hover { translate: calc(-1 * var(--nudge)) 0; }
.db-calendar__nav--next:not([aria-disabled="true"]):hover { translate: var(--nudge) 0; }
.db-calendar__nav[aria-disabled="true"] { opacity: var(--o-disabled); cursor: default; }
.db-calendar__nav:focus-visible { outline-color: var(--c-focus-on-dark); outline-offset: -2px; }

/* ---- month change: the body fades out in 150ms (ease-in) and back in over 200ms (ease-out);
        the height is not animated ---- */
.db-calendar__body { transition: opacity 200ms var(--ease-enter); }
.db-calendar__body.is-out { opacity: 0; transition: opacity 150ms var(--ease-exit); }

/* ---- grid: 64px black weekday row; 7 equal columns; 142px day cells with 1px grey lines ---- */
.db-calendar__grid { width: 100%; table-layout: fixed; border-collapse: collapse; border-spacing: 0; }
.db-calendar table.db-calendar__grid th {
  height: var(--h-cal-weekday); padding: 0; background-color: var(--c-black); color: var(--c-white); text-align: center; vertical-align: middle;
  font-size: var(--fs-20); line-height: var(--lh-tight); font-weight: var(--fw-semibold); text-transform: uppercase;
}
.db-calendar table.db-calendar__grid td {
  height: var(--h-cal-cell); padding: var(--sp-12); vertical-align: top; border: var(--bw-hair) solid var(--cal-line);
}
.db-calendar__num { display: block; font-size: var(--fs-20); line-height: var(--lh-tight); font-weight: var(--fw-semibold); color: var(--c-black); }
.db-calendar table.db-calendar__grid td.is-out .db-calendar__num { color: var(--c-blue-100); }
/* today: red day number and a red bar along the top of the cell */
.db-calendar table.db-calendar__grid td.is-today .db-calendar__num { color: var(--c-red); }
.db-calendar table.db-calendar__grid td.is-today { box-shadow: inset 0 3px 0 var(--c-red); }

/* ---- event chip: red box, 6px padding, 12px/1.4/600 white text (not uppercase), first chip 21px
        below the day number; the whole chip links to the event ---- */
.db-calendar__chip {
  display: block; margin-top: 21px; padding: var(--sp-6); background-color: var(--c-chip-bg); color: var(--c-white);
  font-size: var(--fs-12); line-height: var(--lh-normal); font-weight: var(--fw-semibold); text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-standard);
}
.db-calendar__chip + .db-calendar__chip { margin-top: var(--sp-6); }
.db-calendar__chip > span { display: block; }
.db-calendar__chip:hover { background-color: var(--c-red-600); color: var(--c-white); }
.db-calendar__chip:focus-visible { outline: var(--bw-focus) solid var(--c-white); outline-offset: -4px; }

/* ---- agenda list (phone view, and the no-JavaScript reading order) ---- */
.db-calendar__agenda { display: none; list-style: none; margin: 0; padding: 0; }
.db-calendar__item { display: flex; align-items: flex-start; gap: var(--sp-16); padding-block: var(--sp-16); border-bottom: var(--bw-hair) solid var(--cal-line); }
/* 56px red stamp: weekday over day number */
.db-calendar__stamp {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 56px; height: 56px;
  background-color: var(--c-red); color: var(--c-white); text-transform: uppercase;
}
.db-calendar__stamp > span:first-child { font-size: var(--fs-12); line-height: var(--lh-normal); font-weight: var(--fw-semibold); }
.db-calendar__stamp > span:last-child { font-size: 20px; line-height: var(--lh-tight); font-weight: var(--fw-black); }
.db-calendar__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.db-calendar__range, .db-calendar__loc { font-size: var(--fs-16); line-height: var(--lh-normal); font-weight: var(--fw-medium); }
.db-calendar__link { font-size: var(--fs-18); line-height: var(--lh-normal); font-weight: var(--fw-semibold); color: var(--c-text); text-decoration: none; }
.db-calendar__link:hover { color: var(--c-blue); text-decoration: underline; }
.db-calendar__empty { padding-block: var(--sp-24); font-size: var(--fs-16); line-height: var(--lh-normal); font-weight: var(--fw-medium); border-bottom: var(--bw-hair) solid var(--cal-line); }
.db-calendar__empty a { font-weight: var(--fw-semibold); white-space: nowrap; }

/* ---- tablet (768–1023px): smaller cells, 40px weekday row, chips show the title only (2 lines max) ---- */
@media (max-width: 1023px) {
  .db-calendar table.db-calendar__grid th { height: 40px; }
  .db-calendar table.db-calendar__grid td { height: 100px; padding: var(--sp-10); }
  .db-calendar__chip { margin-top: var(--sp-10); }
  .db-calendar__chip > span:not(:nth-child(2)) { display: none; }
  .db-calendar__chip > span:nth-child(2) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
}
/* ---- phone (767px and below): the agenda list replaces the grid ---- */
@media (max-width: 767px) {
  .db-calendar__head { gap: 0; padding-block: var(--sp-16); }
  .db-calendar__grid { display: none; }
  .db-calendar__agenda { display: block; }
  /* the same size as the event list right under the calendar (S23: Date Box preset, date text fs-28, title like H3 List)
     so the two lists read as one (Dan, 11-11: the calendar's 56px stamp looked small next to it). The stamp stays red. */
  .db-calendar__item { align-items: center; gap: var(--sp-24); }
  .db-calendar__stamp { width: clamp(6rem, 5.0704vw + 4.8116rem, 9.375rem); height: clamp(6rem, 5.0704vw + 4.8116rem, 9.375rem); }
  .db-calendar__stamp > span:first-child,
  .db-calendar__stamp > span:last-child { font-size: var(--gvid-fs-28); line-height: 1.28; font-weight: var(--fw-black); }
  .db-calendar__link { font-size: var(--gvid-fs-24); line-height: var(--gvid-lh-title); }
}
