:root {
  --editorial-cream: #f2ecdd;
  --editorial-ink: #173b2b;
}

.rasca-paper .nav-links a.nav-map {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.skip-link:not(:focus) { clip-path: inset(50%); }

.before-calendar {
  background: #e8e4d7;
  padding-block: 30px;
}

.before-calendar .before-launch {
  background: #f8f3e6;
  color: var(--editorial-ink);
  border: 1px solid #d9d1b7;
  border-left: 5px solid #31704f;
  box-shadow: 0 12px 30px #153b2920;
}

.before-calendar .before-launch:hover { background: #fffaf0; border-color: #31704f; }
.before-calendar .before-launch h2 { color: var(--editorial-ink); }
.before-calendar .before-launch p { color: #476453; }
.before-calendar .before-launch-action { color: #235e40; }

.calendar-section { background: #286748 !important; padding-block: 70px 82px; }
.calendar-section::before { background: linear-gradient(#31704ff0, #155139ec), url('cartell/placa-nova-nadal-1440.webp') center/cover !important; }
.calendar-intro { align-items: end; }
.calendar-intro aside { max-width: 330px; border-left: 1px solid #f2ebd994; padding-left: 24px; }
.calendar-grid { margin-top: 32px; }
.calendar-day-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font: 700 14px/1.4 var(--sans);
}
.calendar-day-picker label { margin-right: 4px; }
.calendar-day-picker select, .calendar-day-picker button {
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid #e7ecd9;
  border-radius: 5px;
  font: inherit;
}
.calendar-day-picker select { background: #17432f; color: #fff; }
.calendar-day-picker button { background: #f2ecdd; color: #173b2b; cursor: pointer; }
.calendar-day-picker button:hover { background: #fff7e4; }
.calendar-map-day {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  color: #10543a;
  font-weight: 700;
  text-underline-offset: 3px;
}
.calendar-map-day:focus-visible { outline-color: #31704f; }
.more-section { background: #e8ede2 !important; color: var(--editorial-ink); padding-block: 72px 76px; }
.more-wrap > h2 { font: 400 clamp(45px, 5vw, 67px)/1 var(--serif); letter-spacing: -.035em; }
.faq-section { background: #1c563d !important; }

.map-section {
  background: #163d2d;
  color: #fff;
  scroll-margin-top: 12px;
}

.map-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, .92fr);
  min-height: 620px;
  max-width: 1600px;
  margin-inline: auto;
}

.map-view { position: relative; min-height: 100%; isolation: isolate; }
#map-canvas { position: absolute; inset: 0; background: #f3eddf; font: 400 14px/1.4 var(--sans); }
.map-reset {
  position: absolute;
  z-index: 500;
  left: 12px;
  top: 12px;
  padding: 9px 14px;
  min-height: 44px;
  border: 1px solid #895;
  border-radius: 7px;
  background: #fffaf0;
  color: #123b29;
  font: 700 13px/1.4 var(--sans);
  cursor: pointer;
}

.map-sidebar {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: clamp(620px, 82vh, 810px);
  padding: clamp(20px, 3vw, 40px);
  gap: 18px;
}

.map-heading h2 { margin: 0; color: #fff4d8; font: 400 clamp(40px, 4.2vw, 63px)/1 var(--serif); }
.map-heading p { margin: 10px 0 0; color: #e1ede2; font: 400 15px/1.5 var(--sans); }
.map-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.map-controls label { display: block; margin-bottom: 5px; font: 700 13px/1.3 var(--sans); }
.map-controls input, .map-controls select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 1px solid #8cb097;
  border-radius: 6px;
  background: #fffdf7;
  color: var(--editorial-ink);
  font: 400 14px/1.4 var(--sans);
}

.map-results { display: grid; align-content: start; gap: 12px; overflow: auto; padding: 5px 7px 5px 5px; }
.map-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px 13px;
  padding: 12px;
  border-radius: 9px;
  background: var(--editorial-cream);
  color: var(--editorial-ink);
}

.map-card.is-active { box-shadow: inset 0 0 0 3px #78ad83; }
.map-card:not(.has-photo) { grid-template-columns: minmax(0, 1fr); }
.map-card .map-title { display: inline-flex; align-items: center; min-height: 44px; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; text-align: left; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; }
.map-card .map-title:hover { color: #a62b35; }
.map-card .map-title:focus-visible { outline: 3px solid #b97621; outline-offset: 3px; }
.map-card-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 80px;
  max-height: 145px;
  border-radius: 5px;
  object-fit: cover;
}
.map-card h3, .map-popup h3 { margin: 0 0 7px; font: 750 16px/1.25 var(--sans); }
.map-card p, .map-popup p { margin: 4px 0; font: 400 13px/1.4 var(--sans); }
.map-card .map-when, .map-popup .map-when { font-weight: 700; }
.map-pin-link {
  display: block;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.map-card .map-place, .map-popup .map-place {
  display: inline-block;
  margin: 3px 0 0;
  padding: 3px 8px;
  border-radius: 10px;
  background: #e0e5d5;
  font: 600 12px/1.4 var(--sans);
}
.map-action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 43px;
  padding: 8px 15px;
  border: 1px solid #24533b;
  border-radius: 24px;
  background: #24533b;
  color: #fff !important;
  font: 700 13px/1.4 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.map-card .map-action { grid-column: 1/-1; }
.map-action:hover { background: #112e22; }
.map-action:focus-visible, .map-close:focus-visible, .map-icon:focus-visible,
.map-pin-link:focus-visible, .map-reset:focus-visible, .map-controls :focus-visible {
  outline: 3px solid #b97621;
  outline-offset: 3px;
}

.map-sidebar .map-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 7px 14px;
  border: 0;
  border-radius: 24px;
  background: #102c21;
  font: 600 13px/1.4 var(--sans);
}
.map-summary p { margin: 0; }
.map-summary button {
  min-height: 36px;
  padding: 5px 9px;
  border: 0;
  border-radius: 14px;
  background: #f2ecdd;
  color: #173b2b;
  cursor: pointer;
}
.map-empty { margin: 0; padding: 14px; font: 400 15px/1.6 var(--sans); }

.map-icon {
  display: grid;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  background: #21533a;
  color: white;
  font: 750 15px/1 var(--sans);
  box-shadow: 0 3px 7px #08241965;
}
.map-icon.is-single { border-radius: 50% 50% 50% 5px; transform-origin: center; }
.map-icon.is-active { background: #f6d48b; color: #173b2b; border-color: #173b2b; }
#map-canvas .leaflet-popup-content-wrapper, #map-canvas .leaflet-popup-tip {
  background: var(--editorial-cream);
  color: var(--editorial-ink);
}
.map-popup .map-card-image { max-height: 110px; margin-bottom: 9px; }
.map-popup .map-action { width: 100%; margin-top: 6px; }
.map-popup-events { max-height: 170px; overflow-y: auto; padding: 2px; }
.map-popup-events button { margin: 5px 0; width: 100%; }
#map-canvas .leaflet-popup-close-button { color: #173b2b; background: #f2ecdd; border-radius: 50%; margin: 3px; }

.map-detail {
  position: fixed;
  width: min(560px, calc(100% - 24px));
  max-height: min(86dvh, 760px);
  margin: auto;
  padding: 25px;
  border: 1px solid #9eaa96;
  border-radius: 13px;
  background: #fffaf0;
  color: var(--editorial-ink);
  box-shadow: 0 18px 60px #0b2519aa;
}
.map-detail::backdrop { background: #09261bb8; }
.map-detail form { display: flex; justify-content: end; }
.map-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #e0ebdc; color: #173b2b; font-size: 25px; cursor: pointer; }
.map-detail h3 { margin: 12px 0; font: 400 clamp(27px, 4vw, 39px)/1.1 var(--serif); }
.map-detail .map-card-image { max-height: 210px; margin-top: 8px; }
.map-detail p, .map-detail dd { overflow-wrap: anywhere; font: 400 15px/1.55 var(--sans); }
.map-detail-facts { display: grid; gap: 9px; }
.map-detail-facts div { border-bottom: 1px solid #d7dfd0; padding-bottom: 7px; }
.map-detail-facts dt { font: 700 13px/1.4 var(--sans); }
.map-detail-facts dd { margin: 2px 0 0; }
.map-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

@media (max-width: 760px) {
  .map-shell { display: flex; flex-direction: column; }
  .map-view { min-height: min(62dvh, 450px); order: 1; }
  .map-sidebar { display: contents; }
  .map-heading { order: 0; padding: 23px 20px 8px; }
  .map-controls { order: 0; padding: 0 20px 16px; }
  .map-results { order: 3; max-height: 380px; margin: 0 15px 16px; }
  .map-sidebar .map-summary { order: 2; margin: 12px 20px; }
}

@media (max-width: 640px) {
  .nav-links .nav-map { margin-left: 13px; }
  .before-calendar { padding-block: 20px; }
  .calendar-section { padding-block: 50px 48px; }
  .calendar-intro aside { border: 0; padding: 0; }
  .calendar-day-picker label { flex-basis: 100%; }
  .more-section { padding-block: 55px 58px; }
}
