/* Meet Sweat. Rounded, warm and a bit cheeky, to match the mascot.
   Black comes from the logo, the page is soft paper, "pool blue" is the one
   action colour and sun-yellow is the headband sticker. Fonts are served from
   /fonts (Fredoka for headings and buttons, Figtree for reading). */

@font-face {
  font-family: 'Fredoka';
  src: url('../fonts/fredoka-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('../fonts/figtree-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --ink: #17130f;
  --bg: #f7f3ea;
  --card: #fffdf8;
  --sand: #eee8da;
  --text: #201b15;
  --muted: #6f665a;
  --border: #e3dbc9;
  --accent: #2457f5;
  --accent-hover: #1a43c9;
  --on-accent: #fff;
  --sun: #ffd447;
  --on-sun: #2b2100;
  --danger: #d93a45;
  --warn: #d97706;
  --err-bg: #fdecec;
  --err-border: #f5c2c5;
  --shadow: 0 1px 0 rgba(60, 40, 10, 0.05), 0 12px 28px -18px rgba(60, 40, 10, 0.35);
  --display: 'Fredoka', ui-rounded, 'SF Pro Rounded', 'Segoe UI', system-ui, sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink: #000;
    --bg: #14110e;
    --card: #1f1b17;
    --sand: #2a251f;
    --text: #f5efe3;
    --muted: #a99f90;
    --border: #3a342b;
    --accent: #6d93ff;
    --accent-hover: #8aa8ff;
    --on-accent: #0b1330;
    --err-bg: #3a1c1f;
    --err-border: #6b2b30;
    --shadow: 0 12px 28px -18px rgba(0, 0, 0, 0.8);
  }
}
:root[data-theme='dark'] {
  --ink: #000;
  --bg: #14110e;
  --card: #1f1b17;
  --sand: #2a251f;
  --text: #f5efe3;
  --muted: #a99f90;
  --border: #3a342b;
  --accent: #6d93ff;
  --accent-hover: #8aa8ff;
  --on-accent: #0b1330;
  --err-bg: #3a1c1f;
  --err-border: #6b2b30;
  --shadow: 0 12px 28px -18px rgba(0, 0, 0, 0.8);
}

* {
  box-sizing: border-box;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
}

/* ---- header: same black as the logo's own background, so it blends in ---- */
.masthead {
  background: #000;
  color: #faf5eb;
}
.masthead-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px 16px;
}
.logo {
  display: block;
  width: 104px;
  height: 104px;
  flex: none;
}
.tagline {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
/* Signed out: the logo is the whole welcome. */
body.signed-out .masthead-inner {
  flex-direction: column;
  text-align: center;
  padding: 24px 16px 28px;
}
body.signed-out .logo {
  width: min(280px, 70vw);
  height: auto;
  aspect-ratio: 1;
}
body.signed-out .tagline {
  font-size: 1.5rem;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 48px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  margin: 0 0 6px;
  line-height: 1.2;
}

/* ---- controls ---- */
select,
input,
textarea,
button {
  font: inherit;
  color: var(--text);
}
select,
input,
textarea {
  padding: 10px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--card);
  min-height: 44px;
  transition: border-color 0.12s;
}
textarea {
  min-height: 0;
}
select:hover,
input:hover,
textarea:hover {
  border-color: var(--muted);
}
input[type='checkbox'] {
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
  width: 1.1rem;
  height: 1.1rem;
}
input[readonly] {
  background: var(--bg);
  color: var(--muted);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

button {
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  padding: 10px 22px;
  min-height: 44px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--accent);
  color: var(--on-accent);
  transition:
    background-color 0.12s,
    transform 0.08s;
}
button:hover {
  background: var(--accent-hover);
}
button:active {
  transform: translateY(1px);
}
button.secondary {
  background: var(--sand);
  color: var(--text);
  border-color: var(--border);
}
button.secondary:hover {
  background: var(--border);
}
button.danger {
  background: var(--danger);
  color: #fff;
}
button.danger:hover {
  filter: brightness(0.92);
}
button.small {
  padding: 5px 16px;
  min-height: 36px;
  font-size: 0.9rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: 12px 0 4px;
}

/* ---- loading feedback ---- */
.loadbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--sun), var(--accent), transparent) 0 0 / 40% 100% no-repeat;
}
/* The short delay stops a flash on fast responses; the bar only appears when it's actually slow. */
body.busy .loadbar {
  opacity: 1;
  transition: opacity 0.15s 0.25s;
  animation: loadbar-sweep 1.1s ease-in-out infinite;
}
@keyframes loadbar-sweep {
  from {
    background-position: -40% 0;
  }
  to {
    background-position: 140% 0;
  }
}
body.busy #app {
  opacity: 0.55;
  transition: opacity 0.15s 0.25s;
}
button:disabled {
  opacity: 0.6;
  cursor: progress;
}
#app:empty::before {
  content: 'Loading…';
  display: block;
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

/* ---- tabs: a pill-shaped switch ---- */
nav {
  display: flex;
  gap: 4px;
  margin: 14px 0 18px;
  padding: 4px;
  background: var(--sand);
  border-radius: 999px;
  overflow-x: auto;
}
nav button {
  flex: 1 0 auto;
  background: none;
  color: var(--muted);
  border: none;
  min-height: 40px;
  padding: 6px 16px;
}
nav button:hover {
  background: none;
  color: var(--text);
}
nav button.active {
  background: var(--ink);
  color: #faf5eb;
}

/* ---- cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card strong {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.25;
}
.card .comment strong,
.card .tag strong {
  font-size: inherit;
}
.userbar {
  margin-bottom: 2px;
}

/* ---- profile completeness ---- */
.progress {
  height: 12px;
  background: var(--sand);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sun), var(--accent));
  border-radius: 999px;
  transition: width 0.3s;
}
.steps {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.steps li {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.steps li.done {
  color: var(--muted);
}
.steps li.done > span:last-child {
  text-decoration: line-through;
}
.nudge {
  display: grid;
  gap: 10px;
  background: color-mix(in srgb, var(--sun) 22%, var(--card));
  border-color: color-mix(in srgb, var(--sun) 60%, var(--border));
}
.notice {
  background: var(--sand);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.9rem;
}
.report-form {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- people ---- */
.linklike {
  background: none;
  border: none;
  padding: 0;
  min-height: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}
.linklike:hover {
  background: none;
  text-decoration-color: currentColor;
}
.tag .linklike {
  font-size: inherit;
}
.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.profile-head h2 {
  margin: 0;
  font-size: 1.5rem;
}
.profile-head img {
  margin: 0 !important;
}
.avatar-fallback {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--sun);
  color: var(--on-sun);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 600;
  flex: none;
}
.bio {
  white-space: pre-wrap;
  max-width: 60ch;
  margin: 0 0 14px;
}
.interest-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}
.interest-row select {
  min-height: 38px;
  padding: 4px 12px;
  font-size: 0.9rem;
}

/* ---- your events ---- */
.history-group {
  margin-top: 14px;
}
.history-group > strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px dashed var(--border);
}

/* ---- tags: little stickers ---- */
.tag {
  display: inline-block;
  background: var(--sand);
  border-radius: 999px;
  padding: 2px 11px;
  margin: 0 6px 4px 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.tag-activity {
  background: var(--sun);
  color: var(--on-sun);
  transform: rotate(-1.5deg);
}
.tag-done {
  background: color-mix(in srgb, #2e9e5b 18%, var(--card));
  color: #23794a;
}
.tag-partner {
  background: color-mix(in srgb, var(--accent) 16%, var(--card));
  color: var(--accent);
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.comment {
  padding: 10px 0;
  border-top: 1px dashed var(--border);
  font-size: 0.95rem;
}
.formgrid {
  display: grid;
  gap: 2px;
}
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 32px 16px;
  border: 2px dashed var(--border);
  border-radius: 22px;
}
.backlink {
  background: none;
  color: var(--accent);
  border: none;
  padding: 0;
  min-height: 0;
  margin-bottom: 12px;
  font-weight: 600;
}
.backlink:hover {
  background: none;
  text-decoration: underline;
}
.err {
  background: var(--err-bg);
  color: var(--danger);
  border: 1px solid var(--err-border);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
details {
  margin-top: 28px;
}
details summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---- maps ---- */
.map-picker {
  height: 230px;
  border-radius: 16px;
  border: 2px solid var(--border);
  margin: 8px 0;
  z-index: 0;
}
.map-search {
  margin: 8px 0 0;
}
.map-search .row {
  flex-wrap: nowrap;
}
.map-search input {
  flex: 1;
  min-width: 0;
}
.map-search-results {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.map-search-result {
  text-align: left;
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-family: var(--body);
  font-weight: 400;
}
.map-search-result:hover {
  background: var(--sand);
}
.map-search-result strong {
  font-family: var(--body);
  font-size: inherit;
  font-weight: 700;
}

@media (max-width: 480px) {
  .logo {
    width: 76px;
    height: 76px;
  }
  .tagline {
    font-size: 1.1rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
  .tag-activity {
    transform: none;
  }
  body.busy .loadbar {
    animation: none;
    background-position: 30% 0;
  }
}
