:root {
  --color-primary: #1f4e79;
  --color-primary-contrast: #ffffff;
  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-text: #222;
  --color-muted: #666;
  --color-border: #d9dde3;
  --panel-width: 360px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
}

/* Header */
.site-header {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-primary); /* fallback while the image loads */
  background-image: url("../img/bg-header.png");
  background-repeat: no-repeat;
  background-size: cover;        /* fills the full width without distortion */
  background-position: center top; /* always centered horizontally, aligned to the top */
}
.site-header {
  --title-scale: 1.5; /* title size relative to the header height */
  overflow: hidden;
}
.site-header h1 {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Title image: always centered, scaled to fit without deforming */
.site-header h1 img {
  display: block;
  width: 100%;
  height: calc(100% * var(--title-scale)); /* flex centering keeps the overflow even top and bottom */
  flex: none;
  object-fit: contain;
  object-position: center;
}

/* Filters */
.filters {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .6rem 1rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.filters__label { font-weight: 600; }
/* Pushed to the right end of the filters bar */
.filters__total {
  margin-left: auto;
  font-size: .75rem;
  color: var(--color-muted);
  white-space: nowrap;
}
.filters__search {
  flex: 0 1 240px;
  padding: .35rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: .9rem;
}
.filters__chips { display: flex; flex-wrap: wrap; gap: .5rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  cursor: pointer;
  font-size: .9rem;
  user-select: none;
}
.chip input { margin: 0; }
.chip:has(input:checked) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-primary-contrast);
}

/* Map area fills the remaining height */
.map-wrap {
  position: relative;
  flex: 1;
  min-height: 400px;
}
#map {
  position: absolute;
  inset: 0;
}

/* Floating POI panel */
.poi-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  width: var(--panel-width);
  max-width: calc(100% - 2rem);
  z-index: 1100; /* above Leaflet panes and controls */
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
  overflow: hidden;
  isolation: isolate; /* keeps the blurred background behind the content */
}
.poi-panel[hidden] { display: none; }

/* Area below the header: hosts the blurred background and the scrolling body */
.poi-panel__content {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

/* Blurred POI icon as background (starts after the title), set per POI via --poi-bg */
.poi-panel__content::before {
  content: "";
  position: absolute;
  inset: -30px; /* oversize so the blur does not fade at the edges */
  z-index: -1;
  background-image: var(--poi-bg, none);
  background-size: cover;
  background-position: center;
  filter: blur(10px);
  opacity: .4; /* keeps the text readable */
}

.poi-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
  padding: 1rem 1rem .75rem;
  border-bottom: 1px solid var(--color-border);
}
.poi-panel__header h2 { margin: 0; font-size: 1.25rem; }
.poi-panel__header h3 {
  margin: .25rem 0 0;
  font-size: .95rem;
  font-weight: 400;
  color: var(--color-muted);
}
.poi-panel__close {
  border: 0;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-muted);
}
.poi-panel__close:hover { color: var(--color-text); }

/* Only the body scrolls; the header stays fixed */
.poi-panel__body {
  height: 100%;
  overflow-y: auto;
  padding: 1rem;
  line-height: 1.55;
}
.poi-panel__body p { margin: 0 0 1em; }

.map-error {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background: rgba(255, 255, 255, .92);
  color: #a00;
}
.map-error[hidden] { display: none; }

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding: .6rem 1rem;
  font-size: .8rem;
  background: #222;
  color: #ddd;
}
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer__contact, .site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
}

/* Mobile: panel becomes a bottom sheet */
@media (max-width: 640px) {
  .site-header { height: 60px; }
  .poi-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 60%;
    border-radius: 12px 12px 0 0;
  }
  .site-footer {
    flex-direction: column;
  }
}
