/* Ausstellungsradar Web – orientiert sich an den iOS-Systemfarben, -Schriftgrößen und -Komponenten der App. */

:root {
  --label: #000;
  --label2: rgba(60, 60, 67, 0.6);
  --label3: rgba(60, 60, 67, 0.3);
  --separator: rgba(60, 60, 67, 0.29);
  --bg: #fff;
  --grouped-bg: #f2f2f7;
  --grouped-cell: #fff;
  --fill3: rgba(118, 118, 128, 0.12);
  --fill4: rgba(116, 116, 128, 0.08);
  --press: #d1d1d6;
  --bar: rgba(249, 249, 249, 0.82);
  --bar-line: rgba(0, 0, 0, 0.3);
  --tint: #007aff;
  --red: #ff3b30;
  --blue: #007aff;
  --orange: #ff9500;
  --gray: #8e8e93;
  --menu: rgba(242, 242, 242, 0.8);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  --dim: rgba(0, 0, 0, 0.2);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tabbar-h: calc(49px + var(--safe-bottom));
  --nav-h: 44px;
  --pad: max(16px, var(--safe-left));
  --pad-r: max(16px, var(--safe-right));
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --label: #fff;
    --label2: rgba(235, 235, 245, 0.6);
    --label3: rgba(235, 235, 245, 0.3);
    --separator: rgba(84, 84, 88, 0.65);
    --bg: #000;
    --grouped-bg: #000;
    --grouped-cell: #1c1c1e;
    --fill3: rgba(118, 118, 128, 0.24);
    --fill4: rgba(116, 116, 128, 0.18);
    --press: #3a3a3c;
    --bar: rgba(22, 22, 23, 0.8);
    --bar-line: rgba(255, 255, 255, 0.15);
    --tint: #0a84ff;
    --red: #ff453a;
    --blue: #0a84ff;
    --orange: #ff9f0a;
    --menu: rgba(37, 37, 37, 0.82);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    --dim: rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body {
  font: 17px/1.294 var(--font);
  letter-spacing: -0.41px;
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; letter-spacing: inherit; }
a { color: var(--tint); text-decoration: none; }
svg.i { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; flex: none; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; }
#tabs { position: absolute; inset: 0; }
.tab { position: absolute; inset: 0; overflow: hidden; background: var(--bg); }
.tab.grouped { background: var(--grouped-bg); }

/* ---------- Seiten-Stapel (Push-Navigation) ---------- */
.page {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: var(--bg);
  padding-bottom: calc(var(--tabbar-h) + 24px);
  will-change: transform;
}
.page.grouped { background: var(--grouped-bg); }
.page.covered { pointer-events: none; }
.page.push-in   { animation: push-in .42s cubic-bezier(.2, .8, .2, 1) both; box-shadow: -10px 0 30px rgba(0,0,0,.12); }
.page.push-out  { animation: push-out .42s cubic-bezier(.2, .8, .2, 1) both; }
.page.pop-in    { animation: pop-in .38s cubic-bezier(.2, .8, .2, 1) both; }
.page.pop-out   { animation: pop-out .38s cubic-bezier(.2, .8, .2, 1) both; box-shadow: -10px 0 30px rgba(0,0,0,.12); }
@keyframes push-in  { from { transform: translateX(100%); } to { transform: none; } }
@keyframes push-out { from { transform: none; filter: none; } to { transform: translateX(-30%); filter: brightness(.92); } }
@keyframes pop-in   { from { transform: translateX(var(--below, -30%)); filter: brightness(.92); } to { transform: none; filter: none; } }
@keyframes pop-out  { from { transform: translateX(var(--from, 0)); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .page.push-in, .page.push-out, .page.pop-in, .page.pop-out { animation-duration: .01s; }
}

/* ---------- Navigationsleiste ---------- */
.navbar {
  position: sticky; top: 0; z-index: 5;
  padding-top: var(--safe-top);
  background: transparent;
  transition: background-color .2s, box-shadow .2s;
}
.navbar.scrolled, .navbar.solid {
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 var(--bar-line);
}
.navbar .bar {
  height: var(--nav-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 calc(var(--pad-r) - 8px) 0 calc(var(--pad) - 8px);
}
.navbar .title {
  font-weight: 600; font-size: 17px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw;
  opacity: 0; transition: opacity .15s;
}
.navbar.scrolled .title, .navbar.solid .title { opacity: 1; }
.navbar .left { justify-self: start; display: flex; }
.navbar .right { justify-self: end; display: flex; gap: 4px; }
.navbtn {
  color: var(--tint); font-size: 17px; height: 44px; min-width: 44px; padding: 0 8px;
  display: inline-flex; align-items: center; gap: 4px; justify-content: center;
}
.navbtn:active { opacity: .3; }
.navbtn .i { font-size: 22px; }
.back { padding-left: 0; gap: 2px; max-width: 42vw; }
.back .i { font-size: 24px; margin-right: -2px; }
.back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.large-title {
  font: 700 34px/41px var(--display); letter-spacing: 0.37px;
  margin: 2px 0 0; padding: 0 var(--pad-r) 6px var(--pad);
}

/* ---------- Suche ---------- */
.search { display: flex; align-items: center; gap: 8px; padding: 2px var(--pad-r) 10px var(--pad); }
.search label {
  flex: 1; display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 8px; border-radius: 10px; background: var(--fill3); color: var(--label2);
}
.search label .i { font-size: 17px; }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--label);
  font: 17px var(--font); letter-spacing: -0.41px; padding: 0; height: 100%;
}
.search input::placeholder { color: var(--label2); }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear { color: var(--label3); font-size: 17px; display: flex; padding: 4px; }
.search .cancel { color: var(--tint); white-space: nowrap; }

/* ---------- Liste ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 10px var(--pad-r) 10px var(--pad); position: relative; color: inherit;
}
.row::after {
  content: ""; position: absolute; left: calc(var(--pad) + 100px); right: 0; bottom: 0;
  height: 0.5px; background: var(--separator);
}
.row:active, .row.pressed { background: var(--press); }
.thumb {
  width: 88px; height: 66px; border-radius: 6px; overflow: hidden; flex: none;
  display: grid; place-items: center; position: relative;
}
.thumb img, .hero img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; display: block; }
.thumb img.loaded, .hero img.loaded { opacity: 1; }
.thumb > .i, .hero > .i { position: absolute; font-size: 20px; }
.thumb img, .hero img { position: relative; z-index: 1; }
.hero.done { background: none; min-height: 0; }
.hero.done > .i { display: none; }
.bg-M { background: var(--red); } .bg-G { background: var(--blue); } .bg-A { background: var(--orange); }
.ph-M { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.ph-G { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.ph-A { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }
.c-M { color: var(--red); } .c-G { color: var(--blue); } .c-A { color: var(--orange); }
.row .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.caption { font-size: 12px; line-height: 16px; letter-spacing: 0; font-weight: 600; color: var(--label2); display: flex; align-items: center; gap: 6px; }
.new { font-size: 11px; line-height: 13px; font-weight: 700; letter-spacing: 0.06px; color: #fff; background: var(--red); border-radius: 99px; padding: 1px 5px; }
.headline { font-weight: 600; font-size: 17px; line-height: 22px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sub { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--label3); font-size: 14px; align-self: center; margin-left: 4px; }
.notice { display: flex; gap: 8px; align-items: center; font-size: 13px; line-height: 18px; color: var(--label2); padding: 8px var(--pad-r) 12px var(--pad); }
.notice .i { font-size: 17px; }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 18vh 32px 0; color: var(--label2); gap: 6px;
}
.empty .i { font-size: 48px; margin-bottom: 10px; }
.empty h2 { font: 700 22px/28px var(--display); color: var(--label); margin: 0; }
.empty p { margin: 0; font-size: 15px; line-height: 20px; }

/* Pull-to-Refresh */
.ptr {
  position: absolute; left: 0; right: 0; z-index: 4; height: 0; display: flex; justify-content: center;
  pointer-events: none;
}
.ptr .spinner { margin-top: 8px; width: 26px; height: 26px; opacity: 0; transition: opacity .15s; color: var(--label2); }
.ptr.on .spinner { opacity: 1; }
.ptr.loading .spinner { animation: spin .9s steps(8) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Filtermenü ---------- */
.menu-backdrop { position: fixed; inset: 0; z-index: 50; }
.menu {
  position: fixed; z-index: 51; min-width: 250px; border-radius: 13px; overflow: hidden;
  background: var(--menu); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  transform-origin: top right; animation: menu-in .28s cubic-bezier(.2, 1.2, .4, 1) both;
}
.menu.closing { animation: menu-out .16s ease-in both; }
@keyframes menu-in { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes menu-out { to { transform: scale(.9); opacity: 0; } }
.menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 11px 16px 11px 12px; font-size: 17px;
}
.menu button + button { box-shadow: inset 0 0.5px 0 var(--separator); }
.menu button:active { background: var(--fill3); }
.menu .check { width: 18px; font-size: 15px; font-weight: 600; display: grid; place-items: center; }
.menu .label { flex: 1; }
.menu .sym { font-size: 18px; color: var(--label); }

/* ---------- Detail ---------- */
.detail { padding: 8px var(--pad-r) 0 var(--pad); max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.hero { border-radius: 8px; overflow: hidden; min-height: 200px; display: grid; place-items: center; position: relative; }
.hero img { height: auto; object-fit: contain; }
.hero.has-img { background: transparent; }
.credit { font-size: 11px; line-height: 13px; letter-spacing: 0.06px; color: var(--label2); margin-top: -12px; }
.d-head { display: flex; flex-direction: column; gap: 4px; }
.d-count { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; font-weight: 600; color: var(--label2); }
.d-title { font: 700 22px/28px var(--display); letter-spacing: 0.35px; margin: 0; }
.d-dates { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; }
.detail p { margin: 0; }
.venue-card { background: var(--fill4); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.venue-card .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.bordered {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px;
  background: var(--fill3); color: var(--tint); font-size: 15px; letter-spacing: -0.24px;
}
.bordered:active { opacity: .5; }
.bordered .i { font-size: 16px; }

/* ---------- Gruppierte Listen (Info, Ortsblatt) ---------- */
.group { margin: 0 var(--pad-r) 35px var(--pad); }
.group > h3 {
  margin: 0 16px 7px; font-size: 13px; line-height: 18px; font-weight: 400; letter-spacing: -0.08px;
  text-transform: uppercase; color: var(--label2);
}
.cells { background: var(--grouped-cell); border-radius: 10px; overflow: hidden; }
.cell {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 11px 16px; width: 100%;
  text-align: left; position: relative; color: var(--label);
}
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--separator); }
button.cell:active, a.cell:active { background: var(--press); }
a.cell { color: var(--tint); }
a.cell.nav { color: var(--label); }
.cell .grow { flex: 1; min-width: 0; }
.cell .value { color: var(--label2); }
.cell .t { font-weight: 600; }
.cell .c { font-size: 12px; line-height: 16px; color: var(--label2); letter-spacing: 0; }
.cell.block { display: block; }
.footnote { font-size: 13px; line-height: 18px; letter-spacing: -0.08px; }
.footnote p { margin: 0 0 8px; }
.caption2 { font-size: 11px; line-height: 13px; letter-spacing: 0.06px; color: var(--label2); }
.page.grouped .large-title { padding-bottom: 14px; }

/* ---------- Karte ---------- */
#map { position: absolute; inset: 0; background: #e9e5dc; }
@media (prefers-color-scheme: dark) { #map { background: #1d2026; } }
.map-nav { position: absolute; top: 0; left: 0; right: 0; z-index: 1000; }
.map-ctrl {
  position: absolute; z-index: 1000; right: max(10px, var(--safe-right));
  top: calc(var(--safe-top) + var(--nav-h) + 10px);
  display: flex; flex-direction: column; border-radius: 8px; overflow: hidden;
  background: var(--bar); box-shadow: 0 1px 6px rgba(0,0,0,.15);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.map-ctrl button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--tint); font-size: 19px; }
.map-ctrl button:active { background: var(--fill3); }
.map-ctrl button.active .i { fill: currentColor; }
.leaflet-container { font: inherit; background: transparent; }
.osm { filter: saturate(.72) brightness(1.03); }
@media (prefers-color-scheme: dark) { .osm { filter: invert(1) hue-rotate(180deg) saturate(.6) brightness(.9) contrast(.88); } }
.leaflet-control-attribution {
  font-size: 10px; background: transparent !important; color: var(--label2);
  margin-bottom: calc(var(--tabbar-h) + 2px) !important; margin-left: max(4px, var(--safe-left)) !important;
}
.leaflet-control-attribution a { color: inherit; }
.leaflet-bottom.leaflet-right .leaflet-control-attribution { margin-right: max(4px, var(--safe-right)) !important; }
.pin { background: none; border: 0; }
.pin .dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 14px;
  border: 1.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); transition: transform .15s;
}
.pin.sel .dot { transform: scale(1.3); }
.pin .lbl {
  position: absolute; top: 32px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: 0; color: var(--label);
  text-shadow: 0 0 2px var(--bg), 0 0 2px var(--bg), 0 0 3px var(--bg);
  display: none; pointer-events: none;
}
.labels .pin .lbl { display: block; }
.me { width: 18px; height: 18px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; box-shadow: 0 0 0 6px color-mix(in srgb, var(--blue) 25%, transparent), 0 1px 4px rgba(0,0,0,.3); }

/* Bottom-Sheet */
.sheet-dim { position: absolute; inset: 0; z-index: 2050; background: var(--dim); opacity: 0; transition: opacity .3s; }
.sheet-dim.on { opacity: 1; }
.sheet-dim:not(.on) { pointer-events: none; }
.sheet {
  position: absolute; z-index: 2100; left: 0; right: 0; bottom: 0;
  height: calc(100% - var(--safe-top) - 10px);
  border-radius: 10px 10px 0 0; overflow: hidden; background: var(--grouped-bg);
  box-shadow: 0 -2px 20px rgba(0,0,0,.15);
  transform: translateY(100%); transition: transform .45s cubic-bezier(.2, .9, .25, 1);
  touch-action: none;
}
.sheet.dragging { transition: none; }
.sheet.closed { pointer-events: none; }
.sheet .grabber { position: absolute; top: 5px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--label3); z-index: 10; }
.sheet .page { background: var(--grouped-bg); padding-bottom: calc(var(--safe-bottom) + 24px); touch-action: pan-y; }
.sheet .page .navbar { padding-top: 6px; }
.sheet .page.detail-page { background: var(--bg); }
@media (min-width: 700px) {
  .sheet {
    left: 50%; right: auto; width: 540px; margin-left: -270px; border-radius: 12px;
    bottom: calc(var(--tabbar-h) + 16px); height: min(720px, calc(100% - var(--safe-top) - var(--tabbar-h) - 120px));
  }
}

/* ---------- Tabbar ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2000;
  height: var(--tabbar-h); padding-bottom: var(--safe-bottom);
  display: flex; justify-content: center;
  background: var(--bar); box-shadow: 0 -0.5px 0 var(--bar-line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.tabbar button {
  flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 7px; gap: 2px; color: var(--gray); font-size: 10px; font-weight: 500; letter-spacing: 0.1px; position: relative;
}
.tabbar button .i { font-size: 24px; }
.tabbar button.on { color: var(--tint); }
.tabbar .badge {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 13px; line-height: 18px; font-weight: 400; text-align: center;
}

/* iPad/Desktop: Tabs oben als schwebende Segmentleiste wie in iPadOS */
@media (min-width: 700px) {
  :root { --tabbar-h: 0px; }
  .tabbar {
    top: calc(var(--safe-top) + 4px); bottom: auto; left: 50%; right: auto; transform: translateX(-50%);
    height: 36px; padding: 3px; border-radius: 99px; gap: 0;
    background: color-mix(in srgb, var(--fill3) 70%, var(--bar)); box-shadow: 0 2px 12px rgba(0,0,0,.08);
  }
  .tabbar button { flex-direction: row; padding: 0 18px; font-size: 15px; font-weight: 500; color: var(--label); border-radius: 99px; max-width: none; align-items: center; justify-content: center; gap: 6px; }
  .tabbar button .i { display: none; }
  .tabbar button.on { background: var(--bg); color: var(--tint); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
  .tabbar .badge { position: static; margin-left: 2px; font-size: 12px; height: 18px; }
  .page { padding-bottom: calc(var(--safe-bottom) + 32px); }
  #tab-list .navbar .title, #tab-info .navbar .title, .map-nav .title { visibility: hidden; }
  .row::after { left: calc(var(--pad) + 100px); }
}

@media (hover: hover) {
  .row:hover { background: var(--fill4); }
  button.cell:hover { background: var(--fill4); }
}
