:root {
  --bg: #fff8e6;
  --surface: #ffffff;
  --surface-soft: #fff2c7;
  --text: #172033;
  --muted: #647084;
  --brand: #f6c343;
  --brand-dark: #d99c00;
  --ink: #24314f;
  --good: #168a4a;
  --warn: #a96b00;
  --bad: #b3261e;
  --line: rgba(23, 32, 51, .12);
  --shadow: 0 18px 50px rgba(36, 49, 79, .12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(246,195,67,.45), transparent 28rem),
    linear-gradient(180deg, #fff9e8 0%, #f7fbff 100%);
}

button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0 calc(24px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: var(--brand);
  box-shadow: 0 10px 24px rgba(217,156,0,.22);
  font-size: 25px;
}
.brand strong { display: block; font-size: 1.1rem; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }

.language-select {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--ink);
}

.hero-card,
.controls-card,
.map-card,
.list-card {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: center;
  padding: clamp(22px, 4vw, 42px);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -80px -140px auto;
  width: 340px;
  height: 340px;
  background: rgba(246,195,67,.32);
  border-radius: 50%;
  pointer-events: none;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}
h1 { margin: 0; font-size: clamp(2rem, 6vw, 4.5rem); line-height: .96; letter-spacing: -.06em; max-width: 820px; }
.hero-card p:not(.eyebrow) { color: var(--muted); max-width: 640px; font-size: 1.08rem; line-height: 1.55; }

.primary-button,
.secondary-button,
.ghost-button,
.report-button,
.chip {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--ink);
  color: white;
  padding: 15px 20px;
  min-height: 54px;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(36,49,79,.2);
  position: relative;
  z-index: 1;
}
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.report-button:hover,
.chip:hover { transform: translateY(-1px); }
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 14px 18px;
  font-weight: 800;
}
.ghost-button {
  background: var(--surface-soft);
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 750;
}

.controls-card {
  margin: 18px 0;
  padding: 14px;
  border-radius: var(--radius-lg);
  display: grid;
  gap: 12px;
}
.search-wrap span {
  display: block;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 750;
  margin: 0 0 6px 4px;
}
.search-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px 16px;
  background: #fff;
  outline: none;
}
.search-wrap input:focus { border-color: var(--brand-dark); box-shadow: 0 0 0 4px rgba(246,195,67,.22); }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 780;
  white-space: nowrap;
}
.chip.active { background: var(--brand); border-color: transparent; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr);
  gap: 18px;
  align-items: start;
}
.map-card { border-radius: var(--radius-xl); overflow: hidden; min-height: 650px; }
#map { width: 100%; height: 650px; background: #eaf1ef; }
.list-card { border-radius: var(--radius-xl); padding: 16px; max-height: 650px; overflow: hidden; display: flex; flex-direction: column; }
.list-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 12px; }
.list-header h2 { margin: 0; letter-spacing: -.03em; }
.list-header p { margin: 4px 0 0; color: var(--muted); }
.church-list { overflow-y: auto; padding-right: 4px; display: grid; gap: 10px; }
.church-item {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
  cursor: pointer;
}
.church-item:hover { border-color: rgba(217,156,0,.42); box-shadow: 0 10px 26px rgba(36,49,79,.08); }
.church-item-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.church-item h3 { margin: 0; font-size: 1rem; letter-spacing: -.02em; }
.church-item p { margin: 6px 0 0; color: var(--muted); font-size: .93rem; line-height: 1.35; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: .78rem;
  font-weight: 850;
  margin: 0;
  white-space: nowrap;
}
.status-confirmed { color: var(--good); background: rgba(22,138,74,.1); }
.status-unknown { color: var(--warn); background: rgba(169,107,0,.1); }
.status-closed { color: var(--bad); background: rgba(179,38,30,.1); }

.drawer { position: fixed; inset: 0; z-index: 1200; display: none; }
.drawer.open { display: block; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(23,32,51,.42); backdrop-filter: blur(6px); }
.drawer-panel {
  position: absolute;
  right: 14px;
  top: 14px;
  bottom: calc(14px + var(--safe-bottom));
  width: min(460px, calc(100% - 28px));
  background: #fff;
  border-radius: 30px;
  box-shadow: 0 25px 80px rgba(0,0,0,.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.drawer-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  font-size: 28px;
  cursor: pointer;
}
.drawer-image {
  min-height: 190px;
  background: linear-gradient(135deg, var(--surface-soft), #eaf1ff);
  background-size: cover;
  background-position: center;
}
.drawer-content { padding: 20px; overflow-y: auto; }
.drawer-content h2 { margin: 12px 0 8px; font-size: 1.75rem; letter-spacing: -.04em; }
.muted { color: var(--muted); }
.distance-line { color: var(--ink); font-weight: 800; }
.drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 12px; }
.report-button { width: 100%; background: #f3f6fb; color: var(--ink); padding: 14px 16px; font-weight: 800; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translateX(-50%) translateY(120px);
  z-index: 1500;
  max-width: min(520px, calc(100% - 28px));
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 13px 18px;
  box-shadow: 0 12px 35px rgba(36,49,79,.3);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  text-align: center;
  font-weight: 750;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.drawer-meta {
  margin-top: 14px;
  color: var(--muted);
  font-size: .92rem;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(246,195,67,.32);
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: var(--brand);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(36,49,79,.22);
}


.leaflet-popup-content-wrapper { border-radius: 16px; }
.marker-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.22);
}
.marker-confirmed { background: var(--good); }
.marker-unknown { background: var(--warn); }
.marker-closed { background: var(--bad); }

@media (max-width: 880px) {
  .app-shell { width: min(100% - 18px, 1180px); }
  .hero-card { grid-template-columns: 1fr; border-radius: 24px; }
  .primary-button { width: 100%; }
  .content-grid { grid-template-columns: 1fr; }
  .map-card { min-height: 420px; }
  #map { height: 420px; }
  .list-card { max-height: none; }
  .drawer-panel { top: auto; right: 0; left: 0; bottom: 0; width: 100%; max-height: min(88vh, 760px); border-radius: 28px 28px 0 0; }
  .drawer-actions { grid-template-columns: 1fr; }
}

/* v5: indbygget letvægts-clustering, så hele Danmark ikke dækkes af enkeltmarkører. */
.marker-cluster-bubble {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255,255,255,.95);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .24);
  font-size: 15px;
  font-weight: 900;
  color: #12213f;
  background: #f6c343;
}

.marker-cluster-bubble.cluster-confirmed {
  background: #7bd99b;
}

.marker-cluster-bubble.cluster-unknown {
  background: #f6c343;
}

.marker-cluster-bubble.cluster-closed {
  background: #ff9f9f;
}

/* v6: pænere enkeltmarkører - små Tissetårnet pins i stedet for de lidt morbide standardpinde 😄 */
.tt-marker-wrap {
  background: transparent;
  border: 0;
}

.tt-marker {
  width: 44px;
  height: 54px;
  display: block;
  transform: translateY(0);
  transition: transform .14s ease, filter .14s ease;
  filter: drop-shadow(0 9px 10px rgba(15, 23, 42, .24));
}

.tt-marker:hover {
  transform: translateY(-3px) scale(1.04);
  filter: drop-shadow(0 12px 14px rgba(15, 23, 42, .30));
}

.tt-marker-svg {
  width: 44px;
  height: 54px;
  display: block;
}

.tt-marker-shadow {
  fill: rgba(15, 23, 42, .18);
}

.tt-marker-pin {
  fill: #f6c343;
  stroke: #ffffff;
  stroke-width: 3;
}

.tt-marker-core {
  fill: rgba(255,255,255,.92);
}

.tt-marker-roof,
.tt-marker-house,
.tt-marker-door,
.tt-marker-cross {
  fill: none;
  stroke: #24314f;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tt-marker-confirmed .tt-marker-pin { fill: #55c979; }
.tt-marker-unknown .tt-marker-pin { fill: #f6c343; }
.tt-marker-closed .tt-marker-pin { fill: #ef7777; }
.tt-marker-confirmed .tt-marker-core { fill: #eefbf2; }
.tt-marker-unknown .tt-marker-core { fill: #fff8df; }
.tt-marker-closed .tt-marker-core { fill: #fff0f0; }

@media (max-width: 880px) {
  .tt-marker,
  .tt-marker-svg {
    width: 40px;
    height: 49px;
  }
}
