/* The tree and the detail tabs are peers in each family card. */
.profile-parity .profile-content {
  display: grid;
  gap: clamp(.85rem, 2.4vw, 1.65rem);
  align-items: start;
  min-width: 0;
  margin: 1.15rem var(--profile-inset) 1.5rem;
}

.profile-parity .profile-content > * { min-width: 0; }
.profile-parity .profile-panels .profile-tabs { margin: 0; }
.profile-parity .profile-panels .profile-panel { padding: 1rem; }
.profile-parity .profile-family-summary {
  padding: clamp(.7rem, 2vw, 1.2rem);
  border: 1px solid var(--border);
  border-radius: .8rem;
  background: var(--surface);
}
.profile-parity .profile-family-summary > h3 {
  margin: 0 0 .65rem;
  font: 500 clamp(1.35rem, 2.6vw, 1.9rem)/1.2 var(--serif);
}
.profile-parity .profile-family-summary > .profile-tree-controls:last-child { margin: .65rem 0 0; }
.profile-parity .profile-family-summary .profile-pedigree {
  margin: 0;
  height: min(52svh, 24rem);
  min-height: 13rem;
  max-height: 24rem;
}
.profile-tree-modes {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .7rem;
}
.profile-tree-modes button { min-height: 2.75rem; }
.profile-tree-modes button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.profile-fan {
  --line: var(--border);
  --surface-2: var(--panel);
  --text-soft: var(--muted);
  min-width: 0;
}
.profile-fan-viewport {
  max-width: 100%;
  max-height: 24rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--paper);
}
.profile-fan-canvas { padding: .5rem; }
.profile-fan .fan-roster { margin-top: .6rem; border: 1px solid var(--border); border-radius: .65rem; }
.profile-parity .profile-world-art {
  align-self: center;
  flex: 0 1 14rem;
  width: min(23%, 14rem);
  min-width: 0;
  pointer-events: none;
}
.profile-parity .profile-world-art > svg { display: block; width: 100%; height: auto; }

#person.profile-parity[data-world] .profile-hero {
  --card-ink: #fff4f7;
  --card-muted: #e9d5e3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, .45fr) auto;
  grid-template-areas: "identity photo art close";
  align-items: center;
  background: var(--card-hero);
  border-color: var(--card-edge);
}
.profile-parity[data-world] .profile-identity { grid-area: identity; }
.profile-parity[data-world] .profile-identity :is(h2, h3) { color: var(--card-ink); }
.profile-parity[data-world] .profile-identity p:not(.kicker) { color: var(--card-muted); }
.profile-parity[data-world] .profile-identity .kicker { color: var(--card-highlight); }
.profile-parity[data-world] .profile-photo-slot { grid-area: photo; margin: 0; }
.profile-parity[data-world] .profile-world-art { grid-area: art; width: 100%; }
.profile-parity[data-world] .profile-close { grid-area: close; align-self: start; }
.profile-parity[data-world] .profile-panels {
  border: 1px solid var(--border);
  border-radius: .8rem;
  background: var(--surface);
}
.profile-parity[data-world] .profile-panels .profile-tabs {
  border-radius: .8rem .8rem 0 0;
  border-bottom: 1px solid var(--border);
}

/* The central arch and round portrait echo the stained glass. */
#person.profile-parity[data-world="gothic"] {
  --card-highlight: #f4bfdc;
  --card-edge: #875473;
  --card-hero: radial-gradient(ellipse at 50% 0%, #63365f, transparent 72%), #231526;
  border-radius: 1.5rem 1.5rem .35rem .35rem;
}
#person.profile-parity[data-world="gothic"] .profile-hero {
  grid-template-areas: ". photo close" "identity identity identity" ". art .";
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr) minmax(0, 1fr);
  justify-items: center;
  gap: .45rem;
  padding-block: 1.15rem;
  text-align: center;
}
#person.profile-parity[data-world="gothic"] .profile-world-art { width: min(100%, 10.5rem); }
#person.profile-parity[data-world="gothic"] .profile-close { justify-self: end; }
#person.profile-parity[data-world="gothic"] .profile-family-summary {
  border-style: double;
  border-width: 3px;
  border-radius: .4rem;
}
#person.profile-parity[data-world="gothic"] .profile-family-summary > h3 { text-align: center; }
#person.profile-parity[data-world="gothic"] .profile-pedigree {
  background: repeating-linear-gradient(135deg, transparent 0 28px, color-mix(in srgb, var(--accent) 13%, transparent) 29px 30px), var(--paper);
}

/* The tree is the stage and the detail is a narrow cue panel. */
#person.profile-parity[data-world="kpop"] {
  --card-highlight: #ffb7ef;
  --card-edge: #9b6ae2;
  --card-hero:
    linear-gradient(112deg, transparent 52%, #f195e35e 52.3% 52.55%, transparent 53% 66%, #91f3ff59 66.3% 66.55%, transparent 67%),
    repeating-linear-gradient(0deg, transparent 0 4px, #af82fe23 5px 6px),
    linear-gradient(118deg, #171231, #492769);
}
#person.profile-parity[data-world="kpop"] .profile-content { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
#person.profile-parity[data-world="kpop"] .profile-identity h2 {
  font-family: var(--sans);
  font-weight: 800;
  letter-spacing: -.045em;
}
#person.profile-parity[data-world="kpop"] .profile-family-summary {
  border-inline-start: 3px solid #ac72ef;
  border-inline-end: 3px solid #5c9eaf;
}
#person.profile-parity[data-world="kpop"] .profile-pedigree {
  background: repeating-linear-gradient(0deg, transparent 0 6px, color-mix(in srgb, var(--accent) 11%, transparent) 7px 8px), var(--paper);
}

/* The paired map and inventory are framed with straight rails. */
#person.profile-parity[data-world="dungeon"] {
  --card-highlight: #f1d290;
  --card-edge: #906342;
  --card-hero:
    linear-gradient(#ddaf682c 1px, transparent 1px) 0 0 / 21px 21px,
    linear-gradient(90deg, #ddaf682c 1px, transparent 1px) 0 0 / 21px 21px,
    linear-gradient(115deg, #211c1a, #3a4b37);
  border-radius: .25rem;
}
#person.profile-parity[data-world="dungeon"] .profile-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#person.profile-parity[data-world="dungeon"] :is(.profile-family-summary, .profile-panels, .profile-tabs, .profile-tabs button, .profile-close, .profile-pedigree, .pedigree-node, .profile-avatar, .profile-photo-slot button) {
  border-radius: .2rem;
}
#person.profile-parity[data-world="dungeon"] :is(.profile-identity h2, .profile-family-summary h3) {
  font-family: "Cascadia Mono", Consolas, monospace;
  letter-spacing: -.045em;
}
#person.profile-parity[data-world="dungeon"] .profile-pedigree {
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 18px 18px,
    var(--paper);
}

/* The shell opens into a wide, rounded tree with a row of fact cards. */
#person.profile-parity[data-world="pets"] {
  --card-highlight: #fff0ce;
  --card-edge: #ba80a2;
  --card-hero: radial-gradient(circle at 82% 0%, #714873, transparent 58%), linear-gradient(118deg, #254c54, #365f65);
  border-radius: 1.7rem;
}
#person.profile-parity[data-world="pets"] .profile-hero {
  grid-template-areas: "photo identity art close";
  grid-template-columns: auto minmax(0, 1fr) minmax(0, .5fr) auto;
}
#person.profile-parity[data-world="pets"] :is(.profile-family-summary, .profile-panels, .profile-pedigree) { border-radius: 1.2rem; }
#person.profile-parity[data-world="pets"] .profile-pedigree {
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent) 0 2px, transparent 2.5px) 0 0 / 24px 24px, var(--panel);
}
#person.profile-parity[data-world="pets"] .profile-panel dl {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: .6rem;
}
#person.profile-parity[data-world="pets"] .profile-panel dl > div {
  grid-template-columns: 1fr;
  gap: .2rem;
  padding: .65rem;
  border: 1px solid var(--border);
  border-radius: .7rem;
  background: var(--panel);
}

/* Two book pages with a gold rule and a wave motif. */
#person.profile-parity[data-world="velvet"] {
  --card-highlight: #f1d199;
  --card-edge: #a97a61;
  --card-hero: radial-gradient(ellipse at 82% 40%, #764358, transparent 58%), linear-gradient(115deg, #281829, #492639);
}
#person.profile-parity[data-world="velvet"] .profile-content { grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr); }
#person.profile-parity[data-world="velvet"] .profile-family-summary {
  border-inline-end: 3px double var(--gold);
  border-radius: .8rem .25rem .25rem .8rem;
}
#person.profile-parity[data-world="velvet"] .profile-panels { border-radius: .25rem .8rem .8rem .25rem; }
#person.profile-parity[data-world="velvet"] .profile-pedigree {
  background: repeating-radial-gradient(ellipse at 65% 140%, transparent 0 19px, color-mix(in srgb, var(--gold) 18%, transparent) 20px 21px), var(--paper);
}

@media screen and (max-width: 760px) {
  #person.profile-parity[data-world] .profile-content { grid-template-columns: minmax(0, 1fr); }
  #person.profile-parity[data-world] .profile-hero {
    gap: .65rem;
    grid-template-areas: "identity photo" "art art";
    grid-template-columns: minmax(0, 1fr) auto;
  }
  #person.profile-parity[data-world="pets"] .profile-hero { grid-template-areas: "photo identity" "art art"; grid-template-columns: auto minmax(0, 1fr); }
  #person.profile-parity[data-world="gothic"] .profile-hero {
    grid-template-areas: "photo" "identity" "art";
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 3rem;
  }
  #person.profile-parity[data-world] .profile-world-art { width: min(100%, 10rem); }
  #person.profile-parity[data-world="gothic"] .profile-world-art { width: min(100%, 7rem); }
  .profile-parity .profile-family-summary .profile-pedigree { max-height: 20rem; }
}

@media print {
  #person.profile-parity[open] .profile-content { display: block; margin: 0; }
  #person.profile-parity[open] :is(.profile-world-art, .profile-family-summary) { display: none !important; }
  #person.profile-parity[open] .profile-panels { border: 0; }
  #person.profile-parity[open] .profile-hero {
    display: flex;
    justify-content: space-between;
    background: #fff;
  }
}
