/*
 * Adventure Tracker — base stylesheet.
 * Tokens are SPEC §17. Accessibility rules are SPEC §18 and are load-bearing, not preference.
 *
 * The one rule that drives everything: --orange measures 3.49:1 on paper. It is a fill.
 * Anything carrying a word uses --orange-dp.
 */

:root {
  --orange: #e2582f; /* fills, medallion, live marker — never body text */
  --orange-dp: #b03a18; /* anything carrying words — 5.04:1 with white, AA */
  --orange-lt: #e86837; /* highlight and gradients only */
  --leaf: #263a22; /* app bars, dark surfaces */
  --leaf-mid: #355230; /* secondary action, approved state */
  --rc-brown: #321505; /* body text, church footer, QR modules */
  --rc-olive: #5a4f31; /* secondary text, meta */
  --sage: #c9d3ba; /* quiet panels */
  --sage-lt: #e7ecdf; /* table heads, date blocks */
  --paper: #faf8f3; /* page background — never #FFF */
  --line: #ddd8cb;

  --display: 'Anton', Impact, sans-serif; /* headlines, dates, banners only */
  --ui: 'Jost', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --r: 14px;
  --tap: 44px; /* SPEC §18 / 2.5.5 minimum touch target */
  --gut: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.62;
  color: var(--rc-brown);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* 1.4.10 Reflow: nothing may push the page wider than the viewport at 320px. */
  overflow-x: hidden;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

/* ── Type scale (SPEC §17: Anton is display only) ───────────────────────── */

.display,
h1.display,
.date-block .day {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.005em;
  line-height: 1;
  text-transform: uppercase;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 600;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 600;
}

h3 {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
}

.mono,
.eyebrow {
  font-family: var(--mono);
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rc-olive);
}

.muted {
  color: var(--rc-olive);
  font-size: 13px;
  line-height: 1.55;
}

/* ── Focus and skip link (2.4.1, 2.4.7) ─────────────────────────────────── */

:focus-visible {
  outline: 3px solid var(--orange-dp);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 100;
  background: var(--leaf);
  color: #fff;
  padding: 12px 16px;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.12s ease-out;
}

.skip-link:focus {
  top: 0;
}

/*
 * An upload that went wrong says so in words, in a colour, and never in a colour alone.
 * #93300f on --paper is 8.1:1.
 */
.upload-error {
  color: #93300f;
  font-weight: 600;
  line-height: 1.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--gut);
}

.appbar {
  background: var(--leaf);
  color: #fff; /* 12.28:1 — AAA */
  padding: 18px 0 20px;
}

.appbar .eyebrow {
  color: var(--sage);
}

.appbar h1,
.appbar h2 {
  color: #fff;
}

main {
  padding: 20px 0 56px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rc-olive);
  margin: 26px 0 10px;
}

.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ── The blaze: the one orange dot. Decorative, never the only signal. ──── */

.blaze {
  display: inline-block;
  width: 13px;
  height: 13px;
  background: var(--orange);
  border-radius: 99px;
  flex: none;
  box-shadow: inset -2px -2px 0 rgb(0 0 0 / 13%);
}

.blaze.sm {
  width: 9px;
  height: 9px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 11px;
  overflow: hidden;
}

.card.live {
  border-color: var(--orange);
  border-width: 1.5px;
}

.card .pad {
  padding: 15px;
}

.event-row {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 13px;
  padding: 14px;
  align-items: start;
}

/* 1.4.10: grid children refuse to shrink below content width without this. */
.event-row > * {
  min-width: 0;
}

.date-block {
  background: var(--sage-lt);
  border-radius: 10px;
  text-align: center;
  padding: 7px 4px 8px;
}

.date-block .month {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rc-olive);
}

.date-block .day {
  font-size: 25px;
  color: var(--rc-brown);
  margin: 1px 0;
}

.date-block .weekday {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rc-olive);
}

.event-row h3 {
  overflow-wrap: anywhere;
}

.meta {
  color: var(--rc-olive);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 3px;
}

/* ── Status chips. Never colour alone (SPEC §18) — each carries a word. ──── */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 99px;
  background: var(--sage-lt);
  color: var(--rc-olive);
  border: 1px solid var(--line);
}

.tag.live {
  background: var(--orange-dp);
  color: #fff;
  border-color: var(--orange-dp);
}

.tag.ok {
  background: var(--leaf-mid);
  color: #fff;
  border-color: var(--leaf-mid);
}

.tag.draft {
  background: var(--sage);
  color: var(--rc-brown);
  border-color: var(--sage);
}

/*
 * A shut upload window used to render as a plain "Published" tag, which made a broken code
 * indistinguishable from a working one at a glance. Outlined rather than filled so it reads as a
 * state that wants attention without competing with the filled "uploads open" tag beside it.
 * #93300f on --paper is 8.1:1.
 */
.tag.shut {
  background: var(--paper);
  color: #93300f;
  border-color: #93300f;
}

/* ── The upload-window controls, held apart from navigation. ─────────────── */

.window-controls {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.window-state {
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 9px;
  color: var(--rc-brown);
}

/* ── Buttons. Everything tappable is a real button. ─────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 11px 18px;
  border-radius: 10px;
  border: 1.5px solid var(--orange-dp);
  background: var(--orange-dp);
  color: #fff;
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn:hover {
  background: #9a3214;
  border-color: #9a3214;
}

.btn.ghost {
  background: transparent;
  color: var(--rc-brown);
  border-color: var(--line);
}

.btn.ghost:hover {
  background: var(--sage-lt);
  border-color: var(--rc-olive);
}

.btn.dark {
  background: var(--leaf);
  border-color: var(--leaf);
  color: #fff;
}

.btn.dark:hover {
  background: var(--leaf-mid);
  border-color: var(--leaf-mid);
}

/*
 * A button that takes something away must not be able to pass for a navigation button. This used
 * to share `--line` with .ghost, so "Close uploads now" sat in a wrapped row of five identical grey
 * pills and got tapped by mistake. Carrying its own colour on the border is what separates it.
 */
.btn.danger {
  background: transparent;
  color: #93300f;
  border-color: #93300f;
}

.btn.danger:hover {
  background: #93300f;
  color: #fff;
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

/* ── Forms. Every input has a real <label for>. ─────────────────────────── */

.field {
  margin-bottom: 15px;
}

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rc-olive);
  margin-bottom: 6px;
}

.input,
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='url'],
input[type='number'],
input[type='datetime-local'],
input[type='date'],
input[type='time'],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 13px;
  border: 1.5px solid var(--line); /* 1.4.11 non-text contrast */
  border-radius: 10px;
  background: #fff;
  color: var(--rc-brown);
  font-family: var(--ui);
  font-size: 16px; /* 16px stops iOS Safari zooming the page on focus */
  line-height: 1.4;
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--rc-olive);
}

.hint {
  font-size: 12.5px;
  color: var(--rc-olive);
  margin-top: 5px;
}

.field-error {
  font-size: 13px;
  color: #93300f;
  margin-top: 5px;
  font-weight: 500;
}

/* ── Notes and banners ──────────────────────────────────────────────────── */

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 14px;
  border-radius: 11px;
  background: var(--sage-lt);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
}

.note > * {
  min-width: 0;
}

.note.blaze-note {
  background: #fdf0eb;
  border-color: #f2c9ba;
}

.note.ok {
  background: #eef3ea;
  border-color: #cbd9c4;
}

.note.warn {
  background: #fbf3e4;
  border-color: #e6d5ae;
}

/* ── Progress (1.4.11: the bar needs 3:1 against its track) ─────────────── */

.bar {
  height: 10px;
  border-radius: 99px;
  background: var(--sage);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  background: var(--orange-dp);
}

/* ── Empty states ───────────────────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 46px 20px;
  border: 1.5px dashed var(--line);
  border-radius: var(--r);
  background: #fff;
}

.empty h2 {
  margin-bottom: 7px;
}

.empty p {
  color: var(--rc-olive);
  max-width: 42ch;
  margin: 0 auto 18px;
}

/* ── Church footer (SPEC §17: the lockup appears on every public page) ──── */

.church-footer {
  background: var(--rc-brown);
  color: #fff; /* 16.87:1 — AAA */
  padding: 26px 0 34px;
  margin-top: 40px;
  font-size: 13px;
  line-height: 1.6;
}

.church-footer a {
  color: #fff;
}

.church-footer .eyebrow {
  color: var(--sage);
  margin-bottom: 6px;
}

/* The supplied church artwork has a white ground, so it sits on a paper plate rather than being
   knocked out — retouching somebody's logo to fit a background is not ours to do. */
/*
 * A plain block, sized against its container.
 *
 * Neither `inline-block` nor `fit-content` works here: both size the box from the content, so the
 * image's intrinsic 560px leaked out and pushed the page 248px wide at 320px — caught by the
 * reflow gate. A block with `width:100%` resolves against `.wrap` instead, and `max-width` caps
 * it on a wide screen. `box-sizing: border-box` from the reset keeps the padding inside.
 */
/* The plate is a link now; it must not pick up default link underlining or colour. */
a.church-plate {
  display: inline-block;
  text-decoration: none;
}

.church-plate {
  display: block;
  width: 100%;
  max-width: 292px;
  background: var(--paper);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.church-plate img {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Motion ─────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Wider screens. Phone-first; the laptop is the enhancement. ─────────── */

@media (min-width: 768px) {
  body {
    font-size: 15.5px;
  }

  .wrap {
    padding: 0 24px;
  }

  h1 {
    font-size: 30px;
  }
}

/* ── Prose: rendered Markdown from event copy and profiles ──────────────── */

.prose {
  max-width: 68ch;
}

.prose p {
  margin: 0 0 12px;
}

.prose ul,
.prose ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.prose li {
  margin-bottom: 5px;
}

.prose h1,
.prose h2,
.prose h3 {
  margin: 20px 0 8px;
}

.prose a {
  color: var(--orange-dp);
}

.prose strong {
  font-weight: 600;
}

.prose blockquote {
  margin: 0 0 14px;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--sage);
  color: var(--rc-olive);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--sage-lt);
  padding: 1px 5px;
  border-radius: 5px;
}

/* Wide content scrolls inside its own box; the page body never scrolls sideways. */
.prose pre,
.prose table {
  overflow-x: auto;
  max-width: 100%;
  display: block;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

a {
  color: var(--orange-dp);
}

dl,
dd,
dt {
  margin: 0;
}

/* ── Audience choice list (broadcasts composer, mockup d6) ───────────────── */

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  min-height: var(--tap);
}

.choice input[type='radio'] {
  width: 20px;
  height: 20px;
  min-height: 0;
  flex: none;
  accent-color: var(--orange-dp);
}

.choice:has(input:checked) {
  border-color: var(--orange-dp);
  background: #fdf0eb;
}

.choice .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--rc-olive);
}

/* Long option text makes a <select> refuse to shrink; cap it so 320px reflow holds. */
select {
  max-width: 100%;
  text-overflow: ellipsis;
}

/* ── The lockup on admin screens (SPEC §17) ─────────────────────────────── */

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgb(255 255 255 / 12%);
}

.brand-lockup img {
  flex: none;
  border-radius: 7px;
}

.brand-parent {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--sage);
  overflow-wrap: anywhere;
}

.brand-name {
  display: block;
  font-size: 17px;
  color: #fff;
  line-height: 1.1;
}

/* ── Roomier form fields ─────────────────────────────────────────────────
   The defaults were cramped on a phone: entering an address, a director could
   read about a third of it at a time. Taller boxes, more line-height, and a
   right inset on selects so the native chevron never clips the value. */

.field {
  margin-bottom: 20px;
}

.field label {
  font-size: 11px;
  margin-bottom: 7px;
}

.input,
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='url'],
input[type='number'],
input[type='search'],
input[type='datetime-local'],
input[type='date'],
input[type='time'],
select,
textarea {
  min-height: 52px;
  padding: 14px;
  font-size: 16px;
  line-height: 1.45;
}

select {
  padding-right: 38px;
}

textarea {
  min-height: 160px;
}

.hint {
  font-size: 13px;
  margin-top: 7px;
  line-height: 1.5;
}

/* ── The map, and the address lookup that places its pin. ────────────────── */

/*
 * The frame is a fixed pixel size because the tile arithmetic is in pixels — the pin sits at an
 * exact offset and reflowing the box would slide it off the building. So the box keeps its size
 * and the container clips it, centred: on a narrow phone you see the middle of the same map rather
 * than a differently-wrong one, and the pin is dead centre either way.
 *
 * overflow:hidden here is also what keeps a 640px frame from pushing the page wider than a 320px
 * viewport (1.4.10 Reflow).
 */
.map {
  margin-bottom: 14px;
}

.map-link {
  display: block;
  text-decoration: none;
}

.map-frame {
  position: relative;
  overflow: hidden;
  max-width: 100%;
  margin-left: 50%;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--sage-lt);
}

/* The point of the pin is the location, so it hangs above the coordinate rather than centred on it. */
.map-pin {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: 0;
  transform: translate(-50%, -100%);
  border-radius: 50% 50% 50% 0;
  rotate: -45deg;
  background: var(--orange);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 45%);
}

/* Attribution is a licence condition of using OpenStreetMap tiles, not decoration. */
.map-credit {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 6px;
  color: var(--rc-olive);
}

.map-credit a {
  color: var(--rc-olive);
}

.address-results {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.address-results li + li {
  border-top: 1px solid var(--line);
}

.address-result {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 11px 14px;
  text-align: left;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--rc-brown);
  background: #fff;
  border: 0;
  cursor: pointer;
}

.address-result:hover {
  background: var(--sage-lt);
}
