/* The camper profile page (camper.php)
   ==========================================================================
   The one screen in the app that is about a person rather than a camp, and
   the app's answer to swapping Instagram handles at the end of a week. So it
   is quieter and more generous than the rest: a single column, one band of
   brand colour at the top, and the pictures given room to be looked at.

   Palette and type come from the BJJ Globetrotters design guide — navy
   #363e5e, cream #f8f0d8, sand #e0b878, the four-colour sequence — rather
   than being invented here. */

.cs-cp {
  --cp-navy: #363e5e;
  --cp-navy-deep: #262c45;
  --cp-cream: #f8f0d8;
  --cp-sand: #e0b878;
  --cp-red: #e05038;
  --cp-orange: #ec8448;
  --cp-sage: #88a8a0;
}

/* The same side air every other card in the app has (.card-style). Without it
   the profile runs edge to edge on a phone while everything below it does
   not, which reads as a broken page rather than a wide one. */
.cs-cp-card {
  margin: 0 16px 14px;
  border-radius: 18px;
  background: var(--cs-surface, #fff);
  box-shadow: 0 1px 2px rgba(16, 16, 30, 0.05), 0 8px 24px -14px rgba(16, 16, 30, 0.3);
  overflow: hidden;
}

/* --- the top -------------------------------------------------------------- */

/* One band of brand colour, carrying the guide's four-colour sequence as a
   hairline along the bottom. It is the only decoration on the page, which is
   what lets it be decoration at all. */
.cs-cp-band {
  position: relative;
  /* Short when it is only colour — a tall empty slab is just a bruise at the
     top of the page. A cover picture earns the extra height. */
  height: 78px;
  background:
    radial-gradient(130% 150% at 15% -20%, rgba(224, 184, 120, 0.42) 0%, rgba(224, 184, 120, 0) 55%),
    radial-gradient(120% 140% at 95% 0%, rgba(136, 168, 160, 0.3) 0%, rgba(136, 168, 160, 0) 60%),
    linear-gradient(160deg, var(--cp-navy) 0%, var(--cp-navy-deep) 100%);
}

/* Their own cover picture behind the gradient. The gradient stays so the
   avatar always has something dark to sit against, whatever the picture is. */
.cs-cp-band.has-photo {
  height: 136px;
  background-size: cover;
  background-position: center;
}

.cs-cp-band.has-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(170deg, rgba(38, 44, 69, 0.48) 0%, rgba(38, 44, 69, 0.78) 100%);
}

.cs-cp-band::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: linear-gradient(90deg,
    var(--cp-red) 0 25%, var(--cp-orange) 25% 50%, var(--cp-sand) 50% 75%, var(--cp-sage) 75% 100%);
}

.cs-cp-body { padding: 0 20px 20px; }

.cs-cp-avatar {
  /* The band is positioned and the avatar was not, so the band painted over
     it and sliced the top off the circle along the four-colour line. */
  position: relative;
  z-index: 1;
  width: 108px;
  height: 108px;
  margin: -54px 0 12px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--cs-surface-2, #f1f1f4);
  border: 4px solid var(--cs-surface, #fff);
  box-shadow: 0 8px 22px -10px rgba(16, 16, 30, 0.55);
  cursor: pointer;
}

.cs-cp-name {
  margin: 0 0 3px;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.cs-cp-flag {
  height: 15px;
  margin-left: 7px;
  border-radius: 2px;
  position: relative;
  top: -2px;
}

.cs-cp-fullname {
  font-size: 14px;
  line-height: 1.35;
  color: var(--cs-muted, #6b7085);
}

.cs-cp-place {
  margin-top: 3px;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--cs-muted, #6b7085);
}
.cs-cp-place i { font-size: 11px; opacity: 0.65; margin-right: 2px; }

/* fnDrawBelt() draws to the width it is given, and the page is wider than the
   table cell this used to sit in. On its own at this size it reads as a
   progress bar — the one thing it must not look like — so it is kept short
   and the rank is said in words beside it. */
.cs-cp-beltrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 13px;
}
.cs-cp-belt { width: 86px; flex: none; }
.cs-cp-beltname {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cs-muted, #6b7085);
}

.cs-cp-bio {
  margin: 14px 0 0;
  font-size: 15.5px;
  line-height: 1.52;
  overflow-wrap: anywhere;
}

/* --- the three numbers ---------------------------------------------------- */

.cs-cp-facts {
  display: flex;
  gap: 26px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--cs-line, rgba(26, 31, 54, 0.08));
}

.cs-cp-fact { display: flex; flex-direction: column; gap: 1px; }

.cs-cp-fact strong {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.cs-cp-fact span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cs-faint, #9a9aa5);
}

/* --- where else to find them ---------------------------------------------- */

/* Only what they filled in. A row of greyed-out logos for the services
   somebody is not on reads as an empty profile. */
.cs-cp-links { display: flex; gap: 10px; margin-top: 18px; }

.cs-cp-link img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: block;
}

/* --- buttons --------------------------------------------------------------- */

.cs-cp-actions { display: flex; gap: 8px; margin-top: 18px; }

.cs-cp-btn {
  flex: 1 1 0;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--cs-line-strong, rgba(15, 15, 25, 0.14));
  border-radius: 13px;
  background: transparent;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none !important;
  color: var(--cs-text, #1a1f36) !important;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.cs-cp-btn:active { transform: scale(0.985); }

.cs-cp-btn-main {
  background: var(--cp-navy);
  border-color: var(--cp-navy);
  color: var(--cp-cream) !important;
}

.cs-cp-seen {
  margin-top: 13px;
  font-size: 11.5px;
  color: var(--cs-faint, #9a9aa5);
}

/* --- their pictures -------------------------------------------------------- */

.cs-cp-pics { padding: 18px 20px 20px; }

.cs-cp-pics-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.cs-cp-pics-head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cs-muted, #6b7085);
}

.cs-cp-pics-count {
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cs-faint, #9a9aa5);
}

.cs-cp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.cs-cp-grid[hidden] { display: none; }

.cs-cp-cell {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
  background: var(--cs-surface-2, #f1f1f4);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cs-cp-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cs-cp-cell.is-going { opacity: 0.35; }

/* The one being uploaded: the picture off the phone, dimmed, with the bar
   filling along the bottom. Nothing jumps when the server answers. */
.cs-cp-cell.is-uploading img { filter: brightness(0.6); }

.cs-cp-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0%;
  background: var(--cp-sand);
  transition: width 0.2s ease;
}

.cs-cp-coverflag {
  position: absolute;
  left: 7px;
  bottom: 7px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(16, 16, 30, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff !important;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Adding, as the first tile — where the next picture is going to appear. */
.cs-cp-addcell {
  display: grid;
  place-items: center;
  border: 1.5px dashed var(--cs-line-strong, rgba(15, 15, 25, 0.2));
  background: transparent;
  color: var(--cs-muted, #6b7085);
  font-size: 19px;
}
.cs-cp-addcell input { display: none; }
.cs-cp-addcell:active { transform: scale(0.97); }
.cs-cp-addcell[hidden] { display: none; }

.cs-cp-hint {
  margin: 12px 0 0;
  font-size: 11.5px;
  text-align: center;
  color: var(--cs-faint, #9a9aa5);
}
.cs-cp-hint.is-bad { color: var(--cp-red); font-weight: 700; }
.cs-cp-hint[hidden] { display: none; }

/* --- the empty state, which has to do the persuading ----------------------- */

/* The box, and nothing else. It was a headline and a paragraph explaining
   what a picture is for, which nobody needed and which made an empty profile
   look like a lecture. */
.cs-cp-empty {
  display: block;
  padding: 24px 20px;
  border: 1.5px dashed var(--cs-line-strong, rgba(15, 15, 25, 0.18));
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cs-cp-empty input { display: none; }
.cs-cp-empty[hidden] { display: none; }

.cs-cp-empty-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin: 0 auto 15px;
  border-radius: 50%;
  background: rgba(224, 184, 120, 0.22);
  color: #8a6a32;
  font-size: 21px;
}

.cs-cp-empty-btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 13px;
  background: var(--cp-sand);
  color: #23283d !important;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- the numbers ------------------------------------------------------------ */

/* These are the best thing about a Globetrotters profile — 1315 sparring
   rounds, 408 beers — and they were being filed away as thirteen rows of
   label-and-right-aligned-figure. Now the number is the thing you see and the
   label explains it, which is the right way round. */
.cs-cp-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.cs-cp-stat {
  padding: 13px 14px 12px;
  border-radius: 13px;
  background: var(--cs-surface-2, #f6f6f8);
}

/* Camps, classes, open mats and rounds: the ones about training lead, and get
   the width to prove it. */
.cs-cp-stat.is-lead {
  grid-column: span 2;
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: linear-gradient(135deg, rgba(54, 62, 94, 0.07) 0%, rgba(224, 184, 120, 0.13) 100%);
}

.cs-cp-stat strong {
  display: block;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.cs-cp-stat.is-lead strong { font-size: 27px; flex: none; }

.cs-cp-stat-label {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--cs-muted, #6b7085);
}
.cs-cp-stat.is-lead .cs-cp-stat-label { margin-top: 0; font-size: 13px; font-weight: 700; }

.cs-cp-stat-note {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--cs-faint, #9a9aa5);
}
.cs-cp-stat.is-lead .cs-cp-stat-note {
  margin: 0 0 0 auto;
  text-align: right;
}

/* --- camps together --------------------------------------------------------- */

.cs-cp-camps { display: flex; flex-wrap: wrap; gap: 7px; }

.cs-cp-camp {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--cs-surface-2, #f1f1f4);
  font-size: 12.5px;
  font-weight: 600;
}

/* --- the sheet -------------------------------------------------------------- */

.cs-cp-sheet {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(16, 16, 30, 0.5);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: cs-cp-fade 160ms ease-out both;
}
.cs-cp-sheet[hidden] { display: none !important; }

@keyframes cs-cp-fade { from { opacity: 0; } to { opacity: 1; } }

.cs-cp-sheet-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  animation: cs-cp-rise 280ms cubic-bezier(0.17, 1.02, 0.35, 1) both;
}

@keyframes cs-cp-rise {
  from { transform: translateY(26px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.cs-cp-sheet-btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 15px;
  background: var(--cs-surface, #fff);
  color: var(--cs-text, #1a1f36);
  font-size: 15px;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}
.cs-cp-sheet-btn.is-danger { color: var(--cp-red); }
.cs-cp-sheet-btn.is-quiet { margin-top: 5px; font-weight: 800; }

/* --- no access --------------------------------------------------------------- */

.cs-cp-denied { text-align: center; padding: 16px 0 8px; }
.cs-cp-denied i { font-size: 30px; opacity: 0.3; }
.cs-cp-denied p {
  margin: 15px auto 18px;
  max-width: 28em;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--cs-muted, #6b7085);
}
.cs-cp-denied .cs-cp-btn { display: inline-flex; flex: none; padding: 0 22px; }

/* --- the preview's way through (profile_content.php) ------------------------- */

/* The way out of the preview. It is the sheet's own action, so it carries the
   weight — an outlined button sitting directly above the grey Close button
   read as two versions of the same thing. */
/* Standalone on a settings page it has to line up with the cards around it;
   inside the profile preview the sheet already provides the inset. */
.cs-profile-open-standalone { margin: 0 16px 16px; }

.cs-profile-open {
  /* No width: 100% — it would be measured before the side margins and spill
     32px past the cards it is meant to line up with. A block-level flex box
     fills what is left on its own. */
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  /* The Close button sits directly under this one inside the sheet and the two
     were touching, which read as a single two-storey slab. */
  margin: 12px 0 10px;
  padding: 0 16px;
  border: 0;
  border-radius: 13px;
  background: #363e5e;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none !important;
  color: #f8f0d8 !important;
}
.cs-profile-open span:first-child { flex: 1 1 auto; text-align: left; }
.cs-profile-open-count {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.72;
}
.cs-profile-open i { font-size: 11px; opacity: 0.6; }

/* --- dark ------------------------------------------------------------------- */

/* style.css paints every span white in dark mode with !important, and much of
   this is spans, so each one says its colour louder. */
body .cs-cp .cs-cp-camp,
body .cs-cp .cs-cp-fact strong,
body .cs-cp .cs-cp-stat strong { color: var(--cs-text, #1a1f36) !important; }
body.theme-dark .cs-cp .cs-cp-camp,
body.theme-dark .cs-cp .cs-cp-fact strong,
body.theme-dark .cs-cp .cs-cp-stat strong { color: var(--cs-text, #f4f1ea) !important; }
body .cs-cp .cs-cp-stat-label { color: var(--cs-muted, #6b7085) !important; }
body .cs-cp .cs-cp-stat-note { color: var(--cs-faint, #9a9aa5) !important; }
body .cs-profile-open span { color: #f8f0d8 !important; }
body .cs-cp .cs-cp-fact span { color: var(--cs-faint, #9a9aa5) !important; }
body .cs-cp .cs-cp-btn-main { color: var(--cp-cream) !important; }
body .cs-cp .cs-cp-empty-btn { color: #23283d !important; }
body .cs-cp .cs-cp-coverflag { color: #fff !important; }

body.theme-dark .cs-cp-card { background: var(--cs-surface, #1c1f24); }
body.theme-dark .cs-cp-avatar { border-color: var(--cs-surface, #1c1f24); background: #2c3038; }
body.theme-dark .cs-cp-camp,
body.theme-dark .cs-cp-stat,
body.theme-dark .cs-cp-cell { background: #2c3038; }
body.theme-dark .cs-cp-stat.is-lead {
  background: linear-gradient(135deg, rgba(136, 168, 160, 0.14) 0%, rgba(224, 184, 120, 0.16) 100%);
}
body.theme-dark .cs-cp-facts { border-top-color: rgba(255, 255, 255, 0.09); }
body.theme-dark .cs-cp-sheet-btn { background: var(--cs-surface, #1c1f24); color: var(--cs-text, #f4f1ea); }
body.theme-dark .cs-cp-empty-icon { background: rgba(224, 184, 120, 0.16); color: var(--cp-sand); }

@media (prefers-reduced-motion: reduce) {
  .cs-cp-btn:active,
  .cs-cp-addcell:active { transform: none; }
  .cs-cp-sheet-card { animation: cs-cp-fade 140ms linear both; }
}
