/* ==========================================================================
   Components: reusable blocks shared by sections and pages
   ========================================================================== */

/* Typography helpers ------------------------------------------------------ */

.text-light {
  font-weight: 300;
}

.section-title {
  margin: 0;
  padding: 0 var(--space-5);
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0.1em;
}

.section-title--display {
  font-family: var(--font-display);
  font-weight: 400;
}

@media (min-width: 1024px) {
  .section-title {
    padding: 0;
    font-size: 40px;
    line-height: 56px;
    letter-spacing: 0.15em;
  }
}

/* Button ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  align-self: center;
  justify-content: center;
  height: 38px;
  padding: 0 var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  font: 300 11.5px var(--font-body);
  letter-spacing: 0.2em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--duration-400),
    color var(--duration-400),
    border-color var(--duration-400);
}

.btn:hover,
.btn:focus {
  background: var(--color-text);
  color: var(--color-on-light);
}

/* Chip: filter toggle and radio label ------------------------------------- */

.chip {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  font: 300 12px var(--font-heading);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background-color var(--duration-400),
    color var(--duration-400);
}

.chip:hover,
.chip[aria-pressed="true"] {
  background: var(--color-text);
  color: var(--color-on-light);
}

@media (min-width: 1024px) {
  .chip {
    height: 36px;
    min-height: 36px;
  }
}

/* Form fields ------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-5);
}

.field__label {
  font: 300 13px/1.3 var(--font-heading);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field__control {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  color-scheme: dark;
  font: 300 15px var(--font-body);
}

.field__control::placeholder {
  color: var(--white-75);
}

.field__control option {
  background: var(--color-bg-base);
  color: var(--color-text);
}

.field__control--file {
  padding: 9px var(--space-3);
}

.field__control--textarea {
  min-height: 120px;
  padding: 10px var(--space-3);
  resize: vertical;
}

.field__control--checkbox {
  flex: none;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  accent-color: var(--color-text);
}

.field__hint {
  font-size: 12px;
}

.field--check {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-3);
}

.field--check .field__label {
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.form-error {
  margin-bottom: var(--space-4);
  padding: 10px var(--space-3);
  border: 1px solid var(--color-line);
  font-size: 14px;
}

.form-thanks {
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  font-size: 16px;
  line-height: 1.6;
}

/* Skip link --------------------------------------------------------------- */

.skip-link {
  position: fixed;
  top: -60px;
  left: var(--space-2);
  z-index: var(--z-skip-link);
  padding: var(--space-3) 18px;
  background: var(--color-text);
  color: var(--color-on-light);
  font: 400 14px var(--font-heading);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-2);
}

/* Site header, burger and full-screen navigation -------------------------- */

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: var(--space-5) 22px;
  pointer-events: none;
}

.site-header > * {
  pointer-events: auto;
}

.nav-toggle {
  position: relative;
  z-index: var(--z-toggle);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  cursor: pointer;
}

.nav-toggle__bars {
  position: relative;
  display: block;
  width: 30px;
  height: 20px;
}

.nav-toggle__bar {
  position: absolute;
  left: 0;
  width: 30px;
  height: 2px;
  border-radius: 1px;
  background: var(--color-text);
  transition:
    transform var(--duration-300),
    opacity var(--duration-200),
    top var(--duration-300);
}

.nav-toggle__bar:nth-child(1) { top: 0; }
.nav-toggle__bar:nth-child(2) { top: 9px; }
.nav-toggle__bar:nth-child(3) { top: 18px; }

.nav-toggle:hover .nav-toggle__bar {
  opacity: 0.7;
}

.site-header.is-open .nav-toggle__bar:nth-child(1) {
  top: 9px;
  transform: rotate(45deg);
}

.site-header.is-open .nav-toggle__bar:nth-child(2),
.site-header.is-open .nav-toggle:hover .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.site-header.is-open .nav-toggle__bar:nth-child(3) {
  top: 9px;
  transform: rotate(-45deg);
}

.site-nav {
  position: fixed;
  inset: 0;
  z-index: var(--z-header);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--black-94);
  font: 300 20px var(--font-heading);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-350),
    visibility var(--duration-350);
}

.site-header.is-open .site-nav {
  opacity: 1;
  visibility: visible;
}

.site-nav__link {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 10px;
  color: var(--color-text);
  text-decoration: none;
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  opacity: 0.6;
}

@media (min-width: 1024px) {
  .site-header {
    padding: 34px 44px;
  }
}

/* Back to top ------------------------------------------------------------- */

.to-top {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: var(--z-to-top);
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--black-60);
  color: var(--color-text);
  font: 300 22px/1 var(--font-heading);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--duration-300),
    background-color var(--duration-400),
    color var(--duration-400);
}

.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.to-top:hover {
  background: var(--color-text);
  color: var(--color-on-light);
}

/* Status badge and dot ---------------------------------------------------- */

.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  font: 300 11px/1 var(--font-heading);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-xs);
  background: var(--color-text);
}

/* Location card ----------------------------------------------------------- */

.loc-card {
  margin-bottom: var(--space-3);
  padding: 14px;
  border: 1px solid var(--white-35);
  border-radius: var(--radius);
  transition:
    border-color var(--duration-200),
    background-color var(--duration-200);
}

.loc-card.is-highlighted {
  border-color: var(--color-line);
  background: var(--white-08);
}

.loc-card__title {
  margin: 0 0 var(--space-1);
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-align: left;
}

.loc-card__line {
  margin: 0 0 var(--space-1);
  font: 300 14px/1.45 var(--font-body);
}

.loc-card__line--meta {
  font-weight: 400;
}

.loc-card__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.loc-card__actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

@media (min-width: 1024px) {
  .loc-card:last-child {
    margin-bottom: 0;
  }
}

/* Map pins and popups ----------------------------------------------------- */

.pin-marker {
  border: 0;
  background: transparent;
}

.pin {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--color-text);
  box-shadow: 0 0 0 2px var(--color-bg-base);
  transition: transform var(--duration-150);
}

.pin::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: var(--radius-xs);
  background: var(--color-accent);
}

.pin.is-highlighted {
  transform: scale(1.3);
  box-shadow: 0 0 0 3px var(--color-text);
}

.pin__count {
  position: absolute;
  top: -9px;
  right: -9px;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-on-light);
  color: var(--color-text);
  font: 400 11px/16px var(--font-heading);
  text-align: center;
}

.popup__address {
  opacity: 0.85;
}

/* Leaflet theme ------------------------------------------------------------
   Leaflet's stylesheet loads first. Selectors below match or outrank its
   specificity (including the .leaflet-touch variants), so no !important is
   needed. */

.leaflet-container {
  border-radius: var(--radius);
  background: var(--color-bg-base);
  font-family: var(--font-body);
}

.leaflet-container .leaflet-bar {
  overflow: hidden;
  border: 1px solid var(--white-55);
  border-radius: var(--radius);
  background: var(--color-overlay);
  box-shadow: none;
  backdrop-filter: blur(4px);
}

.leaflet-container .leaflet-bar a {
  width: 30px;
  height: 30px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: 300 18px/30px var(--font-heading);
  text-indent: 0;
}

/* Outranks Leaflet's .leaflet-touch corner radii on the first and last control */
.leaflet-container .leaflet-bar a,
.leaflet-container .leaflet-bar a:first-child,
.leaflet-container .leaflet-bar a:last-child {
  border-radius: 0;
}

.leaflet-container .leaflet-bar a + a {
  border-top: 1px solid var(--white-35);
}

.leaflet-container .leaflet-bar a:hover,
.leaflet-container .leaflet-bar a:focus-visible {
  background: var(--white-15);
}

.leaflet-container .leaflet-bar a.leaflet-disabled {
  background: transparent;
  opacity: 0.35;
}

.leaflet-top.leaflet-left .leaflet-control {
  margin: var(--space-3) 0 0 var(--space-3);
}

/* Attribution stays small and quiet; the tile licence requires it */
.leaflet-container .leaflet-control-attribution {
  margin: 0;
  padding: 0 var(--space-2) var(--space-1);
  background: transparent;
  box-shadow: none;
  color: var(--white-45);
  font: 300 9px/1.4 var(--font-body);
}

.leaflet-container .leaflet-control-attribution a {
  color: var(--white-45);
  text-decoration: none;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border: 1px solid var(--color-line);
  background: var(--color-bg-base);
  box-shadow: none;
  color: var(--color-text);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
}

.leaflet-popup-content {
  margin: var(--space-3) var(--space-4);
  font: 300 13px/1.45 var(--font-body);
}

.leaflet-popup-content p {
  margin: 0 0 var(--space-1);
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--color-text);
}
