/* Mobile-first, one column, system fonts only. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5d636b;
  --line: #dcd9d2;
  --accent: #b3261e;
  --accent-text: #ffffff;
  --notice: #eef6ee;
  --error: #b3261e;
  --done: #dcf1e1;
  --done-text: #1d6b34;
  --problem: #fbe1df;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --surface: #202225;
    --text: #e8e6e3;
    --muted: #a3a7ad;
    --line: #3a3d42;
    --accent: #e5736b;
    --accent-text: #17181a;
    --notice: #1f3323;
    --error: #ff8a80;
    --done: #1f3a27;
    --done-text: #8fd9a5;
    --problem: #4a2422;
  }
}

* { box-sizing: border-box; }

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

/* The wallpaper: pastel gifts (gifts.svg) behind the page, faint, and
   mostly covered by the cards. Fixed, so it stays put while scrolling. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("gifts.96c2cc493ae7.svg") 0 0 / 360px repeat;
  opacity: 0.45;
}
@media (prefers-color-scheme: dark) {
  body::before { opacity: 0.1; }
}

a { color: var(--accent); }

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.bar form { margin: 0; }
.brand { font-weight: 600; color: var(--text); text-decoration: none; }

/* The header menu: a <details> element, so it works without JavaScript. */
.menu { position: relative; }
.menu summary { cursor: pointer; list-style: none; color: var(--text); display: flex; padding: 0.25rem; }
.menu summary::-webkit-details-marker { display: none; }
/* Tap anywhere else to close it: while open, the summary covers the page
   with an invisible layer, and tapping that toggles the menu shut. */
.menu[open] summary::before { content: ""; position: fixed; inset: 0; z-index: 5; cursor: default; }
.menu nav {
  position: absolute;
  right: 0;
  top: 1.75rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 13rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.12);
}
.menu nav a, .menu nav button.link { text-align: left; text-decoration: none; }

main { max-width: 42rem; margin: 0 auto; padding: 1rem; }
footer { max-width: 42rem; margin: 2rem auto; padding: 0 1rem; color: var(--muted); font-size: 0.875rem; }

h1 { font-size: 1.5rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.125rem; margin: 2rem 0 0.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}

a.card { display: block; color: inherit; text-decoration: none; }
a.card strong { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }

.muted, small { color: var(--muted); }
small { display: block; font-size: 0.875rem; }
small.inline { display: inline; margin-left: 0.35rem; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
ul.tight li { padding: 0.3rem 0; }
.row { display: flex; gap: 0.5rem; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.row form { margin: 0; }

.field { margin: 0 0 1rem; }
.field label { display: block; font-weight: 500; margin-bottom: 0.25rem; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0.375rem;
}
textarea { min-height: 8rem; }

button, .button {
  display: inline-block;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 0.375rem;
  cursor: pointer;
  text-decoration: none;
}
button.secondary, .button.secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}
button.link {
  padding: 0;
  font-weight: inherit;
  color: var(--accent);
  background: none;
  text-decoration: underline;
}

.notice { background: var(--notice); padding: 0.75rem 1rem; border-radius: 0.375rem; }
.errorlist { color: var(--error); padding-left: 1.25rem; margin: 0.25rem 0 0; }
.errors .errorlist { padding-left: 0; list-style: none; }
.copy { word-break: break-all; font-family: ui-monospace, monospace; font-size: 0.875rem; }

/* Tick-box lists (CheckboxSelectMultiple) */
.field div label { display: block; font-weight: normal; padding: 0.25rem 0; }
.field div label input { margin-right: 0.5rem; }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; vertical-align: -0.15rem; }

.icon { flex: none; vertical-align: middle; }

/* Swipe to delete (see swipe.js): a .swipe container holds a red
   "Delete" underneath, and the .swipeable link on top slides left. */
.swipe { position: relative; overflow: hidden; }
ul.plain li.swipe { padding: 0; }
.swipe-action {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 1rem;
  color: #ffffff;
  background: #b3261e;
  font-weight: 600;
}
.swipeable {
  position: relative;
  background: var(--surface);
  touch-action: pan-y;
  transition: transform 0.2s ease;
}
.swipeable.sliding { transition: none; }
.card-swipe { margin: 0.75rem 0; border-radius: 0.5rem; }
.card-swipe .card { margin: 0; }

/* People rows: the whole row is a link to edit them. */
a.person { align-items: center; padding: 0.35rem 0; color: inherit; text-decoration: none; }
a.person .icon { color: var(--muted); }
a.person:hover .icon { color: var(--accent); }

.title-row { display: flex; align-items: center; gap: 0.5rem; }
.icon-link { color: var(--muted); display: inline-flex; }
.icon-link:hover { color: var(--accent); }
.danger-zone { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

button.big { font-size: 1.125rem; padding: 0.8rem 1.4rem; }

/* The participant page */
.reveal { text-align: center; padding: 1.5rem 1rem; }
.reveal ul { text-align: left; }
.receiver { font-size: 2rem; font-weight: 700; margin: 0.25rem 0 1rem; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.note { white-space: normal; }
details.danger-zone summary { cursor: pointer; color: var(--muted); }
.danger-zone + .danger-zone { margin-top: 1rem; padding-top: 0; border-top: 0; }
.progress li small { display: block; }
/* Status pills on the progress page: green once done, red for problems */
.pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.pill {
  padding: 0.1rem 0.6rem;
  font-size: 0.8125rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.pill.done { color: var(--done-text); background: var(--done); border-color: transparent; font-weight: 600; }
.pill.problem { color: var(--error); background: var(--problem); border-color: transparent; font-weight: 600; }
.progress .resend { font-size: 0.875rem; white-space: nowrap; }
.warning { color: var(--error); font-weight: 600; }

/* Home page cards: a link to open, and a button for the next step */
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link strong { color: var(--accent); }
.card-action { margin: 0.75rem 0 0; }
.card-action .button { padding: 0.45rem 0.9rem; font-size: 0.95rem; }

/* The email preview inside the send and draw summary pages */
.email-preview { display: block; width: 100%; height: 34rem; border: 1px solid var(--line); border-radius: 0.5rem; background: #fbfaf7; }
.recipients li small { display: inline; margin-left: 0.35rem; }
