*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --navy: #0a0e27;
  --purple: #2a1b5e;
  --gold: #d4af37;
  --gold-light: #f0d878;
  --text: #f5f7ff;
  --event-dot: #5dade2;
  --today: #e74c3c;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Montserrat", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(88, 42, 138, 0.35), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(26, 92, 138, 0.25), transparent 40%),
    linear-gradient(180deg, var(--navy) 0%, #050814 100%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(10, 14, 39, 0.9);
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
}

.nav-brand,
.nav-link {
  color: var(--gold-light);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  text-align: center;
  flex: 1;
}

.calendar-app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toolbar-left h2 {
  margin: 0;
  min-width: 11rem;
  text-align: center;
  font-size: 1.25rem;
  color: var(--gold-light);
}

.toolbar-left button,
.view-btn,
.close-btn {
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 0.5rem;
  background: rgba(42, 27, 94, 0.65);
  color: var(--gold-light);
  font: inherit;
  cursor: pointer;
}

.toolbar-left button {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.4rem;
  line-height: 1;
}

.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.view-btn {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.view-btn.active {
  background: rgba(212, 175, 55, 0.25);
  border-color: var(--gold);
}

#search {
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 0.5rem;
  background: rgba(12, 16, 40, 0.8);
  color: var(--text);
  font: inherit;
  min-width: 220px;
}

.range-note {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  opacity: 0.8;
}

.feed-loading {
  margin-bottom: 1rem;
  padding: 0.65rem 1rem;
  border-radius: 0.5rem;
  background: rgba(42, 27, 94, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.25);
  font-size: 0.85rem;
  text-align: center;
}

.feed-loading.hidden {
  display: none;
}

.source-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  font-size: 0.78rem;
}

.source-label {
  opacity: 0.75;
}

.source-chip {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(93, 173, 226, 0.2);
  border: 1px solid rgba(93, 173, 226, 0.35);
}

.source-warn {
  color: #f0d878;
  opacity: 0.85;
}

.event-source {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.3rem;
  background: rgba(212, 175, 55, 0.15);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gold-light);
}

.event-card a {
  color: var(--gold-light);
}

.event-title-link {
  text-decoration: none;
}

.event-title-link:hover {
  text-decoration: underline;
}

.event-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
}

.event-meta a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.calendar-view {
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 0.85rem;
  overflow-x: auto;
  background: rgba(12, 16, 40, 0.6);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(5.5rem, auto);
  width: 100%;
  min-width: 280px;
}

.weekday-cell {
  padding: 0.65rem 0.25rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold-light);
  text-transform: uppercase;
  background: rgba(42, 27, 94, 0.5);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.calendar-grid > :nth-child(7n) {
  border-right: none;
}

.day-cell {
  min-width: 0;
  min-height: 5.5rem;
  padding: 0.4rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.15s ease;
  overflow: visible;
  align-self: stretch;
}

.day-cell:hover:not(.empty):not(.disabled) {
  background: rgba(212, 175, 55, 0.08);
}

.day-cell.empty {
  background: rgba(0, 0, 0, 0.15);
  cursor: default;
}

.day-cell.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.day-cell.today .day-num {
  background: var(--today);
  color: #fff;
}

.day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
}

.day-events {
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.day-event-pill {
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  background: rgba(93, 173, 226, 0.25);
  font-size: 0.6rem;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.list-view ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.event-card {
  padding: 1rem 1.15rem;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 0.75rem;
  background: rgba(12, 16, 40, 0.75);
}

.event-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--gold-light);
}

.event-meta {
  margin: 0.2rem 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

.event-meta strong {
  color: var(--gold);
  font-weight: 600;
}

.event-date-tag {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
  background: rgba(212, 175, 55, 0.15);
  font-size: 0.75rem;
  font-weight: 600;
}

.day-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  width: min(100%, 380px);
  height: 100%;
  padding: 1.25rem;
  border-left: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(10, 14, 39, 0.97);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
}

.day-panel h3 {
  margin: 0 2rem 1rem 0;
  color: var(--gold-light);
}

.day-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  line-height: 1;
}

.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.7;
}

.site-footer p {
  margin: 0.35rem 0;
}

.no-events {
  padding: 2rem;
  text-align: center;
  opacity: 0.7;
}

@media (max-width: 700px) {
  .nav-title {
    font-size: 0.9rem;
  }

  .day-cell {
    min-height: 4rem;
  }

  .day-event-pill {
    font-size: 0.52rem;
    padding: 0.1rem 0.25rem;
  }
}
