/* Large, high-contrast and calm: designed for older readers. */

:root {
  --ink: #1b1b1b;
  --muted: #4a4a4a;
  --bg: #f7f4ee;
  --card: #ffffff;
  --line: #cfc8bb;
  --primary: #1d4f91;
  --primary-dark: #133766;
  --focus: #ffbf47;
  --green: #17602f;
  --green-bg: #e2f2e7;
  --amber: #7a4d00;
  --amber-bg: #fff1cf;
  --red: #a4161a;
  --red-bg: #fde8e8;
  --blue-bg: #e6eef9;
}

html { font-size: 125%; }
html[data-size="large"] { font-size: 150%; }
html[data-size="larger"] { font-size: 175%; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Verdana, Arial, sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

.wrap { max-width: 50rem; margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 30rem; }

h1 { font-size: 1.8rem; line-height: 1.2; margin: 1rem 0 .75rem; }
h2 { font-size: 1.4rem; line-height: 1.25; margin: 2rem 0 .75rem; }
h3 { font-size: 1.3rem; line-height: 1.25; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); text-underline-offset: .15em; }
a:hover { color: var(--primary-dark); text-decoration-thickness: 3px; }
.lead { font-size: 1.1rem; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 8px var(--focus); }
main:focus { outline: none; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--focus); color: var(--ink); padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */

.site-header { background: var(--primary); color: #fff; }
.site-header :focus-visible { outline-color: var(--focus); box-shadow: none; }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding-top: .75rem; padding-bottom: .75rem; }
.brand { color: #fff; font-size: 1.3rem; font-weight: 800; text-decoration: none; }
.brand:hover { color: #fff; text-decoration: underline; }

.text-size { display: none; align-items: center; gap: .35rem; font-size: .85rem; }
.js .text-size { display: flex; }
.text-size button {
  font: inherit; font-weight: 800; min-width: 2.6rem; min-height: 2.4rem; padding: 0 .5rem;
  background: transparent; color: #fff; border: 2px solid #fff; border-radius: .4rem; cursor: pointer;
}
.text-size button[aria-pressed="true"] { background: #fff; color: var(--primary); }

.main-nav { padding-bottom: .5rem; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: center; }
.main-nav .push { margin-left: auto; }
.main-nav a, .nav-button {
  display: inline-block; padding: .4rem 0; color: #fff; font: inherit; font-weight: 700;
  background: none; border: 0; text-decoration: underline; text-underline-offset: .2em; cursor: pointer;
}
.main-nav a[aria-current="page"] { text-decoration-thickness: 4px; }
.main-nav a:hover, .nav-button:hover { color: #fff; text-decoration-thickness: 4px; }

.signed-in { margin: 1rem 0 0; color: var(--muted); }

.site-footer { margin-top: 3rem; padding: 1.5rem 0; border-top: 2px solid var(--line); color: var(--muted); }
.site-footer .credit { font-size: .85rem; margin: 0; }

/* ---------- Messages ---------- */

.flash { border-left: 8px solid var(--primary); background: var(--blue-bg); padding: .8rem 1rem; margin: 1rem 0; border-radius: .4rem; font-weight: 600; }
.flash p:last-child, .flash ul:last-child { margin-bottom: 0; }
.flash-success { border-color: var(--green); background: var(--green-bg); }
.flash-error { border-color: var(--red); background: var(--red-bg); }
.flash ul { margin: .25rem 0 0; padding-left: 1.25rem; }
.flash-error a { color: var(--red); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block; font: inherit; font-weight: 700; font-size: 1.05rem; line-height: 1.3;
  padding: .7rem 1.3rem; min-height: 3rem; border-radius: .5rem; border: 3px solid transparent;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: var(--blue-bg); color: var(--primary-dark); }
.btn-danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red-bg); color: var(--red); }
.btn-small { font-size: .85rem; padding: .35rem .8rem; min-height: 2.4rem; }
.btn-wide { width: 100%; }

form.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---------- Activities ---------- */

.how { background: var(--card); border: 2px solid var(--line); border-radius: .6rem; padding: .6rem 1rem; margin: 1rem 0; }
.how summary { font-weight: 700; cursor: pointer; color: var(--primary); padding: .3rem 0; }
.how ol { margin: .5rem 0 .5rem; padding-left: 1.5rem; }
.how li { margin-bottom: .5rem; }

.tabs { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.25rem 0 .5rem; }
.tab {
  padding: .55rem 1rem; border: 3px solid var(--primary); border-radius: .5rem;
  font-weight: 700; text-decoration: none; color: var(--primary); background: #fff;
}
.tab[aria-current="page"] { background: var(--primary); color: #fff; }

.month { margin-top: 2rem; padding-bottom: .3rem; border-bottom: 3px solid var(--primary); }

.event {
  display: flex; gap: 1.1rem; background: var(--card); border: 2px solid var(--line);
  border-radius: .75rem; padding: 1.1rem; margin-bottom: 1.1rem; scroll-margin-top: 1rem;
}
.event-mine { border: 3px solid var(--green); }
.event-cancelled { background: #f1efeb; }

.event-date {
  flex: 0 0 4.4rem; align-self: flex-start; text-align: center; line-height: 1.15;
  background: var(--blue-bg); color: var(--primary-dark); border-radius: .5rem; padding: .5rem .25rem;
}
.event-date span { display: block; }
.event-date .wd, .event-date .mn { font-weight: 700; text-transform: uppercase; font-size: .8rem; letter-spacing: .03em; }
.event-date .dn { font-size: 1.9rem; font-weight: 800; }

.event-body { flex: 1; min-width: 0; }
.event h3 { margin: 0 0 .25rem; }
.when { font-weight: 700; margin-bottom: .5rem; }
.desc { white-space: pre-line; }

.facts { margin: 0 0 .75rem; }
.facts div { display: flex; flex-wrap: wrap; gap: 0 .5rem; }
.facts dt { font-weight: 700; }
.facts dt::after { content: ":"; }
.facts dd { margin: 0; }
.facts-stacked div { margin-bottom: .4rem; }

.event-status { border-top: 2px solid var(--line); margin-top: .9rem; padding-top: .9rem; }
.event-status ~ p { margin-top: .9rem; }

.badge { display: inline-block; font-weight: 800; padding: .15em .75em; border-radius: 999px; border: 2px solid; margin: 0 0 .6rem; }
.badge-open { background: var(--blue-bg); color: var(--primary-dark); border-color: var(--primary); }
.badge-ready { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }
.badge-booked { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.badge-cancelled { background: var(--red-bg); color: var(--red); border-color: var(--red); }
td .badge { margin: 0; white-space: nowrap; }

.count { margin-bottom: .4rem; }
.count .big { font-size: 1.6rem; font-weight: 800; }
.meter { height: 1.4rem; background: #e7e1d6; border: 2px solid var(--muted); border-radius: 999px; overflow: hidden; margin-bottom: .6rem; }
.meter-fill { height: 100%; background: var(--primary); }

/* Totaliser: ticks above, bar with dashed goal lines, goal numbers below. Side padding leaves room for the end marker. */
.totaliser { padding: 0 .9rem; margin: .25rem 0 .9rem; }
.tot-ticks, .tot-labels { position: relative; }
.tot-ticks { height: 2.1rem; }
.tot-labels { height: 1.6rem; }
.tot-tick {
  position: absolute; bottom: .3rem; transform: translateX(-50%);
  width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 3px solid #bdb5a6; background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem; font-weight: 900; line-height: 1;
}
.tot-tick.is-done { background: var(--green); border-color: var(--green); }
.tot-bar { position: relative; height: 1.9rem; margin: 0; }
.tot-line { position: absolute; top: 0; bottom: 0; border-left: 3px dashed var(--ink); transform: translateX(-1.5px); }
.tot-line.is-done { border-left-color: #fff; }
.tot-labels span { position: absolute; top: .25rem; transform: translateX(-50%); font-weight: 800; font-size: .9rem; line-height: 1.2; }

.stretch-note { border-left: 4px solid var(--primary); padding-left: .75rem; }

.mine { border-left: 6px solid var(--green); background: var(--green-bg); padding: .7rem 1rem; border-radius: .4rem; margin: .9rem 0 0; }
.mine p:last-child { margin-bottom: 0; }
.mine-reserve { border-color: var(--amber); background: var(--amber-bg); }
.mine-title { font-weight: 800; font-size: 1.1rem; }

.empty { background: var(--card); border: 2px dashed var(--line); border-radius: .75rem; padding: 1.5rem; margin: 1rem 0; }

/* ---------- Forms ---------- */

.card { background: var(--card); border: 2px solid var(--line); border-radius: .75rem; padding: 1.25rem; margin: 1rem 0; }
.field { margin-bottom: 1.4rem; }
label { display: block; font-weight: 700; margin-bottom: .3rem; }
.hint { color: var(--muted); margin-bottom: .35rem; }
.error-msg { color: var(--red); font-weight: 700; margin-bottom: .35rem; }
.has-error input, .has-error textarea { border-color: var(--red); }

input[type="text"], input[type="password"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"], input[type="time"], select, textarea {
  font: inherit; width: 100%; max-width: 30rem; padding: .6rem .75rem; min-height: 3rem;
  color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: .4rem;
}
input.input-short { max-width: 8rem; }
input.input-medium { max-width: 14rem; }
.book-form { border-top: 2px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.inline-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
textarea { max-width: 100%; }

.checkbox { display: flex; align-items: flex-start; gap: .75rem; margin: 0 0 1.25rem; }
.checkbox input { width: 1.6rem; height: 1.6rem; margin: .1rem 0 0; flex: none; accent-color: var(--primary); }
.checkbox label { font-weight: 400; margin: 0; cursor: pointer; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: .5rem 0 1rem; border: 2px solid var(--line); border-radius: .6rem; background: var(--card); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--blue-bg); }
tbody tr:last-child td { border-bottom: 0; }

details.past, details.danger-zone { margin: 2rem 0 1rem; }
details.past summary, details.danger-zone summary { font-weight: 700; cursor: pointer; color: var(--primary); padding: .3rem 0; }
details.danger-zone summary { color: var(--red); }
details.danger-zone[open] { border: 2px solid var(--red); border-radius: .6rem; padding: .75rem 1rem; background: #fff; }

/* ---------- Small screens ---------- */

@media (max-width: 36rem) {
  html { font-size: 112.5%; }
  html[data-size="large"] { font-size: 131%; }
  html[data-size="larger"] { font-size: 150%; }
  .event { flex-direction: column; gap: .6rem; }
  .event-date { display: flex; gap: .4rem; align-items: baseline; padding: .3rem .7rem; flex-basis: auto; }
  .event-date .dn { font-size: 1.2rem; }
  .event .actions .btn, .event .actions form.inline { display: block; width: 100%; }
  .main-nav .push { margin-left: 0; }
}

/* ---------- Printing (organiser's lists) ---------- */

@media print {
  html, html[data-size] { font-size: 11pt; }
  body { background: #fff; }
  .site-header, .site-footer, .signed-in, .flash, .no-print, .actions { display: none !important; }
  .card, .table-wrap { border: 0; padding: 0; }
  th { background: none; }
  a { color: inherit; text-decoration: none; }
}
