/* Bright, cheerful, phone-first. Always light, whatever the device setting. */
@font-face {
  font-family: "Fredoka"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/assets/fonts/fredoka.woff2) format("woff2");
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/assets/fonts/nunito.woff2) format("woff2");
}

:root {
  --coral: #ff5e57;
  --orange: #ff8a3d;
  --sun: #ffc23d;
  --accent: #d63f1f;        /* links and icons: coral, dark enough to read on white */
  --accent-fill: #f04a2a;   /* main buttons */
  --accent-soft: #ffece4;
  --on-accent: #fff;
  --bg: #fff8ef;            /* warm cream */
  --surface: #fff;
  --text: #2d2238;          /* warm plum-black */
  --muted: #7a6d82;
  --line: #f1e4d6;
  --danger: #c62828;
  --warn-bg: #fff3d6;
  --warn-text: #8a5300;
  --ok: #1b8a4a;
  --radius: 20px;
  --shadow: 0 2px 0 rgba(45, 34, 56, .04), 0 6px 18px rgba(255, 120, 60, .10);
  --sunset: linear-gradient(120deg, #ff5e7e 0%, #ff7a45 45%, #ffb43d 100%);
  --heading: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  color-scheme: light;
}

/* Category colours: --cat is the bright colour, --cat-ink a darker one for text. */
.cat-arts { --cat: #8b5cf6; --cat-ink: #6431d8; }
.cat-music { --cat: #ec4899; --cat-ink: #b8186a; }
.cat-sports { --cat: #0ea5e9; --cat-ink: #0369a1; }
.cat-family { --cat: #f59e0b; --cat-ink: #a15c00; }
.cat-community { --cat: #10b981; --cat-ink: #047857; }
.cat-faith { --cat: #6366f1; --cat-ink: #4338ca; }
.cat-fundraisers { --cat: #f97316; --cat-ink: #b44708; }
.cat-markets { --cat: #e11d48; --cat-ink: #b0123a; }
.cat-food { --cat: #ef4444; --cat-ink: #b91c1c; }
.cat-learning { --cat: #14b8a6; --cat-ink: #0f766e; }
.cat-c0 { --cat: #a855f7; --cat-ink: #7e22ce; }
.cat-c1 { --cat: #22c55e; --cat-ink: #15803d; }
.cat-c2 { --cat: #3b82f6; --cat-ink: #1d4ed8; }
.cat-c3 { --cat: #f43f5e; --cat-ink: #be123c; }
.cat-c4 { --cat: #eab308; --cat-ink: #854d0e; }
.cat-c5 { --cat: #06b6d4; --cat-ink: #0e7490; }
.cat-c6 { --cat: #d946ef; --cat-ink: #a21caf; }
.cat-c7 { --cat: #84cc16; --cat-ink: #4d7c0f; }
.cat-other, .cat-all { --cat: #ff7a45; --cat-ink: #c2410c; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Nunito", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
body.has-tabs { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 32px; }
body.narrow main { max-width: 440px; padding-top: 24px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-family: var(--heading); font-weight: 600; }
img { max-width: 100%; }

.icon { width: 24px; height: 24px; fill: currentColor; flex: none; }

/* Header: a sunset band */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 4px;
  min-height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0 14px;
  background: var(--sunset); color: #fff;
  box-shadow: 0 2px 12px rgba(255, 94, 87, .25);
}
.topbar h1 {
  flex: 1; font-size: 22px; font-weight: 600; letter-spacing: .2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px;
  text-shadow: 0 1px 2px rgba(150, 40, 20, .25);
}
.icon-btn {
  display: inline-grid; place-items: center;
  min-width: 44px; height: 44px; padding: 0 6px;
  border: 0; border-radius: 22px; background: none;
  color: inherit; font-size: 26px; line-height: 1; text-decoration: none; cursor: pointer;
}
.icon-btn:active { background: rgba(255, 255, 255, .25); }

/* Home page greeting, in the same sunset band, with a curved bottom edge */
body.home .topbar { box-shadow: none; }
.hero {
  position: relative;
  background: var(--sunset); color: #fff;
  padding: 2px 16px 34px;
}
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 22px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.hero > * { max-width: 688px; margin-left: auto; margin-right: auto; }
.hero-title { font-family: var(--heading); font-size: 30px; font-weight: 700; line-height: 1.15; margin: 4px auto 2px; text-shadow: 0 1px 3px rgba(150, 40, 20, .25); }
.hero-sub { margin: 0 auto 14px; font-weight: 700; opacity: .95; }

/* Search */
.searchbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding: 0 16px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 28px;
  color: var(--muted);
}
.hero .searchbar { border-color: transparent; box-shadow: 0 6px 20px rgba(160, 50, 20, .22); margin-bottom: 0; position: relative; z-index: 1; }

/* Category chips */
/* The category row scrolls sideways. A fade and an arrow show there's more that way
   (app.js sets more-left / more-right as it scrolls). */
.chips-wrap { position: relative; margin: -6px -16px 4px; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 16px 10px; scroll-padding: 0 48px;
}
.chips-wrap::before, .chips-wrap::after {
  content: ""; position: absolute; top: 0; bottom: 6px; width: 64px; z-index: 1;
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.chips-wrap::before { left: 0; background: linear-gradient(to right, var(--bg) 30%, transparent); }
.chips-wrap::after { right: 0; background: linear-gradient(to left, var(--bg) 30%, transparent); }
.chips-wrap.more-left::before, .chips-wrap.more-right::after { opacity: 1; }
.chips-arrow {
  position: absolute; top: 6px; z-index: 2;
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; background: var(--surface); color: var(--accent);
  box-shadow: 0 2px 8px rgba(45, 34, 56, .18); cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.chips-arrow.left { left: 8px; }
.chips-arrow.right { right: 8px; }
.chips-arrow .icon { width: 22px; height: 22px; }
.more-left .chips-arrow.left, .more-right .chips-arrow.right { opacity: 1; pointer-events: auto; }
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex: none; padding: 8px 14px; border-radius: 20px;
  background: var(--surface);
  border: 2px solid color-mix(in srgb, var(--cat) 30%, white);
  color: var(--cat-ink); text-decoration: none; font-size: 15px; font-weight: 800; white-space: nowrap;
}
.chips a[aria-current] { background: var(--cat); border-color: var(--cat); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--cat) 35%, transparent); }

/* Days and event cards */
.day { margin-bottom: 6px; }
.day-title { display: flex; align-items: baseline; gap: 8px; font-size: 24px; padding: 14px 4px 8px; }
.day-date { font-family: "Nunito", sans-serif; font-size: 15px; font-weight: 700; color: var(--muted); }
.event-card {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px; padding: 14px 14px 14px 16px;
  background: var(--surface); border-radius: var(--radius);
  border-left: 6px solid var(--cat);
  box-shadow: var(--shadow);
  color: var(--text); text-decoration: none;
  transition: transform .12s ease;
}
.event-card:active { transform: scale(.98); }
.event-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.event-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.time-pill {
  padding: 2px 10px; border-radius: 12px;
  background: var(--cat); color: #fff;
  font-size: 13px; font-weight: 800; white-space: nowrap;
}
.cat-label { font-size: 13px; font-weight: 800; color: var(--cat-ink); text-decoration: none; }
.event-name { font-family: var(--heading); font-size: 19px; font-weight: 600; line-height: 1.25; }
.event-place { display: flex; align-items: center; gap: 3px; font-size: 14px; color: var(--muted); font-weight: 600; }
.event-place .icon { width: 16px; height: 16px; color: var(--cat); }
.thumb { flex: none; width: 80px; height: 80px; object-fit: cover; border-radius: 14px; background: var(--line); }

.promo {
  display: flex; align-items: center; gap: 14px;
  margin-top: 20px; padding: 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #fff1c9, #ffe0d1);
  color: var(--text); text-decoration: none; font-size: 15px;
}
.promo-emoji { font-size: 34px; }

/* Event page */
.poster { display: block; margin: 0 0 -28px; border-radius: var(--radius); overflow: hidden; background: var(--surface); text-align: center; box-shadow: var(--shadow); }
.poster img { display: block; margin: 0 auto; max-height: 70vh; width: auto; }
.banner-art {
  display: grid; place-items: center; height: 150px; margin-bottom: -28px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.35) 0 18px, transparent 19px),
    radial-gradient(circle at 85% 70%, rgba(255,255,255,.25) 0 26px, transparent 27px),
    radial-gradient(circle at 65% 20%, rgba(255,255,255,.3) 0 8px, transparent 9px),
    linear-gradient(135deg, var(--cat), color-mix(in srgb, var(--cat) 55%, #ffc23d));
}
.banner-art span { font-size: 64px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.15)); margin-top: -20px; }
.event-main { position: relative; margin-left: 10px; margin-right: 10px; }
.event-title { font-size: 28px; line-height: 1.15; }
.facts { display: flex; flex-direction: column; }
.fact { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 2px dashed var(--line); color: var(--text); text-decoration: none; min-width: 0; font-weight: 600; }
.fact .icon {
  width: 36px; height: 36px; padding: 7px; border-radius: 50%;
  background: color-mix(in srgb, var(--cat, var(--coral)) 15%, white); color: var(--cat-ink, var(--accent));
}
a.fact > span:not(.muted) { color: var(--cat-ink, var(--accent)); }
.fact > span { min-width: 0; overflow-wrap: anywhere; }
.fact .muted { font-weight: 400; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.description { overflow-wrap: anywhere; }
.description p { margin: 8px 0 0; }

/* Banners */
.banner {
  display: flex; align-items: center; gap: 8px;
  width: 100%; margin: 0 0 12px; padding: 12px 16px;
  border: 0; border-radius: 16px;
  background: var(--accent-soft); color: var(--text);
  font: inherit; font-weight: 700; text-align: left; text-decoration: none;
}
.topbar ~ .banner { width: auto; max-width: 688px; margin: 14px 16px 0; }
@media (min-width: 721px) { .topbar ~ .banner { margin: 14px auto 0; } }
.banner.warn { background: var(--warn-bg); color: var(--warn-text); }
.banner.link { cursor: pointer; }

/* Lists (admin) */
.group { margin-bottom: 8px; }
.group-title { font-size: 14px; font-weight: 800; font-family: "Nunito", sans-serif; color: var(--muted); padding: 14px 4px 6px; letter-spacing: .04em; text-transform: uppercase; }
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  padding: 12px 16px; min-height: 56px;
  border-bottom: 2px solid var(--bg);
  color: var(--text); text-decoration: none;
}
.group .row:first-of-type { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.group .row:last-of-type { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); border-bottom: 0; }
a.row:active { background: var(--accent-soft); }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 800; }
.row-sub { font-size: 14px; color: var(--muted); }
.row .thumb { width: 56px; height: 56px; border-radius: 12px; }
/* To Review: a tick box beside each row, and a bar to act on the ticked ones */
.row.pick { padding: 0 16px 0 4px; }
.row-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 0; color: inherit; text-decoration: none; }
.pick-box { flex: none; display: grid; place-items: center; width: 44px; align-self: stretch; cursor: pointer; }
.pick-box input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent-fill); cursor: pointer; }
.row.flagged { box-shadow: inset 4px 0 0 var(--sun); }
.dup-note { margin-top: 4px; padding: 4px 10px; border-radius: 10px; align-self: flex-start; background: var(--warn-bg); color: var(--warn-text); font-size: 13px; font-weight: 700; }
.bulk-bar {
  position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 5;
  display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 10px 8px 4px;
  background: var(--surface); border-radius: var(--radius); box-shadow: 0 -2px 16px rgba(45, 34, 56, .10);
}
.bulk-bar #pick-count { flex: 1; min-width: 0; font-weight: 700; }
.quick-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.quick-picks .chip {
  padding: 6px 12px; border-radius: 20px; border: 2px solid var(--accent-soft);
  background: var(--surface); color: var(--accent); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
}
.quick-picks .chip:active { background: var(--accent-soft); }
.quick-picks .count { opacity: .7; font-size: 12px; }
.tag {
  display: inline-block; align-self: flex-start; padding: 2px 10px;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 800; text-decoration: none;
}
.row-title .tag { margin-left: 6px; vertical-align: 2px; }

/* Bottom tabs (admin) */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: flex;
  background: var(--surface);
  box-shadow: 0 -4px 16px rgba(45, 34, 56, .06);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none;
}
.tabbar a.active { color: var(--accent); }
.tabbar a { position: relative; }
.badge {
  position: absolute; top: 4px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent-fill); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

.site-footer { max-width: 720px; margin: 0 auto; padding: 8px 16px 36px; text-align: center; }
.site-footer p { margin: 4px 0; }
.site-footer a { color: inherit; }

/* Cards and forms */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-title { font-size: 20px; }
.card > p:first-child { margin-top: 0; }
.card > p:last-child { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > p { margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 16px; }
label.check input { width: 22px; height: 22px; accent-color: var(--accent-fill); }
input:not([type=checkbox]):not([type=hidden]):not([type=radio]), select, textarea {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
  color: var(--text); background: #fffdfa;
  border: 2px solid var(--line); border-radius: 14px;
  min-height: 50px;
}
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 138, 61, .2); }
.searchbar input[type=search] { flex: 1; border: 0 !important; background: none !important; padding: 13px 0 !important; box-shadow: none !important; min-width: 0; min-height: 0 !important; font-weight: 600; }
input[type=file] { padding: 10px; }
textarea { resize: vertical; }
.form-section { font-size: 20px; margin-top: 8px; padding-top: 16px; border-top: 2px dashed var(--line); }
.hint { margin-top: -6px !important; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two > label { min-width: 0; }
.copy-field { font-family: ui-monospace, Menlo, monospace; font-size: 13px !important; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; }
form.inline { display: inline; }
.image-preview { max-height: 240px; width: auto; align-self: flex-start; border-radius: 14px; }
details summary { cursor: pointer; color: var(--accent); font-weight: 800; }
details[open] summary { margin-bottom: 8px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 8px 0; border-bottom: 2px dashed var(--line); display: flex; flex-direction: column; }
ul.plain li:last-child { border-bottom: 0; }
ul.plain a { font-weight: 800; }
ul.plain .muted { font-size: 12px; overflow-wrap: anywhere; }
.status-choice { display: flex; flex-direction: column; gap: 10px; border: 0; margin: 0; padding: 0; }
.status-choice label { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 16px; }
.status-choice input { width: 22px; height: 22px; accent-color: var(--accent-fill); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 2px solid var(--line); border-radius: 24px;
  background: var(--surface); color: var(--accent);
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
  transition: transform .1s ease;
}
.btn:active { transform: scale(.97); }
.btn .icon { width: 20px; height: 20px; }
.btn.primary {
  background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent);
  box-shadow: 0 4px 0 #c2361a, 0 8px 18px rgba(240, 74, 42, .25);
}
.btn.primary:active { box-shadow: 0 1px 0 #c2361a; transform: translateY(3px); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.small .icon { width: 18px; height: 18px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.button-row.start { justify-content: flex-start; margin-top: 4px; }
.button-row.spread { justify-content: space-between; align-items: center; }
.row.user { flex-wrap: wrap; }
.row.user .button-row { width: 100%; justify-content: flex-start; }

.menu { display: flex; flex-direction: column; padding: 4px 18px; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 13px 0; color: var(--text); font-weight: 700; text-decoration: none; border-bottom: 2px dashed var(--line); }
.menu a:last-child { border-bottom: 0; }
.menu a .icon { color: var(--accent); }

.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 2px dashed var(--line); }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.error { margin: 0; padding: 10px 14px; border-radius: 14px; background: #ffe5e2; color: var(--danger); font-weight: 700; }

/* Empty states */
.empty { text-align: center; padding: 40px 24px; color: var(--muted); }
.empty-emoji { font-size: 56px; line-height: 1.2; }
.empty .icon { width: 56px; height: 56px; color: var(--orange); }
.empty h2 { color: var(--text); font-size: 24px; margin: 8px 0 4px; }
.empty p { margin: 0 0 12px; }

/* Segmented filter (admin lists) */
.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; margin: 0 0 12px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); }
.segmented a {
  flex: 1; text-align: center; padding: 8px 4px; border-radius: 14px;
  color: var(--text); text-decoration: none; font-size: 14px; font-weight: 800; white-space: nowrap;
}
.segmented a[aria-current] { background: var(--sunset); color: #fff; }
.segmented .count { opacity: .75; font-size: 12px; }

/* Activity log */
.activity-entry { align-items: flex-start; }
.activity-details { font-size: 14px; color: var(--muted); white-space: pre-line; margin-top: 4px; padding-left: 8px; border-left: 3px solid var(--line); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.event-main .button-row .btn { flex: 1 1 auto; }

/* Submit form and review */
.promo.intro { margin: 0 0 14px; }
.promo + .promo { margin-top: 12px; }
.thanks { padding: 32px 22px; align-items: center; }
.thanks .button-row { justify-content: center; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.review-card { border: 3px solid var(--sun); }
.review-card .tag { margin-right: 4px; }
.note { margin: 0; padding: 10px 14px; border-left: 4px solid var(--sun); background: var(--warn-bg); border-radius: 0 12px 12px 0; overflow-wrap: anywhere; }
.source-link { overflow-wrap: anywhere; margin: 0; }
.source-text summary { cursor: pointer; font-weight: 700; }
.source-text p { margin: 8px 0 0; max-height: 320px; overflow: auto; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); overflow-wrap: anywhere; }
.dup-card { background: #fff3d6; }
.dup-card .row { border-radius: 14px; margin-top: 6px; }

/* Repeating events */
.weekdays { display: flex; flex-wrap: wrap; gap: 6px; border: 0; margin: 0; padding: 0; }
.weekdays legend { font-size: 14px; font-weight: 800; color: var(--muted); margin-bottom: 4px; padding: 0; }
.weekdays label { position: relative; }
.weekdays input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.weekdays span {
  display: inline-block; min-width: 42px; padding: 8px 6px; border-radius: 14px; text-align: center;
  border: 2px solid var(--line); background: var(--surface); color: var(--text); font-weight: 800; font-size: 14px; cursor: pointer;
}
.weekdays input:checked + span { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.weekdays input:focus-visible + span { outline: 3px solid var(--sun); }
.repeat-label { font-size: 13px; font-weight: 700; color: var(--muted); }
