/* nocove.ca — "Community blue" theme. Designed for older readers on phones (WeChat).
 *
 * PALETTE — one brand colour, neutrals, one action colour. Do not add others.
 *   --brand   #1f3a5f navy   headings, top banner, selected menu item, language switch, number badges
 *   --action  #c2410c orange "Sign the petition" ONLY (and nothing else), so it is always the obvious next step
 *   --ink     #1c2430        body text            (about 15:1 on white)
 *   --ink-2   #4a5568        secondary text       (about 7.5:1 on white)
 *   --paper   #f7f8fa        page background
 *   --card    #ffffff        cards
 *   --line    #dfe3ea        borders and dividers
 *   --tint    #e8eef6        light navy wash for the selected menu item
 */
:root {
  --brand: #1f3a5f;
  --brand-dark: #152a46;
  --tint: #e8eef6;
  --action: #c2410c;
  --action-dark: #9a3412;
  --ink: #1c2430;
  --ink-2: #4a5568;
  --paper: #f7f8fa;
  --card: #ffffff;
  --line: #dfe3ea;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  padding-bottom: 92px; /* room for the sticky petition bar */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}
:lang(zh-Hans) {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  line-height: 1.75;
  letter-spacing: 0;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.1rem, 8vw, 3rem); }
h2 { font-size: 1.6rem; color: var(--brand); }
h3 { font-size: 1.3rem; color: var(--ink); }
p { margin: 0 0 0.75em; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.hero :focus-visible, .petition-bar :focus-visible { outline-color: var(--ink); }

/* ---------- Bilingual display ---------- */
html[data-lang="en"] [lang="zh-Hans"] { display: none !important; }
html[data-lang="zh"] [lang="en"] { display: none !important; }
html[data-lang="both"] .bi > [lang] { display: block; }
html[data-lang="both"] .bi > [lang="zh-Hans"] { margin-top: 0.15em; }
html[data-lang="both"] p.bi > [lang="en"],
html[data-lang="both"] li.bi > [lang="en"] { color: var(--ink-2); }

/* ---------- Language switch ---------- */
.langbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.langbar button {
  min-height: 48px;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.langbar button[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Site navigation (no hamburger) ---------- */
.sitenav {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 + 2 on phones: big targets, no cramped words */
  gap: 6px;
  padding: 8px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.sitenav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 4px 2px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  border-radius: 10px;
  border: 2px solid transparent;
}
.sitenav a [lang] { display: block; }
.sitenav a[aria-current="page"] { background: var(--tint); border-color: var(--brand); color: var(--brand); }
@media (min-width: 640px) { .sitenav { grid-template-columns: repeat(5, 1fr); } }

/* ---------- Hero ---------- */
.hero {
  background: var(--brand);
  color: #fff;
  padding: 32px 20px 28px;
  text-align: center;
}
.hero h1 { margin-bottom: 0.4em; }
.hero .focus { max-width: 34rem; margin: 0 auto 1.1em; font-size: 1.15rem; }
html[data-lang="both"] .hero p.bi > [lang="en"] { color: #fff; }
.hero .btn { max-width: 26rem; }

/* ---------- Layout ---------- */
main { max-width: 40rem; margin: 0 auto; padding: 8px 16px 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin: 20px 0;
}
.status { border-left: 8px solid var(--brand); border-radius: 0 14px 14px 0; }
.event { border-top: 6px solid var(--brand); }

/* ---------- Event ---------- */
.datebox {
  display: inline-block;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--tint);
  color: var(--brand);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.35;
}
.datebox [lang] { display: block; }
.place { font-weight: 700; }

/* ---------- Buttons ----------
 * .btn.action  = orange, the petition only
 * .btn         = navy, the main button on a card
 * .btn.secondary = white with navy border, everything else */
.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  margin: 12px auto 0;
  padding: 10px 18px;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: var(--brand);
  border: 2px solid var(--brand);
  border-radius: 12px;
  cursor: pointer;
}
.btn [lang] { display: block; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--card); color: var(--brand); border-color: var(--brand); }
.btn.secondary:hover { background: var(--tint); }
.btn.action { background: var(--action); border-color: var(--action); color: #fff; }
.btn.action:hover { background: var(--action-dark); border-color: var(--action-dark); }
.btn-row { display: grid; gap: 12px; margin-top: 4px; }
.btn-row .btn { margin-top: 0; }

.hint { font-size: 1.05rem; color: var(--ink-2); margin-top: 10px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.numbered { counter-reset: n; }
.numbered > li { position: relative; padding-left: 52px; counter-increment: n; }
.numbered > li::before {
  content: counter(n);
  position: absolute;
  left: 0;
  top: 10px;
  width: 38px;
  height: 38px;
  line-height: 38px;
  text-align: center;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border-radius: 50%;
}
.slogans > li { font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.slogans > li.focus { color: var(--brand); }
.slogans > li [lang="zh-Hans"] { font-weight: 700; }

/* ---------- News ---------- */
.news-item { scroll-margin-top: 12px; }
.news-item .date { font-weight: 700; color: var(--ink-2); font-size: 1.1rem; margin-bottom: 0.25em; }
.news-item h2 { font-size: 1.4rem; }
.headlines > li a { font-weight: 700; display: block; }
.headlines .date { display: block; color: var(--ink-2); font-size: 1rem; font-weight: 700; }

/* ---------- Resources ---------- */
.resource img {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.resource .meta { font-size: 1.05rem; color: var(--ink-2); }
.category { margin: 32px 0; scroll-margin-top: 12px; }
.category > h2 { padding-bottom: 6px; border-bottom: 3px solid var(--brand); }
.category .card { margin: 14px 0; }

/* ---------- Volunteer QR ---------- */
.volunteer { text-align: center; }
.volunteer img { display: block; width: 100%; max-width: 280px; height: auto; margin: 4px auto 14px; border: 1px solid var(--line); border-radius: 10px; }

/* ---------- Sticky petition bar ---------- */
.petition-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
}
.petition-bar .btn { margin: 0 auto; max-width: 40rem; min-height: 60px; }
html[data-lang="both"] .petition-bar .btn { flex-direction: row; gap: 0.6em; }

/* ---------- Footer ---------- */
footer {
  max-width: 40rem;
  margin: 0 auto;
  padding: 8px 16px 32px;
  color: var(--ink-2);
  font-size: 1.125rem;
  text-align: center;
}
.updated { font-weight: 700; color: var(--ink); }
.share-msg { margin-top: 10px; font-weight: 700; }
