:root {
  --bg: #F4EDE2;
  --surface: #FFF8EF;
  --ink: #162533;
  --ink-soft: #5B6770;
  --accent: #C85D42;
  --gold: #D2AE61;
  --moss: #64806A;
  --border: #DFCDB8;
  --error: #B33A3A;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* ── Cards ──────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.card h3 {
  font-size: 16px;
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 4px;
}

/* ── Group header ───────────────────────────────────────────────── */

.group-header {
  text-align: center;
  padding: 16px 0 8px;
}

.group-header h1 {
  font-size: 24px;
  margin-bottom: 4px;
}

.group-header .tagline {
  color: var(--ink-soft);
  font-size: 14px;
}

/* ── Gathering card ─────────────────────────────────────────────── */

.gathering-title {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gathering-book {
  font-size: 18px;
  margin-bottom: 12px;
}

.gathering-book a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-style: italic;
}

.gathering-book a:hover {
  text-decoration: underline;
}

.gathering-book .book-author {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 400;
  font-style: normal;
}

.gathering-detail {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.gathering-detail strong {
  color: var(--ink);
}

.bring-list {
  list-style: none;
  padding: 0;
  margin-top: 8px;
}

.bring-list li {
  font-size: 14px;
  padding: 4px 0;
  color: var(--ink-soft);
}

.bring-list li::before {
  content: "· ";
  color: var(--accent);
  font-weight: bold;
}

/* ── RSVP ───────────────────────────────────────────────────────── */

.rsvp-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.rsvp-btn {
  flex: 1;
  min-height: 44px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.rsvp-btn:hover {
  border-color: var(--accent);
}

.rsvp-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.rsvp-clear {
  flex: 0 0 44px;
  font-size: 18px;
  color: var(--ink-soft);
}

.bringing-field {
  margin-top: 8px;
}

.bringing-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--surface);
}

/* ── Who's in ───────────────────────────────────────────────────── */

.whos-in-list {
  list-style: none;
  padding: 0;
}

.whos-in-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.whos-in-list li:last-child {
  border-bottom: none;
}

.rsvp-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.rsvp-badge.yes { background: var(--moss); color: white; }
.rsvp-badge.no { background: var(--ink-soft); color: white; }
.rsvp-badge.maybe { background: var(--gold); color: var(--ink); }

/* ── Poll ───────────────────────────────────────────────────────── */

.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
  min-height: 44px;
  overflow: hidden;
}

.poll-option-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--border);
  opacity: 0.4;
  border-radius: 7px 0 0 7px;
  transition: width 0.3s ease;
}

.poll-option.voted .poll-option-fill {
  background: var(--accent);
  opacity: 0.15;
}

.poll-option-label {
  position: relative;
  z-index: 1;
}

.poll-option:hover {
  border-color: var(--accent);
}

.poll-option.voted {
  border-color: var(--accent);
}

.poll-votes {
  position: relative;
  z-index: 1;
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 8px;
}

/* ── Forms ──────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: var(--surface);
  height: 48px;
}

.form-group input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  width: 100%;
}

.btn:hover { opacity: 0.9; }

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--border);
}

.error-text {
  color: var(--error);
  font-size: 14px;
  margin-top: 8px;
}

.help-text {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 4px;
}

/* ── Header ─────────────────────────────────────────────────────── */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

header .user-name {
  font-size: 14px;
  color: var(--ink-soft);
}

header a {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
}

/* ── Bottom nav ─────────────────────────────────────────────────── */

nav.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 0;
  z-index: 10;
}

nav.bottom-bar a {
  flex: 1;
  max-width: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.15s;
}

nav.bottom-bar a.active {
  color: var(--accent);
}

/* ── Admin controls ─────────────────────────────────────────────── */

.admin-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.admin-link {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* ── Likes ──────────────────────────────────────────────────────── */

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink-soft);
  transition: color 0.15s;
  min-height: 32px;
}

.like-btn:hover {
  color: var(--accent);
}

.like-btn.liked {
  color: var(--accent);
}

.like-btn.liked .like-heart {
  color: var(--accent);
}

.like-heart {
  font-size: 16px;
}

.like-count {
  font-size: 13px;
  font-weight: 600;
}

.gathering-like {
  font-size: 15px;
}

/* ── Comments ───────────────────────────────────────────────────── */

.comments-list {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.comment {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.comment:last-child {
  border-bottom: none;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comment-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.comment-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: 8px;
}

.comment-body {
  font-size: 14px;
  color: var(--ink);
  margin-top: 2px;
  line-height: 1.4;
}

.comment-form {
  margin-top: 12px;
}

/* ── htmx loading state ─────────────────────────────────────────── */

.htmx-request {
  opacity: 0.6;
  transition: opacity 0.2s;
}

/* ── Login page centered ────────────────────────────────────────── */

.login-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 80dvh;
}

.login-page h1 {
  text-align: center;
  margin-bottom: 24px;
}
