/* Pedigree tools use Paw Creek's existing theme colors and form controls. */
.pc-pedigree-suggestions {
    display: grid;
    gap: 5px;
    max-width: 720px;
}

.pc-pedigree-suggestions button.pc-pedigree-suggestion {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 9px 12px;
    color: var(--pc-text, #4c3d49);
    text-align: left;
    background: var(--pc-panel-bg, #fff8f3);
    border: 1px solid var(--pc-border, #c5a5b2);
    border-radius: 0;
    cursor: pointer;
}

.pc-pedigree-suggestions button.pc-pedigree-suggestion:hover,
.pc-pedigree-suggestions button.pc-pedigree-suggestion:focus-visible {
    background: var(--pc-subtle-bg, #f8e5df);
    color: var(--pc-text, #4c3d49);
}

.pc-pedigree-suggestion small { font-weight: normal; }
.pc-pedigree-editor { max-width: 780px; }
.pc-pedigree-depth { margin: 10px 0; }

.pc-pedigree-levels {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 100%;
    padding: 4px 4px 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.pc-pedigree-generation {
    flex: 0 0 245px;
    min-width: 0;
}

.pc-pedigree-generation h3 {
    position: sticky;
    top: 0;
    margin: 0 0 12px;
    padding: 9px;
    font-size: 16px;
    background: var(--pc-side-title-bg, #e9c4d0);
    color: var(--pc-side-title-text, #54263e);
    border: 1px solid var(--pc-border, #c5a5b2);
}

.pc-pedigree-card {
    display: grid;
    gap: 5px;
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid var(--pc-border, #c5a5b2);
    background: var(--pc-panel-bg, #fff8f3);
    color: var(--pc-text, #4c3d49);
    overflow-wrap: anywhere;
}

.pc-pedigree-card--empty {
    border-style: dashed;
    background: var(--pc-subtle-bg, #fff8f3);
}

/* Sire and dam use UKC's pedigree colors. Each slot's final branch
   (even = sire, odd = dam) determines its color at every generation. */
.pc-pedigree-card--sire {
    --pc-ancestor-bg: #d9ecff;
    --pc-ancestor-ink: #0b3a5b;
    --pc-ancestor-border: #9ec4e0;
}

.pc-pedigree-card--dam {
    --pc-ancestor-bg: #ffd6ea;
    --pc-ancestor-ink: #5b173c;
    --pc-ancestor-border: #e7a6c6;
}

.pc-pedigree-card--sire,
.pc-pedigree-card--dam {
    background: var(--pc-ancestor-bg);
    color: var(--pc-ancestor-ink);
    border-color: var(--pc-ancestor-border);
}

/* Paw Creek's global theme rules color links and <small> separately.
   Keep ancestor labels and linked names legible on the tinted cards. */
body[data-theme] .pc-pedigree-card--sire :is(a, small, .muted),
body[data-theme] .pc-pedigree-card--dam :is(a, small, .muted) {
    color: var(--pc-ancestor-ink);
}

/* Use UKC's corresponding dark shades on Paw Creek's five dark themes. */
body:is([data-theme="blue-carpet"], [data-theme="jade-floor"],
        [data-theme="purple-shag"], [data-theme="stars"],
        [data-theme="tartan"]) .pc-pedigree-card--sire {
    --pc-ancestor-bg: #123349;
    --pc-ancestor-ink: #cfe8ff;
    --pc-ancestor-border: #527d99;
}

body:is([data-theme="blue-carpet"], [data-theme="jade-floor"],
        [data-theme="purple-shag"], [data-theme="stars"],
        [data-theme="tartan"]) .pc-pedigree-card--dam {
    --pc-ancestor-bg: #3e1e33;
    --pc-ancestor-ink: #ffd6ea;
    --pc-ancestor-border: #965b7a;
}

.pc-pedigree-card small { font-size: 11px; }
.pc-pedigree-card strong { font-size: 14px; line-height: 1.3; }
.pc-pedigree-edit-link { font-size: 12px; justify-self: start; }
.pc-pedigree-offspring { display: flex; flex-wrap: wrap; gap: 8px 16px; }

@media (max-width: 850px) {
    .pc-pedigree-generation { flex-basis: 210px; }
}

@media print {
    .pc-pedigree-depth,
    .pc-pedigree-edit-link,
    .pc-pedigree-editor,
    .pc-pedigree-suggestions { display: none !important; }
    .pc-pedigree-levels { max-width: none; overflow: visible; }
}

/* UKC's existing five-position placement showcase on Paw Creek Petz profiles.
   Share the ribbon and caption rows so ribbons bottom-align and show titles
   begin at the same height, even when the artwork has different native sizes. */
.pc-ukc-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 150px));
    align-items: stretch;
    gap: 12px;
    margin: 12px 0;
}

.pc-ukc-showcase-card {
    display: grid;
    grid-row: span 2;
    grid-template-rows: subgrid;
    justify-items: center;
    row-gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
    overflow-wrap: anywhere;
}

.pc-ukc-showcase-card img {
    display: block;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    object-fit: initial;
    image-rendering: auto;
}

/* The first row holds native-size ribbon artwork; the second holds text. */
.pc-ukc-showcase-card > img,
.pc-ukc-showcase-card > .pc-ukc-showcase-rank {
    align-self: end;
}

.pc-ukc-showcase-card > span:last-child {
    align-self: start;
}

.pc-ukc-showcase-card span {
    font-size: 12px;
    line-height: 1.4;
}

.pc-ukc-showcase-card .pc-ukc-showcase-rank {
    font-weight: bold;
}
