/* app.css — Gether styles. Mobile-first; colors are tokens so dark mode is automatic. */

:root {
  /* Gether brand: green (primary) + orange (secondary) */
  --bg: #F7F7F2;
  --surface: #FFFFFF;
  --surface-2: #EFF1EA;
  --text: #16201A;
  --text-2: #56605A;
  --text-3: #87908A;
  --border: #E2E6DD;
  --accent: #15803D;        /* green — buttons, links, active tab */
  --accent-ink: #FFFFFF;
  --accent-soft: #DCFCE7;
  --accent-2: #C2410C;      /* orange — dates, hosting, waitlist highlights */
  --accent-2-bright: #F97316; /* decorative orange (bars, gradients) */
  --accent-2-ink: #FFFFFF;
  --accent-2-soft: #FFEDD5;
  --going: #15803D;
  --going-soft: #DCFCE7;
  --maybe: #A16207;
  --maybe-soft: #FEF9C3;
  --no: #64748B;
  --no-soft: #EEF2F6;
  --danger: #DC2626;
  --shadow: 0 1px 2px rgba(22, 32, 26, .06), 0 6px 20px rgba(22, 32, 26, .06);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1210;
    --surface: #171C19;
    --surface-2: #1F2622;
    --text: #F1F4F1;
    --text-2: #B0B9B3;
    --text-3: #818B85;
    --border: #29312C;
    --accent: #4ADE80;
    --accent-ink: #0E1210;
    --accent-soft: #143322;
    --accent-2: #FB923C;
    --accent-2-bright: #FB923C;
    --accent-2-ink: #0E1210;
    --accent-2-soft: #3A2210;
    --going: #4ADE80;
    --going-soft: #143322;
    --maybe: #FACC15;
    --maybe-soft: #332B0A;
    --no: #94A3B8;
    --no-soft: #222833;
    --danger: #F87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px calc(var(--nav-h) + var(--safe-b) + 24px);
}
.app.no-nav { padding-bottom: calc(var(--safe-b) + 32px); }
.app.flush-top { padding-top: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 10px) 12px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar-title { font-size: 20px; font-weight: 750; letter-spacing: -.01em; padding-left: 4px; }
.topbar-spacer { flex: 1; }
.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
}

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: center;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 72px; color: var(--text-3); font-size: 11px; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--accent); }
.tab-create .plus {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
  transform: translateY(-6px);
}
.tab-create .plus svg { width: 26px; height: 26px; }

/* ---------- Generic pieces ---------- */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.stack > * + * { margin-top: 12px; }
.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); margin: 22px 4px 8px;
}
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.center { text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 14px; border: 0;
  font-weight: 650; font-size: 16px; cursor: pointer;
  background: var(--surface-2); color: var(--text);
  transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2);
}
.pill.going { background: var(--going-soft); color: var(--going); }
.pill.maybe { background: var(--maybe-soft); color: var(--maybe); }
.pill.no { background: var(--no-soft); color: var(--no); }
.pill.waitlist { background: var(--accent-2-soft); color: var(--accent-2); }
.pill.host { background: var(--accent-2); color: var(--accent-2-ink); }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em;
  background-size: cover; background-position: center;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { position: relative; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

/* ---------- Forms ---------- */
.field { display: block; }
.field + .field { margin-top: 14px; }
.label { display: block; font-size: 14px; font-weight: 650; margin: 0 0 6px 2px; color: var(--text-2); }
.label .req { color: var(--accent-2); }
.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
  appearance: none; -webkit-appearance: none;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.input.invalid { border-color: var(--danger); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.row .field + .field { margin-top: 0; }
.hint { font-size: 13px; color: var(--text-3); margin: 6px 2px 0; }
.error-text { color: var(--danger); font-size: 14px; margin: 8px 2px 0; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
details.more > summary {
  list-style: none; cursor: pointer; font-weight: 650; color: var(--accent);
  padding: 14px 4px; display: flex; align-items: center; gap: 6px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "＋"; }
details.more[open] > summary::before { content: "－"; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); }

/* ---------- Home feed ---------- */
.greeting { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 4px 4px 14px; }
.event-card {
  display: flex; gap: 14px; align-items: stretch;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px; color: inherit;
}
.event-card + .event-card { margin-top: 12px; }
.event-card:active { transform: scale(.99); }
.thumb {
  position: relative; flex: none; width: 92px; min-height: 92px; border-radius: 14px; overflow: hidden;
  display: grid; place-items: center; font-size: 36px;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.event-card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 2px 4px 2px 0; }
.event-card .when { font-size: 13px; font-weight: 700; color: var(--accent-2); text-transform: uppercase; letter-spacing: .03em; }
.event-card .title { font-size: 17px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.event-card .where { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-card .meta { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }

/* Category covers (used when there's no cover image) */
.cat-Movie   { background: linear-gradient(135deg, #3B1E54, #9B3D6B); }
.cat-Food    { background: linear-gradient(135deg, #F97316, #FACC15); }
.cat-Concert { background: linear-gradient(135deg, #7C3AED, #EC4899); }
.cat-Sports  { background: linear-gradient(135deg, #059669, #84CC16); }
.cat-Party   { background: linear-gradient(135deg, #DB2777, #F59E0B); }
.cat-Trip    { background: linear-gradient(135deg, #0EA5E9, #6366F1); }
.cat-Other   { background: linear-gradient(135deg, #15803D, #F97316); }

/* ---------- Event page ---------- */
.cover {
  position: relative; margin: 0 -16px; height: 240px;
  display: grid; place-items: center; font-size: 84px; overflow: hidden;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.25), transparent 40%, transparent 60%, var(--bg)); }
.cover .float-btn { position: absolute; top: calc(var(--safe-t) + 12px); z-index: 2; }
.cover .float-btn.left { left: 12px; }
.cover .float-btn.right { right: 12px; }
.event-head { position: relative; margin-top: -36px; padding: 0 4px; }
.event-head h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 6px; }
.host-line { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 15px; }

.details { padding: 4px 16px; }
.detail-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; }
.detail-row + .detail-row { border-top: 1px solid var(--border); }
.detail-row .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-2-soft); display: grid; place-items: center; flex: none; font-size: 18px; }
.detail-row .main { font-weight: 650; }
.detail-row .sub { font-size: 14px; color: var(--text-2); }
.countdown { font-variant-numeric: tabular-nums; }
.description { white-space: pre-wrap; word-wrap: break-word; }

.guest-group + .guest-group { margin-top: 14px; }
.guest-group h4 { margin: 0 0 8px; font-size: 14px; color: var(--text-2); display: flex; gap: 8px; align-items: center; }
.guest { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.guest .name { font-weight: 600; }
.guest .note { font-size: 13px; color: var(--text-2); }
.capacity-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.capacity-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2-bright)); border-radius: 99px; }

.rsvp-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.rsvp-bar .inner { max-width: 528px; margin: 0 auto; display: flex; gap: 8px; }
.rsvp-bar .btn { flex: 1; height: 50px; font-size: 15px; padding: 0 8px; }
.rsvp-bar .btn.sel-going { background: var(--going); color: #fff; }
.rsvp-bar .btn.sel-maybe { background: var(--maybe); color: #fff; }
.rsvp-bar .btn.sel-no { background: var(--no); color: #fff; }
.rsvp-bar .status-line { max-width: 528px; margin: 0 auto 8px; font-size: 14px; color: var(--text-2); text-align: center; }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4); animation: fade .2s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-width: 560px; margin: 0 auto; max-height: 90dvh; overflow: auto;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + var(--safe-b));
  animation: up .22s cubic-bezier(.2,.8,.2,1);
}
.sheet .grabber { width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 0 auto 14px; }
.sheet h3 { font-size: 20px; margin-bottom: 12px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Misc ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 12px); transform: translateX(-50%);
  z-index: 60; max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  font-size: 15px; font-weight: 600; box-shadow: var(--shadow); animation: fade .2s;
}
.toast.error { background: var(--danger); color: #fff; }
.empty { text-align: center; padding: 40px 20px; }
.empty .big { font-size: 54px; }
.empty h3 { margin: 10px 0 6px; font-size: 20px; }
.splash { display: grid; place-items: center; min-height: 60dvh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.welcome { padding-top: calc(var(--safe-t) + 8vh); text-align: center; }
.welcome .logo { width: 84px; height: 84px; border-radius: 24px; }
.welcome h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 16px 0 8px; }
.code-input { text-align: center; font-size: 28px; letter-spacing: .4em; font-variant-numeric: tabular-nums; }
.big-code { font-size: 40px; font-weight: 800; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; margin: 8px 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.copy-box { display: flex; gap: 8px; align-items: center; }
.copy-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
