/* Trails Club potluck signups — mobile-first. Palette shared with /pay/. */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1f2a1a;
  --ink-soft: #4a5240;
  --line: #d9dccd;
  --line-soft: #e8eadd;
  --green: #3a4a2c;
  --green-dark: #2c3920;
  --green-soft: #eef1e4;
  --warn: #b54e1d;
  --warn-soft: #fbefe8;
  --ok: #2c6b3f;
  --ok-soft: #e9f3ec;
  --amber: #8a6410;
  --amber-soft: #fbf3dc;
  --shadow: 0 1px 2px rgba(40, 50, 30, .06), 0 4px 14px rgba(40, 50, 30, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 44px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
code { font-size: .9em; background: var(--green-soft); padding: .1em .35em; border-radius: 5px; }
.muted { color: var(--ink-soft); font-weight: 400; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem;
  padding: .75rem 1rem;
  padding-top: max(.75rem, env(safe-area-inset-top));
  background: var(--green);
  color: #f3efe6;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem; min-width: 0;
  color: inherit; text-decoration: none;
  border-radius: 8px; padding: 2px 6px; margin-left: -6px;
}
.brand:hover, .brand:focus-visible { background: rgba(255,255,255,.12); }
.brand__logo { height: 28px; width: auto; display: block; flex-shrink: 0; }
.brand__name { font-weight: 600; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(255,255,255,.18); color: #fff;
  border-radius: 999px; padding: .25rem .55rem;
  white-space: nowrap;
}

/* ---------- layout ---------- */
.container { max-width: 880px; margin: 0 auto; padding: 1rem 1rem 4rem; }
.page-title { margin: .5rem 0 .25rem; font-size: 1.6rem; line-height: 1.15; text-wrap: balance; }
.page-sub { margin: 0 0 1rem; color: var(--ink-soft); }
.section-title { font-size: 1.05rem; margin: 1.75rem 0 .5rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: .35rem 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 1rem;
  box-shadow: var(--shadow);
}
.card--link { display: block; color: inherit; text-decoration: none; }
.card--link:hover, .card--link:focus-visible { border-color: var(--green); }
.card__title { margin: 0 0 .25rem; font-size: 1.1rem; font-weight: 650; }
.card__sub { margin: 0 0 .75rem; color: var(--ink-soft); font-size: .93rem; }
.card--link .card__sub { margin-bottom: 0; }

/* ---------- intro: facts + optional photo ---------- */
.intro { display: grid; gap: 1rem; margin-bottom: 1rem; }
.intro .facts, .intro .tally { margin: 0; }
.intro__photo {
  order: -1; /* photo first on small screens */
  display: block; width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ---------- event facts ---------- */
.facts dl { margin: 0; display: grid; gap: .6rem; }
.facts dl > div { display: grid; grid-template-columns: 4.25rem 1fr; gap: .5rem; }
.facts dt {
  font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-soft); padding-top: .2rem;
}
.facts dd { margin: 0; font-weight: 600; }
.facts dd .muted { font-size: .92rem; }
.facts__notes {
  margin: .9rem 0 0; padding: .85rem 0 0 1.1rem;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-soft); font-size: .93rem;
}
.facts__notes li { margin: .3rem 0; }
.facts__more { margin: .75rem 0 0; font-size: .93rem; }

/* ---------- notices ---------- */
.notice {
  border-radius: var(--radius-sm);
  padding: .8rem .95rem;
  margin: 0 0 1rem;
  border: 1px solid;
}
.notice p { margin: 0 0 .4rem; }
.notice p:last-child { margin-bottom: 0; }
.notice__title { font-weight: 700; }
.notice--ok { background: var(--ok-soft); border-color: #b9d6c1; color: #1d4a2b; }
.notice--warn { background: var(--warn-soft); border-color: #e7c3ae; color: #7a3413; }
.claim { display: flex; gap: .5rem; align-items: center; }
.claim input {
  flex: 1; min-width: 0;
  font: inherit; font-size: .85rem; color: inherit;
  background: #fff; border: 1px solid #b9d6c1; border-radius: 8px;
  padding: .45rem .6rem;
}

/* ---------- tally ---------- */
.tally {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .6rem 1rem;
  margin: 1.25rem 0 1rem;
}
.tally__nums { margin: 0; color: var(--ink-soft); }
.tally__nums strong { color: var(--ink); font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ---------- categories ---------- */
.cat__head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.cat__head .card__title { margin: 0; }
.cat__count { font-size: .82rem; color: var(--ink-soft); white-space: nowrap; }
.cat__count--need { color: var(--amber); font-weight: 600; }
.cat__bar {
  display: block; width: 100%; height: 6px; margin: .6rem 0 .2rem;
  border: 0; border-radius: 999px; overflow: hidden;
  background: var(--line-soft);
  -webkit-appearance: none; appearance: none;
}
.cat__bar::-webkit-progress-bar { background: var(--line-soft); }
.cat__bar::-webkit-progress-value { background: var(--green); border-radius: 999px; }
.cat__bar::-moz-progress-bar { background: var(--green); border-radius: 999px; }
.cat__empty { margin: .75rem 0 0; color: var(--ink-soft); font-style: italic; }
.cat__ideas {
  margin: .75rem 0 0; padding: .5rem .7rem;
  background: var(--amber-soft); border-radius: 8px;
  font-size: .88rem; color: #5e4409;
}
.cat__add {
  display: inline-flex; align-items: center; min-height: var(--tap);
  margin: .35rem 0 -.5rem;
  font-size: .93rem; font-weight: 600; text-decoration: none;
}
.cat__add:hover { text-decoration: underline; }

.dishes { list-style: none; margin: .5rem 0 0; padding: 0; }
.dish { padding: .6rem 0; border-top: 1px solid var(--line-soft); }
.dish:first-child { border-top: 0; }
.dish--mine {
  background: var(--green-soft);
  margin: 0 -.6rem; padding-left: .6rem; padding-right: .6rem;
  border-radius: 8px; border-top-color: transparent;
}
.dish--mine + .dish { border-top-color: transparent; }
.dish__line { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .4rem; }
.dish__name { font-weight: 600; overflow-wrap: anywhere; }
.dish__by { font-size: .88rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.dish__note { font-style: italic; }
.chip {
  display: inline-block;
  font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-decoration: none;
  color: var(--ok); background: var(--ok-soft);
  border: 1px solid #b9d6c1; border-radius: 999px;
  padding: .05rem .4rem;
  cursor: help;
}
.chip--host { color: var(--amber); background: var(--amber-soft); border-color: #e6d3a0; cursor: default; }

/* ---------- form ---------- */
.field { display: block; margin: .75rem 0; }
.field--compact { margin: .5rem 0 0; }
.field__label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .3rem; }
.field__hint { font-weight: 400; }
.field__help { display: block; margin-top: .25rem; font-size: .8rem; color: var(--ink-soft); }
input[type="text"], input[type="email"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  font: inherit; color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .6rem .75rem;
}
textarea { min-height: 0; font-size: .9rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--green); outline-offset: 2px;
}
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.who { display: grid; gap: 0 .75rem; }
@media (min-width: 520px) {
  .who { grid-template-columns: 1fr 11rem; }
  .dish-row__main { grid-template-columns: 11rem 1fr; }
}

/* One-line summaries of what a returning person already entered. */
.folded {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfbf8;
  margin: .6rem 0 0;
}
.folded > summary {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: var(--tap);
  padding: .45rem .8rem;
  cursor: pointer; list-style: none;
}
.folded > summary::-webkit-details-marker { display: none; }
.folded__text { min-width: 0; overflow-wrap: anywhere; }
.folded__edit { flex-shrink: 0; font-size: .85rem; font-weight: 600; color: var(--green); text-decoration: underline; }
.folded[open] > summary { border-bottom: 1px solid var(--line-soft); }
.folded[open] .folded__edit { visibility: hidden; }
.who-done[open] { padding-bottom: .6rem; }
.who-done > .who, .who-done > .field { margin-left: .8rem; margin-right: .8rem; }
.dish-done > .dish-row { border: 0; margin: 0; background: none; }

.dish-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfbf8;
  padding: .25rem .8rem .8rem;
  margin: .9rem 0 0;
  min-width: 0;
}
.dish-row__main { display: grid; gap: 0 .75rem; }
.dish-row .field { margin: .6rem 0 0; }
.diet-picks { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: .6rem 0 0; }
.diet-pick { display: inline-flex; align-items: center; gap: .4rem; min-height: 32px; font-size: .9rem; }
.diet-pick input { width: 1.1rem; height: 1.1rem; accent-color: var(--green); }
.dish-row__remove, .linklike {
  background: none; border: 0; padding: 0;
  font: inherit; font-size: .85rem; color: var(--warn);
  text-decoration: underline; cursor: pointer;
}
.dish-row__remove { margin-top: .7rem; min-height: 32px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap);
  padding: .6rem 1.1rem;
  font: inherit; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; border-radius: 999px;
  cursor: pointer;
}
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-dark); }
.btn--ghost { background: transparent; color: var(--green-dark); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--green); }
.btn--danger { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn--danger:hover { background: var(--warn); color: #fff; }
.btn--big { font-size: 1.05rem; padding: .8rem 1.5rem; }
.btn--small { min-height: 36px; padding: .35rem .8rem; font-size: .875rem; }
.btn--add { margin-top: .9rem; }
.signup__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.signup__other { margin: 1rem 0 0; font-size: .9rem; color: var(--ink-soft); }
.signup__remove { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); }

.footer { margin-top: 2rem; text-align: center; font-size: .88rem; color: var(--ink-soft); }
.footer p { margin: .3rem 0; }

/* ---------- coordinator ---------- */
.login { max-width: 420px; margin: 2rem auto; padding: 1.5rem; }
.admin-bar { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; margin-bottom: .25rem; }
.admin-bar .linklike { color: var(--green); font-size: inherit; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; }
.row-actions .btn { margin: 0 .25rem .25rem 0; }
.invite__form { display: grid; gap: 0 .75rem; align-items: end; }
.invite__form .field { margin: .25rem 0 .75rem; }
.invite__form .btn { margin-bottom: .75rem; }
@media (min-width: 720px) { .invite__form { grid-template-columns: 1fr 1fr auto; } }
.claim .btn { flex-shrink: 0; }
.table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 1rem; overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
  text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); background: var(--green-soft);
  padding: .55rem .75rem;
}
.table td { padding: .65rem .75rem; border-top: 1px solid var(--line-soft); vertical-align: top; overflow-wrap: anywhere; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 719px) {
  .table thead { display: none; }
  .table tr { display: block; padding: .6rem .85rem; border-top: 1px solid var(--line); }
  .table tr:first-child { border-top: 0; }
  .table td { display: grid; grid-template-columns: 5.5rem 1fr; gap: .5rem; padding: .2rem 0; border: 0; text-align: left; }
  .table td.num { text-align: left; }
  .table td[data-label]::before {
    content: attr(data-label);
    font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-soft); padding-top: .15rem;
  }
  .table td:last-child { display: block; margin-top: .4rem; }
}
@media (min-width: 720px) {
  .container:has(.table) { max-width: 1100px; }
}

/* ---------- wider screens: category cards side by side ---------- */
@media (min-width: 720px) {
  /* Keep the photo from filling a whole tablet screen. */
  .intro__photo { max-width: 600px; justify-self: center; }
  .cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
  .cats .cat { margin: 0; display: flex; flex-direction: column; }
  .cats .cat__add { margin-top: auto; padding-top: .35rem; align-self: flex-start; }
}
@media (min-width: 1100px) {
  .container:has(.cats) { max-width: 1280px; }
  .cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Without a photo the facts card spreads into two columns; with one, the
     photo takes the right half and the card stays stacked. */
  .intro:not(.intro--photo) .facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 0 2rem; }
  .intro:not(.intro--photo) .facts__notes {
    grid-column: 2; grid-row: 1 / span 2;
    margin-top: 0; padding-top: 0; padding-left: 2.6rem;
    border-top: 0; border-left: 1px solid var(--line-soft);
  }
  .intro:not(.intro--photo) .facts__notes li:first-child { margin-top: 0; }
  .intro:not(.intro--photo) .facts__more { grid-column: 1; }
  /* Photo keeps its own shape (no cropping); the tally fills the space left
     under it. */
  .intro--photo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .intro--photo .facts { grid-column: 1; grid-row: 1 / span 2; }
  .intro--photo .intro__photo { order: 0; grid-column: 2; grid-row: 1; max-width: none; }
  .intro--photo .tally { grid-column: 2; grid-row: 2; align-self: center; }
  .signup { max-width: 760px; margin-left: auto; margin-right: auto; }
}

@media print {
  .topbar, .no-print, .signup, .intro__photo, .cat__add, .tally .btn, .footer, .cat__ideas { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .container { max-width: none; padding: 0; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
}
