:root {
  --background: #ffffff;
  --surface: #0f4158;
  --text: #0f4158;
  --muted: #657083;
  --border: #0f4158;
  --accent: #1f5f73;
  --accent-dark: #164756;
  --accent-soft: #e7f1f4;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.14);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  background: transparent;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
a {
  font: inherit;
}

.calendar-shell {
  width: 100%;
  padding: clamp(18px, 3vw, 38px);
}

.calendar-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.calendar-heading h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.05;
}

.calendar-intro {
  max-width: 330px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.status {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
}

.status[hidden] {
  display: none;
}

.status.error {
  border-color: #e3a7a7;
  background: #fff1f1;
  color: #8f1d1d;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.category-filter {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.category-filter:hover,
.category-filter:focus-visible,
.category-filter.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

#calendar {
  padding: clamp(12px, 2vw, 22px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* FullCalendar refinements */
.fc {
  --fc-border-color: var(--border);
  --fc-button-bg-color: var(--accent);
  --fc-button-border-color: var(--accent);
  --fc-button-hover-bg-color: var(--accent-dark);
  --fc-button-hover-border-color: var(--accent-dark);
  --fc-button-active-bg-color: var(--accent-dark);
  --fc-button-active-border-color: var(--accent-dark);
  --fc-today-bg-color: var(--accent-soft);
  color: var(--text);
}

.fc .fc-toolbar {
  gap: 12px;
}

.fc .fc-toolbar-title {
  font-size: clamp(1.1rem, 3vw, 1.55rem);
}

.fc .fc-button {
  border-radius: 10px;
  box-shadow: none;
  text-transform: capitalize;
}

.fc .fc-event {
  border: 0;
  border-radius: 7px;
  padding: 2px 4px;
  cursor: pointer;
}

.fc .fc-list-event:hover td {
  background: var(--accent-soft);
}

.calendar-event-hidden {
  display: none !important;
}

.event-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  box-shadow: var(--shadow);
}

.event-dialog::backdrop {
  background: rgba(10, 18, 31, 0.68);
  backdrop-filter: blur(4px);
}

.dialog-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: var(--surface);
}

.dialog-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #172033;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-image {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
}

.dialog-content {
  padding: clamp(22px, 5vw, 38px);
}

.dialog-category {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

.dialog-content h2 {
  margin: 0 45px 10px 0;
  font-size: clamp(1.55rem, 5vw, 2.35rem);
  line-height: 1.1;
}

.dialog-date,
.dialog-location {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.45;
}

.dialog-description {
  margin: 22px 0 0;
  white-space: pre-wrap;
  line-height: 1.65;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  color: white;
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--accent-dark);
}

.button-secondary {
  background: var(--surface);
  color: var(--accent-dark);
}

@media (max-width: 700px) {
  .calendar-shell {
    padding: 14px;
  }

  .calendar-heading {
    display: block;
  }

  .calendar-intro {
    margin-top: 12px;
  }

  #calendar {
    padding: 9px;
  }

  .fc .fc-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  .dialog-actions {
    display: grid;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #111827;
    --surface: #182235;
    --text: #f3f5f7;
    --muted: #b6c0cf;
    --border: #354155;
    --accent: #69b3c7;
    --accent-dark: #8ecddd;
    --accent-soft: #243c47;
  }

  .dialog-close {
    background: rgba(24, 34, 53, 0.94);
    color: #f3f5f7;
  }
}
