@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,600..900&display=swap');

:root {
  --green: #1b4b3b;
  --red: #9f2838;
  --bg: #f2efe6;
  --card: #faf9f5;
  --border: #d9d3c3;
  --muted-bg: #ebe7dc;
  --text: #1f1f1f;
  --muted: #6b7280;
  --marigold: #f2a93b;
}

html { font-size: 19px; background: var(--bg); }

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
}

h1, h2, h3, h4 { font-family: 'Fraunces', serif; margin: 0; }

* { box-sizing: border-box; }

/* Layout */
.page { max-width: 480px; margin: 0 auto; padding: 0 1rem 5rem; }
.logo-wrap { text-align: center; padding: 2rem 0 1.25rem; }
.logo-wrap img { width: 8rem; height: auto; display: inline-block; }
.logo-wrap a { display: inline-block; }

/* ── Nav bar ── */
.nav-bar {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 -1rem 1.5rem;
  padding: 0.6rem 1rem;
  background: var(--card);
  border-bottom: 1.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.45rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  color: var(--muted);
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.nav-link:hover  { background: var(--muted-bg); color: var(--text); }
.nav-link.active { background: var(--green); color: white; border-color: var(--green); }
.nav-link svg    { flex-shrink: 0; }

/* Form elements */
input, textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1.1rem;
  font-family: 'DM Sans', sans-serif;
  border: 1.5px solid var(--border);
  border-radius: 0.6rem;
  background: var(--card);
  color: var(--text);
  outline: none;
  display: block;
}
select {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1.1rem;
  font-family: 'DM Sans', sans-serif;
  border: 1.5px solid var(--border);
  border-radius: 0.6rem;
  background: var(--card);
  color: var(--text);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(27,75,59,0.12);
}
textarea { resize: none; }

/* Labels & fields */
.field { margin-bottom: 1.25rem; }
.field:last-child { margin-bottom: 0; }
label { font-size: 1.05rem; font-weight: 600; display: block; margin-bottom: 0.35rem; }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: -0.2rem; margin-bottom: 0.5rem; }
.err { color: var(--red); font-size: 0.9rem; margin-top: 0.3rem; display: none; }
.err.show { display: block; }

/* Section cards */
.section-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.section-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 1.1rem;
}

/* Pill buttons */
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.pill {
  padding: 0.55rem 1.1rem;
  border-radius: 9999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--muted-bg);
  color: var(--text);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.3;
}
.pill:active { transform: scale(0.96); }
.pill.on-green { background: var(--green); color: white; border-color: var(--green); }
.pill.on-red   { background: var(--red);   color: white; border-color: var(--red);   }

/* Buttons */
.btn {
  display: block; width: 100%;
  padding: 1rem 1.5rem;
  background: var(--green); color: white;
  border: none; border-radius: 1rem;
  font-size: 1.25rem; font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer; text-align: center;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-red     { background: var(--red); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.28rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.9rem; font-weight: 600;
  margin: 0.15rem;
}
.badge-green { background: rgba(27,75,59,0.1);  color: var(--green); }
.badge-red   { background: rgba(159,40,56,0.1); color: var(--red);   }

/* ── Circular avatar ── */
.avatar {
  width: 4rem; height: 4rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--border);
  background: var(--muted-bg);
  flex-shrink: 0;
  display: inline-block;
}
.avatar-initials {
  width: 4rem; height: 4rem;
  border-radius: 50%;
  background: var(--green);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 1.3rem; font-weight: 700;
  flex-shrink: 0;
  border: 2.5px solid var(--border);
}
.avatar-sm { width: 2.75rem; height: 2.75rem; font-size: 0.95rem; }

/* Photo upload area */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 1rem;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--muted-bg);
}
.photo-upload-area:hover { border-color: var(--green); background: rgba(27,75,59,0.04); }
.photo-upload-area input[type="file"] { display: none; }
.photo-upload-area p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.photo-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.photo-preview-circle {
  width: 7rem; height: 7rem;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--green);
  display: block;
}

/* Phone link */
.phone-links { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.25rem; }
.phone-link {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.95rem; font-weight: 700;
  text-decoration: none;
  border: 1.5px solid;
  transition: opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.phone-link-call { color: var(--green); border-color: rgba(27,75,59,0.35); background: rgba(27,75,59,0.06); }
.phone-link-sms  { color: var(--red);   border-color: rgba(159,40,56,0.35); background: rgba(159,40,56,0.06); }
.phone-link:active { opacity: 0.65; }

/* Board cards */
.person-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 1.5rem;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.person-card-body { padding: 1.25rem; }
.person-card-header { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 0.5rem; }
.person-card-header-info { min-width: 0; }
.person-card-name { font-family: 'Fraunces', serif; font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-bottom: 0.2rem; }
.person-card-age  { font-size: 1rem; color: var(--green); font-weight: 600; }
.person-card-loc  { font-size: 0.95rem; color: var(--muted); margin-bottom: 0.85rem; margin-top: 0.25rem; }
.dl-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--muted); margin-bottom: 0.15rem; }
.dl-value { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }
.partner-bar { background: var(--green); color: white; padding: 1.25rem; }
.partner-bar-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; opacity: 0.7; margin-bottom: 0.2rem; }
.partner-bar-name  { font-family: 'Fraunces', serif; font-size: 1.75rem; font-weight: 700; margin-bottom: 0.75rem; line-height: 1.2; }
.partner-bar-ice   { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); border-radius: 0.75rem; padding: 1rem; font-size: 1rem; font-style: italic; line-height: 1.5; }
.needs-partner-bar { background: rgba(159,40,56,0.08); padding: 1.25rem; display: flex; align-items: center; gap: 0.75rem; }
.needs-partner-bar p { font-weight: 700; font-size: 1.15rem; color: var(--red); margin: 0; }

/* Waiting banner */
.waiting-banner {
  background: rgba(27,75,59,0.08);
  border: 1.5px solid rgba(27,75,59,0.18);
  border-radius: 0.9rem;
  padding: 1.1rem 1.25rem;
  font-size: 1.1rem; font-weight: 600;
  text-align: center; color: var(--green);
  margin-bottom: 1.5rem;
}

/* Roster rows */
.roster-row {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.roster-name { font-weight: 700; font-size: 1.2rem; line-height: 1.2; }
.roster-meta { font-size: 0.95rem; color: var(--muted); margin-top: 0.1rem; }
.delete-btn {
  background: none; border: none; cursor: pointer; padding: 0.5rem;
  color: var(--muted); border-radius: 50%;
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.delete-btn:hover { color: var(--red); background: rgba(159,40,56,0.08); }

/* Stats grid */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-bottom: 1.25rem; }
.stat-box { background: var(--muted-bg); border: 1.5px solid var(--border); border-radius: 1rem; padding: 1.1rem; text-align: center; }
.stat-num { font-family: 'Fraunces', serif; font-size: 2.75rem; font-weight: 700; color: var(--green); line-height: 1; }
.stat-label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-top: 0.3rem; }
.stat-txt { font-family: 'Fraunces', serif; font-size: 1.4rem; font-weight: 700; line-height: 1.2; margin-bottom: 0.1rem; }

/* Duplicate warning */
.dup-warning { background: #fff0f0; border: 1.5px solid rgba(159,40,56,0.25); border-radius: 1rem; padding: 1rem 1.1rem; margin-bottom: 1.25rem; display: none; }
.dup-warning.show { display: block; }
.dup-title { font-weight: 700; font-size: 1.1rem; color: var(--red); margin-bottom: 0.25rem; }
.dup-msg   { font-size: 1rem; color: var(--red); }

/* Modal overlay */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.48); z-index: 50;
  align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card);
  border-radius: 1.5rem 1.5rem 0 0;
  padding: 1.75rem 1.5rem 2.5rem;
  width: 100%; max-width: 480px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
}
.modal-box h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.6rem; }
.modal-box p  { font-size: 1.05rem; color: var(--muted); line-height: 1.5; margin-bottom: 1.5rem; }
.modal-actions { display: flex; flex-direction: column; gap: 0.75rem; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 1.5rem; height: 1.5rem;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  vertical-align: middle; margin-right: 0.5rem;
}
.spinner-dark {
  border: 3px solid rgba(27,75,59,0.2);
  border-top-color: var(--green);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading placeholder */
.loading-wrap { display: flex; flex-direction: column; align-items: center; padding: 5rem 0; color: var(--muted); }
.loading-wrap .spinner { width: 2.5rem; height: 2.5rem; margin: 0 0 1rem; }

/* Host header */
.host-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.host-header svg { flex-shrink: 0; }
.host-header h1 { font-size: 1.75rem; font-weight: 700; }
.section-wrap { background: var(--card); border: 1.5px solid var(--border); border-radius: 1.5rem; padding: 1.25rem; margin-bottom: 1.5rem; }

/* Misc */
.page-title { text-align: center; margin-bottom: 1.5rem; }
.page-title h1 { font-size: 2.25rem; font-weight: 700; }
.eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--green); margin-bottom: 0.4rem; }

.need-help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; background: rgba(235,231,220,0.5); padding: 1rem; border-radius: 0.9rem; margin-top: 0.5rem; }

/* ── Feed tabs ── */
.feed-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 1rem;
  padding: 0.35rem;
}
.feed-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: 0.7rem;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.feed-tab svg { flex-shrink: 0; }
.feed-tab:hover { background: var(--muted-bg); color: var(--text); }
.feed-tab.active { background: var(--green); color: white; }

.feed-panel { /* no extra styles needed — panels are plain wrappers */ }

/* ── Feed ── */
.feed-composer {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.feed-composer h2 {
  font-size: 1.3rem; font-weight: 700; color: var(--green);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem; margin-bottom: 1rem;
}

/* Photo picker grid for feed */
.feed-photo-picker {
  border: 2px dashed var(--border);
  border-radius: 0.9rem;
  padding: 1.1rem;
  text-align: center;
  cursor: pointer;
  background: var(--muted-bg);
  transition: border-color 0.15s;
}
.feed-photo-picker:hover { border-color: var(--green); }
.feed-photo-picker input { display: none; }
.feed-photo-picker p { margin: 0; font-size: 0.95rem; color: var(--muted); }

.feed-thumbs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.feed-thumbs img {
  width: 100%; aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.6rem;
  border: 1.5px solid var(--border);
  display: block;
}
.feed-thumb-single img { grid-column: 1 / -1; aspect-ratio: 16/9; }

/* Upload progress */
.upload-progress {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--green);
}
.upload-progress.show { display: flex; }
.progress-bar-track {
  flex: 1;
  height: 6px;
  background: var(--muted-bg);
  border-radius: 9999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Feed post card */
.post-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 1.5rem;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.post-card-header {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.25rem 0.75rem;
}
.post-author-info { min-width: 0; }
.post-author-name { font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.post-time { font-size: 0.85rem; color: var(--muted); margin-top: 0.1rem; }
.post-caption {
  padding: 0 1.25rem 1rem;
  font-size: 1.05rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.post-photos-single img {
  width: 100%; display: block;
  object-fit: cover;
  cursor: zoom-in;
  max-height: 400px;
}
.post-photos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.post-photos-grid img {
  width: 100%; aspect-ratio: 1;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%; max-height: 90dvh;
  border-radius: 0.5rem;
  object-fit: contain;
}
.lightbox-close {
  position: absolute; top: 1rem; right: 1rem;
  background: rgba(255,255,255,0.15);
  border: none; color: white;
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%; font-size: 1.4rem;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-close:hover { background: rgba(255,255,255,0.28); }
