/* Temples: a fold-out map pinned into the noticeboard. */

.page-temples main {
  padding-bottom: 46px;
}

.temples-page-head {
  align-items: flex-start;
}

.temples-page-head h1 {
  max-width: 780px;
}

.temples-head-stat {
  display: flex;
  flex: 0 1 170px;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 2px;
  text-align: right;
}

.temples-head-stat strong {
  color: var(--saffron-deep);
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
}

.temples-head-stat span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.temples-head-stat .temples-head-regions {
  margin-top: 12px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.66rem;
}

.temples-explorer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 0 28px;
  align-items: stretch;
  margin: 6px 0 46px;
}

.temples-map-panel {
  min-width: 0;
  border: 1px solid var(--line-strong);
  background: var(--card);
}

.temples-map-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.temples-map-toolbar h2 {
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
}

.temples-map-toolbar p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.temples-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.temples-filter-btn {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.68rem;
  line-height: 1.35;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.temples-filter-btn:hover {
  border-color: var(--saffron-line);
  color: var(--saffron-deep);
}

.temples-filter-btn.is-active {
  border-color: var(--green);
  background: var(--green);
  color: var(--paper);
}

.temple-map {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 548px;
  background: var(--paper-2);
}

.temple-map .maplibregl-map {
  font-family: var(--font-body);
  background: var(--paper-2);
}

.temple-map .maplibregl-ctrl-attrib {
  background: rgba(251, 250, 245, 0.92);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 10px;
  line-height: 1.4;
}

.temple-map .maplibregl-ctrl-attrib a {
  color: var(--saffron-deep);
}

/* The optional map-host name is hidden; OpenMapTiles and OpenStreetMap stay credited. */
.temple-map .maplibregl-ctrl-attrib a[href*="openfreemap.org"] {
  display: none;
}

.temple-map .maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: none;
}

.temple-map .maplibregl-ctrl-group button {
  border-bottom: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-body);
}

.temple-map .maplibregl-ctrl-group button:last-child {
  border-bottom: 0;
}

.temple-map .maplibregl-ctrl-group button:hover {
  background: var(--paper-2);
}

.temple-map .maplibregl-popup-content {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.8rem;
  line-height: 1.45;
  box-shadow: 0 1px 0 rgba(27, 26, 23, 0.12);
}

.temple-map .maplibregl-popup-tip {
  border-top-color: var(--paper);
  border-bottom-color: var(--paper);
}

.temple-map .maplibregl-popup-close-button {
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}

.temple-map .maplibregl-popup-close-button:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.temple-popup {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
}

.temple-popup strong {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.3;
}

.temple-popup-city {
  color: var(--saffron-deep);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.temple-popup-address {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.temple-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.temple-popup-actions a {
  color: var(--saffron-deep);
  font-size: 0.7rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.temple-marker {
  width: 24px;
  height: 24px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.temple-marker-dot {
  display: block;
  width: 17px;
  height: 17px;
  margin: 3px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--saffron);
  box-shadow: 0 0 0 1px var(--saffron-deep);
}

.temple-marker-dot::after {
  display: block;
  width: 3px;
  height: 3px;
  margin: 4px auto 0;
  border-radius: 50%;
  background: var(--paper);
  content: "";
}

.temple-map-caption {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.5;
}

.temple-map-dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--saffron);
}

.temple-map-noscript {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--danger);
  font-size: 0.78rem;
}

.temples-side {
  padding: 22px 0 0;
  border-top: 2px solid var(--ink);
}

.temples-side h2 {
  margin-top: 5px;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
}

.temples-side-copy {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

.temples-region-list {
  margin: 17px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.temples-region-list li {
  border-bottom: 1px solid var(--line);
}

.temples-region-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 9px 0;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease;
}

.temples-region-button:hover,
.temples-region-button.is-active {
  color: var(--saffron-deep);
}

.temples-region-button.is-active span {
  font-weight: 700;
}

.temples-region-button span {
  font-size: 0.91rem;
  line-height: 1.3;
}

.temples-region-button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.4;
}

.temples-key {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.temples-key-pin {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--saffron);
}

.temples-directory {
  padding-top: 5px;
}

.temples-directory-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ink);
}

.temples-directory-head h2 {
  margin-top: 5px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.temples-directory-head > p {
  max-width: 340px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
  text-align: right;
}

.temples-region {
  margin-top: 27px;
  scroll-margin-top: 20px;
}

.temples-region-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-strong);
}

.temples-region-head h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
}

.temples-region-head span {
  color: var(--muted);
  font-size: 0.68rem;
}

.temple-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 26px;
}

.temple-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px 0 17px;
  border-top: 1px solid var(--line);
}

.temple-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.temple-card-city {
  color: var(--saffron-deep);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.temple-card-tradition {
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.3;
  text-align: right;
}

.temple-card h4 {
  margin-top: 5px;
  font-family: var(--font-body);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
}

.temple-card-address {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.temple-card-note {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 0.76rem;
  line-height: 1.55;
}

.temple-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
}

.temple-card-actions .text-link {
  font-size: 0.72rem;
}

.temples-note {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 22px;
  margin-top: 36px;
  padding-top: 15px;
  border-top: 1px solid var(--line-strong);
}

.temples-note-label {
  color: var(--saffron-deep);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.temples-note p:last-child {
  max-width: 800px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.65;
}

.temples-note a {
  color: var(--saffron-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 1060px) {
  .temples-filter-btn {
    padding: 4px 6px;
    font-size: 0.64rem;
  }

  .temples-filter-btn:nth-child(1) {
    display: none;
  }
}

@media (max-width: 900px) {
  .temples-explorer {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .temples-side {
    padding-top: 16px;
  }

  .temples-region-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 18px;
    border-top: 0;
  }

  .temples-region-list li {
    border-bottom: 0;
  }

  .temples-region-button {
    flex-direction: row;
    align-items: baseline;
    gap: 4px;
    padding: 0;
  }

  .temples-region-button small {
    margin-top: 0;
  }

  .temples-key {
    margin-top: 12px;
  }

  .temple-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .temples-page-head {
    align-items: flex-start;
  }

  .temples-head-stat {
    flex: none;
    flex-direction: row;
    align-items: baseline;
    gap: 7px;
    padding-top: 0;
    text-align: left;
  }

  .temples-head-stat strong {
    font-size: 1.8rem;
  }

  .temples-head-stat .temples-head-regions {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .temples-map-toolbar {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .temples-filter {
    justify-content: flex-start;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .temples-filter-btn {
    flex: none;
    white-space: nowrap;
    font-size: 0.67rem;
  }

  .temples-filter-btn:nth-child(1) {
    display: inline-block;
  }

  .temple-map {
    height: 410px;
  }

  .temples-directory-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
  }

  .temples-directory-head > p {
    max-width: 100%;
    text-align: left;
  }

  .temple-card-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .temple-card {
    padding: 13px 0 15px;
  }

  .temple-card-actions {
    padding-top: 8px;
  }

  .temples-note {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }
}

@media print {
  .temples-explorer,
  .temples-filter {
    display: none !important;
  }

  .temple-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
