/* Calendar-specific layout. Color tokens (--bg-dark, --bg-dark-2, --accent,
   --text-light, --text-muted, --border) come from map.css's :root, loaded
   before this file, so the calendar matches the map's existing palette. */

html, body {
  margin: 0; min-height: 100%; height: auto;
  /* map.css (loaded before this file, for its color tokens) sets html/body
     to a hard height:100% + overflow:hidden -- correct for the full-screen
     Leaflet map, wrong here: a 5- or 6-row month's actual content height
     often exceeds the viewport/iframe height by a modest amount, and hidden
     overflow was silently clipping that instead of letting the page scroll
     to it. Override both back to normal scrolling behavior. */
  overflow-y: auto; overflow-x: hidden;
  background: var(--bg-dark); color: var(--text-light);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
#cal-app { min-height: 100vh; display: flex; flex-direction: column; }

#cal-header {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
#cal-logo { height: 34px; width: auto; }
#cal-heading { font-size: 18px; margin: 0; flex: 1 0 auto; }
#cal-submit-btn {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 7px 14px; border-radius: 20px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); font-size: 13px; font-weight: 600;
  text-decoration: none;
}
#cal-submit-btn:hover { background: var(--accent); color: var(--bg-dark); }
#cal-nav { display: flex; align-items: center; gap: 12px; margin-left: auto; }
#cal-nav button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-dark-2); color: var(--text-light); cursor: pointer; font-size: 15px;
}
#cal-nav button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
#cal-nav button:disabled { opacity: 0.35; cursor: not-allowed; }
#cal-month-label { font-weight: 700; font-size: 15px; min-width: 140px; text-align: center; }

#cal-grid-wrap { padding: 16px 20px 40px; max-width: 900px; margin: 0 auto; width: 100%; box-sizing: border-box; }
#cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); margin-bottom: 8px; text-align: center;
}
#cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-dark-2); color: var(--text-light); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-family: inherit; font-size: 13px; padding: 0;
}
.cal-cell:hover:not(:disabled) { border-color: var(--accent); }
.cal-cell:disabled { cursor: default; opacity: 0.4; }
.cal-cell-empty { visibility: hidden; border: none; background: none; }
.cal-cell-today .cal-cell-num { color: var(--accent); font-weight: 700; }
/* Replaces the old plain dot: a blurred glow over the whole cell frame,
   plus a small "x events" label under the day number. */
.cal-cell-has-events {
  border-color: rgba(241, 174, 41, 0.55);
  box-shadow: 0 0 12px 2px rgba(241, 174, 41, 0.55);
}
.cal-cell-has-events:hover:not(:disabled) {
  box-shadow: 0 0 16px 3px rgba(241, 174, 41, 0.75);
}
.cal-cell-count { font-size: 9.5px; font-weight: 600; line-height: 1.1; color: var(--accent); text-align: center; }

#cal-agenda { display: none; padding: 8px 16px 40px; max-width: 600px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.cal-agenda-empty { color: var(--text-muted); font-size: 13.5px; padding: 24px 0; text-align: center; }

.cal-event-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-dark-2); color: var(--text-light);
  cursor: pointer; font-family: inherit; margin-bottom: 8px;
}
.cal-event-row:hover { border-color: var(--accent); }
.cal-event-row-venue { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.cal-event-row-title { font-size: 14px; font-weight: 700; }
.cal-event-row-when { font-size: 12px; color: var(--text-muted); }

/* Day panel: sheet anchored to the bottom (works well on both mobile and desktop). */
#cal-day-panel {
  position: fixed; inset: 0; z-index: 5400;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.2s ease;
}
#cal-day-panel.hidden { display: none; }
#cal-day-panel.cal-panel-visible { opacity: 1; }
#cal-day-panel-inner {
  position: relative; width: min(480px, 100%); max-height: 75vh; overflow-y: auto;
  background: var(--bg-dark); border: 1px solid var(--border); border-radius: 16px 16px 0 0;
  padding: 24px 20px 20px; transform: translateY(16px); transition: transform 0.2s ease;
}
#cal-day-panel.cal-panel-visible #cal-day-panel-inner { transform: translateY(0); }
#cal-day-panel-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-dark-2); color: var(--text-light);
  cursor: pointer; font-size: 15px; line-height: 1;
}
#cal-day-panel-close:hover { border-color: var(--accent); color: var(--accent); }
#cal-day-panel-title { margin: 0 0 14px; padding-right: 24px; font-size: 17px; }

/* Event detail modal -- same information the map popup shows for an
   event: image, venue, when, description, link. */
#cal-detail-overlay {
  position: fixed; inset: 0; z-index: 5500;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; transition: opacity 0.2s ease;
}
#cal-detail-overlay.hidden { display: none; }
#cal-detail-overlay.cal-detail-visible { opacity: 1; }
#cal-detail-modal {
  position: relative; width: min(440px, 100%); max-height: 85vh; overflow-y: auto;
  background: var(--bg-dark); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5); padding: 28px 24px 24px;
  transform: scale(0.94) translateY(8px); transition: transform 0.2s ease;
}
#cal-detail-overlay.cal-detail-visible #cal-detail-modal { transform: scale(1) translateY(0); }
#cal-detail-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-dark-2); color: var(--text-light);
  cursor: pointer; font-size: 15px; line-height: 1;
}
#cal-detail-close:hover { border-color: var(--accent); color: var(--accent); }
.cal-detail-image {
  display: block; width: 100%; height: auto; max-height: 320px; object-fit: contain;
  background: var(--bg-dark-2); border-radius: 10px; margin-bottom: 14px;
  cursor: zoom-in;
}
.cal-detail-image.hidden { display: none; }
.cal-detail-venue { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 4px; }
.cal-detail-title { margin: 0 0 8px; padding-right: 24px; font-size: 19px; line-height: 1.3; }
.cal-detail-when { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.cal-detail-desc { font-size: 14px; line-height: 1.55; margin-bottom: 14px; }
.cal-detail-desc p { margin: 0 0 10px; }
.cal-detail-desc p:last-child { margin-bottom: 0; }
.cal-detail-desc a { color: var(--accent); }
.cal-detail-desc img { max-width: 100%; border-radius: 8px; }
.cal-detail-link { display: inline-block; color: var(--accent); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.cal-detail-link:hover { text-decoration: underline; }
.cal-detail-link.hidden { display: none; }

/* The sponsor bubble (markup/CSS shared with the map via map.css) defaults
   to bottom-right stacked above the News & Updates bubble on desktop and
   flips to top-left on mobile -- that flip exists specifically to dodge the
   MAP's mobile bottom-sheet sidebar. This page has neither that sidebar nor
   an announcement bubble to clear, and top-left here would sit right on top
   of #cal-logo/#cal-heading instead, so it stays in the true bottom-right
   corner on both breakpoints. */
#cehub-sponsor-bubble { right: 18px; bottom: 18px; }

@media (max-width: 767px) {
  #cal-grid-wrap { display: none; }
  #cal-agenda { display: block; }
  #cal-heading { display: none; } /* keeps the header compact on a small screen */
  #cal-header { padding: 14px 16px; }
  #cehub-sponsor-bubble { top: auto; left: auto; right: 14px; bottom: 14px; }
}
