/*
 * 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;
}

.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);
}

/* ── 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);
}

.btn.danger {
  background: transparent;
  color: #93300f;
  border-color: var(--line);
}

.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;
}

/* ── 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;
}
