: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 {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.42rem;
  min-width: 0;
}

.hero-action-row {
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.meta-row span,
.meta-pill-button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.62rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.meta-pill-button {
  font-family: inherit;
  flex: 0 0 auto;
  font-weight: 650;
  cursor: pointer;
}

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

.meta-pill-button.active {
  background: var(--brand-soft);
  border-color: #bdd3ff;
  color: #1a4ea8;
}

.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.5rem 0.58rem;
  margin: 1.05rem 0 0.55rem;
  display: grid;
  gap: 0.42rem;
}

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

.month-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

#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-text {
  width: auto;
  min-width: 2.35rem;
  padding: 0 0.8rem;
  font-size: 0.88rem;
  font-weight: 600;
}

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

.btn:disabled {
  cursor: default;
  color: var(--muted);
  background: #f2f4f8;
  border-color: var(--line);
  transform: none;
}

.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-reverse;
  align-content: flex-start;
  max-height: 1.9rem;
  overflow: hidden;
}

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

.dot.beauty {
  background: #cb4f7d;
}

.dot.food {
  background: #f08f2e;
}

.dot.culture {
  background: #2a7dbf;
}

.dot.community {
  background: #2f9e5f;
}

.dot.other {
  background: #8a95a6;
}

.calendar-legend {
  margin-top: 0.56rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
}

.calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
}

.calendar-legend-label {
  font-size: 0.72rem;
  color: var(--muted);
}

.agenda {
  padding: 1rem;
}

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

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.map-toolbar .status {
  margin: 0;
  flex: 1;
}

.map-locate-btn {
  flex-shrink: 0;
}

.view-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.36rem;
  width: min(260px, 100%);
}

.view-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 10px;
  padding: 0.42rem 0.62rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

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

.view-tab.active {
  background: var(--brand-soft);
  color: #1a4ea8;
  border-color: #bdd3ff;
}

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.5rem 0.64rem;
  font: inherit;
  font-size: 0.9rem;
}

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

.month-search-wrap.collapsed {
  display: none;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.filter-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem;
}

.filter-label {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-segments {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.filter-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.34rem 0.58rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

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

.filter-chip.active {
  background: var(--brand-soft);
  border-color: #bdd3ff;
  color: #1a4ea8;
}

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

.agenda-view[hidden] {
  display: none;
}

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

.events-map {
  width: 100%;
  height: min(560px, 58vh);
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.leaflet-container {
  font-family: "Space Grotesk", system-ui, sans-serif;
}

.leaflet-popup-content-wrapper {
  border-radius: 14px;
}

.leaflet-container a.leaflet-popup-close-button {
  width: 44px !important;
  height: 44px !important;
  top: 2px !important;
  right: 2px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1 !important;
  font-size: 32px !important;
  font-weight: 500;
  color: #3e4c63;
  border-radius: 12px;
  touch-action: manipulation;
}

.leaflet-container a.leaflet-popup-close-button:hover,
.leaflet-container a.leaflet-popup-close-button:focus-visible {
  background: #eef3ff;
  color: #1f3d6b;
  outline: none;
}

.leaflet-popup-content {
  margin: 0.75rem;
}

.map-popup-location {
  margin: 0 0 0.48rem;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
  color: #25324a;
}

.map-popup-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.36rem;
}

.map-popup-item {
  margin: 0;
}

.map-popup-event {
  border: 1px solid #d8e3f7;
  background: #f7faff;
  color: #1f3d6b;
  text-align: left;
  padding: 0.45rem 0.55rem;
  font-family: inherit;
  width: 100%;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title arrow"
    "time arrow";
  align-items: center;
  gap: 0.12rem 0.46rem;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, transform 0.12s ease;
}

.map-popup-event-title {
  grid-area: title;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.28;
}

.map-popup-event-time {
  grid-area: time;
  font-size: 0.74rem;
  color: #5e6a7b;
}

.map-popup-event-arrow {
  grid-area: arrow;
  font-size: 0.9rem;
  color: #2e5fae;
}

.map-popup-event:hover,
.map-popup-event:focus-visible {
  border-color: #b6ccf5;
  background: #edf3ff;
  transform: translateY(-1px);
  outline: none;
}

.map-popup-more {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: #6d7788;
}

.event-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  position: relative;
  padding: 0.72rem;
  padding-right: 5.4rem;
  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: 0 0 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);
}

.event-meta-chips,
.slideover-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  margin: 0.42rem 0 0;
}

.slideover-chip-row {
  margin: -0.08rem 0 0.54rem;
}

.event-info-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d8dee8;
  background: #f7f8fb;
  color: #576275;
  border-radius: 999px;
  padding: 0.2rem 0.44rem;
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.event-info-chip.free {
  color: #1f5c3a;
  background: #e9f8ef;
  border-color: #bee8cf;
}

.event-info-chip.paid {
  color: #7d4d10;
  background: #fff3df;
  border-color: #f0d3a7;
}

.event-info-chip.unknown {
  color: #576275;
  background: #f4f6fa;
  border-color: #d8dee8;
}

.event-corner-chip {
  position: absolute;
  top: 0.5rem;
  right: 0.56rem;
  border-radius: 999px;
  font-size: 0.65rem;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.22rem 0.43rem;
  border: 1px solid transparent;
  z-index: 1;
}

.event-corner-chip.beauty {
  color: #7e173e;
  background: #fde8f0;
  border-color: #f6bfd2;
}

.event-corner-chip.food {
  color: #8d4f00;
  background: #fff0de;
  border-color: #f6d3a7;
}

.event-corner-chip.culture {
  color: #154272;
  background: #e8f1ff;
  border-color: #bdd4f7;
}

.event-corner-chip.community {
  color: #1f5c3a;
  background: #e7f8ef;
  border-color: #bfe8d0;
}

.event-corner-chip.other {
  color: #485468;
  background: #f0f3f8;
  border-color: #d4dbe5;
}

.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: 1900;
}

.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: 2000;
  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: center;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

#eventModalTitle {
  line-height: 1.12;
}

.slideover-photo-wrap {
  --slideover-photo-max-height: min(280px, 34vh);
  position: relative;
  display: grid;
  place-items: center;
  margin: 0 0 0.6rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  max-height: var(--slideover-photo-max-height);
  background:
    linear-gradient(180deg, rgba(242, 244, 248, 0.4), rgba(242, 244, 248, 0.88)),
    #f2f4f8;
  isolation: isolate;
}

.slideover-photo-wrap.loading {
  min-height: var(--slideover-photo-max-height);
}

.slideover-photo-backdrop {
  position: absolute;
  inset: -12%;
  width: 124%;
  height: 124%;
  object-fit: cover;
  filter: blur(20px) saturate(1.05);
  opacity: 0.42;
  transform: scale(1.05);
  z-index: 0;
}

.slideover-photo-wrap.loading .slideover-photo-backdrop,
.slideover-photo-wrap.loading .slideover-photo {
  opacity: 0;
}

.slideover-photo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 58%),
    linear-gradient(180deg, rgba(242, 244, 248, 0.08), rgba(242, 244, 248, 0.66));
  z-index: 1;
  pointer-events: none;
}

.slideover-photo-wrap.loading::after {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(242, 244, 248, 0.92)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 25%, rgba(255, 255, 255, 0.4) 37%, rgba(255, 255, 255, 0.08) 63%);
  background-size: auto, 220% 100%;
  animation: slideover-photo-loading 1.2s ease-in-out infinite;
}

.slideover-photo {
  position: relative;
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: var(--slideover-photo-max-height);
  object-fit: contain;
  background: transparent;
  z-index: 2;
}

@keyframes slideover-photo-loading {
  0% {
    background-position: 0 0, 100% 0;
  }
  100% {
    background-position: 0 0, -100% 0;
  }
}

.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 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.slideover-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0 0.4rem;
}

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

.slideover-category-pill {
  border-radius: 999px;
  font-size: 0.66rem;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.24rem 0.45rem;
  border: 1px solid transparent;
  white-space: nowrap;
}

.slideover-category-pill.beauty {
  color: #7e173e;
  background: #fde8f0;
  border-color: #f6bfd2;
}

.slideover-category-pill.food {
  color: #8d4f00;
  background: #fff0de;
  border-color: #f6d3a7;
}

.slideover-category-pill.culture {
  color: #154272;
  background: #e8f1ff;
  border-color: #bdd4f7;
}

.slideover-category-pill.community {
  color: #1f5c3a;
  background: #e7f8ef;
  border-color: #bfe8d0;
}

.slideover-category-pill.other {
  color: #485468;
  background: #f0f3f8;
  border-color: #d4dbe5;
}

.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;
}

.slideover-description p {
  margin: 0 0 0.75rem;
}

.slideover-description ul,
.slideover-description ol {
  margin: 0 0 0.85rem 1.15rem;
  padding: 0;
}

.slideover-description li {
  margin: 0.28rem 0;
}

.slideover-description a {
  color: #0b5bd3;
  font-weight: 650;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.slideover-description strong {
  font-weight: 750;
}

.slideover-description:empty {
  display: none;
}

.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;
  }

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

  .map-locate-btn {
    width: 100%;
    justify-content: center;
  }

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

  .events-map {
    height: min(420px, 52vh);
  }

  .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);
  }
}

@media (max-width: 560px) {
  .view-tabs {
    width: 100%;
  }

  .events-map {
    height: min(360px, 50vh);
  }
}
