/* ── Togather web — premium, warm, mobile-first ───────────────────────────── */

:root {
  --bg:        #FDFAF7;
  --accent:    #E8A598;
  --accent-dk: #D98C7D;
  --sage:      #8FAF8F;
  --ink:       #2C2C2C;
  --ink-soft:  rgba(44, 44, 44, 0.62);
  --ink-faint: rgba(44, 44, 44, 0.40);
  --card:      #FFFFFF;
  --sunken:    #F4ECE5;
  --hairline:  rgba(44, 44, 44, 0.08);
  --accent-soft: rgba(232, 165, 152, 0.16);
  --sage-soft:   rgba(143, 175, 143, 0.18);
  --shadow:    rgba(154, 106, 90, 0.16);
  --serif: Georgia, "Times New Roman", "Iowan Old Style", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  /* gentle warm wash from the top */
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(232, 165, 152, 0.10), transparent 60%),
    var(--bg);
  min-height: 100vh;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 20px calc(40px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Wordmark ─────────────────────────────────────────────────────────────── */

.wordmark {
  text-align: center;
  padding: 6px 0 18px;
}
.wordmark-text {
  font-family: var(--serif);
  font-weight: bold;
  font-size: 20px;
  letter-spacing: 0.3px;
  color: var(--ink);
}

#view { flex: 1 0 auto; }

.foot {
  margin-top: 36px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.foot strong { color: var(--ink-soft); font-weight: 600; }

/* ── Generic bits ─────────────────────────────────────────────────────────── */

.serif { font-family: var(--serif); font-weight: bold; color: var(--ink); }
.muted { color: var(--ink-soft); line-height: 1.5; margin: 0; }
.muted.small { font-size: 13px; }
.overline {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  box-shadow: 0 12px 28px var(--shadow);
}

.state {
  text-align: center;
  padding: 60px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.state .serif { font-size: 24px; }

.spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.badge {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-dk);
  margin: 0 auto;
}
.badge svg { width: 28px; height: 28px; }

/* ── Buttons & inputs ─────────────────────────────────────────────────────── */

.btn {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px var(--shadow);
}
.btn.primary:hover { background: var(--accent-dk); }
.btn.big { width: 100%; padding: 16px; font-size: 17px; border-radius: 16px; }
.btn.ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--hairline);
}
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.input {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 13px 15px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.linklike {
  color: var(--accent-dk);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

/* ── Event header ─────────────────────────────────────────────────────────── */

.event-head {
  text-align: center;
  padding: 8px 4px 22px;
}
.event-title {
  font-family: var(--serif);
  font-weight: bold;
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.12;
  margin: 0 0 8px;
  color: var(--ink);
}
.event-date {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 14px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
}
.status-pill.open   { background: var(--sage-soft); color: #5d7d5d; }
.status-pill.closed { background: var(--sunken);    color: var(--ink-soft); }
.status-pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.event-meta {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--ink-faint);
}

/* ── Uploader card ────────────────────────────────────────────────────────── */

.uploader { padding: 22px; margin-bottom: 22px; }
.uploader-inner { display: flex; flex-direction: column; gap: 12px; }
.uploader .overline { margin-bottom: 2px; }
.uploader.closed-card { text-align: center; }
.uploader.closed-card .uploader-inner { align-items: center; gap: 10px; }
.uploader.closed-card h3 { font-size: 22px; margin: 4px 0 0; }

.name-row { display: flex; gap: 10px; }
.name-row .input { flex: 1; }
.name-row .btn { white-space: nowrap; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--sunken);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.progress-label { font-size: 13px; color: var(--ink-soft); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Photo grid ───────────────────────────────────────────────────────────── */

.grid-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 2px 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  padding: 0;
  border-radius: 11px;
  overflow: hidden;
  background: var(--sunken);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cell img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.cell:hover img { transform: scale(1.04); }
.cell-name {
  position: absolute;
  left: 5px; bottom: 5px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.36);
  padding: 2px 7px;
  border-radius: 999px;
  max-width: calc(100% - 10px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(2px);
}

.grid-empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 36px 20px;
  border: 1px dashed var(--hairline);
  border-radius: 18px;
  background: rgba(255,255,255,0.5);
}
.grid-empty .serif { font-size: 19px; display: block; margin-bottom: 6px; }

/* ── Lightbox ─────────────────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 9, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  touch-action: pan-y;
}
.lightbox[hidden] { display: none; }
.lb-stage {
  max-width: 100vw;
  max-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lb-stage img {
  max-width: 100%;
  max-height: 86vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lb-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-nav:disabled { opacity: 0.25; cursor: default; }
.lb-name {
  position: absolute;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255,255,255,0.14);
  padding: 8px 16px;
  border-radius: 999px;
}

@media (max-width: 380px) {
  .name-row { flex-direction: column; }
  .name-row .btn { width: 100%; }
}
