/* Sport taxonomy navigation. */
.sport-tree {
  --step: 28px;
  display: flex;
  flex-direction: column;
  row-gap: 12px;
}
.sport-row { padding-left: calc(var(--level) * var(--step)); }

/* Legacy shortcode grid. Elementor Loop Grid does not use this wrapper. */
.pm-player-card-grid,
.pm-sport-children-grid {
  display: grid;
  width: 100%;
  max-width: none;
  gap: 22px;
  box-sizing: border-box;
}
.pm-player-card-grid--cols-1,
.pm-sport-children-grid--cols-1 { grid-template-columns: minmax(0, 1fr); }
.pm-player-card-grid--cols-2,
.pm-sport-children-grid--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pm-player-card-grid--cols-3,
.pm-sport-children-grid--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pm-player-card-grid--cols-4,
.pm-sport-children-grid--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/*
 * Player card content.
 * The card always fills its parent Loop Item. No fixed card width, no max-width,
 * and no independent grid sizing are applied here. Elementor controls the item
 * width, columns, gaps and breakpoints.
 */
.pm-player-card {
  --pm-purple: #4d224d;
  --pm-gold: #ebc873;
  --pm-cream: #fbf8ef;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 22px;
  background: linear-gradient(180deg, #fbf8ef 0%, #fbf8ef 66%, #f0d37f 100%);
  box-shadow: 0 5px 16px rgba(29, 20, 8, .11);
}

.pm-player-card__hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: clamp(220px, 23vw, 270px);
  min-height: 220px;
  padding: 18px 16px 0;
  box-sizing: border-box;
  overflow: hidden;
  isolation: isolate;
  text-decoration: none !important;
}

.pm-player-card__brand {
  position: absolute;
  inset: 16px 12px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 185px;
  z-index: 1;
  opacity: .94;
  pointer-events: none;
}

.pm-player-card__brand-logo {
  display: block;
  width: min(100%, 210px);
  height: auto;
  max-height: 185px;
  object-fit: contain;
  object-position: center;
}

.pm-player-card__image-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.pm-player-card__image {
  display: block;
  width: auto;
  max-width: min(100%, 220px);
  max-height: 245px;
  height: auto;
  object-fit: contain;
  object-position: center bottom;
}

.pm-player-card__image-wrap.is-placeholder {
  align-items: center;
  justify-content: center;
}
.pm-player-card__image-wrap.is-placeholder .pm-player-card__image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 220px);
  max-height: 245px;
  object-fit: contain;
  object-position: center;
  align-self: center;
}

.pm-player-card__body {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px 18px;
  text-align: center;
}

/* Keep the reference typography. Do not shrink it to compensate for a narrow parent. */
.pm-player-card .pm-player-card__name {
  display: block;
  max-width: 100%;
  margin: 0;
  padding: 0;
  color: #4d224d;
  font-family: inherit;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: .01em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.pm-player-card .pm-player-card__score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  min-height: 34px;
  box-sizing: border-box;
  margin: 0;
  padding: 7px 18px;
  border: 0;
  border-radius: 999px;
  background: #4d224d;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: none;
}

.pm-player-card .pm-player-card__link {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 0;
  color: #4d224d;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: underline;
  text-underline-offset: 3px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.player-mgmt-empty { color: inherit; }

/* Sport/team child cards. */
.pm-sport-children-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 18px;
  background: #fbf8ef;
  color: #4d224d;
  text-decoration: none;
  box-shadow: 0 5px 16px rgba(29, 20, 8, .1);
}
.pm-sport-children-card .pm-sport-children-card__name {
  font-size: clamp(15px, 1.2vw, 18px);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

/* Make the shortcode widget occupy the full Elementor Loop Item content width. */
.elementor-widget-shortcode:has(.pm-player-card) {
  width: 100% !important;
  max-width: 100% !important;
  align-self: stretch;
}
.elementor-widget-shortcode:has(.pm-player-card) > .elementor-widget-container,
.elementor-widget-shortcode:has(.pm-player-card) .elementor-shortcode {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Elementor's own image shortcode helper. */
.equality-player-visual {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: clamp(180px, 22vw, 260px) !important;
  padding: 8px 20px !important;
  margin: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  line-height: 0 !important;
  text-decoration: none !important;
}
.equality-player-visual .equality-player-photo {
  display: block !important;
  flex: 0 1 auto !important;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: clamp(172px, 20vw, 244px) !important;
  object-fit: contain !important;
  object-position: center bottom !important;
  margin: 0 auto !important;
  padding: 0 !important;
}
.equality-player-visual.is-placeholder { align-items: center !important; }
.equality-player-visual.is-placeholder .equality-player-photo {
  width: auto !important;
  height: auto !important;
  max-width: min(100%, 220px) !important;
  max-height: 240px !important;
  object-fit: contain !important;
  object-position: center center !important;
}

@media (max-width: 1024px) {
  /* Only the legacy plugin-owned grid gets fallback columns. Elementor Loop Grid is untouched. */
  .pm-player-card-grid--cols-4,
  .pm-player-card-grid--cols-3,
  .pm-sport-children-grid--cols-4,
  .pm-sport-children-grid--cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pm-player-card__hero { height: 245px; min-height: 245px; }
  .pm-player-card__brand { height: 175px; }
  .pm-player-card__brand-logo { max-height: 175px; }
  .pm-player-card__image { max-height: 225px; }
}

@media (max-width: 767px) {
  /* Legacy grid stacks; Elementor columns remain under Elementor's responsive controls. */
  .pm-player-card-grid,
  .pm-sport-children-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px;
  }
  .pm-player-card { border-radius: 18px; }
  .pm-player-card__hero { height: 235px; min-height: 235px; padding: 14px 12px 0; }
  .pm-player-card__brand { inset: 14px 12px auto; height: 165px; }
  .pm-player-card__brand-logo { max-height: 165px; }
  .pm-player-card__image { max-width: 200px; max-height: 220px; }
  .pm-player-card__body { gap: 9px; padding: 12px 14px 16px; }
}
