:root {
  color-scheme: light;
  --bg: #f3f6f2;
  --surface: #ffffff;
  --text: #16221d;
  --muted: #62706a;
  --line: #d9e3dd;
  --accent: #256c55;
  --accent-2: #b84a2d;
  --shadow: 0 20px 60px rgba(31, 50, 41, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef3ef;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2.25rem;
  line-height: 1;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.brand-lockup {
  display: grid;
  width: clamp(270px, 30vw, 360px);
  justify-items: center;
  gap: 3px;
  min-width: 0;
}

.brand-logo-window {
  position: relative;
  width: 100%;
  aspect-ratio: 1.99;
  overflow: hidden;
}

.brand-logo {
  position: absolute;
  top: -27.7%;
  left: -12.7%;
  width: 129.7%;
  max-width: none;
  height: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.version-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.topbar-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.view-tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 3px;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
}

.view-tab.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(31, 50, 41, 0.1);
}

.view-tab svg,
.detail-action-button svg,
.icon-text-button svg,
.primary-button svg,
.clear-filters-button svg,
.collection-item svg,
.auth-icon svg,
.home-council-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.topbar-metrics span,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  padding: 8px 12px;
  color: var(--muted);
}

.topbar-metrics strong {
  color: var(--text);
}

.filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(155px, 0.85fr) minmax(150px, 0.8fr) minmax(270px, 1.25fr) auto;
  column-gap: 8px;
  row-gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.date-range-filter {
  min-width: 0;
  margin: 0 0 0 12px;
  border: 0;
  padding: 0;
}

.date-range-filter legend {
  width: 100%;
  margin-bottom: 6px;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

.date-range-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.date-range-inputs label {
  min-width: 0;
  gap: 3px;
  font-size: 0.72rem;
}

.filters > label {
  min-width: 0;
}

.filters input,
.filters select {
  width: 100%;
  min-width: 0;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

input,
select,
.ghost-button,
.primary-button,
.favorite-button,
.clear-filters-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 13px;
}

.ghost-button,
.primary-button,
.favorite-button,
.clear-filters-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-weight: 700;
}

.clear-filters-button {
  min-height: 36px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 0.78rem;
}

.primary-button,
.ghost-button[aria-pressed="true"],
.favorite-button.is-favorite {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: stretch;
}

.map-panel,
.detail-panel,
.list-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.map-panel {
  min-height: 620px;
  overflow: hidden;
}

.map {
  position: relative;
  min-height: 620px;
  height: 620px;
  z-index: 1;
}

.leaflet-container {
  font: inherit;
  background: #e8f1f2;
}

.leaflet-control-attribution {
  font-size: 0.72rem;
}

.festival-pin {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 999px 999px 999px 6px;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(20, 39, 32, 0.28);
  transform: rotate(-45deg);
}

.festival-pin span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  transform: rotate(45deg);
}

.festival-pin.is-selected {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.festival-pin.is-dimmed {
  opacity: 0.28;
}

.map-legend {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: calc(100% - 36px);
  z-index: 500;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.legend-symbol {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.85rem;
}

.council-tooltip {
  border: 0;
  border-radius: 6px;
  background: #173f33;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(20, 39, 32, 0.18);
}

.council-tooltip::before {
  border-top-color: #173f33;
}

path[role="button"]:focus {
  outline: none;
  stroke: #0b6b4f;
  stroke-width: 4;
}

path[role="button"] {
  cursor: pointer;
}

.detail-panel {
  padding: 22px;
  min-height: 620px;
  max-height: 620px;
  overflow: auto;
}

.empty-state {
  height: 100%;
  display: grid;
  align-content: center;
}

.empty-state p:last-child {
  color: var(--muted);
}

.festival-detail.hidden,
.hidden {
  display: none;
}

.festival-detail {
  scroll-margin-top: 14px;
}

.detail-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.detail-title h2 {
  margin-bottom: 6px;
  font-size: 1.6rem;
  line-height: 1.08;
}

.festival-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.festival-photo-frame {
  min-width: 0;
  margin: 0;
}

.festival-photo-frame a {
  display: block;
  overflow: hidden;
  border-radius: 6px;
  background: #e6ece8;
  aspect-ratio: 4 / 3;
}

.festival-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.festival-photo-frame figcaption {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.festival-photo-frame.is-unavailable {
  display: none;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.detail-action-button,
.icon-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 11px;
  cursor: pointer;
  font-weight: 800;
}

.detail-action-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.chip {
  font-size: 0.78rem;
  font-weight: 700;
}

.detail-block {
  margin: 18px 0;
}

.detail-block h3 {
  margin: 0 0 6px;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--accent);
}

.detail-block p {
  color: var(--muted);
  line-height: 1.55;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf8;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.rating-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.rating-button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 6px 3px;
  cursor: pointer;
}

.rating-button span {
  font-size: 1.55rem;
  line-height: 1;
}

.rating-button small {
  max-width: 100%;
  font-size: 0.66rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.rating-button:hover,
.rating-button.is-selected {
  border-color: var(--accent);
  background: #e5f2ec;
  color: var(--text);
}

.source-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.list-section {
  margin-top: 18px;
  padding: 18px;
}

.list-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.list-heading p {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.festival-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.festival-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.festival-card:hover,
.festival-card.is-selected {
  border-color: var(--accent);
  outline: 2px solid rgba(37, 108, 85, 0.12);
}

.festival-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.2;
}

.festival-card p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.empty-list {
  grid-column: 1 / -1;
  color: var(--muted);
}

.profile-view {
  min-height: 620px;
  border-top: 1px solid var(--line);
  padding: 30px 0 48px;
}

.profile-heading {
  max-width: 760px;
  margin-bottom: 22px;
}

.profile-heading h2,
.profile-summary h2,
.section-heading h2,
.collection-heading h2 {
  margin-bottom: 0;
}

.auth-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 760px;
}

.auth-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.auth-option:hover {
  border-color: var(--accent);
}

.auth-option strong,
.auth-option small {
  display: block;
}

.auth-option small {
  margin-top: 3px;
  color: var(--muted);
}

.auth-icon,
.provider-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #edf3ef;
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 900;
}

.google-mark {
  background: #fff;
  border: 1px solid #d8dee3;
  color: #4285f4;
}

.facebook-mark {
  background: #1877f2;
  color: #fff;
  font-family: Arial, sans-serif;
}

.auth-form-slot {
  max-width: 760px;
  margin-top: 18px;
}

.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.auth-form .primary-button,
.profile-form-footer .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.profile-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-identity p:last-child {
  margin: 4px 0 0;
  color: var(--muted);
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
  gap: 42px;
}

.profile-form {
  min-width: 0;
}

.section-heading,
.collection-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.profile-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.home-council-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  margin-top: 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
}

.home-council-button:hover {
  background: #e5f2ec;
}

.interest-fieldset {
  margin: 24px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 20px 0 0;
}

.interest-fieldset legend {
  padding: 0 8px 0 0;
  color: var(--text);
  font-weight: 800;
}

.interest-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.interest-option {
  position: relative;
  display: block;
}

.interest-option input {
  position: absolute;
  width: 1px;
  min-height: 0;
  opacity: 0;
}

.interest-option span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 7px 10px;
  color: var(--muted);
  cursor: pointer;
}

.interest-option input:checked + span {
  border-color: var(--accent);
  background: #e5f2ec;
  color: var(--text);
}

.interest-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-form-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

.profile-feedback {
  color: var(--accent);
  font-weight: 800;
}

.profile-collections {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding-left: 34px;
}

.collection-group + .collection-group {
  margin-top: 30px;
}

.collection-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.collection-heading > strong {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.collection-list {
  display: grid;
  gap: 8px;
}

.collection-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.collection-item:hover {
  border-color: var(--accent);
}

.collection-emoji {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.collection-copy {
  min-width: 0;
}

.collection-copy strong,
.collection-copy small {
  display: block;
}

.collection-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-copy small,
.collection-empty {
  margin-top: 3px;
  color: var(--muted);
}

.collection-empty {
  margin-bottom: 0;
  padding: 8px 0;
}

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

  .detail-panel {
    min-height: auto;
    max-height: none;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-collections {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 28px;
    padding-left: 0;
  }
}

@media (max-width: 760px) {
  .auth-form {
    grid-template-columns: 1fr;
  }
}

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

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .brand-lockup {
    width: min(100%, 360px);
  }

  .topbar-side,
  .view-tabs {
    width: 100%;
  }

  .topbar-side {
    justify-items: stretch;
  }

  .topbar-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .topbar-metrics span {
    justify-content: center;
    padding: 7px;
    font-size: 0.78rem;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .date-range-filter {
    margin: 0;
  }

  .date-range-filter legend {
    width: auto;
    text-align: left;
  }

  .date-range-inputs {
    gap: 8px;
  }

  .filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-column: auto;
  }

  .clear-filters-button {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .map,
  .map-panel {
    min-height: 470px;
    height: 470px;
  }

  .map-legend {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
  }

  .profile-view {
    padding-top: 22px;
  }

  .auth-options,
  .profile-fields {
    grid-template-columns: 1fr;
  }

  .profile-summary {
    align-items: flex-start;
  }

  .profile-summary .icon-text-button {
    width: 42px;
    padding: 0;
    font-size: 0;
  }

  .detail-actions {
    grid-template-columns: 1fr;
  }
}
