:root {
  /* brand */
  --color-primary: #40b36e;
  --color-on-primary: #fff;
  --color-link: #007bff;
  --accent: var(--color-primary);
  --accent-contrast: var(--color-on-primary);

  --accent-fill: color-mix(in srgb, var(--accent-contrast) 12%, transparent);
  --accent-fill-hover: color-mix(in srgb, var(--accent-contrast) 18%, transparent);
  --accent-fill-focus: color-mix(in srgb, var(--accent-contrast) 20%, transparent);
  --accent-fill-active: color-mix(in srgb, var(--accent-contrast) 22%, transparent);
  --accent-border: color-mix(in srgb, var(--accent-contrast) 35%, transparent);
  --accent-placeholder: color-mix(in srgb, var(--accent-contrast) 72%, transparent);
  --accent-focus: color-mix(in srgb, var(--accent-contrast) 75%, transparent);
  --accent-action-hover: color-mix(in srgb, var(--accent-contrast) 85%, transparent);
  --text-primary: var(--color-text);
  --text-secondary: var(--color-muted);
  --bg: var(--color-background);
  --surface: var(--color-surface);
  --surface-translucent: var(--color-surface-translucent);
  --border: var(--color-border);
  --muted: var(--color-muted);
  --hover: var(--color-hover);
  --shadow: rgb(0 0 0 / 18%);

  /* text */
  --color-text: #333333;

  /* neutrals */
  --color-border: #dddddd;
  --color-background: #f5f5f5;
  --color-hover: #eeeeee;
  --color-surface: #ffffff;
  --color-muted: #666666;
  --color-surface-translucent: rgb(255 255 255 / 80%);

  /* social */
  --color-facebook: #3b5998;
  --color-youtube: #e15759;

  /* ratings */
  --color-rating-easy: #28a745;
  --color-rating-medium: #ffc107;
  --color-rating-hard: #dc3545;

  --radius-sm: 4px;
  --radius-md: 5px;
  --radius-lg: 8px;
  --font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* brand */
    --color-link: #6cb2ff;

    /* text */
    --color-text: #e0e0e0;

    /* neutrals */
    --color-border: #444444;
    --color-background: #1a1a1a;
    --color-hover: #2a2a2a;
    --color-surface: #242424;
    --color-muted: #999999;
    --color-surface-translucent: rgb(36 36 36 / 85%);
  }
}
html {
  scrollbar-gutter: stable;
  overflow-x: hidden;
  height: 100%;
}

a {
  color: var(--color-primary);
}

.js-required-message {
  text-align: center;
}

body {
  font-family: var(--font-family);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  overflow-x: hidden;
  color: var(--color-text);
  background-color: var(--color-background);
}

body>* {
  min-width: 0;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: content-box;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

ul,
ol {
  padding-left: 40px;
}
/* Navigation Bar */
.site-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 1px 4px rgb(0 0 0 / 18%);
  z-index: 1000;
}

.site-header__brand {
  color: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.site-header__action {
  margin-left: auto;
  padding: 0.35rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background-color: var(--accent-contrast);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.site-header__action:hover {
  background-color: var(--accent-action-hover);
}

.site-header__time {
  font-size: 0.8em;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0.85;
}

.site-header__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.site-header__time + .site-header__nav {
  margin-left: 0;
}

.site-header__nav a {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  color: var(--accent-contrast);
  font-size: 0.9rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.site-header__nav a:hover {
  background-color: var(--accent-fill-hover);
}

.site-header__nav a[aria-current="page"] {
  background-color: var(--accent-contrast);
  border-color: var(--accent-contrast);
  color: var(--accent);
}


.site-header__filter {
  position: relative;
}

.site-header__filter-button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  color: var(--accent-contrast);
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}

.site-header__filter-button::-webkit-details-marker {
  display: none;
}

.site-header__filter-button::after {
  content: "▾";
  font-size: 0.75rem;
}

.site-header__filter[open] .site-header__filter-button {
  background-color: var(--accent-contrast);
  color: var(--accent);
}

.site-header__filter.is-active .site-header__filter-button {
  font-weight: 700;
}

.site-header__filter-body {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: max-content;
  min-width: 180px;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 4px 16px var(--shadow);
}

.site-header__filter-body label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  white-space: nowrap;
  cursor: pointer;
}

.site-header__filter-body label:hover {
  background: var(--hover);
}

.site-header__filter-body input {
  margin: 0;
  accent-color: var(--accent);
}

.site-header__filter-body label.site-header__filter-all {
  margin-bottom: 0.2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.site-header__filter-body label:has(input:not([data-all]):not(:checked)) {
  opacity: 0.45;
}

@media (max-width: 1100px) {
  .site-header__time {
    display: none;
  }
}

.site-header__nav a:focus-visible,
.site-header__action:focus-visible,
.site-header__search input:focus-visible,
.site-header summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.site-header__search {
  position: relative;
  flex: 1 1 190px;
  max-width: none;
  min-width: 0;
  margin: 0;
}

.address-search-input {
  width: 100%;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  background: var(--accent-fill);
  color: var(--accent-contrast);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.2;
}

.address-search-input::placeholder {
  color: var(--accent-placeholder);
  opacity: 1;
}

.address-search-input:focus {
  outline: 2px solid var(--accent-focus);
  outline-offset: 1px;
  background: var(--accent-fill-focus);
}

.address-search-input::-webkit-search-cancel-button {
  filter: invert(1);
  opacity: 0.7;
}

.address-search-results,
.address-search-status {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 4px 16px var(--shadow);
}

.address-search-results {
  max-height: 280px;
  padding: 0.25rem;
  overflow-y: auto;
  list-style: none;
}

.address-search-status {
  padding: 0.5rem 0.55rem;
  color: var(--muted);
}

.address-search-results[hidden],
.address-search-status[hidden] {
  display: none;
}

.address-search-result {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.address-search-result:hover,
.address-search-result.is-active {
  background: var(--hover);
}

.address-search-title {
  color: var(--text-primary);
  font-weight: 600;
}

.address-search-detail {
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .site-header__search {
    width: 100%;
    flex-basis: 100%;
    max-width: none;
  }
}
/* Map page shell */
body:has(.map-shell) {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.map-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.map-shell #map,
.map-shell #map-fullscreen {
  position: absolute;
  inset: 0;
  background: var(--surface);
  text-align: left;
}

/* MapLibre built-in controls */
.maplibregl-ctrl-group {
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 2px 8px var(--shadow);
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--border);
}

.maplibregl-ctrl button:not(:disabled):hover {
  background-color: var(--hover);
}

.maplibregl-ctrl-attrib {
  background-color: var(--surface);
  color: var(--muted);
}

.maplibregl-ctrl-attrib a {
  color: var(--muted);
}

.maplibregl-ctrl-attrib.maplibregl-compact {
  background-color: var(--surface);
}

@media (prefers-color-scheme: dark) {
  .maplibregl-ctrl-icon,
  .maplibregl-ctrl-attrib-button {
    filter: invert(1);
  }

  .maplibregl-ctrl-logo {
    filter: brightness(0) invert(1);
  }
}

/* MapLibre popup shell */
.maplibregl-popup-content {
  max-width: 340px;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  color: var(--text-primary);
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow);
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: var(--surface);
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: var(--surface);
}

.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: var(--surface);
}

.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: var(--surface);
}

.maplibregl-popup-close-button {
  display: flex;
  align-items: center;
  justify-content: center;
  top: 0;
  right: 0;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 0 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.maplibregl-popup-close-button:hover {
  background: var(--hover);
  color: var(--text-primary);
}

.maplibregl-popup-close-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.map-popup {
  max-height: 320px;
  overflow-y: auto;
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.4;
}

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

.map-popup-title {
  margin: 0 0 4px;
  padding-right: 3rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}

.map-popup-status {
  display: inline-block;
  margin-bottom: 4px;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--muted);
  color: var(--accent-contrast);
  font-size: 0.72rem;
  font-weight: 600;
}

.map-popup-description {
  margin: 0.55rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.map-popup-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.5rem;
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
}

.map-popup-meta dt {
  color: var(--muted);
  white-space: nowrap;
}

.map-popup-meta dd {
  margin: 0;
}

.map-popup-action {
  display: block;
  width: fit-content;
  margin: 10px auto 0;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-contrast);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.map-popup-action:hover {
  opacity: 0.9;
  text-decoration: none;
}

.map-popup-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.map-popup-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0.55rem 0 0;
}

.map-popup-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.map-popup-pill--easy {
  background: var(--color-rating-easy);
  color: var(--color-on-primary);
}

.map-popup-pill--medium {
  background: var(--color-rating-medium);
  color: #1a1a1a;
}

.map-popup-pill--hard {
  background: var(--color-rating-hard);
  color: var(--color-on-primary);
}
/* Stats Page */
.stats-header {
  text-align: center;
  margin-bottom: 40px;
}

.stats-header p {
  margin: 0;
}

.stats-header span {
  display: inline-block;
  margin: 0 10px;
}

.stats-header strong {
  font-size: 1.5em;
}

#charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 24px;
}

figure {
  text-align: center;
}

figcaption {
  margin-top: 10px;
  font-size: smaller;
}

figcaption ul {
  list-style: none;
  padding: 0;
}

/* Charts */
.chart-canvas {
  position: relative;
  height: 200px;
}

/* Monthly Chart */
#monthly-chart {
  margin-bottom: 40px;
}

#monthly-chart .chart-canvas {
  height: 300px;
  max-width: 800px;
  margin: 0 auto;
}

/* Rankings Section */
#rankings {
  display: grid;
  grid-template-columns: minmax(0, 40%) minmax(0, 60%);
  gap: 24px;
  margin-bottom: 40px;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  #rankings {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ranking {
  list-style: none;
  counter-reset: rank;
  margin: 0;
}

.ranking li {
  counter-increment: rank;
  display: grid;
  grid-template-columns: 2em 1fr auto;
  gap: 2px 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.ranking li:last-child {
  border-bottom: none;
}

.ranking li::before {
  content: counter(rank);
  color: var(--color-primary);
  font-weight: 700;
  text-align: right;
}

.ranking a {
  grid-column: 2;
  text-decoration: none;
}

.ranking span {
  grid-column: 2;
  font-size: 0.9em;
}

.ranking b {
  grid-column: 3;
}
hr {
  border: none;
  border-top: 2px solid var(--color-border);
}
/* Church Details Page */
.church-details {
  width: 100%;
}

.church-details>header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--color-border);
}

.church-details address {
  font-size: 1.1em;
  color: var(--color-text);
  margin-bottom: 10px;
  font-style: normal;
}

.church-details>header>div {
  margin-top: 10px;
}

.church-details>header>div a {
  text-decoration: none;
}

.church-details>header>a {
  display: inline-block;
  margin: 16px 0;
  padding: 10px 20px;
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-primary);
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  line-height: normal;
  white-space: nowrap;
}

.church-details>section {
  margin-bottom: 30px;
}

.church-details article {
  margin-bottom: 20px;
  padding: 15px;
  background-color: var(--color-background);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--color-link);
}

.church-details article.rating-easy {
  border-left-color: var(--color-rating-easy);
}

.church-details article.rating-medium {
  border-left-color: var(--color-rating-medium);
}

.church-details article.rating-hard {
  border-left-color: var(--color-rating-hard);
}

.church-details article header {
  margin-bottom: 8px;
  opacity: 0.75;
}

.church-details article footer {
  text-align: left;
  font-size: 0.9em;
  color: var(--color-text);
  opacity: 0.7;
  margin: 0;
}

.church-details article>p {
  line-height: 1.5;
  color: var(--color-text);
  margin-top: 0;
  margin-bottom: 10px;
}

.source-compare summary {
  font-size: 0.8em;
  color: var(--color-text);
  opacity: 0.4;
  cursor: pointer;
}

.source-compare table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 0.9em;
}

.source-compare th,
.source-compare td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.source-compare tbody tr:last-child th,
.source-compare tbody tr:last-child td {
  border-bottom: none;
}

.source-compare thead th {
  font-weight: 600;
}

.source-compare tbody th {
  font-weight: normal;
  white-space: nowrap;
}

.source-compare a {
  text-decoration: none;
}
.news-item {
  margin: 0 0 40px;
}

.news-date {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.news-summary,
.news-content {
  line-height: 1.7;
}

.news-summary li,
.news-content li {
  margin-bottom: 4px;
}

.news-content img {
  max-width: 100%;
}

.news-content pre {
  padding: 12px;
  overflow-x: auto;
  background-color: var(--color-background);
  border-radius: var(--radius-md);
}

.news-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.news-content blockquote {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  border-left: 3px solid var(--color-border);
}
.info-content {
  line-height: 1.7;
}

.info-content,
.news-content,
.news-summary {
  line-height: 1.7;
}

.info-content a,
.news-content a,
.news-summary a {
  color: var(--link);
}

.info-content img,
.news-content img,
.news-summary img {
  max-width: 100%;
  height: auto;
}

.info-content pre,
.news-content pre,
.news-summary pre {
  padding: 0.75rem;
  overflow-x: auto;
  border-radius: 6px;
  background: var(--bg);
}

.info-content code,
.news-content code,
.news-summary code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.info-content blockquote,
.news-content blockquote,
.news-summary blockquote {
  margin: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.info-content table,
.news-content table,
.news-summary table {
  width: 100%;
  border-collapse: collapse;
}

.info-content th,
.info-content td,
.news-content th,
.news-content td,
.news-summary th,
.news-summary td {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  text-align: left;
}
