:root {
  --paper: #fffafa;
  --blush: #fbe8eb;
  --rose: #b52f4d;
  --rose-dark: #791d33;
  --ink: #3f2028;
  --muted: #7d5a63;
  --line: #eccfd6;
  --map-paper: #f7f1e8;
  --shadow: 0 18px 44px rgba(99, 38, 52, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: linear-gradient(180deg, #fffdfd 0%, #fceff2 100%);
  color: var(--ink);
  font-family: Arial, sans-serif;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(181, 47, 77, 0.34);
  outline-offset: 3px;
}

.map-header,
.map-page,
.map-footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.map-header {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  align-items: start;
  padding: 28px 0 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  min-height: 44px;
  padding: 0 4px;
  color: var(--rose-dark);
  font-weight: 700;
  text-decoration: none;
}

.back-link span {
  font-size: 1.35rem;
  transition: transform 160ms ease;
}

.back-link:hover span {
  transform: translateX(-3px);
}

.header-copy {
  max-width: 650px;
  text-align: center;
  justify-self: center;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  color: var(--rose-dark);
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 340px);
  min-height: 570px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.map-frame {
  min-width: 0;
  padding: 14px;
  background: #fff;
}

.map-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 540px;
  overflow: hidden;
  border: 1px solid #ded5c8;
  border-radius: 6px;
  background-color: var(--map-paper);
  isolation: isolate;
}

.map-surface {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--map-paper);
}

.map-surface,
.map-surface .maplibregl-canvas {
  border-radius: 6px;
}

.map-surface .maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(121, 29, 51, 0.16);
  border-radius: 6px;
  box-shadow: 0 5px 14px rgba(63, 32, 40, 0.13);
}

.map-surface .maplibregl-ctrl-group button {
  width: 34px;
  height: 34px;
}

.map-surface .maplibregl-ctrl-attrib {
  color: #54484b;
  font-size: 10px;
}

.map-status {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  width: min(360px, calc(100% - 36px));
  padding: 18px;
  border: 1px solid rgba(121, 29, 51, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 250, 0.96);
  box-shadow: 0 10px 30px rgba(63, 32, 40, 0.16);
  color: var(--muted);
  text-align: center;
  transform: translate(-50%, -50%);
}

.map-status[hidden] {
  display: none;
}

.map-status-title {
  margin: 0;
  color: var(--rose-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.map-status-message {
  margin: 7px 0 0;
  font-size: 0.82rem;
  line-height: 1.55;
}

.map-canvas.is-unavailable .map-hint {
  display: none;
}

.map-hint {
  position: absolute;
  z-index: 5;
  left: 12px;
  bottom: 10px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(121, 29, 51, 0.13);
  border-radius: 6px;
  background: rgba(255, 250, 250, 0.9);
  color: var(--muted);
  font-size: 0.75rem;
  box-shadow: 0 4px 14px rgba(63, 32, 40, 0.08);
}

.map-pin {
  z-index: 4;
  width: 48px;
  height: 56px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.map-pin[hidden] {
  display: none;
}

.pin-marker {
  position: absolute;
  top: 4px;
  left: 8px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 8px;
  background: var(--rose);
  box-shadow: 0 5px 12px rgba(82, 25, 39, 0.28);
  color: #fff;
  transform: rotate(-45deg);
  transition: background-color 160ms ease, transform 160ms ease;
}

.pin-number {
  font-size: 0.78rem;
  font-weight: 800;
  transform: rotate(45deg);
}

.map-pin:hover .pin-marker,
.map-pin.is-selected .pin-marker {
  background: var(--rose-dark);
  transform: rotate(-45deg) scale(1.12);
}

.map-pin.is-selected .pin-marker {
  box-shadow: 0 0 0 5px rgba(181, 47, 77, 0.16), 0 6px 14px rgba(82, 25, 39, 0.3);
}

.place-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--paper);
}

.place-photo-wrap {
  aspect-ratio: 4 / 3;
  margin: 14px 14px 0;
  overflow: hidden;
  border-radius: 6px;
  background: var(--blush);
}

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

.place-photo-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
}

.place-photo-placeholder[hidden],
.place-photo[hidden] {
  display: none;
}

.place-details {
  padding: 24px 22px 28px;
}

.place-details h2 {
  margin: 6px 0 4px;
  color: var(--rose-dark);
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  line-height: 1.15;
}

.place-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.place-description {
  margin: 18px 0 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.7;
}

.map-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding: 24px 0 36px;
  color: var(--muted);
  font-size: 0.88rem;
}

.map-footer a {
  color: var(--rose-dark);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

@media (max-width: 800px) {
  .map-header {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .header-copy {
    text-align: left;
    justify-self: start;
  }

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

  .map-canvas {
    min-height: 500px;
  }

  .place-panel {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) 1.2fr;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .place-photo-wrap {
    margin: 14px;
  }
}

@media (max-width: 560px) {
  .map-header,
  .map-page,
  .map-footer {
    width: min(100% - 24px, 1180px);
  }

  .map-header {
    padding-top: 14px;
  }

  .map-layout {
    min-height: 0;
  }

  .map-frame {
    padding: 8px;
  }

  .map-canvas {
    min-height: 440px;
  }

  .map-hint {
    max-width: calc(100% - 24px);
  }

  .place-panel {
    display: flex;
  }

  .place-photo-wrap {
    aspect-ratio: 16 / 9;
    margin: 10px 10px 0;
  }

  .place-details {
    padding: 20px 18px 24px;
  }

}

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