/* Brand palette sampled from the mapzest.app circle logo: petrol/teal + citrus yellow. */
:root {
  --bg: #ffffff;
  --surface: #f6f7f6;
  --text: #1c2e32;
  --text-muted: #5c7075;
  --brand: #153a40;
  --accent: #fdce02;
  --accent-text: #153a40;
  --border: rgba(21, 58, 64, 0.15);
  --link: #153a40;
  --shadow: 0 1px 3px rgba(21, 58, 64, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d2226;
    --surface: #123138;
    --text: #eef5f2;
    --text-muted: #9fb3b6;
    --brand: #eef5f2;
    --accent: #fdce02;
    --accent-text: #153a40;
    --border: rgba(255, 255, 255, 0.14);
    --link: #8fd6cf;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0d2226;
  --surface: #123138;
  --text: #eef5f2;
  --text-muted: #9fb3b6;
  --brand: #eef5f2;
  --accent: #fdce02;
  --accent-text: #153a40;
  --border: rgba(255, 255, 255, 0.14);
  --link: #8fd6cf;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f7f6;
  --text: #1c2e32;
  --text-muted: #5c7075;
  --brand: #153a40;
  --accent: #fdce02;
  --accent-text: #153a40;
  --border: rgba(21, 58, 64, 0.15);
  --link: #153a40;
  --shadow: 0 1px 3px rgba(21, 58, 64, 0.08);
}

* { box-sizing: border-box; }

body {
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3, .brand-word {
  font-family: 'Comfortaa', 'Work Sans', sans-serif;
  font-weight: 700;
  color: var(--brand);
}
h1 { font-size: 1.7rem; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ─────────────────────────────────────────────────────────────── */
header.site {
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--bg);
}
header.site .brand { display: flex; align-items: center; gap: .5rem; font-size: 1.1rem; flex-shrink: 0; }
header.site .brand img { width: 32px; height: 32px; display: block; }
nav.purposes { display: flex; gap: 1rem; flex-wrap: wrap; font-weight: 500; font-size: .92rem; }
.header-controls { display: flex; align-items: center; gap: .6rem; margin-left: auto; }

/* ── Theme toggle ───────────────────────────────────────────────────────── */
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--brand); }

/* ── Social links ───────────────────────────────────────────────────────── */
.social-links { display: flex; align-items: center; gap: .5rem; }
.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
}
.social-links a:hover { background: var(--accent); color: var(--accent-text); text-decoration: none; }
footer.site .social-links { margin-top: .75rem; }

/* ── Search ─────────────────────────────────────────────────────────────── */
.search-wrap { position: relative; width: 100%; max-width: 260px; }
.search-input {
  width: 100%;
  padding: .5rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 20;
  display: none;
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: .55rem .8rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--surface); text-decoration: none; }
.search-results .r-name { font-weight: 600; }
.search-results .r-meta { font-size: .8rem; color: var(--text-muted); }
.search-results .r-empty { padding: .75rem .8rem; color: var(--text-muted); font-size: .88rem; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.back-link { display: inline-block; margin-bottom: 1rem; font-weight: 600; }
.subtitle { color: var(--text-muted); margin: -.35rem 0 .75rem; font-size: .95rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; margin: 1.5rem 0; }
.card { position: relative; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); transition: box-shadow .15s, border-color .15s; }
.card:hover { box-shadow: var(--shadow); border-color: var(--brand); }
.card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--border); }
.card .body { padding: .75rem .9rem 1rem; }
.card h3 { margin: 0 0 .15rem; font-size: 1.02rem; font-family: 'Work Sans', sans-serif; font-weight: 600; color: var(--text); }
.card-subtitle { color: var(--text-muted); font-size: .8rem; margin: 0 0 .3rem; }
.card .address, .card .date { color: var(--text-muted); font-size: .88rem; margin: 0; }
/* Stretched-link pattern: the title's <a> is the only real link, but its ::after covers the
   whole card, so the image and padding are clickable too without nested/duplicate anchors. */
.card h3 a::after { content: ""; position: absolute; inset: 0; }

.badge {
  display: inline-block;
  font-size: .75rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  margin: .15rem .3rem .15rem 0;
  font-weight: 600;
}
.badge.badge-accent { background: var(--accent); color: var(--accent-text); border-color: transparent; }

.cta {
  display: inline-block;
  margin-top: 1rem;
  padding: .7rem 1.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}
.cta:hover { text-decoration: none; opacity: .88; }

.app-nudge { color: var(--text-muted); }
.app-nudge a { font-weight: 600; }

footer.site { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem 3rem; color: var(--text-muted); font-size: .85rem; border-top: 1px solid var(--border); margin-top: 2rem; }

/* ── Date selector (events/offers) ─────────────────────────────────────── */
.date-selector { display: flex; align-items: center; gap: .6rem; margin: 1rem 0; flex-wrap: wrap; }
.date-selector input[type="date"] {
  padding: .45rem .6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}
.date-selector button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: .45rem .8rem;
  cursor: pointer;
  font-family: inherit;
}

/* ── Past listings toggle (category pages, events/offers listings) ──────── */
.past-toggle { display: flex; align-items: center; gap: .4rem; margin: 1rem 0; font-size: .9rem; color: var(--text-muted); cursor: pointer; width: fit-content; }
.past-toggle input { cursor: pointer; }
[data-past] { display: none; }
body.show-past .card[data-past] { display: flex; }
body.show-past [data-section-wrap][data-past] { display: block; }
