/*
 * How a public profile looks.
 *
 * Everything is scoped to .glitterbox-profile, so the same styles can drive the
 * public page and the live preview in the editor without leaking into the app.
 * A theme only ever sets three colours (as custom properties) and picks a font
 * and pattern by name (as data attributes). The CSS for those lives here.
 */

/* The colours, fonts and patterns are in profile_looks.css, shared with the home page's cards. */
.glitterbox-profile {
  margin: 0;
  min-height: 100vh;
}

/* The profile itself */
.glitterbox-profile .profile {
  container-type: inline-size;
  max-width: 40rem;
  margin: 0 auto;
  padding: 3rem 1rem;
}

.glitterbox-profile .profile:not([data-layout="single"]) {
  max-width: 64rem;
}

.glitterbox-profile h1 {
  margin: 0;
  font-size: 2.5rem;
  color: var(--profile-accent);
  overflow-wrap: anywhere;
}

.glitterbox-profile .username {
  margin-top: 0.25rem;
  opacity: 0.7;
}

.glitterbox-profile a {
  color: var(--profile-accent);
}

/* Layouts: sections stack on small screens, and sit side by side when there's room. */
.glitterbox-profile .profile-sections,
.glitterbox-profile .profile-section {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}

.glitterbox-profile .profile-sections {
  margin-top: 2rem;
}

@container (min-width: 46rem) {
  .glitterbox-profile .profile[data-layout="sidebar-left"] .profile-sections {
    grid-template-columns: 17rem 1fr;
  }

  .glitterbox-profile .profile[data-layout="sidebar-right"] .profile-sections {
    grid-template-columns: 1fr 17rem;
  }
}

/* Widgets */
.glitterbox-profile .widget {
  padding: 1rem 1.25rem;
  border: 2px dashed var(--profile-accent);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--profile-background) 85%, transparent);
  overflow-wrap: anywhere;
}

.glitterbox-profile .widget h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.glitterbox-profile .widget p {
  margin: 0;
}

.glitterbox-profile .about p {
  margin: 0.5rem 0;
  white-space: pre-line;
}

.glitterbox-profile .mood strong {
  color: var(--profile-accent);
}

.glitterbox-profile .interests dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}

.glitterbox-profile .interests dt {
  font-weight: 700;
  color: var(--profile-accent);
}

.glitterbox-profile .interests dd {
  margin: 0;
  white-space: pre-line;
}

.glitterbox-profile now-playing {
  display: block;
}

.glitterbox-profile now-playing .play {
  padding: 0.6rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--profile-accent);
  color: var(--profile-background);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.glitterbox-profile now-playing iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.5rem;
}

.glitterbox-profile now-playing iframe[data-service="YouTube"] {
  aspect-ratio: 16 / 9;
}

.glitterbox-profile now-playing iframe[data-service="Spotify"] {
  height: 152px;
}

/* Adding a friend happens on the app: this is just a link there. */
.glitterbox-profile .add-friend {
  margin: 0.75rem 0 0;
}

.glitterbox-profile .add-friend a {
  display: inline-block;
  background: var(--profile-background);
  padding: 0.35rem 0.9rem;
  border: 2px solid var(--profile-accent);
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}

/* The Top 8: each friend's tile is in their own colours (see ThemesController). */
.glitterbox-profile .top-friends .friend-count {
  margin-bottom: 0.75rem;
  opacity: 0.8;
}

.glitterbox-profile .top-friends ol {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.glitterbox-profile .top-friend a {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  color: inherit;
  text-decoration: none;
}

.glitterbox-profile .top-friend .tile {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--tile-accent, var(--profile-accent));
  border-radius: 0.5rem;
  background: var(--tile-background, var(--profile-background));
  color: var(--tile-accent, var(--profile-accent));
  font-size: 2rem;
  font-weight: 700;
}

.glitterbox-profile .top-friend a:hover .tile {
  box-shadow: 0 0 12px var(--tile-accent, var(--profile-accent));
}

.glitterbox-profile .top-friend .name {
  font-size: 0.85rem;
  text-align: center;
  overflow-wrap: anywhere;
}

.glitterbox-profile .top-friend .username {
  font-size: 0.7rem;
  opacity: 0.7;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Profile pictures */
.glitterbox-profile .profile > header {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 1.5rem;
  align-items: center;
}

.glitterbox-profile .profile > header > :not(.avatar) {
  grid-column: 2;
}

.glitterbox-profile .profile > header:not(:has(.avatar)) {
  grid-template-columns: 1fr;
}

.glitterbox-profile .profile > header:not(:has(.avatar)) > * {
  grid-column: 1;
}

.glitterbox-profile .avatar {
  grid-row: 1 / span 3;
  width: 160px;
  height: 160px;
  border: 3px solid var(--profile-accent);
  border-radius: 0.75rem;
  object-fit: cover;
  box-shadow: 0 0 18px color-mix(in srgb, var(--profile-accent) 60%, transparent);
}

.glitterbox-profile .top-friend .tile {
  overflow: hidden;
}

.glitterbox-profile .top-friend .tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Moderation */
.glitterbox-profile .moderated { font-style: italic; opacity: 0.75; }
.glitterbox-profile .suspended { text-align: center; padding: 4rem 1rem; }

/*
 * Glitterbox's bar at the top of every profile. It deliberately ignores the
 * profile's theme (fixed colours and font, not the --profile-* properties), so
 * it looks the same everywhere and you always know how to get back.
 */
.glitterbox-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.25rem;
  padding: 0.6rem 1rem; background: #0a0a0f; border-bottom: 1px solid #ffffff1f;
  font: 600 0.9rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #e8e8f0;
}
.glitterbox-bar a { color: #00ffff; text-decoration: none; }
.glitterbox-bar a:hover, .glitterbox-bar a:focus-visible { text-decoration: underline; }
.glitterbox-bar .glitterbox-logo {
  margin-right: auto; font-size: 1.15rem; font-weight: 800; color: #ff00ff;
  text-shadow: 0 0 10px #ff00ff99; text-decoration: none;
}
.glitterbox-bar .glitterbox-logo span { color: #00ffff; text-shadow: 0 0 10px #00ffff99; }
.glitterbox-bar .glitterbox-report { color: #9a9aa6; font-weight: 400; }
.glitterbox-bar .glitterbox-upvote { color: #ff2a6d; }

/* Under the bar on a competition entry. Fixed colours, like the bar. */
.glitterbox-entry {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem;
  padding: 0.5rem 1rem; background: #1a0a24; border-bottom: 1px solid #ff00ff55;
  font: 400 0.9rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #e8e8f0;
}
.glitterbox-entry p { margin: 0; }
.glitterbox-entry a { color: #00ffff; }
.glitterbox-entry-links { display: flex; gap: 1rem; }
.glitterbox-entry .glitterbox-vote { color: #ff2a6d; font-weight: 600; }
.glitterbox-entry .glitterbox-place { color: #ffd23f; }

/* Trophies from competitions, under the username. */
.glitterbox-profile .trophies { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 0; padding: 0; list-style: none; }
.glitterbox-profile .trophies a {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.85rem; text-decoration: none;
  border: 1px solid var(--profile-accent); color: var(--profile-text); background: var(--profile-soft);
}
