/* === Tokens =============================================== */
:root {
  --bg: #fdfbf6;
  --bg-grad-1: #fdf6ec;
  --bg-grad-2: #fdfbf6;
  --surface: #ffffff;
  --surface-alt: #fff7eb;
  --border: #ead9c5;
  --border-strong: #d9c3a8;
  --primary: #b85428;
  --primary-hover: #9d4520;
  --primary-soft: #fef2e7;
  --accent: #5c8a5f;
  --accent-soft: #ecf3ec;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --text: #2a2520;
  --text-soft: #4a423a;
  --muted: #857a6c;
  --shadow-sm: 0 1px 2px rgba(60, 35, 10, .05);
  --shadow-md: 0 4px 16px rgba(60, 35, 10, .08);
  --shadow-lg: 0 16px 40px rgba(60, 35, 10, .12);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --serif: "Iowan Old Style", "Palatino Linotype", "Cambria", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === Reset / base ========================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 360px, var(--bg) 720px);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--text); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.75rem, 5vw, 2.4rem); letter-spacing: -.01em; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; letter-spacing: -.005em; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: .5rem 0; color: var(--text-soft); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* === Layout ================================================ */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

/* === Header / footer ======================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1.25rem;
  background: rgba(255, 251, 244, .85);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid rgba(234, 217, 197, .7);
}
.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.01em;
  min-width: 0;
  flex: 1 1 auto;
}
.brand > span:not(.brand-mark) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}
.brand .brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
.site-header nav { display: flex; gap: .35rem; flex: 0 0 auto; }
.site-header nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  padding: .45rem .75rem;
  border-radius: var(--radius-pill);
}
.site-header nav a:hover { background: var(--surface-alt); color: var(--text); }

.site-footer {
  text-align: center;
  padding: 3rem 1rem 2rem;
  color: var(--muted);
  font-size: .85rem;
}

/* === Cards ================================================= */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(234, 217, 197, .5);
}

/* === Hero / event card ===================================== */
.event-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(234, 217, 197, .5);
  margin-top: .5rem;
}
.event-hero {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #f4b48a 0%, #e08855 40%, #b85428 100%);
  overflow: hidden;
}
.event-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.event-hero-fallback {
  position: absolute; inset: 0;
  display: grid;
  place-items: center;
  font-size: 4rem;
  opacity: .55;
}
.event-body { padding: 1.5rem 1.5rem 1.75rem; }
.event-title { margin: 0 0 .85rem; }
.event-meta {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.event-meta li {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--text-soft);
}
.event-meta li .ico {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  flex: 0 0 28px;
}
.event-desc {
  white-space: pre-wrap;
  color: var(--text-soft);
  margin: 0 0 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}
.cta-row { display: flex; gap: .6rem; flex-wrap: wrap; }

/* === Buttons =============================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 1px solid transparent;
  padding: .7rem 1.1rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  line-height: 1;
  min-height: 44px;
  transition: transform .05s ease, background .15s ease, border-color .15s ease, color .15s ease;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(184, 84, 40, .25); }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-alt); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-alt); text-decoration: none; }
.btn-block { width: 100%; }
.btn-lg { padding: .9rem 1.4rem; font-size: 1rem; min-height: 52px; }
.btn-link {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: .25rem .55rem;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: auto;
  border-radius: 4px;
}
.btn-link:hover { color: var(--text); }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { color: #7f1d1d; }

/* === Forms ================================================= */
.stack > * + * { margin-top: 1rem; }
.stack label { display: block; font-weight: 500; color: var(--text); font-size: .95rem; }
.stack label small.muted { font-weight: 400; display: block; margin-top: .35rem; }

input[type=text],
input[type=email],
input[type=date],
input[type=time],
input[type=number],
input[type=password],
input[type=file],
textarea,
select {
  width: 100%;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
}
.stack > label > input[type=text],
.stack > label > input[type=email],
.stack > label > input[type=date],
.stack > label > input[type=number],
.stack > label > input[type=password],
.stack > label > textarea,
.stack > label > select {
  margin-top: .35rem;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; min-height: 88px; }
input[type=file] { padding: .5rem; }

/* Card-style radios for attending question */
.attending-toggle {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}
.attending-toggle legend {
  margin: 0 0 .65rem;
  padding: 0;
  font-weight: 500;
  color: var(--text);
  font-size: .95rem;
  grid-column: 1 / -1;
}
.radio-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-height: 64px;
}
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .ico {
  font-size: 1.4rem;
}
.radio-card .label { font-weight: 600; color: var(--text); }
.radio-card .sub { font-size: .8rem; color: var(--muted); display: block; font-weight: 400; }
.radio-card:hover { background: var(--surface-alt); }
.radio-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.radio-card:has(input:checked) .label { color: var(--primary-hover); }

/* Quantity stepper input */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.qty-stepper button {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}
.qty-stepper button:hover { background: var(--surface-alt); }
.qty-stepper button:disabled { color: var(--border-strong); cursor: not-allowed; }
.qty-stepper input {
  width: 44px;
  text-align: center;
  border: 0;
  background: transparent;
  font-weight: 600;
  min-height: 0;
  padding: 0;
  font-size: 1rem;
  -moz-appearance: textfield;
  appearance: textfield;
}
.qty-stepper input:focus { box-shadow: none; }
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* === Flash ================================================ */
.flash {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.flash::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}
.flash-success { background: var(--accent-soft); color: #2f5f33; border: 1px solid #c6dec8; }
.flash-success::before { background: var(--accent); }
.flash-error { background: var(--danger-soft); color: #7f1d1d; border: 1px solid #fecaca; }
.flash-error::before { background: var(--danger); }

/* === RSVP items page ====================================== */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.75rem 0 .75rem;
}
.section-head h2 { margin: 0; }
.section-head .sub { font-size: .85rem; color: var(--muted); }

.item-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.item-row.has-qty { border-color: var(--primary); background: var(--primary-soft); }
.item-row.full { opacity: .65; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; color: var(--text); display: block; }
.item-desc { color: var(--muted); font-size: .88rem; }
.item-progress {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-top: .4rem;
  font-size: .82rem;
  color: var(--muted);
}
.item-progress .bar {
  flex: 1;
  max-width: 120px;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.item-progress .bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width .25s ease;
}
.item-progress.full .bar > span { background: var(--accent); }

.custom-list { display: flex; flex-direction: column; gap: .65rem; }
.custom-row {
  display: grid;
  grid-template-columns: 1.5fr auto 2fr;
  gap: .55rem;
  align-items: center;
}
.custom-row input[type=text] { min-width: 0; }
.custom-row .qty-stepper { justify-self: start; }

/* === Signups page ========================================= */
.stats {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin: .5rem 0 1.5rem;
}
.stat {
  flex: 1;
  min-width: 140px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat .num {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  display: block;
}
.stat .lbl { color: var(--muted); font-size: .85rem; margin-top: .2rem; display: block; }

.signup-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.signup-list li {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
  padding: .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.avatar {
  flex: 0 0 40px;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
}
.signup-body { min-width: 0; flex: 1; }
.signup-who { font-weight: 600; color: var(--text); }
.signup-who .plus { font-weight: 500; color: var(--muted); font-size: .85rem; margin-left: .25rem; }
.signup-what { color: var(--text-soft); font-size: .9rem; margin-top: .15rem; }
.signup-what .empty { color: var(--muted); font-style: italic; }

.needed-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.needed-list li {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .85rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.needed-list strong { color: var(--text); }
.badge {
  margin-left: auto;
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid #fcd34d;
  font-size: .78rem;
  padding: .15rem .65rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
}
.everything-covered {
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: var(--accent-soft);
  border: 1px solid #c6dec8;
  border-radius: var(--radius);
  text-align: center;
  color: #2f5f33;
}
.everything-covered .ico { font-size: 2rem; margin-bottom: .25rem; }

/* === Empty / muted blocks ================================= */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-state .ico { font-size: 2rem; margin-bottom: .25rem; }

/* === Admin =============================================== */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: .5rem 0 1rem;
}
.admin-header h1 { margin: 0; }
.admin-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.admin-list li {
  display: flex; gap: .5rem; align-items: center;
  padding: .5rem .75rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.inline-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-row input[type=text] { flex: 1; min-width: 8rem; }
.inline-row input[type=number] { width: 5.5rem; flex: 0 0 5.5rem; }
.inline { display: inline; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .25rem -.25rem; padding: 0 .25rem; }
.admin-table { width: 100%; min-width: 540px; border-collapse: collapse; margin: .25rem 0; font-size: .92rem; }
.admin-table th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.admin-table th, .admin-table td { text-align: left; padding: .55rem .5rem; vertical-align: middle; border-bottom: 1px solid var(--border); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table input[type=text], .admin-table input[type=number], .admin-table select {
  padding: .4rem .55rem;
  min-height: 36px;
  font-size: .92rem;
}
.admin-table input[type=text] + input[type=text] { margin-top: .3rem; }
.row-actions { display: flex; gap: .25rem; white-space: nowrap; justify-content: flex-end; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .65rem; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.image-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .85rem; background: var(--surface-alt); border-radius: var(--radius-sm); }
.image-row label { display: flex; gap: .35rem; align-items: center; cursor: pointer; }
.thumb { max-width: 160px; max-height: 100px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.pill { padding: .2rem .65rem; border-radius: var(--radius-pill); font-size: .78rem; font-weight: 600; }
.pill-yes { background: var(--accent-soft); color: #2f5f33; border: 1px solid #c6dec8; }
.pill-no { background: var(--danger-soft); color: #7f1d1d; border: 1px solid #fecaca; }

/* === Responsive ============================================ */
@media (max-width: 640px) {
  .container { padding: 1rem 1rem 3rem; }
  .site-header { padding: .75rem 1rem; }
  .site-header nav a { padding: .35rem .55rem; font-size: .85rem; }
  .event-body { padding: 1.25rem 1.1rem 1.5rem; }
  .stat { min-width: 100%; }
  .custom-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .admin-table { font-size: .85rem; }
  .item-row { padding: .85rem .9rem; gap: .55rem; }
  .item-progress .bar { max-width: 80px; }
}

@media (max-width: 420px) {
  .attending-toggle { grid-template-columns: 1fr; }
  .brand { font-size: .95rem; }
  .site-header nav a { padding: .3rem .45rem; font-size: .8rem; }
  .cta-row .btn { flex: 1; }
}
