/* ============================================================
   Town Hub — shared "clean civic" design system.
   Brand colors (--primary/--primary-dark/--accent/--bg/--ink) are
   injected per-town from js/config.js; the ramp, type, spacing,
   elevation and components below are shared and rarely edited.
   ============================================================ */
:root {
  /* Brand — defaults; app.js overrides these from config.colors */
  --primary: #1e3a8a;
  --primary-dark: #14275c;
  --accent: #eaa716;
  --bg: #f4f6fb;
  --ink: #0f1826;

  /* Neutrals / surfaces */
  --paper: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #e4e9f2;
  --line-strong: #cfd7e6;
  --muted: #56617a;
  --muted-2: #7a869e;

  /* Accents derived from brand (safe if brand changes) */
  --primary-tint: color-mix(in srgb, var(--primary) 8%, white);
  --primary-tint-2: color-mix(in srgb, var(--primary) 14%, white);
  --accent-tint: color-mix(in srgb, var(--accent) 16%, white);
  --ring: color-mix(in srgb, var(--primary) 38%, white);

  /* Type */
  --font-display: "Bricolage Grotesque", "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Radius / elevation */
  --r-sm: 9px;
  --r: 14px;
  --r-lg: 20px;
  --r-full: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 24, 38, .06), 0 1px 3px rgba(15, 24, 38, .05);
  --shadow-md: 0 2px 6px rgba(15, 24, 38, .06), 0 10px 24px rgba(15, 24, 38, .07);
  --shadow-lg: 0 8px 20px rgba(15, 24, 38, .10), 0 24px 60px rgba(15, 24, 38, .12);
  --radius: var(--r); /* back-compat alias */

  /* Spacing scale (4px base) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; }
a { color: var(--primary); text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -.015em; font-weight: 700; }
::selection { background: color-mix(in srgb, var(--primary) 22%, white); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }

main { max-width: 1120px; margin: 0 auto; padding: var(--s6) var(--s4) var(--s8); }

/* ---------- icons ---------- */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -.125em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-fill { fill: currentColor; stroke: none; }

/* ---------- announcement banner ---------- */
.banner {
  background: linear-gradient(90deg, var(--accent-tint), color-mix(in srgb, var(--accent) 26%, white));
  color: #5a4406;
  text-align: center;
  font-size: .875rem;
  font-weight: 600;
  padding: var(--s2) var(--s4);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, white);
}

/* ---------- header ---------- */
#site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: var(--s3) var(--s4);
  display: flex; align-items: center; gap: var(--s4);
  flex-wrap: wrap;
}
.logo { text-decoration: none; display: flex; align-items: center; gap: 10px; }
.logo-text {
  font-family: var(--font-display);
  font-size: 1.32rem; font-weight: 800; letter-spacing: -.03em; line-height: 1;
  background: linear-gradient(120deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--accent)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo-img { height: 40px; width: auto; display: block; border-radius: 8px; }
.nav { margin-left: auto; display: flex; gap: 2px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  position: relative; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .86rem;
  padding: 8px 10px; border-radius: var(--r-sm); white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--surface-2); color: var(--primary); }
.nav a.active { color: var(--primary); }
.nav a.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px;
  background: var(--primary); border-radius: 2px;
}
.nav .nav-cta {
  border: 1.5px solid var(--primary); color: var(--primary); margin-left: 8px;
  border-radius: var(--r-full); padding: 7px 16px;
}
.nav .nav-cta:hover { background: var(--primary); color: #fff; }
.nav .nav-cta.active::after { display: none; }
.nav .nav-umbrella { color: var(--muted); font-weight: 600; }
.nav .nav-umbrella:hover { color: var(--primary); }
.nav-toggle {
  display: none; margin-left: auto; background: var(--surface); cursor: pointer; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 7px; line-height: 0;
}
.nav-toggle .icon { width: 22px; height: 22px; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 55%),
    linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; text-align: center; padding: var(--s8) var(--s4) calc(var(--s8) + 8px);
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, #fff 8%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, #fff 8%, transparent) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 40%, transparent 80%);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 40%, transparent 80%);
}
.hero > * { position: relative; }
.hero h1 { margin: 0 0 10px; font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; letter-spacing: -.03em; }
.hero p { margin: 0 auto 24px; opacity: .92; font-size: clamp(1rem, 2vw, 1.18rem); max-width: 560px; }
.hero .btn { margin: 5px; }

/* ---------- sections & grids ---------- */
section { margin-top: var(--s7); }
.section-head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.section-head h2 { margin: 0; font-size: clamp(1.3rem, 2.4vw, 1.7rem); display: inline-flex; align-items: center; gap: 9px; }
.section-head h2 .icon { color: var(--primary); width: 1.05em; height: 1.05em; }
.section-head .more {
  margin-left: auto; font-weight: 700; font-size: .9rem; text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px; color: var(--primary);
}
.section-head .more:hover { gap: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--s4); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--s5); box-shadow: var(--shadow-sm); position: relative;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.card h3 { margin: 10px 0 4px; font-size: 1.14rem; }
.card p { margin: 6px 0; font-size: .95rem; }
.card-sub { color: var(--primary); font-weight: 700; font-size: .9rem !important; }
.card-meta { color: var(--muted); font-size: .85rem !important; }
.card.featured { border-color: color-mix(in srgb, var(--accent) 55%, white); box-shadow: 0 0 0 1px var(--accent), var(--shadow-md); }

/* thumbnail / monogram fallback for imageless cards */
.card-thumb { display: block; width: 100%; height: 150px; border-radius: var(--r-sm); object-fit: cover; margin-bottom: 4px; background: var(--surface-2); }
.monogram {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 2.4rem; color: #fff; letter-spacing: -.02em;
  text-shadow: 0 1px 6px rgba(0,0,0,.18);
}

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; padding: 4px 10px; border-radius: var(--r-full); margin-right: 6px;
}
.badge .icon { width: .85em; height: .85em; }
.badge-type { background: var(--primary-tint); color: var(--primary-dark); }
.badge-featured { background: var(--accent); color: #4a3607; }
.badge-flash { background: #dc2626; color: #fff; }
.badge-cat { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge-family { background: #dcfce7; color: #166534; }
.badge-music { background: #ede9fe; color: #5b21b6; }
.badge-nightlife { background: #fce7f3; color: #9d174d; }
.badge-community { background: #e0f2fe; color: #075985; }
.badge-sports { background: #ffedd5; color: #9a3412; }
.badge-teen { background: #cffafe; color: #155e75; }

.flash-card { border-color: #fca5a5; background: linear-gradient(180deg, #fff7f7, var(--surface)); }
.flash-card .countdown { font-weight: 800; color: #dc2626; }
.flash-card.expired { opacity: .5; }

/* ---------- events ---------- */
.event-card { display: flex; gap: var(--s4); }
.event-date {
  flex: 0 0 62px; text-align: center; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); height: fit-content;
  box-shadow: var(--shadow-sm);
}
.event-date .event-dow { display: block; background: var(--primary); color: #fff; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; font-weight: 800; padding: 3px 0; }
.event-date .event-day { display: block; font-size: 1.55rem; font-weight: 800; line-height: 1.15; margin-top: 3px; font-family: var(--font-display); }
.event-date .event-mon { display: block; font-size: .74rem; color: var(--muted); padding-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.event-body { flex: 1; min-width: 0; }
.event-body h3 a { text-decoration: none; }
.date-heading { font-size: 1.05rem; color: var(--ink); margin: var(--s6) 0 var(--s3); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
#events-list .event-card { margin-bottom: var(--s3); }

/* ---------- filters ---------- */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); margin-bottom: var(--s5); box-shadow: var(--shadow-sm); }
.filters .row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: var(--s2) 0; }
.filters label { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; min-width: 88px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-full);
  padding: 7px 15px; font-size: .87rem; font-weight: 600; cursor: pointer; color: var(--ink);
  transition: all .15s ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
select, input[type="text"], input[type="email"], input[type="tel"], input[type="date"],
input[type="time"], input[type="datetime-local"], input[type="url"], textarea {
  font: inherit; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); max-width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
textarea { width: 100%; resize: vertical; }
.count { color: var(--muted); font-weight: 600; font-size: .92rem; margin: 0 0 var(--s4); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
  padding: 11px 22px; border-radius: var(--r-full); border: none;
  background: var(--primary); color: #fff; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, filter .15s ease;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-accent { background: var(--accent); color: #4a3607; }
.btn-accent:hover { background: var(--accent); filter: brightness(.96); }
.btn-ghost { background: color-mix(in srgb, #fff 16%, transparent); border: 1.5px solid color-mix(in srgb, #fff 60%, transparent); color: #fff; box-shadow: none; }
.btn-ghost:hover { background: color-mix(in srgb, #fff 26%, transparent); }
.btn-outline { background: var(--surface); color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.btn-outline:hover { background: var(--primary-tint); color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }

/* ---------- forms ---------- */
.form-card { max-width: 660px; }
.card.form-card { padding: var(--s6); }
.form-card .field { margin-bottom: var(--s4); display: flex; flex-direction: column; gap: 5px; }
.form-card .field > label { font-weight: 700; font-size: .92rem; }
.form-card .hint { color: var(--muted); font-size: .84rem; margin: 0; }
.radio-row { display: flex; gap: var(--s4); flex-wrap: wrap; }
.radio-row label { font-weight: 600; display: flex; align-items: center; gap: 6px; }
fieldset { border: none; padding: 0; margin: 0; }
.form-status { min-height: 1.2em; font-weight: 700; font-size: .92rem; margin: var(--s3) 0 0; }
.form-status.ok { color: #15803d; }
.form-status.err { color: #dc2626; }
.hp { position: absolute; left: -9999px; height: 1px; width: 1px; opacity: 0; }

/* ---------- pricing (advertise) ---------- */
.trial-banner {
  background: var(--accent-tint);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, white); border-radius: var(--r);
  padding: var(--s4) var(--s5); font-weight: 600;
}
.tier-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 340px)); justify-content: center; align-items: stretch; }
@media (max-width: 560px) { .tier-grid { grid-template-columns: minmax(0, 1fr); } }
.tier-card { display: flex; flex-direction: column; }
.tier-card.featured { transform: none; }
.tier-price { font-family: var(--font-display); font-size: 2rem; font-weight: 800; margin: 6px 0 2px; }
.tier-period { font-size: .9rem; font-weight: 600; color: var(--muted); }
.tier-features { padding-left: 0; list-style: none; margin: var(--s3) 0 var(--s4); flex: 1; }
.tier-features li { font-size: .92rem; padding: 7px 0 7px 26px; position: relative; border-bottom: 1px solid var(--line); }
.tier-features li::before {
  content: ""; position: absolute; left: 2px; top: 11px; width: 15px; height: 15px;
  background: var(--primary-tint); border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e3a8a' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 11px;
}
.tier-card .btn { text-align: center; }
.tier-alt { color: var(--muted); font-size: .85rem; margin: 2px 0 var(--s3); }
.tier-btns { display: flex; gap: var(--s2); flex-wrap: wrap; }
.alacarte-grid { display: grid; gap: var(--s3); max-width: 760px; }
.alacarte-card { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.alacarte-card h3 { margin: 0 0 2px; }
.alacarte-price { font-size: 1.1rem; margin-left: 8px; color: var(--primary); font-weight: 700; }
.faq { max-width: 760px; margin-top: var(--s6); }
.faq h2 { margin-top: 0; }

/* ---------- empty / skeleton ---------- */
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r); padding: var(--s6); text-align: center; }
.empty.err { border-color: #fca5a5; color: #b91c1c; }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--s4); }
.skeleton { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); height: 150px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--primary) 7%, transparent), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

.page-intro { max-width: 720px; }
.page-intro h1 { margin-bottom: 6px; font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.page-intro p { color: var(--muted); margin-top: 0; font-size: 1.02rem; }

/* ---------- footer / newsletter ---------- */
#site-footer { margin-top: var(--s8); background: var(--ink); color: #c3ccdb; }
.newsletter-bar {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; padding: var(--s6) var(--s4);
  display: flex; flex-wrap: wrap; gap: var(--s5); align-items: center; justify-content: center;
}
.newsletter-bar > div { max-width: 440px; }
.newsletter-bar h3 { margin: 0 0 4px; font-size: 1.4rem; }
.newsletter-bar p { margin: 0; opacity: .88; font-size: .96rem; }
.newsletter-form { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: flex-start; }
.newsletter-form input[type="email"] { min-width: 230px; border: none; }
.newsletter-form .form-status { flex-basis: 100%; margin: 0; }
.newsletter-form .other-towns { flex-basis: 100%; font-size: .85rem; opacity: .92; display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.newsletter-form .other-towns label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.newsletter-form .form-status.ok { color: #86efac; }
.newsletter-form .form-status.err { color: #fca5a5; }
.footer-inner { max-width: 1120px; margin: 0 auto; padding: var(--s5) var(--s4); text-align: center; font-size: .9rem; }
.footer-inner a { color: #9ec5fe; }
.footer-inner .sponsor { font-weight: 600; }
.footer-inner .fine { font-size: .8rem; opacity: .72; }

/* ---------- flyers ---------- */
.flyer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--s4); }
.flyer-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease; }
.flyer-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.flyer-card img { display: block; width: 100%; height: auto; }
.flyer-card .flyer-cap { padding: 10px 14px; font-size: .86rem; color: var(--muted); }
.flyer-upload-preview { max-width: 240px; border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: var(--s2); display: none; }

/* ---------- owner portal misc ---------- */
.day-checks { display: flex; gap: var(--s3); flex-wrap: wrap; font-size: .9rem; }
.day-checks label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.day-checks label:first-child { font-weight: 700; margin-right: 4px; }
.pay-next { text-align: center; padding: var(--s3) 0; }
.pay-next h3 { margin: 0 0 8px; }
.pay-next p { color: var(--muted); max-width: 460px; margin: 0 auto var(--s4); }
.pay-next .fine { margin-top: var(--s3); font-size: .8rem; }

/* ---------- anonymous star ratings ---------- */
.rating { display: flex; align-items: center; gap: 6px; margin: 4px 0 6px; font-size: .9rem; flex-wrap: wrap; }
.rating-avg { color: #b45309; font-weight: 800; }
.rating-count { color: var(--muted); font-size: .84rem; }
.rating-thanks { color: #15803d; font-weight: 600; font-size: .84rem; }
.rate-stars { display: inline-flex; flex-direction: row-reverse; }
.rate-star { background: none; border: none; font-size: 1.2rem; line-height: 1; padding: 0 1px; cursor: pointer; color: #cbd5e1; transition: color .12s ease; }
.rate-star:hover, .rate-star:hover ~ .rate-star { color: var(--accent); }
.rate-star:disabled { cursor: default; opacity: .6; }

/* ---------- scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- mobile ---------- */
@media (max-width: 1240px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: var(--s2) var(--s4) var(--s4);
    box-shadow: var(--shadow-md);
  }
  .nav.open { display: flex; }
  .nav a { font-size: .98rem; padding: 11px 10px; }
  .nav a.active::after { display: none; }
  .nav .nav-cta { text-align: center; margin: 6px 0 0; }
  .header-inner { position: relative; }
}
@media (max-width: 720px) {
  main { padding: var(--s5) var(--s4) var(--s7); }
  .event-card { flex-direction: row; }
  .filters label { min-width: 100%; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
