/* ============================================================
   Musikunterricht Berlin — design system
   --------------------------------------------------------------
   Editorial / utilitarian aesthetic. One accent (deep violet),
   warm off-white background, restrained type. Mobile-first.
   ============================================================ */

:root {
  --bg:          #fbfaf6;
  --surface:    #ffffff;
  --text:       #1a1a1a;
  --muted:      #6b6862;
  --border:     #e8e6e0;
  --accent:     #4f3d8e;
  --accent-2:   #7158c7;
  --tag-bg:     #f1eff6;
  --school:     #4f3d8e;
  --teacher:    #b3631f;
  --shadow:     0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);

  /* Single source of truth for content width — used by every page-level
     section so navigating between home/list/detail does not shift the
     content edge horizontally. */
  --content-max: 1200px;
  --gutter:      1.5rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85em; }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .9rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--text); text-decoration: none;
  font-weight: 600; letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-mark {
  display: inline-block;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  text-align: center; line-height: 28px;
  font-size: 16px;
}
.brand-text-em { color: var(--accent); }
.header-search {
  flex: 1; max-width: 540px;
  display: flex; gap: .25rem;
  margin-left: auto;
}
.header-search input {
  flex: 1;
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.header-search input:focus {
  outline: none; border-color: var(--accent);
}
.header-search button {
  padding: 0 .9rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent); color: #fff;
}

/* ============================================================
   Home
   ============================================================ */
.hero {
  max-width: 880px;
  margin: 3rem auto 2rem;
  padding: 0 1.5rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin: 0 0 1rem;
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.hero-search {
  display: flex; gap: .25rem;
  margin: 0 auto 1.5rem;
  max-width: 520px;
}
.hero-search input {
  flex: 1; padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.hero-search input:focus { outline: none; border-color: var(--accent); }
.hero-search button {
  padding: 0 1.2rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent); color: #fff;
  font-weight: 500;
}
.hero-quick {
  display: flex; flex-wrap: wrap; gap: .4rem;
  justify-content: center;
  font-size: .9rem;
}
.hero-quick-label { color: var(--muted); align-self: center; margin-right: .5rem; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .85rem;
  text-decoration: none;
  transition: border-color .12s, background .12s;
}
.chip:hover {
  border-color: var(--accent);
  background: var(--tag-bg);
  text-decoration: none;
}
.chip-count { color: var(--muted); font-size: .8em; }

.hero-map-section {
  max-width: var(--content-max);
  margin: 2rem auto 0;
  padding: 0 var(--gutter);
}
#hero-map {
  width: 100%;
  height: 360px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
@media (max-width: 760px) { #hero-map { height: 260px; } }

.hero-map-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  margin-top: .6rem;
  font-size: .85rem;
  color: var(--muted);
}
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
  vertical-align: middle;
  margin-right: .25rem;
}
.legend-school  { background: var(--school); }
.legend-teacher { background: var(--teacher); }
.legend-cta { margin-left: auto; font-style: italic; }

/* The unzoomable hint cursor: hover hint that the map is clickable but
   wheel-scroll is intentionally disabled (so the page can be scrolled
   past the map). */
#hero-map .leaflet-container {
  cursor: pointer;
}
/* Soft drop shadow on circle markers. Do NOT add `transform: scale` here —
   Leaflet positions circleMarker SVG paths by `cx`/`cy` attributes, and a
   CSS transform on the path applies to the whole SVG canvas (not the
   geometric center), making the marker visually jump away from its true
   coordinate. Hover-resize is handled in JS via setRadius/setStyle. */
.leaflet-interactive {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
}
/* Quiet the busy default popup chrome so the page stays calm */
.leaflet-popup-content-wrapper { border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.leaflet-popup-content { margin: .6rem .8rem; line-height: 1.4; }
.leaflet-popup-content a { color: var(--accent); font-weight: 500; }

/* ============================================================
   Homepage explore sections — replaces the old 4-column grid
   ============================================================ */

/* Shared card chrome used by all three sections below. */
.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}
.bento-card h2 {
  margin: 0 0 1rem;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}
.bento-eyebrow { letter-spacing: -.01em; }
.bento-side { font-size: .85rem; }

/* Full-page-wide instruments section.
   Note: max-width subtracts 2× gutter so the visible card chrome lands at
   the same horizontal positions as the map above (which has its gutter as
   *padding* inside its own max-width container) and as the cards in
   .explore-row below. Without this subtraction the card would extend
   visibly past the map's edges by exactly one gutter on each side. */
.instruments-section {
  max-width: calc(var(--content-max) - 2 * var(--gutter));
  width: calc(100% - 2 * var(--gutter));
  margin: 2rem auto 0;
  padding: 1.5rem;
}

/* Two cards side by side (Bezirke + Sprachen). Stack on narrow screens. */
.explore-row {
  max-width: var(--content-max);
  margin: 1rem auto 0;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 760px) {
  .explore-row { grid-template-columns: 1fr; }
}

/* --- instrument tiles: clean white, accent only on hover --- */
.instrument-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .6rem;
}
@media (max-width: 1000px) { .instrument-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 600px)  { .instrument-grid { grid-template-columns: repeat(2, 1fr); } }

.i-tile {
  display: flex; flex-direction: column; justify-content: space-between;
  gap: .5rem;
  min-height: 90px;
  padding: .8rem .9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.i-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
  text-decoration: none;
}
.i-tile-name { font-weight: 600; font-size: .98rem; line-height: 1.15; }
.i-tile-count { display: flex; align-items: baseline; gap: .3rem; }
.i-tile-count-num {
  font-size: 1.25rem; font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.i-tile-count-sub { font-size: .7rem; color: var(--muted); }

.bento-tail {
  margin-top: 1rem;
  padding-top: .8rem;
  border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  font-size: .85rem;
}
.chip-mini { padding: .15rem .55rem; font-size: .8rem; }

/* --- Bezirk tag cloud (size by count) --- */
.bezirk-cloud {
  display: flex; flex-wrap: wrap; gap: .4rem;
  align-items: baseline;
}
.bz-pill {
  display: inline-block;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  transition: background .12s, color .12s, transform .12s;
}
.bz-pill:hover {
  background: var(--accent); color: #fff; text-decoration: none;
  transform: translateY(-1px);
}

/* --- Languages: code + native name + count --- */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .35rem;
}
.lang-pill {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
  transition: border-color .12s, background .12s;
}
.lang-pill:hover {
  border-color: var(--accent);
  background: var(--tag-bg);
  text-decoration: none;
}
.lang-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--tag-bg);
  padding: .15rem .35rem;
  border-radius: 3px;
  letter-spacing: .03em;
}
.lang-name { flex: 1; }

/* "Popular searches" — discovery shortcut into landing pages */
.popular-links {
  max-width: var(--content-max);
  margin: 1.5rem auto 0;
  padding: 0 var(--gutter);
}
.popular-links h3 {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin: 0 0 .6rem;
}

/* --- Stats strip — playful one-line summary --- */
.stats-strip {
  max-width: var(--content-max);
  margin: 1.5rem auto 4rem;
  padding: 1rem var(--gutter);
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: center;
  gap: .6rem;
  font-size: .9rem;
  color: var(--text);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stats-strip strong { color: var(--accent); font-weight: 600; }
.stats-strip .dot { color: var(--muted); }

/* ============================================================
   List page
   ============================================================ */
.list-page {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  max-width: var(--content-max);
  margin: 1.5rem auto 3rem;
  padding: 0 var(--gutter);
}
@media (max-width: 760px) {
  .list-page { grid-template-columns: 1fr; }
  .filters { order: 1; }
}

.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  align-self: start;
  position: sticky; top: 4rem;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}
.filter-block { margin-bottom: 1.2rem; }
.filter-block h3 {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin: 0 0 .5rem;
}
.filter-block input[type=search],
.filter-block select {
  width: 100%; padding: .5rem .6rem;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface); color: var(--text);
}
.filter-block .radio,
.filter-block .check {
  display: flex; align-items: center; gap: .4rem;
  padding: .25rem .35rem; margin: 0 -.35rem;
  font-size: .9rem;
  border-radius: 4px;
  cursor: pointer;
}
.filter-block .radio:hover,
.filter-block .check:hover { background: var(--tag-bg); }
.filter-block .radio.active { background: var(--tag-bg); color: var(--accent); font-weight: 500; }
.filter-block .radio input,
.filter-block .check input { margin: 0; accent-color: var(--accent); }
.filter-block .muted { margin-left: auto; font-size: .8em; }
.reset-btn {
  width: 100%;
  padding: .5rem;
  background: transparent;
  border: 1px solid var(--border); border-radius: 5px;
  color: var(--muted);
  font-size: .85rem;
}
.reset-btn:hover { border-color: var(--accent); color: var(--accent); }

.list-results { min-width: 0; }
.list-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.list-toolbar h2 { font-size: 1.15rem; margin: 0; font-weight: 500; }
.view-toggle { display: inline-flex; }
.view-toggle button {
  padding: .35rem .8rem;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .85rem;
}
.view-toggle button:first-child { border-radius: 5px 0 0 5px; border-right: none; }
.view-toggle button:last-child { border-radius: 0 5px 5px 0; }
.view-toggle button.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.loading, .empty {
  text-align: center; padding: 3rem 1rem;
  color: var(--muted);
}

.provider-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.provider-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.provider-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: .5rem; margin-bottom: .5rem;
}
.card-name h3 {
  margin: .25rem 0 0; font-size: 1.05rem; font-weight: 600;
  line-height: 1.2;
}
.card-desc {
  font-size: .9rem; color: var(--muted);
  margin: .5rem 0 .8rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tags { margin-bottom: .6rem; }
.card-meta {
  display: flex; flex-wrap: wrap; gap: .8rem;
  font-size: .8rem; color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: .6rem;
}

.tag, .tag-link {
  display: inline-block;
  padding: .15rem .5rem;
  margin: .15rem .15rem 0 0;
  border-radius: 3px;
  background: var(--tag-bg);
  color: var(--accent);
  font-size: .8rem;
  text-decoration: none;
}
.tag-link:hover { background: var(--accent); color: #fff; }
.tag-more { background: transparent; color: var(--muted); }

.kind-badge {
  display: inline-block;
  padding: .1rem .45rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 3px;
  color: #fff;
}
.kind-badge.kind-music_school    { background: var(--school); }
.kind-badge.kind-private_teacher { background: var(--teacher); }
.kind-badge.mini { font-size: .65rem; padding: .05rem .35rem; }

.rating {
  font-size: .9rem; white-space: nowrap;
  color: var(--text);
}
.rating.big { font-size: 1rem; margin-top: .5rem; }

.map-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
#map { height: 70vh; }

/* ============================================================
   Detail page
   ============================================================ */
.detail-page {
  max-width: var(--content-max);
  margin: 1.5rem auto 4rem;
  padding: 0 var(--gutter);
}
.detail-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.detail-hero h1 {
  margin: .5rem 0 .8rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.15;
}
.detail-desc {
  font-size: 1.05rem; color: var(--muted);
  max-width: 65ch;
  margin: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
}
@media (max-width: 760px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-main { min-width: 0; }
.detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.detail-section h2 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .8rem;
}
.tag-list { display: flex; flex-wrap: wrap; gap: .3rem; }

.facts {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.facts > div { min-width: 0; }
.facts dt {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: .25rem;
}
.facts dd { margin: 0; font-size: .95rem; }

.bezirk-link {
  display: inline-block;
  margin-right: .35rem;
  padding-bottom: 1px;
  border-bottom: 1px dashed var(--accent);
}
.bezirk-link:hover { text-decoration: none; border-bottom-style: solid; }

.price-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: .8rem;
  font-size: .9rem;
}
.price-table th, .price-table td {
  padding: .4rem .5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.price-table th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 500;
}
.price-trial { margin: .5rem 0; }
.price-text {
  margin: .5rem 0 0;
  padding: .6rem .8rem;
  background: var(--tag-bg);
  border-left: 3px solid var(--accent);
  font-size: .9rem;
  border-radius: 0 4px 4px 0;
}

.qual-list { padding-left: 1.2rem; margin: 0; }
.qual-list li { margin-bottom: .25rem; }

.sibling-list {
  display: grid; gap: .4rem;
}
.sibling {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .7rem;
  border: 1px solid var(--border); border-radius: 5px;
  text-decoration: none; color: var(--text);
}
.sibling:hover {
  border-color: var(--accent);
  background: var(--tag-bg);
  text-decoration: none;
}
.sibling-name { font-weight: 500; }

.detail-side { display: flex; flex-direction: column; gap: 1rem; }
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.contact-card h3 {
  font-size: .85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .6rem;
}
.contact-card p { margin: .25rem 0; }
.contact-card .cta {
  display: inline-block;
  margin-top: .35rem;
  padding: .55rem 1rem;
  background: var(--accent); color: #fff;
  border-radius: 5px;
  font-weight: 500;
}
.contact-card .cta:hover { background: var(--accent-2); text-decoration: none; }
.social a { margin-right: .8rem; }
.source-note p { margin: 0; }

/* ============================================================
   Landing pages (server-rendered, /unterricht/...)
   ============================================================ */
.landing-page {
  max-width: var(--content-max);
  margin: 1.5rem auto 4rem;
  padding: 0 var(--gutter);
}
.landing-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 1.75rem;
  margin-bottom: 1.5rem;
}
.landing-hero h1 {
  margin: .35rem 0 .8rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.15;
}
.breadcrumbs {
  font-size: .85rem;
  margin: 0 0 .5rem;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.landing-intro {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 70ch;
  margin: 0 0 .8rem;
}
.landing-stats { font-size: .9rem; margin: 0; }
.landing-stats strong { color: var(--accent); font-weight: 600; }

.landing-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
}
.landing-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  letter-spacing: -.01em;
}

/* Cross-link sections (other Bezirke / other Instrumente) — wrap as
   chips so they read as a fan-out of related landing pages. */
.cross-links {
  display: flex; flex-wrap: wrap; gap: .35rem;
}
.cross-links a {
  display: inline-flex; align-items: baseline; gap: .25rem;
  padding: .35rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
  transition: border-color .12s, background .12s;
}
.cross-links a:hover {
  border-color: var(--accent);
  background: var(--tag-bg);
  text-decoration: none;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
