/* The community calendar: a real month grid plus an agenda of full event cards, over the live
   forum tokens and glass renderer. All selectors are page-scoped (f-cal-*). */

.f-cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: start;
}
.f-cal-layout > * {
  min-width: 0;
}
.f-cal-main .f-h {
  flex-wrap: wrap;
  row-gap: 10px;
}
.f-cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.f-cal-month {
  min-width: 11ch;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-shadow: var(--ink);
}

/* ── the month grid: always a real 7x6 calendar, never reshuffled by content ── */
.f-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  padding: 14px 14px 4px;
}
.f-cal-dow {
  padding: 0 0 6px;
  color: var(--muted-dim);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}
.f-cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  aspect-ratio: 1;
  padding: 6px 2px 4px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.f-cal-cell:hover,
.f-cal-cell:focus-visible {
  border-color: var(--line-strong);
  background: rgba(0, 255, 136, 0.07);
}
.f-cal-cell.is-outside {
  color: var(--muted-dim);
  opacity: 0.45;
}
.f-cal-cell.is-today {
  border-color: var(--green);
  background: rgba(0, 255, 136, 0.1);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 136, 0.25);
}
.f-cal-cell.is-today .f-cal-daynum {
  color: var(--green-hot);
  font-weight: 700;
}
.f-cal-daynum {
  font-size: 13px;
  line-height: 1.6;
}
/* A day with at least one open event gets this gold ring behind the day number instead of a
   dot — big enough to read as "something is happening here" at a glance (owner, 2026-11-06). */
.f-cal-cell.has-events::before {
  content: "";
  position: absolute;
  top: 47%;
  left: 46.5%;
  width: 92%;
  height: 92%;
  transform: translate(-50%, -50%);
  background: url("calendar-event-ring.png") center / contain no-repeat;
  opacity: 0.9;
  pointer-events: none;
  z-index: 0;
}
.f-cal-cell.has-events .f-cal-daynum {
  position: relative;
  z-index: 2;
  color: #fff3cc;
  font-weight: 700;
  text-shadow: 0 0 6px #000, 0 0 14px #000, 0 2px 2px #000;
}
/* A day whose only event was cancelled keeps a small, muted dot: still findable, not "live". */
.f-cal-pip {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-top: 1px;
  background: var(--muted-dim);
}
.f-cal-more {
  position: absolute;
  z-index: 2;
  top: 3px;
  right: 4px;
  margin: 0;
  color: #fff3cc;
  font-size: 10px;
  font-weight: 700;
  text-shadow: 0 0 4px #000;
}

/* ── the agenda: full cards, one per event, anchored for the grid's day links ── */
.f-cal-list {
  display: flex;
  flex-direction: column;
}
.f-cal-card {
  display: flex;
  gap: 16px;
  padding: 16px 18px;
  border-top: 1px dashed var(--line);
  scroll-margin-top: 90px;
}
.f-cal-list .f-cal-card:first-child {
  border-top: 1px solid var(--line-strong);
}
.f-cal-card.is-cancelled {
  opacity: 0.6;
}
.f-cal-card.is-past {
  opacity: 0.7;
}
.f-cal-card-time {
  flex: 0 0 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.f-cal-card-date {
  color: var(--green-hot);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.f-cal-card-body {
  min-width: 0;
  flex: 1;
}
.f-cal-card-body h3 {
  margin: 0 0 4px;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.f-cal-card-body h3 a {
  text-decoration: none;
}
.f-cal-card-body h3 a:hover {
  text-decoration: underline;
}
.f-cal-card-loc {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
}
.f-cal-card-desc {
  margin: 0 0 6px;
  max-width: 64ch;
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* ── create-event form ── */
.f-cal-form {
  margin: 0 0 4px;
  border-top: 1px dashed var(--line-strong);
  border-bottom: 1px dashed var(--line-strong);
}
.f-cal-form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* ── single event page ── */
.f-cal-when {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 15px;
}
.f-cal-rsvp {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 4px;
}
.f-cal-attendees {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.f-cal-attendees li {
  color: var(--text);
  font-size: 13px;
}
.f-cal-event.is-cancelled .f-cal-when,
.f-cal-event.is-cancelled .f-poll-description {
  text-decoration: line-through;
  text-decoration-color: var(--muted-dim);
}

@media (max-width: 960px) {
  .f-cal-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .f-cal-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}
@media (max-width: 640px) {
  .f-cal-sidebar {
    display: block;
  }
  .f-cal-grid {
    gap: 2px;
    padding: 10px 8px 2px;
  }
  .f-cal-cell {
    padding: 3px 1px 2px;
  }
  .f-cal-daynum {
    font-size: 11.5px;
  }
  .f-cal-more {
    font-size: 8.5px;
  }
  .f-cal-form-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .f-cal-card {
    padding: 12px 14px;
    gap: 12px;
  }
  .f-cal-card-time {
    flex-basis: 58px;
    font-size: 10px;
  }
  .f-cal-card-date {
    font-size: 13px;
  }
}
@media (max-width: 420px) {
  .f-cal-dow {
    font-size: 9px;
  }
  .f-cal-pip {
    width: 4px;
    height: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .f-cal-cell {
    transition: none;
  }
}
