/* StreamGrid public profile visual shell.
 * Public member spaces use the profile owner's theme, a 1200px expression
 * canvas, natural document scrolling, and future-ready section grid items.
 */

.sg-public-profile {
  --sg-profile-canvas: 1200px;
  --sg-profile-gap: 18px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: clamp(14px, 2vw, 28px) clamp(12px, 2.5vw, 32px) 48px;
}

/* Public Profile, custom member Pages, and Gallery share the same public-space
 * width. The old .profile-container remains as a compatibility class, but its
 * historical 800px card geometry is intentionally neutralized here.
 */
.sg-public-profile-container {
  --sg-profile-canvas: 1200px;
  --sg-profile-gap: 18px;
  width: 100%;
  max-width: var(--sg-profile-canvas) !important;
  min-width: 0;
  margin: clamp(16px, 2vw, 28px) auto 48px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  text-align: left !important;
}

.sg-public-profile > .sg-public-profile-container {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Gallery is an older specialized application and does not yet own the
 * .sg-public-profile main wrapper. Give its shared public shell the same
 * effective desktop gutter as the modern public-profile wrapper. */
.sg-public-profile-container--gallery {
  width: min(calc(100% - 64px), var(--sg-profile-canvas)) !important;
}

.sg-public-profile-header {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 14px;
}

.sg-public-profile-header__art {
  position: relative;
  min-height: clamp(285px, 30vw, 350px);
  padding: clamp(20px, 3vw, 34px);
  display: flex;
  align-items: center;
  background: var(--header-image) center / cover no-repeat;
  border: 1px solid var(--box-border);
  border-radius: var(--border-radius, 10px);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,.28);
  isolation: isolate;
}

.sg-public-profile-header__art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.06), rgba(0,0,0,.20) 60%, rgba(0,0,0,.34));
  pointer-events: none;
}

.sg-public-profile-identity,
.sg-public-profile-actions {
  position: relative;
  z-index: 1;
}

.sg-public-profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.sg-public-profile-avatar {
  width: 156px;
  height: 156px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--theme-color);
  background: color-mix(in srgb, var(--section-bg) 82%, black 18%);
  box-shadow: 0 9px 28px rgba(0,0,0,.38);
}

.sg-public-profile-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 13px;
  color: var(--text-color);
  background: color-mix(in srgb, var(--section-bg) 64%, transparent);
  border: 1px solid color-mix(in srgb, var(--theme-color) 72%, var(--box-border));
  border-radius: min(var(--border-radius, 10px), 14px);
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  font-weight: 760;
  line-height: 1.15;
  backdrop-filter: blur(min(var(--blur-strength, 14px), 14px));
  box-shadow: 0 5px 18px rgba(0,0,0,.18);
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}

.sg-public-profile-name > span:first-child {
  overflow-wrap: anywhere;
}

.sg-plan-badge {
  display: inline-block;
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: .035em;
  color: #000;
  user-select: none;
}

.sg-plan-badge--pro {
  background: linear-gradient(135deg, #19c5ff, #0a9cff);
  border: 1px solid #0a9cff;
}

.sg-plan-badge--elite {
  background: linear-gradient(135deg, #ffba00, #ff8c00);
  border: 1px solid #ff8c00;
}

.sg-public-profile-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: min(620px, calc(100% - 32px));
}

.sg-profile-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--theme-color);
  border-radius: min(var(--border-radius, 10px), 10px);
  background: color-mix(in srgb, var(--section-bg) 76%, black 10%);
  color: var(--text-color);
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(min(var(--blur-strength, 14px), 12px));
  box-shadow: 0 3px 12px rgba(0,0,0,.18);
}

.sg-profile-action:hover:not(:disabled) {
  background: color-mix(in srgb, var(--theme-color) 28%, var(--section-bg));
}

.sg-profile-action:disabled {
  opacity: .58;
  cursor: not-allowed;
}

.sg-profile-action--danger {
  border-color: color-mix(in srgb, #ef5350 72%, var(--box-border));
  background: color-mix(in srgb, #a71919 44%, var(--section-bg));
}

.sg-profile-action--link {
  cursor: pointer;
}

/* Member-created pages are navigation within the member's public space, so the
 * nav is its own themed surface rather than part of the header-art geometry.
 */
.sg-public-profile-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--box-border);
  border-radius: var(--border-radius, 10px);
  background: color-mix(in srgb, var(--section-bg) 88%, transparent);
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  backdrop-filter: blur(var(--blur-strength, 14px)) saturate(118%);
}

.sg-public-profile-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--box-border);
  border-radius: min(var(--border-radius, 10px), 10px);
  color: var(--text-color);
  background: color-mix(in srgb, var(--section-bg) 82%, transparent);
  text-decoration: none;
  font-weight: 700;
}

.sg-public-profile-nav__link:hover,
.sg-public-profile-nav__link.is-active {
  border-color: var(--theme-color);
  background: color-mix(in srgb, var(--theme-color) 18%, var(--section-bg));
  color: var(--text-color);
}

/* Existing header choices are configuration on one renderer. The visual-shell
 * pass removes the old Classic 100px nav spacer; navigation is now independent
 * from the header art for every layout.
 */
.sg-public-profile-header--classic .sg-public-profile-header__art {
  justify-content: center;
  text-align: center;
}

.sg-public-profile-header--classic .sg-public-profile-identity {
  flex-direction: column;
  justify-content: center;
  gap: 11px;
}

.sg-public-profile-header--classic .sg-public-profile-avatar {
  width: 172px;
  height: 172px;
}

.sg-public-profile-header--left .sg-public-profile-header__art {
  justify-content: flex-start;
}

.sg-public-profile-header--left .sg-public-profile-nav {
  justify-content: flex-start;
}

.sg-public-profile-header--right .sg-public-profile-header__art {
  justify-content: flex-end;
}

.sg-public-profile-header--right .sg-public-profile-identity {
  flex-direction: row-reverse;
}

.sg-public-profile-header--right .sg-public-profile-nav {
  justify-content: flex-end;
}

/* Future-ready panel canvas. All existing sections are full-width today.
 * Later layout controls can persist a span/placement per section without
 * changing the public-profile markup or section implementations.
 */
.sg-public-profile-panels {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: var(--sg-profile-gap, 18px);
  width: 100%;
  min-width: 0;
  margin-top: var(--sg-profile-gap, 18px);
}

.sg-public-profile-panel {
  --sg-profile-panel-span: 12;
  grid-column: span var(--sg-profile-panel-span);
  min-width: 0;
  align-self: start;
}

.sg-public-profile-panel > .profile-section,
.sg-public-profile-panel > .profile-public-posts,
.sg-public-profile-panel > .profile-gallery {
  width: 100%;
  max-width: none !important;
  min-width: 0;
  margin: 0 !important;
  padding: clamp(18px, 2.2vw, 26px) !important;
  color: var(--text-color);
  background: color-mix(in srgb, var(--section-bg) 94%, transparent) !important;
  border: 1px solid var(--box-border) !important;
  border-radius: var(--border-radius, 10px) !important;
  box-shadow: 0 7px 24px rgba(0,0,0,.24) !important;
  backdrop-filter: blur(var(--blur-strength, 14px)) saturate(112%);
  text-align: left !important;
  box-sizing: border-box;
}

.sg-public-profile-panel > .profile-section > :first-child,
.sg-public-profile-panel > .profile-public-posts > :first-child,
.sg-public-profile-panel > .profile-gallery > :first-child {
  margin-top: 0;
}

.sg-public-profile-panel > .profile-section > :last-child,
.sg-public-profile-panel > .profile-public-posts > :last-child,
.sg-public-profile-panel > .profile-gallery > :last-child {
  margin-bottom: 0;
}

.profile-section h2,
.profile-section h3,
.profile-section h4,
.profile-public-posts h3,
.profile-gallery h3 {
  color: var(--text-color);
}

.sg-public-profile-panel .profile-section h2,
.sg-public-profile-panel .profile-section h3,
.sg-public-profile-panel .profile-public-posts h3,
.sg-public-profile-panel .profile-gallery h3 {
  margin-top: 0;
  text-align: left;
}

.profile-section a,
.profile-public-posts a,
.profile-gallery a {
  color: var(--link-color);
}

.profile-bio p {
  max-width: 86ch;
  margin: 0;
  line-height: 1.65;
  white-space: pre-wrap;
}

.profile-custom-page .section-box {
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
}

.profile-custom-page .group-page-content {
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-custom-page img,
.profile-custom-page iframe,
.profile-custom-page video {
  max-width: 100%;
}

.profile-xp-track {
  height: 20px;
  overflow: hidden;
  margin: 10px 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--section-bg) 72%, black 20%);
  border: 1px solid var(--box-border);
}

.profile-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--theme-color), var(--secondary-color));
}

/* Public Profile uses the browser page as its scroll surface. A section must
 * not introduce a second vertical scrollbar simply to constrain its content.
 */
.profile-achievements-list {
  max-height: none !important;
  overflow: visible !important;
  padding: 10px 0 0;
  border-radius: var(--border-radius, 10px);
}

.badge-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.badge-item {
  min-width: 0;
}

.badge-item img {
  width: 100px;
  max-width: 100%;
  height: auto;
}

.profile-section.social-links a,
.game-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--link-color);
  border-radius: min(var(--border-radius, 10px), 10px);
  background: color-mix(in srgb, var(--section-bg) 84%, transparent);
  color: var(--text-color);
  font-weight: 650;
  text-decoration: none;
  box-shadow: 0 0 5px rgba(0,0,0,.2);
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.profile-section.social-links a:hover,
.game-badge:hover {
  background: color-mix(in srgb, var(--link-color) 18%, var(--section-bg));
  color: var(--text-color);
  transform: translateY(-2px);
  box-shadow: 0 0 10px color-mix(in srgb, var(--link-color) 55%, transparent);
}

.social-card {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--box-border);
  border-radius: min(var(--border-radius, 10px), 10px);
  background: color-mix(in srgb, var(--section-bg) 82%, black 6%);
}

.social-card:last-child {
  margin-bottom: 0;
}

.social-label {
  margin: 0 0 8px;
  color: var(--link-color);
  font-size: .95rem;
  font-weight: 700;
  text-align: left;
}

.social-group,
.games-played-section .game-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  justify-items: stretch;
}

.games-played-section .game-badge-grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-top: 10px;
}

@media (max-width: 900px) {
  .sg-public-profile,
  .sg-public-profile-container {
    --sg-profile-gap: 14px;
  }

  .sg-public-profile {
    padding-inline: 20px;
  }

  .sg-public-profile-container--gallery {
    width: min(calc(100% - 40px), var(--sg-profile-canvas)) !important;
  }

  .sg-public-profile-header__art {
    min-height: 285px;
  }

  .sg-public-profile-avatar {
    width: 132px;
    height: 132px;
  }

  .sg-public-profile-header--classic .sg-public-profile-avatar {
    width: 148px;
    height: 148px;
  }
}

@media (max-width: 700px) {
  .sg-public-profile {
    padding: 12px 12px 36px;
  }

  .sg-public-profile-container {
    margin-top: 12px !important;
    margin-bottom: 36px !important;
  }

  .sg-public-profile-container--gallery {
    width: min(calc(100% - 24px), var(--sg-profile-canvas)) !important;
  }

  .sg-public-profile > .sg-public-profile-container {
    margin-top: 0 !important;
  }

  .sg-public-profile-header__art {
    min-height: 250px;
    padding: 18px 14px;
  }

  .sg-public-profile-actions {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
    justify-content: center;
  }

  .sg-public-profile-actions + .sg-public-profile-identity {
    padding-top: 72px;
  }

  .sg-public-profile-avatar,
  .sg-public-profile-header--classic .sg-public-profile-avatar {
    width: 116px;
    height: 116px;
  }

  .sg-public-profile-header--left .sg-public-profile-identity,
  .sg-public-profile-header--right .sg-public-profile-identity,
  .sg-public-profile-header--classic .sg-public-profile-identity {
    width: 100%;
    justify-content: center;
    text-align: center;
    flex-direction: column;
  }

  .sg-public-profile-header--left .sg-public-profile-nav,
  .sg-public-profile-header--right .sg-public-profile-nav,
  .sg-public-profile-header--classic .sg-public-profile-nav {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .sg-public-profile-nav__link {
    flex: 0 0 auto;
  }

  .sg-public-profile-panel {
    grid-column: 1 / -1;
  }

  .sg-public-profile-panel > .profile-section,
  .sg-public-profile-panel > .profile-public-posts,
  .sg-public-profile-panel > .profile-gallery {
    padding: 17px !important;
  }

  .badge-container,
  .social-group,
  .games-played-section .game-badge-grid {
    grid-template-columns: 1fr;
  }
}
