:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --text: #1c1b19;
  --muted: #6b6a66;
  --line: #e2e0da;
  --accent: #d52b1e;
  --accent-ink: #ffffff;
  --link: #a1170d;
  --ok: #1d7a46;
  --warn: #b25b00;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --surface: #1f2126;
    --surface-2: #272a31;
    --text: #ececea;
    --muted: #a3a39e;
    --line: #34373f;
    --accent: #e6493c;
    --link: #ff8a80;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); }
a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin-top: 2rem; }
h3 { font-size: 1.02rem; margin-top: 1.5rem; }
p { margin: 0 0 .75rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.prewrap { white-space: pre-wrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: .5rem; }
.skip:focus { left: 8px; z-index: 100; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-weight: 700; padding: .5rem 0; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 7px 6px 6px; background: #fff; clip-path: polygon(50% 0, 100% 45%, 82% 45%, 82% 100%, 60% 100%, 60% 66%, 40% 66%, 40% 100%, 18% 100%, 18% 45%, 0 45%); }
.brand-text small { display: block; font-weight: 400; font-size: .72rem; color: var(--muted); line-height: 1.1; }
.site-nav { display: flex; gap: .25rem; flex-wrap: wrap; margin-left: auto; }
.site-nav a { color: var(--text); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font-size: .95rem; }
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { background: var(--surface-2); font-weight: 600; }

/* hero */
.hero { padding: 1.8rem 0 .6rem; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 70ch; }
.stats { list-style: none; padding: 0; margin: .75rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; color: var(--muted); font-size: .92rem; }
.stats strong { color: var(--text); font-size: 1.15rem; margin-right: .25rem; }

/* home */
.home { padding: 3.5rem 0 3rem; max-width: 680px; margin: 0 auto; }
.home h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.home-intro { font-size: 1.08rem; color: var(--muted); margin: 0 0 2rem; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.1rem 1rem; color: inherit; text-decoration: none;
  transition: transform .08s ease, border-color .15s; }
.tile:hover, .tile:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.tile-icon { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 11px;
  background: var(--surface-2); color: var(--accent); margin-bottom: .7rem; }
.tile-label { display: block; font-weight: 650; font-size: 1.02rem; }
.tile-sub { display: block; margin-top: .15rem; font-size: .85rem; color: var(--muted); }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: .6rem .8rem; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin: 1rem 0 .5rem; box-shadow: var(--shadow); }
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.filters .grow { flex: 1 1 220px; }
.filters select, .filters input { font: inherit; font-size: .95rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; min-width: 9rem; }
.filters input { min-width: 0; width: 100%; }
.filters select:focus, .filters input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.filter-actions { display: flex; gap: .5rem; align-items: center; margin-left: auto; }
.btn { font: inherit; font-size: .92rem; padding: .48rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--muted); }
.btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.view-toggle { display: inline-flex; }
.view-toggle .btn { border-radius: 0; }
.view-toggle .btn:first-child { border-radius: 8px 0 0 8px; }
.view-toggle .btn:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
.linklike { background: none; border: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.result-count { color: var(--muted); font-size: .9rem; margin: .4rem .2rem .8rem; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted); }

/* cards */
.list { display: grid; gap: .7rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .08s ease, border-color .15s; }
.card:hover { border-color: var(--muted); transform: translateY(-1px); }
.card.cancelled, .card.status-past { opacity: .72; }
.card-link { display: grid; grid-template-columns: 78px 1fr auto; gap: 1rem; align-items: center; padding: .85rem 1rem; color: inherit; text-decoration: none; }
.card-date { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.05; padding: .35rem 0; border-right: 1px solid var(--line); min-height: 64px; }
.card-date .dow { font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.card-date .day { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.card-date .mon { font-size: .8rem; font-weight: 600; }
.card-date .yr { font-size: .68rem; color: var(--muted); }
.card-date .nodate { font-size: .72rem; color: var(--muted); line-height: 1.2; }
.card.cancelled .card-date .day { text-decoration: line-through; }
.card-title { font-size: 1.08rem; margin: 0 0 .15rem; }
.card-sub { margin: 0; font-size: .93rem; }
.card-meta { margin: .15rem 0 0; font-size: .82rem; color: var(--muted); }
.card-summary { margin: .35rem 0 0; font-size: .88rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { text-align: right; display: flex; flex-direction: column; align-items: flex-end; min-width: 7.5rem; }
.card-price .price { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-price .price-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.badge { display: inline-block; font-size: .7rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: middle; margin-left: .3rem; text-transform: uppercase; letter-spacing: .03em; }
.badge-canton { background: var(--text); color: var(--bg); }
.badge-cancel, .badge-status.status-cancelled { background: var(--accent); color: #fff; }
.badge-past, .badge-status.status-past { background: var(--surface-2); }
.badge-soon { background: #fff2cc; color: #7a4d00; }
.badge-status.status-upcoming { background: #dcefe3; color: var(--ok); }
@media (prefers-color-scheme: dark) { .badge-soon { background: #4a3a00; color: #ffd76a; } .badge-status.status-upcoming { background: #1c3a29; color: #7fd6a2; } }

/* map */
.map-wrap { margin: 0 0 1rem; }
.map { height: 70vh; min-height: 380px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); position: relative; z-index: 0; }
.map-legend { margin: .5rem .2rem 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.map-legend span::before { content: ""; display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: var(--dot); margin-right: .35em; border: 1px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.map-small { height: 260px; min-height: 220px; }
.map-tall { height: calc(100vh - 330px); min-height: 480px; }
.hero-compact { padding-bottom: .2rem; }
.stats a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
.stats a:hover { border-bottom-style: solid; }
.map-note { margin: .4rem .2rem; }
.leaflet-popup-content { font: 14px/1.4 var(--font); }
.leaflet-popup-content .pp-title { font-weight: 700; display: block; margin-bottom: .15rem; }
.leaflet-popup-content .pp-meta { color: var(--muted); font-size: .85rem; display: block; }
@media (prefers-color-scheme: dark) {
  .leaflet-tile { filter: brightness(.85) contrast(1.05); }
  .leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-bar a { background: var(--surface); color: var(--text); }
  .leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
}

/* hint */
.hint { margin: 2.5rem 0 1rem; padding: 1.2rem 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.hint h2 { margin-top: 0; font-size: 1.05rem; }
.hint p { margin: 0; color: var(--muted); font-size: .95rem; }

/* detail */
.crumbs { margin: 1.2rem 0 .8rem; font-size: .92rem; }
.crumbs a { text-decoration: none; }
.detail-head h1 { margin: .35rem 0 .5rem; }
.badges { margin: 0; }
.badges .badge { margin: 0 .35rem 0 0; font-size: .74rem; }
.tags { list-style: none; padding: 0; margin: .25rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li { background: var(--surface-2); border-radius: 999px; padding: .15rem .6rem; font-size: .82rem; }
.key-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; margin: 1.2rem 0; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .15rem; box-shadow: var(--shadow); }
.fact-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.fact-value { font-size: 1.15rem; font-weight: 700; }
.fact-sub { font-size: .88rem; color: var(--muted); white-space: pre-line; }
.fact-link { font-size: .88rem; margin-top: .3rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.detail-grid > * { min-width: 0; }
.detail, .prewrap, .kv dd, .fact-sub { overflow-wrap: anywhere; }
.detail-main h2:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
.kv div { display: grid; grid-template-columns: 200px 1fr; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .5rem; }
.table-wrap { overflow-x: auto; }
.objects { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .92rem; }
.objects th, .objects td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.objects th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.objects .num { text-align: right; white-space: nowrap; }
.official-text { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; font-size: .95rem; overflow-wrap: anywhere; }
.official-text p { margin: 0 0 .6rem; }
.official-text table { border-collapse: collapse; }
.official-text td, .official-text th { border: 1px solid var(--line); padding: .2rem .4rem; }
.notice { background: var(--surface-2); border-radius: var(--radius); padding: .9rem 1rem; font-size: .9rem; margin-top: 1rem; }
.notice p { margin: .3rem 0 0; }
.detail-side { position: sticky; top: 76px; }

/* prose */
.prose { max-width: 72ch; padding: 1.5rem 0 2rem; }
.prose h2 { margin-top: 1.8rem; }
.prose li { margin-bottom: .35rem; }

/* footer */
/* language menu (native <details>, works without JS) */
.lang-menu { position: relative; flex: none; }
.lang-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem;
  padding: .35rem .5rem .35rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  font-size: .8rem; font-weight: 700; letter-spacing: .04em; color: var(--text); }
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu > summary::after { content: ""; width: 0; height: 0; border: .3rem solid transparent; border-top-color: currentColor; margin-top: .25rem; opacity: .6; }
.lang-menu > summary:hover, .lang-menu[open] > summary { background: var(--surface-2); }
.lang-menu ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; margin: 0; padding: .25rem; min-width: 150px;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.lang-menu li { margin: 0; }
.lang-menu ul a { display: block; padding: .45rem .6rem; border-radius: 7px; color: var(--text); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.lang-menu ul a:hover { background: var(--surface-2); }
.lang-menu ul a[aria-current] { font-weight: 700; color: var(--accent); }
.official-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-top: 2rem; }
.official-head h2 { margin: 0; }
.btn-small { font-size: .8rem; padding: .3rem .7rem; }
.translation-note { margin: .2rem 0 .8rem; }
.site-footer { margin-top: 3rem; padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.site-footer p { margin: 0 0 .4rem; }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.5rem; margin-top: .6rem; }
.footer-bottom p { margin: 0; }
.sa-badge { display: inline-flex; line-height: 0; opacity: .85; }
.sa-badge:hover { opacity: 1; }
.sa-badge img { height: 32px; width: auto; }

@media (max-width: 620px) {
  .tiles { grid-template-columns: 1fr; }
  .home { padding: 2rem 0 2.5rem; }
  .tile { display: grid; grid-template-columns: 40px 1fr; column-gap: .85rem; align-items: center; padding: .8rem .9rem; }
  .tile-icon { width: 40px; height: 40px; margin-bottom: 0; grid-row: span 2; }
  .tile-label { align-self: end; }
  .tile-sub { align-self: start; }
  .brand-text small { display: none; }                 /* keep the header to two tidy rows */
  .header-inner { gap: .4rem .6rem; padding-bottom: .4rem; }
  .site-nav { order: 3; width: 100%; margin-left: 0; }
  .site-nav a { padding: .4rem .55rem; font-size: .9rem; }
  .lang-menu { margin-left: auto; }
}

@media (max-width: 760px) {
  .card-link { grid-template-columns: 64px 1fr; gap: .8rem; }
  .card-price { grid-column: 2; flex-direction: row; gap: .4rem; align-items: baseline; min-width: 0; }
  .card-price .price-label { order: -1; }
  .card-date { min-height: 56px; }
  .card-date .day { font-size: 1.45rem; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters .grow, .filter-actions { grid-column: 1 / -1; }
  .filters select { min-width: 0; width: 100%; }
  .filter-actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .kv div { grid-template-columns: 1fr; gap: .1rem; }
  .map { height: 60vh; }
}
@media print {
  .site-header, .filters, .site-footer, .actions, .map { display: none !important; }
  .card { break-inside: avoid; }
}

.redacted { background: #111; color: #111; border-radius: 3px; padding: 0 .15em; letter-spacing: -.05em; user-select: none; }
@media (prefers-color-scheme: dark) { .redacted { background: #000; color: #000; } }

/* first-visit notice */
.notice-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.notice-dialog { background: var(--surface); color: var(--text); border-radius: var(--radius); max-width: 540px; width: 100%; padding: 1.4rem 1.5rem 1.2rem; box-shadow: 0 20px 60px rgba(0,0,0,.35); max-height: 90vh; overflow-y: auto; }
.notice-dialog h2 { margin: 0 0 .8rem; font-size: 1.3rem; }
.notice-dialog p { font-size: .97rem; }
.notice-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.1rem 0 0; }
body.notice-open { overflow: hidden; }
