/* =========================================================
   Character galleries
   ========================================================= */

.character-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.75rem 0 1.25rem;
}

.character-gallery a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  height: 300px;
  line-height: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  overflow: hidden;
  background: white;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.character-gallery img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.15s ease;
}

.character-gallery a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.character-gallery a:hover img {
  transform: scale(1.03);
}

/* =========================================================
   Character index
   ========================================================= */

.character-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.character-card {
  text-align: center;
  text-decoration: none;
}

.character-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
}

.character-card h3 {
  margin-top: 0.5rem;
}

/* =========================================================
   Pipeline progress
   ========================================================= */

.pipeline-bar {
  width: 100%;
  height: 16px;
  background: #e6e6e6;
  border-radius: 6px;
  overflow: hidden;
  margin: 6px 0 12px 0;
}

.pipeline-bar div {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
}

.stage-complete {
  color: #4caf50;
  font-weight: bold;
}

.stage-partial {
  color: #ff9800;
  font-weight: bold;
}

.stage-missing {
  color: #f44336;
  font-weight: bold;
}

/* =========================================================
   Character header / overview
   ========================================================= */

.character-hero {
  float: right;
  width: min(280px, 38%);
  margin: 0 0 1rem 1.5rem;
}

.character-hero img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.character-overview-text {
  font-size: 0.65rem;
  line-height: 1.55;
  min-height: 220px;
}

.character-overview-text p {
  margin-top: 0;
}

.character-stats {
  margin-top: 0.8rem;
}

.character-stats ul {
  margin: 0.4rem 0 0 1.2rem;
}

.character-stats li {
  margin: 0.2rem 0;
}

.character-header::after {
  content: '';
  display: block;
  clear: both;
}

/* =========================================================
   Shared comparison layouts
   ========================================================= */

.comparison-grid {
  display: grid;
  gap: 1.25rem;
  margin: 1rem 0 2rem;
}

.comparison-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.comparison-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.comparison-label {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--md-default-fg-color--light);
  text-align: center;
}

.comparison-item img {
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 0.5rem;
  display: block;
}

@media (max-width: 900px) {
  .comparison-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Comparison badges
   ========================================================= */

.comparison-badges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.comparison-badge {
  padding: 0.9rem 1rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.75rem;
  background: var(--md-code-bg-color);
}

.comparison-badge__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
  margin-bottom: 0.35rem;
}

.comparison-badge__value {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .comparison-badges {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Height lineup system
   Shared base for:
   - two-character comparison charts
   - multi-character lineup pages
   - single-character height context charts
   ========================================================= */

.height-lineup {
  --lineup-tick-column: 90px;
  --lineup-stage-height: 460px;
  --lineup-footer-height: 3.2rem;

  display: grid;
  grid-template-columns: var(--lineup-tick-column) repeat(3, minmax(0, 1fr));
  gap: 2rem;
  align-items: end;
  margin: 1rem 0 2rem;
  position: relative;
  overflow-y: visible;
}

.height-lineup__scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.height-lineup__ticks {
  position: absolute;
  left: 0;
  width: var(--lineup-tick-column);
  height: var(--lineup-stage-height);
  bottom: var(--lineup-footer-height);
  z-index: 0;
}

.height-lineup__tick {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--md-default-fg-color--lighter);
}

.height-lineup__tick-label {
  position: absolute;
  top: -0.7rem;
  left: 0;
  font-size: 0.72rem;
  color: var(--md-default-fg-color--light);
  background: var(--md-default-bg-color);
  padding-right: 0.35rem;
}

.height-lineup__baseline {
  position: relative;
  left: auto;
  right: auto;
  width: 100%;
  grid-column: 2 / -1;
}

.height-lineup__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  min-width: 0;
}

.height-lineup__figure--ref {
  grid-column: 2;
}

.height-lineup__figure--a {
  grid-column: 3;
}

.height-lineup__figure--b {
  grid-column: 4;
}

.height-lineup__stage {
  width: 100%;
  max-width: 260px;
  height: var(--lineup-stage-height);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0.5rem;
  position: relative;
}

.height-lineup__label {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}

.height-lineup__meta {
  font-size: 0.8rem;
  color: var(--md-default-fg-color--light);
  text-align: center;
}

.height-lineup__silhouette {
  max-width: 100%;
  width: auto;
  object-fit: contain;
  object-position: bottom center;
  display: block;
}

.height-lineup__silhouette--reference {
  opacity: 0.35;
}

/* =========================
   SILHOUETTE MODIFIERS
   ========================= */

.silhouette--elongated {
  transform: scaleY(1.08);
}

.silhouette--compact {
  transform: scaleY(0.92);
}

.silhouette--glute_emphasis {
  border-radius: 45% 45% 55% 55% / 40% 40% 65% 65%;
}

.silhouette--dense {
  transform: scaleX(1.08);
}

.height-lineup__placeholder {
  max-width: 100%;
  opacity: 0.55;
  background: var(--md-default-fg-color--light);
  display: block;
  margin: 0 auto;

  --sil-scale-x: 1;
  --sil-scale-y: 1;
  transform: scaleX(var(--sil-scale-x)) scaleY(var(--sil-scale-y));
  transform-origin: center bottom;
}

.height-lineup__placeholder--reference {
  opacity: 0.3;
}

/* =========================================================
   V1 fallback silhouette archetypes
   ========================================================= */

.height-lineup__placeholder--slender_refined {
  width: 84px;
  clip-path: polygon(
    42% 0%,
    58% 0%,
    63% 7%,
    63% 19%,
    70% 33%,
    67% 100%,
    56% 100%,
    52% 58%,
    48% 58%,
    44% 100%,
    33% 100%,
    30% 33%,
    37% 19%,
    37% 7%
  );
}

.height-lineup__placeholder--slender_tall {
  width: 76px;
  clip-path: polygon(
    43% 0%,
    57% 0%,
    61% 6%,
    61% 17%,
    68% 30%,
    65% 100%,
    55% 100%,
    52% 54%,
    48% 54%,
    45% 100%,
    35% 100%,
    32% 30%,
    39% 17%,
    39% 6%
  );
}

.height-lineup__placeholder--compact_light {
  width: 92px;
  clip-path: polygon(
    41% 0%,
    59% 0%,
    66% 8%,
    66% 23%,
    75% 37%,
    72% 100%,
    57% 100%,
    54% 64%,
    46% 64%,
    43% 100%,
    28% 100%,
    25% 37%,
    34% 23%,
    34% 8%
  );
}

.height-lineup__placeholder--athletic_balanced {
  width: 100px;
  clip-path: polygon(
    40% 0%,
    60% 0%,
    67% 8%,
    67% 20%,
    79% 35%,
    72% 100%,
    57% 100%,
    54% 62%,
    46% 62%,
    43% 100%,
    28% 100%,
    21% 35%,
    33% 20%,
    33% 8%
  );
}

.height-lineup__placeholder--athletic_leg_dominant {
  width: 104px;
  clip-path: polygon(
    42% 0%,
    58% 0%,
    65% 8%,
    65% 19%,
    73% 30%,
    72% 47%,
    69% 100%,
    57% 100%,
    54% 57%,
    46% 57%,
    43% 100%,
    31% 100%,
    28% 47%,
    27% 30%,
    35% 19%,
    35% 8%
  );
}

.height-lineup__placeholder--broad_athletic {
  width: 120px;
  clip-path: polygon(
    40% 0%,
    60% 0%,
    68% 8%,
    68% 20%,
    81% 34%,
    75% 100%,
    58% 100%,
    55% 63%,
    45% 63%,
    42% 100%,
    25% 100%,
    19% 34%,
    32% 20%,
    32% 8%
  );
}

.height-lineup__placeholder--broad_upper_dominant {
  width: 128px;
  clip-path: polygon(
    39% 0%,
    61% 0%,
    72% 8%,
    72% 18%,
    89% 31%,
    77% 100%,
    58% 100%,
    55% 66%,
    45% 66%,
    42% 100%,
    23% 100%,
    11% 31%,
    28% 18%,
    28% 8%
  );
}

.height-lineup__placeholder--heavy_muscular {
  width: 140px;
  clip-path: polygon(
    39% 0%,
    61% 0%,
    69% 8%,
    69% 20%,
    83% 36%,
    78% 100%,
    59% 100%,
    56% 68%,
    44% 68%,
    41% 100%,
    22% 100%,
    17% 36%,
    31% 20%,
    31% 8%
  );
}

.height-lineup__placeholder--massive_upper_dominant {
  width: 152px;
  clip-path: polygon(
    38% 0%,
    62% 0%,
    74% 8%,
    74% 18%,
    93% 30%,
    80% 100%,
    59% 100%,
    56% 69%,
    44% 69%,
    41% 100%,
    20% 100%,
    7% 30%,
    26% 18%,
    26% 8%
  );
}

.height-lineup__placeholder--soft_curvy {
  width: 104px;
  clip-path: polygon(
    42% 0%,
    58% 0%,
    64% 8%,
    64% 20%,
    70% 31%,
    72% 47%,
    69% 100%,
    58% 100%,
    54% 57%,
    46% 57%,
    42% 100%,
    31% 100%,
    28% 47%,
    30% 31%,
    36% 20%,
    36% 8%
  );
}

.height-lineup__placeholder--elongated {
  --sil-scale-y: 1.08;
}

.height-lineup__placeholder--compact {
  --sil-scale-y: 0.92;
}

.height-lineup__placeholder--glute_emphasis {
  --sil-scale-x: 1.04;
}

.height-lineup__placeholder--dense {
  --sil-scale-y: 1.08;
}

/* compact lineup mode overrides */

.height-lineup--compact .height-lineup__placeholder--slender_refined {
  width: 64px;
}
.height-lineup--compact .height-lineup__placeholder--slender_tall {
  width: 58px;
}
.height-lineup--compact .height-lineup__placeholder--compact_light {
  width: 72px;
}
.height-lineup--compact .height-lineup__placeholder--athletic_balanced {
  width: 76px;
}
.height-lineup--compact .height-lineup__placeholder--athletic_leg_dominant {
  width: 80px;
}
.height-lineup--compact .height-lineup__placeholder--broad_athletic {
  width: 92px;
}
.height-lineup--compact .height-lineup__placeholder--broad_upper_dominant {
  width: 100px;
}
.height-lineup--compact .height-lineup__placeholder--heavy_muscular {
  width: 108px;
}
.height-lineup--compact .height-lineup__placeholder--massive_upper_dominant {
  width: 118px;
}
.height-lineup--compact .height-lineup__placeholder--soft_curvy {
  width: 78px;
}

/* =========================================================
   Multi-character lineup mode
   ========================================================= */

.height-lineup--multi {
  grid-template-columns: var(--lineup-tick-column) repeat(
      var(--lineup-count),
      minmax(260px, 260px)
    );
  width: max-content;
  min-width: 100%;
}

.height-lineup__spacer {
  grid-column: 1;
  width: var(--lineup-tick-column);
  height: 1px;
  pointer-events: none;
}

.height-lineup--multi > .height-lineup__figure {
  grid-column: auto;
}

/* =========================================================
   Compact lineup mode (legacy)
   ========================================================= */

.height-lineup--compact {
  --lineup-tick-column: 72px;
  --lineup-stage-height: 360px;
  --lineup-footer-height: 2.8rem;

  gap: 1.25rem;
  margin-top: 2.5rem;
}

.height-lineup--compact .height-lineup__stage {
  max-width: 180px;
  padding: 0 0.5rem;
}

.height-lineup--compact .height-lineup__label {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

.height-lineup--compact .height-lineup__meta {
  font-size: 0.72rem;
}

.height-lineup--compact .height-lineup__tick-label {
  font-size: 0.62rem;
  line-height: 1;
  top: -0.45rem;
}

/* =========================================================
   Single-character height context chart
   ========================================================= */

.height-lineup--character-context {
  --lineup-stage-height: 300px;
  --lineup-footer-height: 2.6rem;

  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: end;
  justify-items: center;
  margin: 1.5rem 0 2rem;
  position: relative;
}

.height-lineup--character-context .height-lineup__baseline {
  left: 0;
  right: 0;
}

.height-lineup--character-context .height-lineup__figure--ref,
.height-lineup--character-context .height-lineup__figure--a {
  grid-column: auto;
}

.height-lineup--character-context .height-lineup__stage {
  max-width: 180px;
  height: var(--lineup-stage-height);
  padding: 0 0.5rem;
}

.height-lineup--character-context .height-lineup__label {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

.height-lineup--character-context .height-lineup__meta {
  font-size: 0.72rem;
  opacity: 0.75;
}

.height-lineup--character-context .height-lineup__placeholder {
  max-width: 90px;
}

/* =========================================================
   Responsive rules
   ========================================================= */

@media (max-width: 1050px) {
  .height-lineup:not(.height-lineup--multi) {
    grid-template-columns: 1fr;
  }

  .height-lineup:not(.height-lineup--multi) .height-lineup__ticks,
  .height-lineup:not(.height-lineup--multi) .height-lineup__baseline {
    display: none;
  }

  .height-lineup:not(.height-lineup--multi) .height-lineup__figure--ref,
  .height-lineup:not(.height-lineup--multi) .height-lineup__figure--a,
  .height-lineup:not(.height-lineup--multi) .height-lineup__figure--b {
    grid-column: auto;
  }

  .height-lineup:not(.height-lineup--multi) .height-lineup__spacer {
    display: none;
  }
}

@media (max-width: 700px) {
  .height-lineup--character-context {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.height-lineup--archetype-doc {
  --lineup-stage-height: 260px;
  --lineup-footer-height: 0rem;

  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  margin: 1rem 0 1.5rem;
  position: relative;
}

.height-lineup--archetype-doc .height-lineup__baseline {
  left: 0;
  right: 0;
}

.height-lineup--archetype-doc .height-lineup__stage {
  max-width: 180px;
  height: var(--lineup-stage-height);
  padding: 0 0.5rem;
}

.height-lineup--archetype-doc .height-lineup__label,
.height-lineup--archetype-doc .height-lineup__meta {
  display: none;
}

/* =========================================================
   Archetype index
   ========================================================= */

.archetype-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0 2rem;
}

.archetype-index-card {
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--md-code-bg-color);
}

.archetype-index-card h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.archetype-index-card .height-lineup--archetype-doc {
  margin: 0.5rem 0 1rem;
}

.archetype-index-card p {
  margin: 0.5rem 0;
}

.archetype-index-card p:last-child {
  margin-bottom: 0;
}

/* =========================================================
   Gallery version toggle behavior
   ========================================================= */

html[data-gallery-versions='latest']
  .character-gallery__item:not([data-is-latest='true']) {
  display: none;
}

html[data-gallery-versions='all'] .character-gallery__item {
  display: inline-flex;
}

.gallery-version-toggle {
  margin-bottom: 1rem;
}

.gallery-version-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--md-default-fg-color--light);
}
