/*
 * The public profile page (public-profile.html), on the tokens of css/app.css
 * and the parts in css/ui.css.
 *
 * Account owners restyle this page with their own CSS and theme colours
 * (profile.html, "Profile look"; js/profile-client.js). That CSS sets the
 * --profile-* custom properties on .public-profile-shell and targets the
 * classes below, and the API only accepts CSS for these class names
 * (api.bluecrazii.nl/api/src/routes/account.js), so keep them. Every colour
 * here reads the --profile-* property first and falls back to the site
 * tokens: a profile without a theme follows the site design and dark mode,
 * a saved theme keeps working. The API scopes user CSS under
 * .public-profile-shell, so most rules here stay at one class and user CSS
 * always wins.
 */

/* Fills the screen between the navigation and the footer, so a theme's page
   colour reaches the bottom even with few events. */
.public-profile-shell {
  min-height: calc(100vh - 57px - 88px);
  color: var(--profile-text, var(--ink));
  background: var(--profile-page-bg, transparent);
}
@media (min-width: 701px) {
  .public-profile-shell { min-height: calc(100vh - 93px - 60px); }
}

/* ---------- the top: banner, picture, name, links ---------- */
.public-profile-hero {
  overflow: hidden;
  border: 1px solid var(--profile-border, var(--line-strong));
  border-radius: 14px;
  background: var(--profile-panel, var(--profile-page-bg, var(--panel-2)));
  color: var(--profile-text, var(--ink));
}
.public-profile-banner {
  height: clamp(110px, 18vw, 260px);
  overflow: hidden;
  background: var(--profile-accent, var(--chip));
}
.public-profile-banner img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: var(--profile-banner-opacity, 1);
}
.public-profile-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 16px;
}
.public-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--profile-accent, var(--chip));
  color: var(--profile-accent-text, var(--muted));
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .02em;
}
/* Set by js/public-profile-page.js once the profile colour is painted on. */
.public-profile-avatar.has-color { color: var(--profile-accent-text, #fff); }
.public-profile-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.public-profile-id { min-width: 0; }
.public-profile-hero h1 {
  margin: 6px 0 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(30px, 6vw, 46px);
  line-height: .95;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.public-profile-hero p {
  margin: 6px 0 0;
  color: var(--profile-muted, var(--muted));
  font-size: 14px;
  line-height: 1.45;
}
.public-profile-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* The small labels: the @handle and the event counts. */
.public-profile-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid var(--profile-border, transparent);
  border-radius: 999px;
  background: var(--profile-chip-bg, var(--profile-accent, var(--chip)));
  color: var(--profile-accent-text, var(--muted));
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* The buttons, the same size and shape as .button in css/ui.css. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--profile-accent, var(--accent));
  color: var(--profile-accent-text, var(--accent-ink));
  font-weight: 700;
  font-size: 14.5px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-secondary {
  border-color: var(--profile-border, transparent);
  background: var(--profile-card-bg, var(--chip));
  color: var(--profile-card-text, var(--ink));
}
.btn-secondary:hover {
  background: color-mix(in srgb, var(--profile-card-text, var(--ink)) 12%, var(--profile-card-bg, transparent));
}
.public-profile-shell a:focus-visible { outline-color: var(--profile-accent, var(--accent)); }

/* ---------- the events ---------- */
.public-profile-section { margin-top: 28px; }
/* A saved theme was made for the old page, where this part sat on its own
   panel, so with custom CSS it gets that panel back. */
.has-custom-css .public-profile-section {
  padding: 16px;
  border: 1px solid var(--profile-border, var(--line-strong));
  border-radius: 14px;
  background: var(--profile-panel, var(--profile-page-bg, var(--panel-2)));
}
.public-profile-section h2 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  text-transform: uppercase;
}
.public-profile-section > p {
  margin: 0;
  max-width: 64ch;
  color: var(--profile-muted, var(--muted));
  font-size: 13.5px;
  line-height: 1.5;
}
.public-event-groups {
  display: grid;
  gap: 22px;
  margin-top: 18px;
  min-width: 0;
}
.public-event-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.public-event-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.public-event-group-head h3 {
  margin: 0;
  color: var(--profile-muted, var(--muted));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.public-event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 10px;
  min-width: 0;
}

/* One event: artwork, name, date, what was saved, and a link. */
.public-event-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--profile-border, var(--line-strong));
  border-radius: 14px;
  background: var(--profile-card-bg, var(--panel-2));
  color: var(--profile-card-text, var(--ink));
}
.public-event-media {
  display: block;
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  background: var(--profile-chip-bg, var(--chip));
}
.public-event-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.public-event-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
}
.public-event-card h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.public-event-card p {
  margin: -4px 0 0;
  color: var(--profile-card-muted, var(--muted));
  font-size: 13px;
  line-height: 1.45;
}
.public-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.public-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--profile-border, transparent);
  border-radius: 999px;
  background: var(--profile-chip-bg, var(--chip));
  color: var(--profile-card-text, var(--muted));
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.public-event-foot {
  margin-top: auto;
  padding-top: 4px;
}
.public-event-foot .btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  font-size: 13px;
  font-weight: 600;
}

.public-empty {
  margin-top: 16px;
  padding: 24px 16px;
  border: 1px dashed var(--profile-border, var(--line-strong));
  border-radius: 14px;
  color: var(--profile-muted, var(--muted));
  text-align: center;
  line-height: 1.5;
}

@media (min-width: 701px) {
  .public-profile-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 20px;
    padding: 22px 24px;
  }
  .public-profile-avatar { width: 88px; height: 88px; font-size: 32px; }
  .public-profile-actions { grid-column: auto; justify-content: flex-end; }
  .public-profile-section { margin-top: 34px; }
  .has-custom-css .public-profile-section { padding: 20px 24px 24px; }
}
