/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #0b0d10;
  --bg-elev: #14181d;
  --bg-hover: #1b2027;
  --line: #262c35;
  --line-soft: #1c2129;
  --text: #eef1f5;
  --text-dim: #98a3b3;
  --text-faint: #5f6b7c;
  --accent: #6c8fff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(108, 143, 255, 0.14);
  --club: #2ea86a;
  --club-soft: rgba(46, 168, 106, 0.16);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.12);
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7;
    --bg-elev: #ffffff;
    --bg-hover: #f0f2f6;
    --line: #e2e6ec;
    --line-soft: #eceff4;
    --text: #10151c;
    --text-dim: #5b6675;
    --text-faint: #8c97a6;
    --accent: #3b62e8;
    --accent-soft: rgba(59, 98, 232, 0.1);
    --club: #178a53; /* darker on light for contrast under white ink */
    --club-soft: rgba(23, 138, 83, 0.1);
    --danger: #d92d2d; /* darker on light: #ff6b6b fails contrast on white */
    --danger-soft: rgba(217, 45, 45, 0.09);
    --shadow: 0 10px 40px rgba(16, 21, 28, 0.14);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ambient wash behind the profile. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 60vh;
  background: radial-gradient(90% 60% at 50% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

button { font: inherit; }

/* ----------------------------------------------------------------- layout */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 8vw, 4.5rem) 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

/* ---------------------------------------------------------------- profile */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}

.avatar {
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
  background: var(--bg-elev);
}

.name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.bio {
  margin: 0;
  max-width: 30rem;
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* One line per statement rather than a reflowing paragraph. Each still wraps on
   its own if the viewport is narrow. */
.bio span {
  display: block;
  text-wrap: balance;
}
.bio span + span { margin-top: 0.1rem; }

/* ------------------------------------------------------------------ links */
.links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 0.97rem;
  font-weight: 550;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.link:hover { background: var(--bg-hover); border-color: var(--text-faint); transform: translateY(-1px); }
.link:active { transform: translateY(0); }

.link--cta {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.link--cta:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.08); }

.link--club {
  background: var(--club);
  border-color: var(--club);
  color: var(--accent-ink);
}
.link--club:hover { background: var(--club); border-color: var(--club); filter: brightness(1.08); }

.link__icon { width: 1.4rem; height: 1.4rem; flex: none; }
.link__go { width: 1.1rem; height: 1.1rem; flex: none; margin-left: auto; opacity: 0.4; }
.link__label { display: flex; flex-direction: column; min-width: 0; }
.link__sub { font-size: 0.8rem; font-weight: 450; opacity: 0.62; }

.foot {
  color: var(--text-faint);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------ sheet */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.sheet[hidden] { display: none; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  animation: fade 0.18s ease;
}

.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 27rem;
  max-height: min(90dvh, 44rem);
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
  overflow: hidden;
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--line-soft);
}

.sheet__title { margin: 0; font-size: 1.05rem; font-weight: 650; }
.sheet__sub { margin: 0.15rem 0 0; font-size: 0.82rem; color: var(--text-dim); }
.sheet__body { padding: 1.2rem; overflow-y: auto; }

.icon-btn {
  flex: none;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn svg { width: 1.05rem; height: 1.05rem; }

/* --------------------------------------------------------------- calendar */
.cal__bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; font-size: 0.95rem; }
.cal__bar .icon-btn { margin: 0; }

.cal__dow, .cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.3rem; }

.cal__dow {
  margin-bottom: 0.35rem;
  color: var(--text-faint);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cal__dow span { text-align: center; }

.day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  cursor: default;
}

.day--open {
  background: var(--bg-hover);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.day--open:hover { background: var(--accent-soft); color: var(--accent); }

/* Availability dot. */
.day--open::after {
  content: "";
  position: absolute;
  bottom: 0.32rem;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
}

.day--sel { background: var(--accent); color: var(--accent-ink); }
.day--sel::after { background: currentColor; }
.day--sel:hover { background: var(--accent); color: var(--accent-ink); }
.day--today { box-shadow: inset 0 0 0 1px var(--text-faint); }
.day--empty { visibility: hidden; }

/* ------------------------------------------------------------------ slots */
.step__label { margin: 0 0 0.8rem; font-size: 0.9rem; font-weight: 600; }

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); gap: 0.45rem; }

.slot {
  padding: 0.62rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.slot:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Unavailable — visible on purpose, so the day reads as a real calendar rather
   than a short list. Struck through so it's unmistakable, not just low-contrast. */
.slot--taken {
  border-color: transparent;
  background: var(--line-soft);
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  cursor: default;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
}
.back:hover { color: var(--text); }
.back svg { width: 0.85rem; height: 0.85rem; }

/* ------------------------------------------------------------------- form */
.picked {
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 0.9rem;
  font-weight: 600;
}
.picked small { display: block; margin-top: 0.15rem; font-weight: 450; color: var(--text-dim); }

.field { display: block; margin-bottom: 0.85rem; }
.field > span { display: block; margin-bottom: 0.35rem; font-size: 0.82rem; font-weight: 600; color: var(--text-dim); }
.field em { font-style: normal; font-weight: 450; color: var(--text-faint); }

.field input, .field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Set on submit, cleared as soon as the field has content — so the form points
   at the offending field instead of just complaining in general. */
.field input.is-invalid, .field textarea.is-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.field input.is-invalid:focus, .field textarea.is-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.field:has(.is-invalid) > span { color: var(--danger); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.err {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.85rem;
}
.err[hidden] { display: none; }

.submit {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--accent);
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.submit:hover:not(:disabled) { filter: brightness(1.08); }
.submit:disabled { opacity: 0.55; cursor: default; }
.submit--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.submit--ghost:hover { background: var(--bg-hover); filter: none; }
.submit--club { background: var(--club); border-color: var(--club); }

/* ------------------------------------------------------------------- club */
.club__pitch { margin: 0 0 1.1rem; color: var(--text-dim); font-size: 0.9rem; }
.club__fine { margin: 0.7rem 0 0; color: var(--text-faint); font-size: 0.78rem; text-align: center; }
.done__mark--club { background: var(--club-soft); color: var(--club); }

/* ------------------------------------------------------------------- done */
.step--done { text-align: center; padding: 1rem 0 0.4rem; }
.step--done h3 { margin: 0 0 0.35rem; font-size: 1.1rem; }

.done__mark {
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  animation: pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.done__mark svg { width: 1.5rem; height: 1.5rem; }

.done__when { margin: 0 0 0.4rem; font-weight: 600; }
.done__note { margin: 0 0 1.3rem; color: var(--text-dim); font-size: 0.86rem; }

.empty { padding: 1.5rem 0; color: var(--text-dim); font-size: 0.88rem; text-align: center; }

/* ----------------------------------------------------------------- motion */
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

@media (max-width: 30rem) {
  .sheet { padding: 0; align-items: flex-end; }
  .sheet__panel { max-width: none; max-height: 92dvh; border-radius: 18px 18px 0 0; border-bottom: 0; }
}
