/* 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-recognition-title {
  display: inline-block;
  flex: 0 0 auto;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--theme-color) 58%, var(--box-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--section-bg) 78%, var(--theme-color) 22%);
  color: var(--text-color);
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: .04em;
  user-select: none;
}

.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:not(:disabled) {
  transition: transform .08s ease, filter .12s ease, background .12s ease, box-shadow .12s ease;
}

.sg-profile-action:active:not(:disabled) {
  transform: translateY(1px) scale(.985);
  filter: brightness(.9);
  box-shadow: 0 1px 5px rgba(0,0,0,.24);
}

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

.sg-profile-action.is-busy:disabled {
  opacity: .92;
  cursor: progress;
  filter: saturate(.9);
}

.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;
  }
}


.sg-profile-staff-override {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  padding: 11px 14px;
  border: 1px solid rgba(241, 199, 91, .55);
  border-radius: 12px;
  background: rgba(241, 199, 91, .10);
  color: var(--sg-ui-text, #f4f4fb);
}
.sg-profile-staff-override > i { margin-top: 2px; color: #f1c75b; }
.sg-profile-staff-override strong, .sg-profile-staff-override span { display: block; }
.sg-profile-staff-override strong { margin-bottom: 2px; }
.sg-profile-staff-override span { color: var(--sg-ui-muted, #aaa9bd); font-size: .9rem; line-height: 1.4; }


/* Owner-view discoverability + anonymous public-preview controls. */
.sg-profile-public-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--theme-color) 58%, var(--box-border));
  border-radius: min(var(--border-radius, 10px), 12px);
  background: color-mix(in srgb, var(--theme-color) 10%, var(--section-bg));
  color: var(--text-color);
  box-shadow: 0 6px 18px rgba(0,0,0,.14);
}

.sg-profile-public-preview > div {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
}

.sg-profile-public-preview > div > i {
  margin-top: 2px;
  color: var(--theme-color);
}

.sg-profile-public-preview strong {
  font-weight: 800;
}

.sg-profile-public-preview a {
  flex: 0 0 auto;
  color: var(--link-color);
  font-weight: 800;
  text-decoration: none;
}

.sg-profile-public-preview a:hover {
  text-decoration: underline;
}

.sg-profile-action--preview {
  gap: 7px;
}

.sg-profile-owner-room-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px dashed color-mix(in srgb, var(--theme-color) 68%, var(--box-border));
  border-radius: min(var(--border-radius, 10px), 14px);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--theme-color) 11%, var(--section-bg)),
      color-mix(in srgb, var(--section-bg) 91%, transparent));
  color: var(--text-color);
}

.sg-profile-owner-room-notice__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--theme-color) 60%, var(--box-border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--theme-color) 14%, var(--section-bg));
  color: var(--theme-color);
}

.sg-profile-owner-room-notice__copy {
  min-width: 0;
}

.sg-profile-owner-room-notice__eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--theme-color);
  font-size: .7rem;
  font-weight: 850;
  letter-spacing: .085em;
  text-transform: uppercase;
}

.sg-profile-owner-room-notice__copy strong {
  display: block;
  font-size: .98rem;
  line-height: 1.35;
}

.sg-profile-owner-room-notice__copy p {
  max-width: 78ch;
  margin: 4px 0 0;
  color: color-mix(in srgb, var(--text-color) 74%, transparent);
  font-size: .88rem;
  line-height: 1.5;
}

.sg-profile-owner-room-notice__action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--theme-color) 70%, var(--box-border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--theme-color) 15%, var(--section-bg));
  color: var(--text-color);
  font-size: .82rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.sg-profile-owner-room-notice__action:hover {
  background: color-mix(in srgb, var(--theme-color) 24%, var(--section-bg));
}

@media (max-width: 700px) {
  .sg-profile-public-preview,
  .sg-profile-owner-room-notice {
    align-items: stretch;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .sg-profile-public-preview {
    flex-direction: column;
  }

  .sg-profile-owner-room-notice__action {
    grid-column: 1 / -1;
    justify-content: center;
  }
}

/* P7.1.1: explicit homepage rows share the same sizing model as Profile Home Studio. */
.sg-public-profile-panels { display: flex; flex-direction: column; }
.sg-profile-home-row { display: grid; gap: var(--sg-profile-gap,18px); min-width: 0; align-items: start; }
.sg-profile-home-row > .sg-public-profile-panel { grid-column: auto; min-width: 0; width: 100%; }
.sg-profile-home-row:not(.sg-profile-home-row--fill) > .sg-public-profile-panel { grid-column: span var(--sg-profile-panel-span); }
@media (max-width: 760px) {
  .sg-profile-home-row { grid-template-columns: minmax(0,1fr) !important; }
  .sg-profile-home-row > .sg-public-profile-panel { grid-column: 1 / -1 !important; }
}

/* P7.1.2: independent stacks, stable reading order on narrow screens */
.sg-profile-home-section{display:grid;gap:var(--sg-profile-gap,18px);align-items:start;min-width:0;width:100%}
.sg-profile-home-column{display:flex;flex-direction:column;gap:var(--sg-profile-gap,18px);min-width:0}
.sg-profile-home-column>.sg-public-profile-panel{min-width:0;width:100%;grid-column:auto}
@media(max-width:700px){.sg-profile-home-section{grid-template-columns:minmax(0,1fr)!important}}

/* P7.2 profile homepage public content widgets */
.sg-home-content-widget{min-width:0}.sg-home-feature-list{display:grid;gap:10px;margin:12px 0}.sg-home-feature-item{display:flex;align-items:center;gap:12px;min-width:0;padding:12px;border:1px solid var(--box-border,#375269);border-radius:9px;background:color-mix(in srgb,var(--section-bg,#122233) 70%,transparent);color:var(--text-color,#eaf7ff);text-decoration:none}.sg-home-feature-item img{width:76px;height:68px;object-fit:cover;border-radius:6px;flex:none}.sg-home-feature-item strong{flex:1;min-width:0;overflow-wrap:anywhere}.sg-home-feature-item:hover{border-color:var(--link-color,#21c9e8)}.sg-home-feature-more{display:inline-block;margin-top:5px}
