:root {
  --bg: #f9f7f1;
  --surface: #fffdf7;
  --surface-2: #fff8e6;
  --ink: #1c2431;
  --muted: #5c6676;
  --line: #ded8ca;
  --brand: #0f5fe8;
  --brand-soft: #e8efff;
  --accent: #ff7f32;
  --shadow: 0 14px 32px rgba(13, 25, 48, 0.07);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, sans-serif;
  background:
    radial-gradient(circle at 10% 20%, #fff2d6 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, #dae8ff 0%, transparent 44%),
    var(--bg);
  color: var(--ink);
}

body.modal-open {
  overflow: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(56px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
}

.bg-orb-a {
  width: 260px;
  height: 260px;
  background: #ffc089;
  top: 4rem;
  right: -3rem;
}

.bg-orb-b {
  width: 230px;
  height: 230px;
  background: #66a9ff;
  bottom: 1rem;
  left: -4rem;
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.hero {
  margin-bottom: 1rem;
}

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

h1 {
  margin: 0.4rem 0;
  font-family: "Fraunces", serif;
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  line-height: 1.05;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 48ch;
}

.meta-row {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-row span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.33rem 0.7rem;
  font-size: 0.83rem;
  color: var(--muted);
}

.card {
  background: color-mix(in oklab, var(--surface), #fff 55%);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.month-search-row {
  padding: 0.62rem 0.7rem;
  margin: 1.05rem 0 0.55rem;
}

.controls {
  padding: 0.7rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.05rem;
}

#monthLabel {
  margin: 0;
  text-align: center;
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  height: 2.35rem;
  width: 2.35rem;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.12s ease;
}

.btn:hover,
.btn:focus-visible {
  outline: none;
  border-color: var(--brand);
  transform: translateY(-1px);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(440px, 2fr);
  gap: 1rem;
}

.calendar {
  padding: 0.72rem;
  align-self: start;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.26rem;
}

.weekday-row {
  margin-bottom: 0.36rem;
}

.weekday-row span {
  text-align: center;
  font-size: 0.67rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.day {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  min-height: 64px;
  padding: 0.26rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.day:hover,
.day:focus-visible {
  border-color: var(--brand);
  outline: none;
}

.day.muted {
  opacity: 0.42;
}

.day.today {
  border-color: var(--accent);
}

.day.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.day-num {
  font-size: 0.8rem;
}

.dot-wrap {
  display: flex;
  gap: 0.18rem;
  flex-wrap: wrap;
}

.dot {
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 999px;
  background: var(--brand);
}

.dot.continuing {
  background: #b5becb;
}

.dot.start {
  background: var(--brand);
}

.dot.more {
  background: var(--accent);
}

.agenda {
  padding: 1rem;
}

.agenda-top {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
}

.month-search-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.58rem 0.72rem;
  font: inherit;
}

.month-search-wrap input:focus-visible {
  outline: 2px solid #98bcff;
  outline-offset: 1px;
}

.status {
  margin-bottom: 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.agenda-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.7rem;
  max-height: 560px;
  overflow: auto;
}

.event-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 0.72rem;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.event-card:hover,
.event-card:focus-visible {
  border-color: var(--brand);
  transform: translateY(-1px);
  outline: none;
}

.event-card.continuing {
  background: #f4f6f9;
  border-color: #d2d8e2;
}

.event-card.continuing .event-title a {
  color: #465164;
}

.event-card.continuing .event-time,
.event-card.continuing .event-location {
  color: #738097;
}

.event-state {
  margin: 0 0 0.24rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7a889e;
}

.event-time {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.event-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.3;
}

.event-title a {
  color: var(--ink);
  text-decoration: none;
}

.event-title a:hover {
  color: var(--brand);
}

.event-location {
  margin: 0.3rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 20, 36, 0.36);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 25;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.event-slideover {
  position: fixed;
  right: 0;
  top: 0;
  height: 100dvh;
  width: min(480px, 96vw);
  background: #fffdf8;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 36px rgba(18, 30, 56, 0.16);
  z-index: 26;
  transform: translateX(102%);
  transition: transform 0.22s ease;
  padding: 1rem;
  overflow: auto;
}

.event-slideover.open {
  transform: translateX(0);
}

.slideover-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.slideover-photo-wrap {
  margin: 0 0 0.6rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f2f4f8;
}

.slideover-photo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: cover;
}

.slideover-photo-strip {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
  overflow: auto;
}

.slideover-photo-thumb {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #fff;
  cursor: pointer;
}

.slideover-photo-thumb.active {
  border-color: var(--brand);
}

.slideover-photo-thumb img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 7px;
}

.slideover-close {
  line-height: 1;
}

.slideover-time {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: pre-line;
}

.slideover-location {
  margin: 0.15rem 0 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: pre-line;
}

.slideover-description {
  margin: 0.35rem 0 0.95rem;
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-line;
}

.slideover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: -0.25rem 0 0.7rem;
}

.slideover-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 10px;
  padding: 0.52rem 0.72rem;
  font-size: 0.83rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.slideover-action:hover {
  transform: translateY(-1px);
}

.slideover-action-primary {
  color: #fff;
  background: linear-gradient(135deg, #0f5fe8 0%, #2f78f0 100%);
  border-color: #0f5fe8;
}

.slideover-action-primary:hover {
  background: linear-gradient(135deg, #0b53cd 0%, #2b6ee0 100%);
}

.slideover-action-secondary {
  color: #305a95;
  background: #eef4ff;
  border-color: #cfe0ff;
}

.slideover-action-secondary:hover {
  border-color: #a8c6ff;
  background: #e6efff;
}

.slideover-action.disabled,
.slideover-action[aria-disabled="true"] {
  color: #8e97a8;
  background: #f2f4f8;
  border-color: #dde2ea;
  pointer-events: none;
  cursor: default;
  transform: none;
}

@media (max-width: 980px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .agenda-list {
    max-height: none;
  }

  .event-slideover {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100vw;
    max-height: min(82dvh, 700px);
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -18px 36px rgba(18, 30, 56, 0.16);
    transform: translateY(102%);
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .event-slideover.open {
    transform: translateY(0);
  }
}
