/* ==========================================================================
   Poseidon Klimaanpassung visual style, adapted for the measures catalogue.
   Palette + typography taken from the original site's tokens.
   ========================================================================== */

@font-face {
  font-family: "ABC Diatype Rounded";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/ABCDiatypeRounded-Regular.woff2") format("woff2");
}

:root {
  --color-primary: #BDE3D3;
  /* mint  – page background        */
  --color-secondary: #161924;
  /* navy  – text, rules, borders   */
  --color-faded: #596A6A;
  /* muted – secondary text         */
  --color-card: #ffffff;
  /* white – map / table panels     */
  --max-width: 1568px;
  --page-margin: 1rem;
  --radius: 0.125rem;
  --font: "ABC Diatype Rounded", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (min-width: 1024px) {
  :root {
    --page-margin: 5rem;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--color-secondary);
  background-color: var(--color-primary);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: currentColor;
}

/* Shared uppercase, tracked-out label treatment (the site's signature). */
.eyebrow,
.filters strong,
#measure-table thead th {
  font-size: 0.75rem;
  line-height: 1.2;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
}

.muted {
  color: var(--color-faded);
}

/* --- Header ------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem var(--page-margin);
  background: var(--color-primary);
  border-bottom: 1px solid var(--color-secondary);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.site-title {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--color-secondary);
  flex-shrink: 0;
}

.site-logo {
  display: block;
  height: 2rem;
  width: auto;
}

@media (min-width: 1024px) {
  .site-logo {
    height: 2.5rem;
  }
}

/* Title sits beside the wordmark, separated by a thin navy rule. */
.site-subtitle {
  padding-left: 1.25rem;
  border-left: 1px solid var(--color-secondary);
  font-size: 0.75rem;
  line-height: 1.25;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
  text-wrap: balance;
}

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

.lang-switcher select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-secondary);
  font-family: var(--font);
  font-size: 0.75rem;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
  cursor: pointer;
}

/* --- Main layout -------------------------------------------------------- */
main {
  width: calc(100% - var(--page-margin) * 2);
  max-width: var(--max-width);
  margin: 2.25rem auto 4rem;
  flex: 1 0 auto;
}

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  width: 100%;
  padding: 2rem var(--page-margin);
  border-top: 1px solid var(--color-secondary);
}

.footer-logo {
  display: block;
  height: 56px;
  width: auto;
  max-width: 100%;
}

/* --- Filters ------------------------------------------------------------ */
.filters {
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-secondary);
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.filters-row:last-child {
  margin-bottom: 0;
}

/* Tag chips — bordered pills; active = navy fill on the mint canvas. */
.tag-chip {
  cursor: pointer;
}

.tag-chip input {
  display: none;
}

.tag-chip span {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius);
  background: transparent;
  font-size: 0.75rem;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
}

.tag-chip input:checked+span {
  background: var(--color-secondary);
  color: var(--color-primary);
}

/* Tags that no measure uses get a muted border. */
.tag-chip span.is-unused {
  border-color: #69747C;
  color: var(--color-faded);
}

/* Match-mode radios + clear button */
.filters-row label {
  font-size: 0.75rem;
  letter-spacing: 0.075rem;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.link-btn {
  background: none;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius);
  padding: 0.3rem 0.75rem;
  color: var(--color-secondary);
  font-family: var(--font);
  font-size: 0.75rem;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
  cursor: pointer;
}

.link-btn:hover {
  background: var(--color-secondary);
  color: var(--color-primary);
}

#result-count {
  letter-spacing: 0.075rem;
  text-transform: uppercase;
  font-size: 0.75rem;
}

/* --- Map + table layout ------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* The map shows tiles, so it keeps a bordered frame; everything else sits
   directly on the mint canvas with thin navy hairlines (the Poseidon look). */
#map {
  height: 72vh;
  min-height: 420px;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius);
}

.table-wrap {
  max-height: 72vh;
  overflow: auto;
  border-top: 1px solid var(--color-secondary);
}

#measure-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

#measure-table th,
#measure-table td {
  text-align: left;
  padding: 0.85rem 0.85rem;
  border-bottom: 1px solid rgba(22, 25, 36, 0.18);
  vertical-align: top;
}

#measure-table thead th {
  position: sticky;
  top: 0;
  background: var(--color-primary);
  border-bottom: 1px solid var(--color-secondary);
  color: var(--color-faded);
}

#measure-table tbody tr:hover {
  background: rgba(22, 25, 36, 0.06);
}

#measure-table a {
  color: var(--color-secondary);
  font-size: 1rem;
  letter-spacing: 0.05rem;
  text-transform: uppercase;
  text-decoration: none;
}

#measure-table a:hover {
  text-decoration: underline;
}

.row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.row-tag {
  font-size: 0.625rem;
  letter-spacing: 0.075rem;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--color-faded);
  border-radius: var(--radius);
  color: var(--color-faded);
}

/* --- Map hover preview -------------------------------------------------- */
.preview-tooltip {
  white-space: normal;
}

.map-preview {
  width: 210px;
}

.map-preview img {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 0.4rem;
}

.map-preview .title {
  font-size: 0.8rem;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  line-height: 1.2;
}

.map-preview .summary {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--color-faded);
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}

/* --- Detail page -------------------------------------------------------- */
.detail {
  line-height: 1.6;
}

.back-link {
  display: inline-block;
  margin-bottom: 2.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-faded);
}

.back-link:hover {
  color: var(--color-secondary);
}

.detail h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.5rem, 1.6vw + 1rem, 2.25rem);
  line-height: 1.2;
  letter-spacing: 0.225rem;
  text-transform: uppercase;
  text-wrap: balance;
  font-weight: 600;
}

.detail h2 {
  margin: 3.5rem 0 1.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
  position: relative;
  padding-top: 1rem;
  border-top: 1px solid var(--color-secondary);
  font-weight: 400;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2.5rem;
}

.tag-chip-static {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius);
  font-size: 0.75rem;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-secondary);
}

.tag-chip-static:hover {
  background: var(--color-secondary);
  color: var(--color-primary);
}

.detail-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.25rem;
  align-items: start;
}

@media (max-width: 800px) {
  .detail-body {
    grid-template-columns: 1fr;
  }
}

.detail-text {
  font-size: 1.0625rem;
  line-height: 1.6;
}

.detail-text p:not(:last-child) {
  margin-bottom: 1em;
}

#detail-map {
  height: 360px;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.gallery figure {
  margin: 0;
}

.gallery img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery figcaption {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--color-faded);
}

/* --- Utilities ---------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Leaflet theming ---------------------------------------------------- */
.leaflet-container {
  font-family: var(--font);
}

.leaflet-popup-content-wrapper,
.leaflet-tooltip.preview-tooltip {
  border-radius: var(--radius);
  border: 1px solid var(--color-secondary);
  color: var(--color-secondary);
  box-shadow: none;
}

.leaflet-tooltip.preview-tooltip {
  background: var(--color-card);
}

.leaflet-tooltip.preview-tooltip::before {
  border-top-color: var(--color-secondary);
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(22, 25, 36, 0.15);
}

/* Pie/wedge divIcon markers — strip Leaflet's default white box. */
.pie-marker {
  background: none;
  border: none;
}

.pie-marker svg {
  display: block;
}

/* --- Filter groups ------------------------------------------------------ */
.filter-group {
  margin-bottom: 1.25rem;
}

.filter-group__label {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 0.75rem;
  line-height: 1.2;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
  color: var(--color-faded);
}

/* --- Map column + kind legend ------------------------------------------- */
.map-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.05rem;
  text-transform: uppercase;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 1px solid var(--color-secondary);
  flex-shrink: 0;
}

/* --- Detail-page goal lead ---------------------------------------------- */
.detail-goal {
  margin: 0 0 2.5rem;
  max-width: 70ch;
  font-size: 1.25rem;
  line-height: 1.5;
}

.detail-goal .eyebrow {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--color-faded);
}

/* --- Small screens / phones --------------------------------------------- */
@media (max-width: 640px) {

  /* Collapse the table into a stacked list: title, then tags below it.
     The summary column is hidden so nothing overflows horizontally. */
  #measure-table thead {
    display: none;
  }

  #measure-table,
  #measure-table tbody,
  #measure-table tr,
  #measure-table td {
    display: block;
    width: 100%;
  }

  #measure-table tr {
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(22, 25, 36, 0.18);
  }

  #measure-table td {
    padding: 0;
    border: none;
  }

  #measure-table .col-tags {
    margin-top: 0.45rem;
  }

  #measure-table .col-summary {
    display: none;
  }

  /* Map gets a phone-friendly height; the table below scrolls with the page. */
  #map {
    height: 55vh;
    min-height: 300px;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
  }
}