/* ── Profile card video background ── */
.profile-card__background {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.45s ease;
}

.profile-card__background[hidden] {
  display: none;
}

.profile-card__bg-stage {
  position: absolute;
  inset: 0;
}

.profile-card__bg-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.55s ease;
}

.profile-card__bg-layer.is-visible {
  opacity: 1;
}

.profile-card__bg-layer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  filter: blur(calc(var(--profile-bg-blur, 0) * 1px));
  transform: scale(1.02);
  will-change: filter;
}

.profile-card__bg-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, calc(var(--profile-bg-darkness, 0) / 100));
  pointer-events: none;
  z-index: 1;
}

.profile-card__body {
  position: relative;
  z-index: 3;
}

/* ── Edit profile background accordion ── */
.profile-bg-accordion {
  gap: 0;
  padding-top: 0;
}

.profile-bg-accordion__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.profile-bg-accordion__toggle:hover {
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.16);
}

.profile-bg-accordion__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-bg-accordion[data-expanded="true"] .profile-bg-accordion__toggle {
  border-color: rgba(255, 255, 255, 0.14);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.profile-bg-accordion__label {
  flex: 1;
}

.profile-bg-accordion__chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  transition: transform 0.32s ease, color var(--transition);
}

.profile-bg-accordion[data-expanded="true"] .profile-bg-accordion__chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.profile-bg-accordion__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.32s ease;
}

.profile-bg-accordion[data-expanded="true"] .profile-bg-accordion__panel {
  grid-template-rows: 1fr;
}

.profile-bg-accordion__panel-inner {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: rgba(0, 0, 0, 0.22);
  transition: padding 0.32s ease;
}

.profile-bg-accordion[data-expanded="true"] .profile-bg-accordion__panel-inner {
  padding: 14px 12px 12px;
}

/* ── Edit Stats accordion (theme-accented) ── */
.profile-stats-accordion,
.profile-links-accordion {
  gap: 0;
  padding-top: 0;
}

.profile-stats-accordion .profile-bg-accordion__toggle,
.profile-links-accordion .profile-bg-accordion__toggle {
  border-color: rgba(var(--accent-r), 0.35);
  background: rgba(var(--accent-r), 0.08);
  box-shadow: 0 0 12px var(--accent-glow-soft);
  transition:
    background var(--transition),
    border-color var(--theme-transition),
    box-shadow var(--theme-transition);
}

.profile-stats-accordion .profile-bg-accordion__label,
.profile-links-accordion .profile-bg-accordion__label {
  color: var(--accent);
  transition: color var(--theme-transition);
}

.profile-stats-accordion .profile-bg-accordion__chevron,
.profile-links-accordion .profile-bg-accordion__chevron {
  color: rgba(var(--accent-r), 0.75);
  transition: transform 0.32s ease, color var(--theme-transition);
}

.profile-stats-accordion .profile-bg-accordion__toggle:hover,
.profile-links-accordion .profile-bg-accordion__toggle:hover {
  background: rgba(var(--accent-r), 0.12);
  border-color: var(--accent-border);
  box-shadow: 0 0 16px var(--accent-glow);
}

.profile-stats-accordion[data-expanded="true"] .profile-bg-accordion__toggle,
.profile-links-accordion[data-expanded="true"] .profile-bg-accordion__toggle {
  border-color: var(--accent-border);
  box-shadow: 0 0 14px var(--accent-glow-soft);
}

.profile-stats-accordion[data-expanded="true"] .profile-bg-accordion__panel-inner,
.profile-links-accordion[data-expanded="true"] .profile-bg-accordion__panel-inner {
  border-color: rgba(var(--accent-r), 0.22);
}

/* ── Edit profile background picker ── */
.profile-bg-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-bg-picker__option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition),
    background var(--transition);
}

.profile-bg-picker__option:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.45);
}

.profile-bg-picker__option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-bg-picker__option.is-selected {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
}

.profile-bg-picker__preview {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(var(--accent-r), 0.18), transparent 55%),
    rgba(255, 255, 255, 0.04);
}

.profile-bg-picker__preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.profile-bg-picker__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0 2px 2px;
}

.profile-bg-picker__option.is-selected .profile-bg-picker__label {
  color: var(--accent);
}

.profile-bg-picker__option:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: calc(50% - 5px);
  justify-self: center;
}

.edit-profile-form__range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-profile-form__range {
  flex: 1;
  height: 6px;
  appearance: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

.edit-profile-form__range::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform var(--transition);
}

.edit-profile-form__range::-webkit-slider-thumb:hover {
  transform: scale(1.08);
}

.edit-profile-form__range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.edit-profile-form__range-value {
  min-width: 2.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .profile-bg-picker {
    grid-template-columns: 1fr;
  }
}
