:root {
  --ink: #102c40;
  --ink-soft: #587083;
  --gold: #b8750b;
  --gold-dark: #754600;
  --navy: #143f5a;
  --line: rgba(16, 44, 64, 0.12);
  --white: rgba(255, 255, 255, 0.92);
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background: #85c8f4 url("assets/bright-horizon.png") center / cover fixed no-repeat;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background: rgba(241, 249, 253, 0.22);
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.calendar-shell { min-height: 100vh; padding: 20px clamp(18px, 3vw, 48px) 32px; }
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1440px, 100%);
  margin: 0 auto 28px;
}
.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--gold-dark);
  font-weight: 800;
  letter-spacing: 0.17em;
  text-decoration: none;
}
.header-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: saturate(1.35) drop-shadow(0 4px 8px rgba(122, 73, 0, 0.22));
}
.site-nav {
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 12px 32px rgba(17, 59, 86, 0.1);
  backdrop-filter: blur(16px);
}
.nav-link {
  padding: 9px 15px;
  border-radius: 999px;
  color: #29475d;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}
.nav-link.active { color: #fff; background: var(--navy); }

.calendar-workspace {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: 18px;
  width: min(1440px, 100%);
  margin: 0 auto;
}
.calendar-sidebar,
.calendar-panel {
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(249, 253, 255, 0.86);
  box-shadow: 0 24px 68px rgba(22, 65, 92, 0.17);
  backdrop-filter: blur(24px) saturate(1.1);
}
.calendar-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 700px;
  padding: 30px 24px;
  border-radius: 28px;
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--gold-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.calendar-sidebar h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2.55rem;
  line-height: 1;
}
.calendar-intro { margin: 13px 0 22px; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.55; }
.primary-button,
.secondary-button,
.delete-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 800;
}
.primary-button { border: 0; color: #fff; background: var(--navy); }
.primary-button:hover { background: #0c324b; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: #f4f8fa; }
.delete-button { border: 1px solid rgba(159, 47, 47, 0.22); color: #9d3030; background: #fff5f5; }

.upcoming-section { margin-top: 30px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-heading h2 { margin: 0; font-size: 0.95rem; }
.section-heading span { color: var(--ink-soft); font-size: 0.7rem; }
.upcoming-list { display: grid; gap: 8px; margin-top: 13px; }
.upcoming-event {
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 11px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  text-align: left;
}
.upcoming-event:hover { background: #fff; }
.event-stripe { border-radius: 99px; background: var(--event-color, var(--gold)); }
.upcoming-event strong,
.upcoming-event small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-event strong { font-size: 0.8rem; }
.upcoming-event small { margin-top: 3px; color: var(--ink-soft); font-size: 0.7rem; }
.empty-upcoming { padding: 22px 10px; color: var(--ink-soft); font-size: 0.78rem; line-height: 1.5; text-align: center; }
.privacy-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  margin-top: auto;
  padding-top: 22px;
  color: var(--ink-soft);
}
.privacy-note > span { color: #34735c; font-size: 1.1rem; }
.privacy-note p { margin: 0; font-size: 0.7rem; line-height: 1.45; }
.privacy-note strong { display: block; color: var(--ink); }

.calendar-panel { min-width: 0; padding: clamp(18px, 2.6vw, 34px); border-radius: 28px; }
.calendar-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.calendar-toolbar h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  text-align: center;
}
.toolbar-navigation { display: flex; gap: 6px; }
.toolbar-navigation button,
.view-select select {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.8rem;
  font-weight: 750;
}
.view-select { justify-self: end; }

#calendar { min-height: 620px; }
.fc { --fc-border-color: rgba(16, 44, 64, 0.1); --fc-page-bg-color: transparent; color: var(--ink); }
.fc .fc-scrollgrid { overflow: hidden; border-radius: 18px; background: rgba(255, 255, 255, 0.46); }
.fc .fc-col-header-cell { padding: 10px 0; background: rgba(232, 244, 249, 0.72); }
.fc .fc-col-header-cell-cushion { color: var(--ink-soft); font-size: 0.72rem; font-weight: 800; text-decoration: none; text-transform: uppercase; }
.fc .fc-daygrid-day-number { padding: 8px; color: var(--ink); font-size: 0.78rem; font-weight: 700; text-decoration: none; }
.fc .fc-day-today { background: rgba(255, 224, 128, 0.24) !important; }
.fc .fc-daygrid-day-frame { min-height: 92px; }
.fc .fc-event { padding: 2px 5px; border: 0; border-radius: 7px; font-size: 0.72rem; cursor: pointer; }
.fc .fc-list { border-radius: 16px; overflow: hidden; }
.fc .fc-list-day-cushion { background: #edf6fa; }
.fc .fc-list-event:hover td { background: #f5fafc; }

.event-dialog {
  width: min(510px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  color: var(--ink);
  background: rgba(252, 254, 255, 0.97);
  box-shadow: 0 30px 90px rgba(10, 38, 57, 0.32);
}
.event-dialog::backdrop { background: rgba(9, 28, 41, 0.5); backdrop-filter: blur(7px); }
.event-dialog form { display: grid; gap: 16px; padding: 28px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-heading h2 { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: 2rem; }
.dialog-close { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #f2f7f9; font-size: 1.25rem; }
.event-dialog label { display: grid; gap: 7px; color: var(--ink); font-size: 0.8rem; font-weight: 800; }
.event-dialog label small { color: var(--ink-soft); font-weight: 500; }
.event-dialog input,
.event-dialog select,
.event-dialog textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid rgba(16, 44, 64, 0.16);
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: #fff;
}
.event-dialog input:focus,
.event-dialog select:focus,
.event-dialog textarea:focus { border-color: rgba(20, 63, 90, 0.55); box-shadow: 0 0 0 3px rgba(20, 63, 90, 0.08); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; margin-top: 4px; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  background: #143f5a;
  box-shadow: 0 14px 34px rgba(12, 42, 60, 0.24);
  font-size: 0.8rem;
  font-weight: 700;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(255, 198, 44, 0.9);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  body { background-attachment: scroll; }
  .calendar-workspace { grid-template-columns: 1fr; }
  .calendar-sidebar { min-height: 0; }
  .privacy-note { margin-top: 24px; }
  .upcoming-list { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .calendar-shell { padding: 14px; }
  .site-header { align-items: flex-start; gap: 14px; margin-bottom: 18px; }
  .header-brand span { display: none; }
  .site-nav { overflow-x: auto; }
  .nav-link { padding: 8px 11px; font-size: 0.76rem; }
  .calendar-sidebar,
  .calendar-panel { border-radius: 22px; }
  .calendar-sidebar { padding: 24px 20px; }
  .upcoming-list { grid-template-columns: 1fr; }
  .calendar-toolbar { grid-template-columns: 1fr auto; }
  .calendar-toolbar h2 { grid-column: 1 / -1; grid-row: 1; }
  .toolbar-navigation { grid-column: 1; grid-row: 2; }
  .view-select { grid-column: 2; grid-row: 2; }
  #calendar { min-height: 540px; }
  .fc .fc-daygrid-day-frame { min-height: 66px; }
  .form-row { grid-template-columns: 1fr; }
  .dialog-actions { grid-template-columns: 1fr 1fr; }
  .dialog-actions span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
