/* neschtli — restrained visual direction
 *
 * Three ideas:
 *  - One accent color (warm orange) — used sparingly
 *  - Heavy use of whitespace; no boxes around boxes
 *  - Sans + serif pair: Inter-like (system) for body, Charter-like (system) for headlines
 *
 * No frameworks. No JS-rendered CSS-in-JS.
 */

:root {
  --accent: #e3552a;          /* warm orange — decorative accents (borders, glyphs, badges) */
  --accent-text: #b9421f;     /* darker orange — for link/button TEXT so it passes WCAG AA */
  --accent-soft: #fdece4;
  --ink: #1c1b1a;
  --ink-muted: #555350;
  --paper: #fbfaf7;
  --line: #e8e4dc;
  --gen-color: #e3552a;     /* Genossenschaft — orange */
  --stift-color: #4d6a3c;   /* Stiftung — green */
  --st-city-color: #3a5680; /* Städtisch — blue */
  --notes-bg: #fff8eb;
  --notes-border: #d6a648;
  --max-width: 64rem;
  --radius: 4px;
  /* Minimum tap target per WCAG 2.5.5 (Target Size, AAA) — we apply
     it as a floor to interactive controls so thumb taps are reliable
     on mobile. */
  --tap-min: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.7rem, 2.5vw + 1rem, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1em; }

a {
  color: var(--accent-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a:hover, a:focus { border-bottom-color: var(--accent-text); }

.muted { color: var(--ink-muted); font-weight: 400; }
.small { font-size: 0.875rem; }

code {
  background: var(--accent-soft);
  padding: 0.05em 0.35em;
  border-radius: 3px;
  font-size: 0.85em;
}

/* Skip-link for keyboard users */
.skip-link {
  position: absolute; left: 0; top: -100px;
  background: var(--accent); color: white; padding: 0.5rem 1rem;
  z-index: 100; text-decoration: none; border-radius: 0 0 4px 0;
  font-weight: 500;
}
.skip-link:focus { top: 0; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 10;
}
.bar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.8rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  font-weight: 600; color: var(--ink);
  border-bottom: 0;
}
.brand-mark { color: var(--accent); font-size: 1.5rem; line-height: 1; }
.brand-name { font-family: "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, serif; font-size: 1.15rem; }
.nav { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: stretch; }
.nav a {
  color: var(--ink-muted); border-bottom: 0;
  /* Pad so each nav link's tap target is at least 44px tall, per WCAG 2.5.5 */
  display: inline-flex; align-items: center;
  padding: 0.5rem 0.85rem;
  min-height: var(--tap-min);
  border-radius: 3px;
}
.nav a:hover { color: var(--ink); background: rgba(0,0,0,0.03); }
.nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Language switcher — native <select> dropdown in the top-right corner.
   Server-rendered from i18n.py:lang_switcher_nav(). The select
   navigates on change via an inline onchange handler, so the whole
   thing works without app.js being loaded. */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  flex: none;  /* don't grow inside the .bar flex container */
}
.lang-switcher-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background-color: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 2.1rem 0.35rem 0.75rem;
  cursor: pointer;
  line-height: 1.2;
  /* Down-chevron caret. Inline SVG so it works without extra HTTP. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='%231c1b1a' d='M1.5 3.5l3.5 3.5 3.5-3.5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 10px 10px;
}
.lang-switcher-select:hover {
  border-color: var(--ink-muted);
}
.lang-switcher-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
  /* Solid accent ring for visibility — the soft accent alone is too subtle. */
  box-shadow: 0 0 0 4px var(--accent-soft);
}
/* RTL: caret on the left, padding mirrored. */
[dir="rtl"] .lang-switcher-select {
  padding: 0.35rem 0.75rem 0.35rem 2.1rem;
  background-position: left 0.6rem center;
}
/* Group the nav and the lang-switcher on the right of the brand. */
.nav {
  margin-left: auto;
}

/* Hero */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.25rem;
}
.hero h1 { margin-bottom: 0.4em; }
/* Use a static muted ink color here, not opacity, so the subtitle
   reliably passes WCAG AA (4.5:1) on the cream background regardless
   of any ancestor transparency. */
.hero .muted { color: var(--ink-muted); font-weight: 400; }
.lede { color: var(--ink-muted); font-size: 1rem; margin: 0.4rem 0 0; }

/* Filters */
.filters {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid var(--line);
}
.filter-row {
  display: flex; flex-wrap: wrap; align-items: end; gap: 0.85rem 1rem;
}
.filter-row label {
  display: flex; flex-direction: column; gap: 0.25rem;
  font-size: 0.85rem; color: var(--ink-muted);
}
.filter-row label.checkbox {
  flex-direction: row; align-items: center; gap: 0.55rem;
  padding: 0.55rem 0.25rem;
  cursor: pointer;
  align-self: end;
  min-height: var(--tap-min);
  height: auto;
}
.filter-row label.checkbox input {
  margin: 0;
  /* Make the checkbox itself easier to hit on touch */
  width: 1.15rem; height: 1.15rem;
}
.filter-row select,
.filter-row input[type=number],
.filter-row input[type=email] {
  font: inherit;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  min-width: 8rem;
  color: var(--ink);
  /* WCAG 2.5.5 — every filter input must have at least a 44px tap height */
  min-height: var(--tap-min);
}
.filter-row input[type=number] { min-width: 6rem; }
.filter-row select:focus,
.filter-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.filter-row button.reset {
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  /* Ensure reset button itself meets 44x44 tap target */
  padding: 0.7rem 0.5rem;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  cursor: pointer;
  font: inherit;
  align-self: end;
}
.filter-row button.reset:hover { color: var(--ink); }
.filter-row button.reset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Results */
.results {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.cards { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }

.card {
  background: white;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gen-color);
  border-radius: var(--radius);
  padding: 0;
  transition: border-color 120ms ease, transform 120ms ease;
}
.card:hover { transform: translateY(-1px); border-color: var(--ink-muted); }
.card .card-body {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 1rem 1.1rem;
  color: inherit;
  height: 100%;
}
.card .card-body:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.card .link-cta {
  background: transparent; color: var(--accent-text);
  border: 1px solid var(--accent-text);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  min-height: var(--tap-min);
  font: inherit; font-size: 0.85rem;
  cursor: pointer;
  /* Compensate for the larger font/padding so the button doesn't dominate the card */
  line-height: 1.2;
}
.card .link-cta:hover { background: var(--accent-text); color: white; border-color: var(--accent-text); }
.card .link-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.card[data-type="Stiftung"] { border-left-color: var(--stift-color); }
.card[data-type="Städtische Wohnung"] { border-left-color: var(--st-city-color); }

.card .title { font-family: "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, serif; font-size: 1.15rem; line-height: 1.3; margin: 0 0 0.15em; }
.card .title .type-glyph { color: var(--gen-color); margin-right: 0.35em; font-size: 1.05em; vertical-align: -0.05em; }
.card[data-type="Stiftung"] .title .type-glyph { color: var(--stift-color); }
.card[data-type="Städtische Wohnung"] .title .type-glyph { color: var(--st-city-color); }
.card .title .rooms { color: var(--ink-muted); font-weight: 500; font-size: 0.85em; letter-spacing: 0.01em; }
.card .title .sep { color: var(--line); margin: 0 0.2em; }
.card .title .loc { font-weight: 700; color: var(--ink); }
.card[data-type="Stiftung"] .title .rooms { color: var(--stift-color); }
.card[data-type="Städtische Wohnung"] .title .rooms { color: var(--st-city-color); }

.card .meta { font-size: 0.875rem; color: var(--ink); }
.card .meta strong { font-weight: 600; }
.card .meta.secondary { color: var(--ink-muted); font-size: 0.825rem; }

.card .notes {
  background: var(--notes-bg);
  border-left: 2px solid var(--notes-border);
  padding: 0.3rem 0.6rem;
  font-size: 0.825rem;
  color: #5a4416;
  margin: 0.25rem 0;
}

/* "Neu" badge on listings first_seen within the last 7 days */
.card .new-badge {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #2e7d4f;
  color: white;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  position: relative;
  top: -0.05em;
}

.card .footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 0.6rem; gap: 0.5rem;
}
.card .source { font-size: 0.75rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; line-height: 1.3; }
.card .direct-link {
  font-weight: 500; color: var(--accent);
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.875rem;
}
.card .direct-link .arrow { transition: transform 120ms ease; }
.card-link:hover .direct-link .arrow { transform: translate(2px, -2px); }

/* Metadata chips inside cards — click to filter the catalogue */
.card .chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.25rem; }
.card .chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.45rem 0.75rem;
  /* WCAG 2.5.5 — chip buttons are interactive filters; need ≥44px tap height */
  min-height: var(--tap-min);
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.card .chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-text);
  color: var(--accent-text);
}
.card .chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.empty { text-align: center; color: var(--ink-muted); padding: 2rem 1rem; }

/* Loading, error, empty states */
/* HTML hidden attribute — must beat `.state { display: flex }` below */
.state[hidden],
.results [hidden],
[hidden] { display: none !important; }
.state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--ink-muted);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
}
.state .state-icon {
  font-size: 2rem; line-height: 1; opacity: 0.7;
}
.state h3 {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 1.05rem; font-weight: 600; color: var(--ink);
}
.state p { margin: 0; }
.state .reset {
  margin-top: 0.6rem; font: inherit; color: var(--accent-text);
  background: transparent; border: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  padding: 0.55rem 0.7rem;
  min-height: var(--tap-min);
  display: inline-flex; align-items: center;
}
.state .reset:hover { color: #8c2e10; }
.state .reset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.state-error { background: #fdf3f0; border: 1px solid #f3c2b4; border-radius: var(--radius); }
.state-error .state-icon { opacity: 1; }
.state-empty strong { color: var(--ink); display: block; font-weight: 600; font-size: 1.05rem; margin-bottom: 0.25rem; }
.state-empty span { display: block; margin-bottom: 0.5rem; }
.state-empty .reset { margin-top: 0.5rem; }

/* About */
.about, .abo {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  border-top: 1px solid var(--line);
}
.about details, .abo details { margin-bottom: 0.5rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--line); }
.about summary, .abo summary { cursor: pointer; font-weight: 500; padding: 0.4rem 0; }
.about p, .abo p { max-width: 50ch; }

/* Abo */
.abo-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }
.abo-form label { display: flex; flex-direction: column; gap: 0.25rem; }
.abo-form input[type=email] {
  font: inherit; padding: 0.55rem 0.75rem; min-width: 16rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: white;
}
.abo-form button {
  font: inherit; padding: 0.6rem 1.1rem;
  background: #b9421f; color: white;
  border: 0; border-radius: var(--radius); cursor: pointer;
}
.abo-form button:hover { background: #9a3717; }
.abo-status { color: var(--ink-muted); margin-top: 0.5rem; font-size: 0.875rem; }
.abo-status.ok { color: #2e7d4f; }

/* Plan grid (Free vs Supporter) */
.plan-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin: 1rem 0 1.25rem;
}
.plan {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.plan h3 { margin: 0; font-size: 1.1rem; }
.plan p { margin: 0; color: var(--ink-muted); font-size: 0.95rem; }
.plan .plan-price {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-muted);
  margin-left: 0.4rem;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}
.plan-supporter { border-left: 3px solid var(--accent); }
.plan-supporter[data-state="loading"] { border-left-color: var(--line); }
.plan-supporter[data-state="disabled"] {
  background: #fafaf7;
  border-left-color: var(--line);
  opacity: 0.85;
}
.plan-supporter[data-state="disabled"] button {
  background: var(--line);
  color: var(--ink-muted);
  cursor: not-allowed;
}
.plan-supporter button {
  font: inherit; padding: 0.6rem 1.1rem;
  background: #b9421f; color: white;
  border: 0; border-radius: var(--radius); cursor: pointer;
  align-self: start;
  margin-top: 0.25rem;
}
.plan-supporter button:hover:not(:disabled) { background: #9a3717; }
.plan-supporter button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Payment-method badges (TWINT / card / Apple Pay / Google Pay) */
.payment-methods {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.payment-methods[hidden] { display: none; }
.payment-methods-heading {
  list-style: none;
  margin: 0 0.25rem 0 0;
  color: var(--ink-muted);
}
.payment-method {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #faf8f4;
  color: var(--ink);
  white-space: nowrap;
}
.payment-method::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.65;
}
.payment-method-twint::before   { background: #ee5a36; }
.payment-method-card::before    { background: #1f6feb; }
.payment-method-apple_pay::before { background: #111; }
.payment-method-google_pay::before { background: #4285f4; }

/* Billing management card (shown when there's a Stripe customer) */
.billing-management {
  background: white;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-top: 1rem;
}
.billing-management h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.billing-dl { margin: 0 0 0.6rem; display: grid; gap: 0.25rem 1rem; grid-template-columns: max-content 1fr; }
.billing-dl dt { color: var(--ink-muted); font-size: 0.85rem; }
.billing-dl dd { margin: 0; font-size: 0.95rem; }
.billing-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.billing-actions button {
  font: inherit; padding: 0.55rem 1rem;
  background: #b9421f; color: white;
  border: 0; border-radius: var(--radius); cursor: pointer;
}
.billing-actions button:hover { background: #9a3717; }
.billing-actions button.reset {
  background: transparent; color: var(--ink-muted); border: 0;
  text-decoration: underline; text-underline-offset: 3px;
  padding: 0.55rem 0.7rem;
  min-height: var(--tap-min);
}
.billing-actions button.reset:hover { color: var(--ink); }
.billing-actions button.reset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding: 1.5rem 1.25rem;
  color: var(--ink-muted);
  font-size: 0.875rem;
  text-align: center;
}
.site-footer span { color: var(--ink); font-weight: 500; }
.site-footer a + a::before { content: " · "; color: var(--ink-muted); }

/* Visually hidden but accessible to screen readers and assistive tech.
 * Used for live status announcements and the page-title h1 mirror when
 * the visible heading is decorative. */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Right-to-left overrides for languages like Arabic. Only structural
 * margins/paddings and a couple of asymmetric text-alignments need
 * flipping; the layout is already flex/grid which mirrors naturally.
 * Skipped on tiny screens where the mobile block already stacks. */
[dir="rtl"] .filter-row label { text-align: right; }
[dir="rtl"] .card-body { text-align: right; }
[dir="rtl"] .results-head { text-align: right; }
[dir="rtl"] .billing-dl { direction: rtl; }
[dir="rtl"] .site-header .bar { flex-direction: row-reverse; }
[dir="rtl"] .payment-methods { flex-direction: row-reverse; }

/* RTL — mirror the colored left accent border to the right side so the
 * affordance reads the same direction as the surrounding text. The
 * default 1px border on the other side stays on the left as a hairline. */
[dir="rtl"] .card { border-left: 1px solid var(--line); border-right: 3px solid var(--gen-color); }
[dir="rtl"] .card[data-type="Stiftung"] { border-right-color: var(--stift-color); }
[dir="rtl"] .card[data-type="Städtische Wohnung"] { border-right-color: var(--st-city-color); }
[dir="rtl"] .plan-supporter { border-left: 1px solid var(--line); border-right: 3px solid var(--accent); }
[dir="rtl"] .billing-management { border-left: 1px solid var(--line); border-right: 3px solid var(--accent); }

/* Mobile */
@media (max-width: 640px) {
  .bar { padding: 0.7rem 1rem; }
  .nav { gap: 0.15rem; font-size: 0.9rem; }
  .nav a { padding: 0.4rem 0.6rem; }
  .filter-row { gap: 0.6rem; }
  .filter-row label { flex: 1 1 calc(50% - 0.5rem); }
  .filter-row label.checkbox { flex: 1 1 100%; }
  .filter-row select, .filter-row input { width: 100%; min-width: 0; }
  .filter-row button.reset { padding: 0.55rem 0.6rem; }
  .hero { padding-top: 1.5rem; }
  .cards { grid-template-columns: 1fr; }
}

/* Modern, quieter visual system ------------------------------------------------
 *
 * The original interface exposed every control with equal visual weight. This
 * layer keeps the same semantic HTML and interaction targets, but establishes a
 * calmer hierarchy: compact navigation, a focused introduction, one filter
 * surface, low-noise listing cards, and a clearly separated subscription area.
 */

:root {
  --accent: #16705d;
  --accent-text: #0d5d4d;
  --accent-strong: #084c40;
  --accent-soft: #e8f3ef;
  --ink: #18231f;
  --ink-muted: #62706b;
  --paper: #f5f7f6;
  --surface: #ffffff;
  --line: #dfe6e3;
  --gen-color: #16705d;
  --stift-color: #627d42;
  --st-city-color: #486b86;
  --notes-bg: #fbf6e9;
  --notes-border: #c9a652;
  --max-width: 72rem;
  --radius: 14px;
}

html { scroll-behavior: smooth; }

html,
body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: inherit;
  font-weight: 720;
  letter-spacing: -0.035em;
}

h1 { font-size: clamp(2.15rem, 4vw, 3.25rem); line-height: 1.06; }
h2 { font-size: clamp(1.35rem, 2vw, 1.65rem); }
h3 { font-size: 1.05rem; }

a { color: var(--accent-text); }
a:hover,
a:focus { border-bottom-color: var(--accent-text); }

.site-header {
  border-bottom-color: rgba(24, 35, 31, 0.08);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.bar {
  min-height: 4.25rem;
  padding: 0.7rem 1.5rem;
}

.brand { gap: 0.65rem; }
.brand-mark {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--accent);
  color: transparent;
  font-size: 0;
}
.brand-name {
  font-family: inherit;
  font-size: 1.12rem;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.nav { gap: 0.15rem; }
.nav a {
  padding: 0.4rem 0.7rem;
  color: var(--ink-muted);
  font-size: 0.88rem;
  border-radius: 9px;
}
.nav a:hover { background: var(--paper); }
.nav a:last-child {
  margin-left: 0.25rem;
  padding-inline: 0.9rem;
  background: var(--ink);
  color: white;
}
.nav a:last-child:hover { background: var(--accent-strong); color: white; }

.lang-switcher-select {
  min-height: 2.5rem;
  padding-block: 0.4rem;
  border-radius: 10px;
  background-color: var(--surface);
}

.hero {
  padding: 4rem 1.5rem 2rem;
}
.hero h1 {
  max-width: 57rem;
  margin: 0;
}
.hero h1 br { display: none; }
.hero h1 .muted {
  display: block;
  max-width: 48rem;
  margin-top: 1rem;
  color: var(--ink-muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  font-weight: 450;
  letter-spacing: -0.015em;
  line-height: 1.45;
}
.lede {
  display: block;
  margin-top: 1.5rem;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.filters {
  padding: 0 1.5rem 2rem;
  border-bottom: 0;
}
.filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 35px rgba(22, 45, 37, 0.05);
}
.filter-row label {
  min-width: 0;
  gap: 0.4rem;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.filter-row select,
.filter-row input[type=number],
.filter-row input[type=email] {
  width: 100%;
  min-width: 0;
  border-color: transparent;
  border-radius: 11px;
  background: var(--paper);
}
.filter-row label.checkbox {
  grid-column: span 3;
  align-self: center;
  padding: 0.2rem 0.35rem;
  color: var(--ink-muted);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.filter-row label.checkbox input { accent-color: var(--accent); }
.filter-row button.reset {
  justify-self: end;
  align-self: center;
  padding-inline: 0.35rem;
  color: var(--ink-muted);
  font-size: 0.82rem;
  text-decoration: none;
}
.filter-row button.reset:hover { color: var(--accent-text); }

.results { padding: 1.25rem 1.5rem 5rem; }
.results-head {
  align-items: center;
  margin: 0 0 1.25rem;
}
.results-head h2 { margin: 0; }
.results-head p {
  max-width: 34rem;
  margin: 0;
  text-align: right;
}
.cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0;
}

.card,
[dir="rtl"] .card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(22, 45, 37, 0.035);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.card:hover {
  border-color: #c6d4ce;
  box-shadow: 0 12px 28px rgba(22, 45, 37, 0.075);
  transform: translateY(-2px);
}
.card .card-body { gap: 0.62rem; padding: 1.25rem; }
.card .title {
  font-family: inherit;
  font-size: 1.08rem;
  letter-spacing: -0.025em;
}
.card .title .type-glyph {
  margin-right: 0.45rem;
  font-size: 0.68em;
}
.card .title .rooms,
.card[data-type="Stiftung"] .title .rooms,
.card[data-type="Städtische Wohnung"] .title .rooms {
  color: var(--ink-muted);
  font-weight: 520;
}
.card .title .sep { color: #c9d1ce; }
.card .title .loc { font-weight: 720; }
.card .meta { color: #2d3935; font-size: 0.88rem; }
.card .meta strong { font-weight: 720; }
.card .meta.secondary { color: var(--ink-muted); font-size: 0.8rem; }
.card .notes {
  margin: 0.1rem 0;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: var(--notes-bg);
  color: #67552c;
  font-size: 0.78rem;
}
.card .chips { gap: 0.75rem; margin-top: 0; }
.card .chip {
  min-height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.76rem;
}
.card .chip:hover {
  border-color: transparent;
  background: transparent;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.card .footer {
  margin-top: 0.2rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.card .source { max-width: 70%; }
.card .link-cta {
  min-height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-text);
  font-size: 0.82rem;
  font-weight: 650;
}
.card .link-cta::after { content: " →"; }
.card .link-cta:hover {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}

.state { padding-block: 4rem; }
.state-error { border-radius: 16px; }

.about,
.abo {
  padding: 4rem 1.5rem;
  border-top-color: var(--line);
}
.about > p,
.abo > p { max-width: 62ch; color: var(--ink-muted); }
.about details {
  max-width: 48rem;
  margin: 0;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.about details:first-of-type { border-top: 1px solid var(--line); }
.about summary { padding: 0.65rem 0; font-weight: 620; }

.abo {
  max-width: none;
  padding-inline: max(1.5rem, calc((100vw - var(--max-width)) / 2));
  border-top: 0;
  background: #edf4f1;
}
.plan-grid { gap: 0.8rem; margin-top: 1.5rem; }
.plan {
  padding: 1.4rem;
  border-color: rgba(13, 93, 77, 0.12);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(22, 45, 37, 0.04);
}
.plan h3 { font-size: 1.08rem; }
.plan-premium,
[dir="rtl"] .plan-premium { border: 1px solid rgba(13, 93, 77, 0.2); }
.plan-premium[data-state="disabled"] { background: rgba(255, 255, 255, 0.65); }
.abo-form input[type=email],
.premium-email-field input {
  min-height: var(--tap-min);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
}
.abo-form button,
.plan-premium button,
.billing-actions button {
  min-height: var(--tap-min);
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 11px;
  background: var(--accent-text);
  color: white;
  font: inherit;
  font-weight: 620;
  cursor: pointer;
}
.abo-form button:hover,
.plan-premium button:hover:not(:disabled),
.billing-actions button:hover { background: var(--accent-strong); }
.plan-premium button:disabled {
  background: #d8e0dd;
  color: #71807a;
  cursor: not-allowed;
}
.premium-email-field {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.premium-email-field label { color: var(--ink-muted); font-size: 0.8rem; }
.premium-email-field input { width: 100%; padding: 0.55rem 0.75rem; font: inherit; }
.billing-management,
[dir="rtl"] .billing-management {
  border: 1px solid rgba(13, 93, 77, 0.18);
  border-radius: 16px;
}

.site-footer {
  margin-top: 0;
  padding-block: 2rem;
  background: var(--surface);
}

@media (max-width: 760px) {
  .bar { padding-inline: 1rem; }
  .nav { display: none; }
  .hero { padding: 3rem 1rem 1.5rem; }
  .hero h1 {
    font-size: clamp(2rem, 9vw, 2.4rem);
    hyphens: auto;
    overflow-wrap: anywhere;
  }
  .lede { max-width: 100%; }
  .filters { padding: 0 1rem 1.5rem; }
  .filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row label.checkbox { grid-column: span 1; }
  .results { padding: 1rem 1rem 4rem; }
  .results-head { align-items: flex-start; }
  .results-head p { text-align: left; }
  .cards { grid-template-columns: 1fr; }
  .about,
  .abo { padding-block: 3rem; padding-inline: 1rem; }
}

@media (max-width: 460px) {
  .lang-switcher-select { max-width: 8.5rem; }
  .filter-row { grid-template-columns: 1fr; }
  .filter-row label.checkbox { grid-column: span 1; }
  .filter-row button.reset { justify-self: start; }
  .card .card-body { padding: 1.05rem; }
  .abo-form { align-items: stretch; }
  .abo-form label { width: 100%; }
  .abo-form input[type=email] { min-width: 0; width: 100%; }
}
