/* Slipside. Mobile-first, single column. The light theme is tuned for
   reading outdoors in direct sun; dark follows the system setting. */

:root {
  --bg: #ffffff;
  --surface: #f2f4f7;
  --text: #0b0d10;
  --muted: #3d4651;
  --border: #8a96a3;
  --accent: #0b4fa8;
  --accent-text: #ffffff;
  --accent-bg: #e8f0fb;
  --focus: #0b4fa8;
  --green: #0b6b2f;
  --green-bg: #e3f5e9;
  --amber: #8a4b00;
  --amber-bg: #fff1d6;
  --red: #a3121b;
  --red-bg: #fde4e5;
  --error-bg: #fde4e5;
  --radius: 12px;
  --tap: 56px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #1a212b;
    --text: #f2f5f8;
    --muted: #b4bfcb;
    --border: #5b6876;
    --accent: #7fb2ff;
    --accent-text: #08111f;
    --accent-bg: #12233d;
    --focus: #7fb2ff;
    --green: #6fdc92;
    --green-bg: #0f2f1b;
    --amber: #ffc261;
    --amber-bg: #36260b;
    --red: #ff8a8f;
    --red-bg: #3d1216;
    --error-bg: #3d1216;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 32rem;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

h1 { font-size: 1.5rem; line-height: 1.2; margin: 1.25rem 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }
p { margin: 0.5rem 0; }
a { color: var(--accent); }
.lead { font-size: 1.1rem; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 0.95rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Header and conditions */

.top { border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.where { font-weight: 600; margin-top: 0; }
.flow .muted { font-size: 0.9rem; }

.reports { margin: 1rem 0; padding: 0.75rem 1rem; background: var(--surface); border-radius: var(--radius); }
.reports > .muted { margin: 0; }
.report-list, .chips { list-style: none; margin: 0; padding: 0; }
.report + .report { border-top: 1px solid var(--border); margin-top: 0.75rem; padding-top: 0.75rem; }
.report .meta { margin: 0 0 0.35rem; font-weight: 600; }
.report .note { margin: 0.35rem 0 0; font-style: italic; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  font-size: 0.9rem;
  padding: 0.2rem 0.6rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}

/* Level markers: colour plus a distinct shape, never colour alone. */
.lvl-green { --lvl: var(--green); --lvl-bg: var(--green-bg); --lvl-mark: "●"; }
.lvl-amber { --lvl: var(--amber); --lvl-bg: var(--amber-bg); --lvl-mark: "▲"; }
.lvl-red   { --lvl: var(--red);   --lvl-bg: var(--red-bg);   --lvl-mark: "■"; }
.chip[class*="lvl-"]:not(.lvl-none) { border-color: var(--lvl); background: var(--lvl-bg); }
.chip[class*="lvl-"]:not(.lvl-none)::before,
.opt[class*="lvl-"] > span::before {
  content: var(--lvl-mark);
  color: var(--lvl);
  display: inline-block;
  width: 1em;
  text-align: center;
  margin-right: 0.4em;
}

/* Form */

.outing h1 { margin-top: 1.5rem; }
.club { margin-bottom: 1rem; }

.question { border: 0; margin: 0 0 1.25rem; padding: 0; min-width: 0; }
.question legend, .question .legend { font-weight: 700; font-size: 1.1rem; padding: 0; margin: 0 0 0.5rem; }
.question.missing legend::after, .question.missing .legend::after { content: " — please choose"; color: var(--red); font-weight: 600; }

.options { display: grid; gap: 0.5rem; }

.opt { display: block; position: relative; text-decoration: none; color: inherit; cursor: pointer; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt > span {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-weight: 600;
}
.opt[class*="lvl-"] > span { border-left: 8px solid var(--lvl); }
.opt input:checked + span {
  border-color: var(--text);
  outline: 2px solid var(--text);
  background: var(--lvl-bg, var(--surface));
}
.opt input:checked + span::after { content: "✓"; margin-left: auto; font-size: 1.25rem; }
.opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
a.opt.default > span { border-color: var(--accent); outline: 2px solid var(--accent); }

.question > .hint { margin: -0.25rem 0 0.5rem; }

/* Launch-only questions are hidden while "No launch" is selected. */
.outing:has(input[name="launch"][value="none"]:checked) .needs-launch { display: none; }

/* Choice: once answered, the title and options collapse to one chip,
   "Question: Answer", styled like the "Today on the water" chips. Answered
   chips wrap together; open questions take a full row. Tapping a chip
   clears its answer (form script). */
.choices { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.35rem; margin: 0 0 1.25rem; }
.choices > .question { flex: 1 0 100%; margin: 0 0 0.9rem; }
.choices > .question:has(input:checked) { flex: none; margin: 0; }
.chip-q { display: none; }
.change-hint { display: none; flex: 1 0 100%; margin: 0.15rem 0 0; font-size: 0.85rem; color: var(--muted); }
.choices:has(.choice input:checked) > .change-hint { display: block; }
.choice:has(input:checked) > .legend,
.choice:has(input:checked) > .hint,
.choice:has(input:checked) .opt:not(:has(input:checked)) { display: none; }
.choice .opt:has(input:checked) > span {
  display: block;
  min-height: 0;
  padding: 0.2rem 0.6rem;
  border: 2px solid var(--lvl, var(--border));
  border-radius: 999px;
  background: var(--lvl-bg, var(--bg));
  outline: 0;
  font-size: 0.9rem;
  font-weight: 400;
}
.choice .opt:has(input:checked) > span::after { content: none; }
.choice .opt:has(input:checked) .chip-q { display: inline; }
.choice .opt:has(input:checked) .ans { font-weight: 700; }
.choice .opt:has(input:focus-visible) > span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Launch: two columns of centred buttons. */
.launches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.launches .opt > span { justify-content: center; text-align: center; }
.launches .opt input:checked + span::after { content: none; }

/* Multi: a row of equal toggle buttons. */
.toggles { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 0.5rem; }
.toggle > span { justify-content: center; padding: 0.5rem; }
.toggle input:checked + span { background: var(--accent); border-color: var(--accent); outline-color: var(--accent); color: var(--accent-text); }
.toggle input:checked + span::before { content: "✓"; margin-right: 0.3em; }
.toggle input:checked + span::after { content: none; }

/* Count: a one-row card, label then − number +. Without the script the
   buttons stay hidden and the number is typed. Sits close under a multi
   (crews, then boats). */
.question[data-type="multi"] + .question[data-type="count"] { margin-top: calc(12px - 1.25rem); }
.count-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
}
.count-card label { flex: 1; font-weight: 600; }
.question.missing .count-card { border-color: var(--red); }
.question.missing .count-card label::after { content: " — please set"; color: var(--red); }
.count-card .hint { display: block; font-weight: 400; }
.count-card input {
  width: 3.5rem;
  min-height: 48px;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  color: inherit;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
}
.count-card.enhanced input { width: 2.5rem; border-color: transparent; -moz-appearance: textfield; appearance: textfield; }
.count-card.enhanced input::-webkit-inner-spin-button,
.count-card.enhanced input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.step {
  flex: none;
  width: 48px;
  height: 48px;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  color: inherit;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

/* Check: a tick-box card; ticked = yes, and the card turns accent blue. */
.check {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-weight: 700;
  cursor: pointer;
}
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.check input { flex: none; width: 28px; height: 28px; margin: 0; accent-color: var(--accent); }
.check .text { flex: 1; }
.check .hint { display: block; font-size: 0.85rem; font-weight: 400; color: var(--muted); }

.note-field { margin: 0 0 1.25rem; }
.note-field summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent); font-weight: 600; }
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

.remaining { margin: 0 0 0.75rem; font-size: 0.85rem; font-weight: 600; color: var(--red); }
.remaining:empty { display: none; }

.primary {
  display: block;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}
.primary:disabled { opacity: 0.6; }

.error {
  margin: 0 0 1rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--red);
  border-radius: var(--radius);
  background: var(--error-bg);
  font-weight: 600;
}

.done h1 { margin-top: 2rem; }

/* Help page and footer */

.help .logo { display: block; margin: 1rem auto 0; }
.help h2 { margin-top: 1.5rem; }
.steps { padding-left: 1.5rem; margin: 0.5rem 0; }
.steps li { margin: 0 0 0.75rem; }
.faq { margin: 0.5rem 0; }
.faq dt { font-weight: 600; margin-top: 0.75rem; }
.faq dd { margin: 0.25rem 0 0; }
footer.site { display: flex; flex-wrap: wrap; gap: 0 1.5rem; margin-top: 2.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border); font-size: 0.95rem; }
footer.site a { display: inline-flex; align-items: center; min-height: 44px; }

/* Outing log */

.log section { margin-top: 1.5rem; }
.log .more { margin-top: 1.5rem; }
