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

/* ---------- hero ---------- */
/* Background photo + headline treatment match mth-potsdam.de's own hero
   exactly (verified against its live CSS): a light "glass" photo behind
   everything, and each headline line as its own tightly-fit dark-green
   block — done with a big line-height rather than padding-block, so the
   color hugs the text the way a highlighter would. The logo + CTA live
   directly on the hero image too (no separate header bar), same as the
   main site. */
.hero {
  position: relative;
  background: var(--off-white) url('/assets/hero-bg-mobile.jpg') no-repeat center top / cover;
  padding-block: 1.5rem 9rem;
}
@media (min-width: 40rem) {
  .hero { background-image: url('/assets/hero-bg.jpg'); }
}
/* The diagonal transition to the off-white page background is a separate
   overlay wedge at the bottom of the hero — not a clip-path on the whole
   section — matching mth-potsdam.de's own technique exactly (verified
   against its live CSS, including its 420px/full-diagonal desktop and
   300px/partial-diagonal mobile figures). Doing it this way keeps the photo
   itself a normal rectangle; only this wedge gets cut at an angle.
   It overlaps 2px past the hero's own bottom edge, into the (identically
   off-white) section below, on purpose: clip-path edges get antialiased
   against whatever sits behind them, and with the photo there that leaves a
   faint seam line exactly on the boundary if the wedge stops flush at it.
   Nothing to contain the overlap with — .hero has no overflow:hidden — so
   it can actually reach past. */
.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: calc(9rem + 2px);
  background: var(--off-white);
  clip-path: polygon(0 100%, 100% 25%, 100% 100%, 0 100%);
  pointer-events: none;
}
/* The main site doesn't cap its header row's width the way our shared
   .wrap does for reading-width content elsewhere (cards, footer, etc.) —
   it's just a flat edge padding, so on a normal desktop monitor the logo
   and headline sit much closer to the true left edge than our capped
   76rem container allows. Widen it for the hero specifically. */
.hero .wrap { position: relative; z-index: 1; max-width: 100rem; }
.hero__top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 3rem; }
.hero__logo img { width: 91px; height: auto; display: block; }
.hero__top-right { display: flex; align-items: center; gap: 1rem; }

/* Mirrors the main site's "DE | EN" switcher: plain text, muted by
   default, the active language picked out in the brand's dark green. */
.lang-switch { display: flex; align-items: center; gap: 0.375rem; font-weight: 600; font-size: 0.9375rem; }
.lang-switch__sep { color: var(--gray); }
.lang-switch__btn {
  background: none; border: 0; padding: 0.5rem 0.125rem; min-height: 2.75rem;
  color: var(--text-muted); font: 600 0.9375rem var(--font); cursor: pointer;
}
.lang-switch__btn:hover { color: var(--green-dark); }
.lang-switch__btn[aria-pressed='true'] { color: var(--green-dark); text-decoration: underline; text-underline-offset: 3px; }
.hero__title { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3em; }
.hero__hl {
  display: inline-block;
  background: var(--green-dark);
  color: var(--white);
  /* fluid, but tuned to land on the main site's own sizes at its own
     breakpoints: ~140px desktop, ~30px small phones */
  font-size: clamp(1.875rem, 9.5vw, 8.75rem);
  line-height: 1.22; /* the background paints the whole line box, so this — not padding-block — is what gives the block its vertical "breathing room" above/below the text */
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  padding-inline: 0.18em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- directory ---------- */
.directory { padding-block: 2.5rem 3rem; position: relative; }

/* Sized to match mth-potsdam.de's own equivalent intro paragraph exactly
   (verified against its live CSS: 16px/23px mobile, 30px/45px, 40px/65px
   desktop) — and placed here, on the plain off-white background, rather
   than over the hero photo where it was hard to read. */
.intro-lead { max-width: 44rem; font-size: 1rem; line-height: 1.4375; color: var(--text); }
.intro-stats { margin-top: 1rem; margin-bottom: 2rem; font-weight: 700; color: var(--green-dark); min-height: 1.55em; }
@media (min-width: 40rem) {
  .intro-lead { font-size: 1.875rem; line-height: 1.5; }
}
@media (min-width: 64rem) {
  .intro-lead { font-size: 2.5rem; line-height: 1.625; }
}

.controls {
  background: var(--white);
  padding: 1rem;
  margin-top: 0;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* lets the chip row scroll instead of widening the page */
  gap: 1rem;
}
.controls__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
.field label, .chips-wrap legend {
  display: block; margin-bottom: 0.25rem;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted);
}
.field input, .field select {
  width: 100%; min-height: 3rem; padding: 0.5rem 0.875rem;
  border: 2px solid var(--gray); border-radius: 0; background: var(--white);
  font: 400 1rem var(--font); color: var(--text);
}
.field input:focus, .field select:focus { border-color: var(--green-dark); outline: none; box-shadow: 0 0 0 3px rgba(0, 80, 79, 0.25); }
.field select { appearance: auto; }

.chips-wrap { border: 0; padding: 0; margin: 0; min-width: 0; }
.chips-wrap legend { padding: 0; }
.chips {
  display: flex; gap: 0.5rem;
  /* mobile: one swipeable row instead of a wall of tags */
  overflow-x: auto; padding-bottom: 0.5rem; margin-inline: -1rem; padding-inline: 1rem;
  scrollbar-width: thin;
}
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 2.5rem; padding: 0.25rem 0.875rem;
  border: 2px solid var(--green-dark); border-radius: 0; background: transparent; color: var(--green-dark);
  font: 600 0.875rem var(--font); cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.chip small { font-weight: 500; opacity: 0.75; font-size: 0.75rem; }
.chip:hover { background: rgba(0, 80, 79, 0.08); }
.chip[aria-pressed='true'] { background: var(--green-dark); color: var(--white); }
.chip[aria-pressed='true'] small { opacity: 0.85; }
.chip[data-empty='true']:not([aria-pressed='true']) { opacity: 0.45; }

.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 1.25rem 1rem; min-height: 3.5rem; }
#count { font-weight: 600; color: var(--text-muted); }
.link-btn { background: none; border: 0; padding: 0.5rem 0; color: var(--green-dark); font: 600 0.9375rem var(--font); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--coral); }

/* ---------- cards ---------- */
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }

.card {
  display: flex; flex-direction: column;
  background: var(--white);
  border-top: 4px solid var(--green-dark);
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1); }
.card__logo {
  display: grid; place-items: center;
  height: 8rem; padding: 1.25rem 1.5rem;
  background: var(--white); border-bottom: 1px solid var(--off-white);
  overflow: hidden;
}
/* place-items: center keeps .card__mono (the fixed-size initials fallback
   below) centered instead of stretched, but it also means the img's grid
   area isn't definite by default — and a grid item's automatic min-height
   defaults to its intrinsic aspect ratio for a replaced element like img,
   not 0. Together those silently overrode width/height: 100% and let the
   img keep its natural aspect-ratio height, so logos with enough built-in
   whitespace between mark and wordmark rendered taller than the box and
   spilled into the card body below. justify/align-self: stretch (just for
   the img) plus min-width/height: 0 (to cancel that automatic minimum)
   gives it an actual definite box, so object-fit can finally constrain it. */
.card__logo img { width: 100%; height: 100%; min-width: 0; min-height: 0; justify-self: stretch; align-self: stretch; object-fit: contain; }
.card__mono {
  display: grid; place-items: center; width: 4.5rem; height: 4.5rem;
  background: var(--off-white); color: var(--green-dark);
  font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em;
}
.card__body { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; padding: 1.25rem 1.25rem 0.5rem; }
.card h3 { font-size: 1.25rem; line-height: 1.25; font-weight: 700; color: var(--green-dark); }
.card__desc { color: var(--text); font-size: 0.96875rem; }
.tags { list-style: none; margin: auto 0 0; padding: 0.25rem 0 0; display: flex; flex-wrap: wrap; gap: 0.375rem; }
.tag {
  padding: 0.25rem 0.625rem; border: 0; border-radius: 0;
  background: var(--off-white); color: var(--text);
  font: 600 0.8125rem var(--font); cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.tag:hover { background: var(--green-sage); }
.tag[aria-pressed='true'] { background: var(--green-light); color: var(--text); }
.card__link {
  display: flex; align-items: center; justify-content: space-between; width: calc(100% - 2.5rem);
  margin: 0.75rem 1.25rem 1.25rem; padding: 0.875rem 0 0; border: 0; border-top: 1px solid var(--off-white);
  background: none; color: var(--green-dark); font: 700 1rem var(--font); text-decoration: none; cursor: pointer;
}
.card__link:hover { color: var(--coral); }
.card__link span[aria-hidden] { transition: transform 0.15s; }
.card__link:hover span[aria-hidden] { transform: translateX(4px); }

/* grouped-by-technology view */
.group + .group { margin-top: 2.25rem; }
.group__title {
  display: flex; align-items: baseline; gap: 0.625rem; margin-bottom: 1rem;
  padding-bottom: 0.5rem; border-bottom: 3px solid var(--green-light);
  font-size: 1.375rem; font-weight: 800; text-transform: uppercase; letter-spacing: -0.01em; color: var(--green-dark);
}
.group__title small { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); text-transform: none; letter-spacing: 0; }

.state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); display: grid; gap: 0.5rem; justify-items: center; }
.state strong { color: var(--text); font-size: 1.125rem; }

/* ---------- call to action + footer ---------- */
.cta { background: var(--green-light); color: var(--text); padding-block: 2.5rem; clip-path: polygon(0 1.5rem, 100% 0, 100% 100%, 0 100%); padding-top: 4rem; }
.cta__inner { display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem; }
.cta h2 { font-size: clamp(1.5rem, 5vw, 2.25rem); font-weight: 800; line-height: 1.1; text-transform: uppercase; letter-spacing: -0.01em; }

.site-footer { background: var(--green-dark); color: var(--white); padding-block: 2.5rem 2rem; }
.site-footer__top { margin-bottom: 2rem; }
.site-footer__logo img { width: 92px; height: auto; display: block; }

.site-footer__bottom { display: flex; flex-direction: column; gap: 2rem; }
.site-footer__contact-title { margin: 0 0 0.625rem; font-size: 1.125rem; font-weight: 700; text-transform: uppercase; }
.site-footer__contact-text { margin: 0; font-size: 0.875rem; line-height: 1.45; max-width: 20rem; }
.site-footer__legal { display: flex; flex-direction: column; gap: 0.625rem; margin-top: 1.5rem; }
.site-footer__legal a {
  color: var(--white); font-weight: 700; font-size: 0.8125rem; letter-spacing: 0.02em;
  text-transform: uppercase; text-decoration: none;
}
.site-footer__legal a:hover { color: var(--green-light); }

.site-footer__social { display: flex; align-items: center; gap: 1rem; }
.site-footer__social a { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; min-height: 2rem; color: var(--white); }
.site-footer__social a:hover { color: var(--green-light); }
.site-footer__social svg { width: 1.375rem; height: 1.375rem; }

.site-footer__partner img { width: 100%; max-width: 7.5rem; height: auto; display: block; }

/* ---------- back to top ---------- */
.back-to-top {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; border-radius: 999px;
  background: var(--coral); color: var(--white);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  opacity: 0; visibility: hidden; transform: translateY(0.5rem);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s, background-color 0.15s;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--coral-hover); }
.back-to-top svg { width: 1.25rem; height: 1.25rem; }

/* ---------- larger screens ---------- */
@media (min-width: 40rem) {
  .controls { padding: 1.5rem; }
  .controls__row { grid-template-columns: minmax(0, 1fr) 13rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
  .cta__inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .site-footer__bottom { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 2.5rem; }
  .site-footer__contact { flex: 1 1 auto; min-width: 0; }
  .site-footer__legal { flex-direction: row; flex-wrap: wrap; gap: 0.5rem 1.625rem; }
  .site-footer__partner { flex: none; }
  .site-footer__partner img { max-width: 9rem; }
}
@media (min-width: 64rem) {
  .hero__logo img { width: 138px; }
  .hero__top { margin-bottom: 6rem; }
  .hero { padding-block: 2.5rem 16rem; }
  .hero::after { height: calc(16rem + 2px); clip-path: polygon(0 100%, 100% 0%, 100% 100%, 0 100%); }
  .controls { padding: 1.75rem 2rem; }
  .chips { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; padding-bottom: 0; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
  .cta { padding-block: 4rem 3.5rem; clip-path: polygon(0 3rem, 100% 0, 100% 100%, 0 100%); padding-top: 6rem; }
  .site-footer__logo img { width: 210px; }
  .site-footer__partner img { max-width: 13.125rem; }
}

/* ---------- partner modal ---------- */
/* Mobile-first: a full-screen sheet (matches the admin editor's own dialog
   pattern), safe-area aware, with just the close button pinned outside the
   scrolling body so it's always reachable. Becomes a centered card at 40rem+. */
/* Pins the page at its current scroll position while the modal is open — see
   lockPageScroll() in app.js for why this (not just overflow:hidden) is
   needed: plain overflow:hidden doesn't reliably stop iOS Safari from
   scrolling the page behind a <dialog>, which showed up as what looked like
   two scrollbars in the popup. JS sets `top` to the negative scroll offset;
   this just needs to be fixed + full-width so that offset actually holds
   the page in place instead of just clipping it. */
body.modal-open { position: fixed; left: 0; right: 0; overflow: hidden; }

#partner-modal {
  position: fixed; inset: 0; margin: 0; border: 0; padding: 0;
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  background: var(--white); color: var(--text);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  /* <dialog> is auto-scrollable by default in the UA stylesheet — with
     height: fit-content + max-height (below), long content (e.g. Limecraft's
     details text) can make the dialog's own box exceed that cap, making the
     dialog itself a second scroll container on top of .modal__body's
     intentional one. Only .modal__body should ever scroll. */
  overflow: hidden;
}
#partner-modal::backdrop { background: rgba(0, 40, 39, 0.6); }
#partner-modal[open] { display: flex; flex-direction: column; }

.modal__close {
  align-self: flex-end; flex: none;
  display: flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; margin: 0.5rem 0.5rem 0 0;
  border: 0; border-radius: 999px; background: var(--off-white); color: var(--text);
  cursor: pointer;
}
.modal__close:hover { background: var(--gray); }
.modal__close svg { width: 1.25rem; height: 1.25rem; }

.modal__body {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 1.5rem 1.5rem;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.modal__logo { display: grid; place-items: center; width: 6rem; height: 6rem; margin-bottom: 1rem; background: var(--off-white); flex: none; overflow: hidden; }
/* Deliberately NOT the width/height:100% + justify/align-self:stretch
   pattern used for .card__logo img: that trick relies on the grid item
   actually stretching to a definite box, which turns out to silently break
   (collapsing to a near-zero box) once the grid container sits inside a
   flex-column ancestor with align-items — exactly .modal__logo's situation
   (nested in .modal__body, a flex column). It visibly showed up as a
   wide/short logo (e.g. Limecraft's) rendering tiny and pinned to one
   corner instead of centered. max-width/max-height alone has none of that
   fragility — it doesn't depend on the item's box being "stretched" at
   all — and is plenty here since .modal__logo was never the one with the
   oversized-logo overflow bug .card__logo needed the stretch fix for. */
.modal__logo img { max-width: 80%; max-height: 80%; object-fit: contain; }
.modal__mono { width: 100%; height: 100%; }
.modal__name { font-size: 1.375rem; font-weight: 800; color: var(--green-dark); margin-bottom: 0.75rem; }
.modal__desc {
  width: 100%; font-size: 1rem; line-height: 1.55; color: var(--text); margin-bottom: 1.5rem; max-width: 32rem;
  text-align: left; /* centered reads fine for the logo/name above, but is hard to read for a full paragraph */
  white-space: pre-line; /* respects line breaks from the admin textarea for multi-paragraph detail text */
}

.modal__benefits { width: 100%; max-width: 32rem; margin-bottom: 1.5rem; text-align: left; }
.modal__benefits h3 { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.75rem; }
.modal__benefits ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.625rem; }
.modal__benefits li { position: relative; padding-left: 1.5rem; font-size: 0.9375rem; line-height: 1.5; }
.modal__benefits li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 0.5rem; height: 0.5rem; background: var(--green-light); }

.modal__link { width: 100%; max-width: 22rem; margin-top: auto; }

@media (min-width: 40rem) {
  /* Still position:fixed; inset:0 from the base rule — that's what makes
     margin:auto center a now-smaller box within the viewport. Overriding
     position here (e.g. to static) breaks that centering entirely. */
  #partner-modal {
    width: min(32rem, calc(100% - 2rem)); height: fit-content;
    max-height: 90dvh; margin: auto; border-top: 4px solid var(--green-dark);
    padding-top: 0; padding-bottom: 0;
  }
  .modal__close { position: absolute; top: 0.75rem; right: 0.75rem; margin: 0; z-index: 1; }
  .modal__body { padding: 1rem 2rem 2rem; }
  .modal__logo { width: 7rem; height: 7rem; }
}
