/**
 * Copyright (c) 2026 DNA Genics, S.L. All rights reserved.
 *
 * Heritage V2 public ancestry catalog and report selection guide.
 */

.anc-catalog-v2.hd-page {
    --catalog-anchor-offset: calc(var(--nav-height, 72px) + 16px);
    --catalog-gutter: clamp(16px, 4vw, 48px);
    --catalog-space: clamp(24px, 4vw, 48px);
    font-family: var(--hd-sans);
    line-height: 1.6;
}

.anc-catalog-v2 .container {
    width: min(calc(100% - 2 * var(--catalog-gutter)), 1320px);
    max-width: none;
    padding-inline: 0;
}

.anc-catalog-v2 [id] {
    scroll-margin-top: var(--catalog-anchor-offset);
}

.anc-catalog-v2 :is(a, summary):focus-visible {
    outline: 3px solid var(--hd-primary);
    outline-offset: 3px;
}

.anc-catalog-v2 .anc-catalog-skip-link {
    position: fixed;
    z-index: 12000;
    top: var(--catalog-anchor-offset);
    left: var(--catalog-gutter);
    transform: translateY(-300%);
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--hd-surface);
    color: var(--hd-primary);
}

.anc-catalog-v2 .anc-catalog-skip-link:focus {
    transform: none;
}

.anc-catalog-v2 :is(h1, h2, h3) {
    color: var(--hd-primary);
    font-family: var(--hd-serif);
    font-weight: 600;
    line-height: 1.1;
}

.anc-catalog-v2 h1 {
    margin: 0 0 16px;
    font-size: clamp(2.6rem, 5vw, 4.7rem);
}

.anc-catalog-v2 h2 {
    font-size: clamp(1.9rem, 3.2vw, 2.8rem);
}

.anc-catalog-v2 h3 {
    font-size: clamp(1.45rem, 2.5vw, 2rem);
}

.anc-catalog-v2 :is(.hd-eyebrow, .anc-catalog-eyebrow, .anc-catalog-chapter) {
    margin-bottom: 10px;
    color: #765827;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.anc-catalog-v2 .anc-catalog-hero {
    padding-block: clamp(16px, 4vw, 48px) var(--catalog-space);
}

.anc-catalog-v2 .anc-catalog-hero__layout {
    display: grid;
    align-items: center;
    gap: var(--catalog-space);
}

.anc-catalog-v2 .anc-catalog-hero__lead {
    max-width: 58ch;
    margin-bottom: 24px;
    color: var(--hd-muted);
}

.anc-catalog-v2 :is(.anc-catalog-actions, .anc-catalog-card__actions) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.anc-catalog-v2 :is(.anc-catalog-button, .anc-catalog-card__link) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--hd-primary);
    color: white;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
}

.anc-catalog-v2 :is(.anc-catalog-button, .anc-catalog-card__link):hover {
    background: #172a21;
    color: white;
}

.anc-catalog-v2 .anc-catalog-button--secondary {
    background: var(--hd-sand);
    color: var(--hd-primary);
}

.anc-catalog-v2 .anc-catalog-button--secondary:hover {
    background: var(--hd-sand-strong);
    color: var(--hd-primary);
}

.anc-catalog-v2 a:not(.hd-btn, .anc-catalog-button, .anc-catalog-card__link) {
    color: var(--hd-primary);
}

.anc-catalog-v2 :is(.anc-catalog-chooser, .anc-catalog-before > .container, .anc-catalog-final-cta) {
    padding: clamp(16px, 3vw, 28px);
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    background: var(--hd-sand);
}

.anc-catalog-v2 .anc-catalog-chooser h2 {
    margin-bottom: 12px;
}

.anc-catalog-v2 .anc-catalog-chooser ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.anc-catalog-v2 .anc-catalog-chooser li + li {
    border-top: 1px solid var(--hd-sand-strong);
}

.anc-catalog-v2 .anc-catalog-chooser a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    padding: 8px 4px;
    font-weight: 600;
    text-decoration: none;
}

.anc-catalog-v2 .anc-catalog-chooser a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.anc-catalog-v2 .anc-catalog-before > .container {
    background: var(--hd-sage);
}

.anc-catalog-v2 .anc-catalog-before p:last-child {
    margin-bottom: 0;
}

.anc-catalog-v2 .anc-catalog-section {
    padding-block: var(--catalog-space);
    border-bottom: 1px solid var(--hd-border);
}

.anc-catalog-v2 .anc-catalog-section__header {
    max-width: 65ch;
    margin-bottom: 20px;
}

.anc-catalog-v2 .anc-catalog-section__header p:last-child {
    margin-bottom: 0;
    color: var(--hd-muted);
}

.anc-catalog-v2 :is(.anc-catalog-grid, .anc-method-overview, .anc-process-steps, .anc-process-expectations) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(14px, 2vw, 24px);
}

.anc-catalog-v2 .anc-catalog-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    background: var(--hd-surface);
}

.anc-catalog-v2 .anc-catalog-card__media {
    position: relative;
    aspect-ratio: 16 / 7;
    overflow: hidden;
    border-radius: calc(var(--hd-radius) - 1px) calc(var(--hd-radius) - 1px) 0 0;
    background: var(--hd-sand) url('/img/ui/placeholders/placeholder-portrait.webp') center / cover no-repeat;
}

.anc-catalog-v2 .anc-catalog-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.anc-catalog-v2 :is(.anc-catalog-card__status, .anc-catalog-card__icon) {
    position: absolute;
    top: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--hd-surface);
    color: var(--hd-primary);
}

.anc-catalog-v2 .anc-catalog-card__status {
    left: 12px;
    font-size: .76rem;
    font-weight: 700;
}

.anc-catalog-v2 .anc-catalog-card__status.is-upcoming {
    background: var(--hd-sand);
}

.anc-catalog-v2 .anc-catalog-card__icon {
    right: 12px;
}

.anc-catalog-v2 .anc-catalog-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    padding: clamp(16px, 2.5vw, 28px);
}

.anc-catalog-v2 .anc-catalog-card__description {
    color: var(--hd-muted);
}

.anc-catalog-v2 .anc-catalog-card__facts {
    margin: 0 0 18px;
}

.anc-catalog-v2 .anc-catalog-card__facts dt {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--hd-border);
    color: var(--hd-primary);
    font-size: .86rem;
    font-weight: 700;
}

.anc-catalog-v2 .anc-catalog-card__facts dd {
    margin: 3px 0 0;
    color: var(--hd-muted);
    font-size: .9rem;
}

.anc-catalog-v2 .anc-catalog-card__features {
    margin: 0;
    padding: 0;
    list-style: none;
}

.anc-catalog-v2 .anc-catalog-card__features li {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.anc-catalog-v2 .anc-catalog-card__features .dna-icon {
    flex: none;
    color: var(--hd-primary);
}

.anc-catalog-v2 :is(.anc-catalog-actions, .anc-catalog-card__actions) .hd-btn {
    min-height: 44px;
    white-space: normal;
    text-align: start;
}

.anc-catalog-v2 .anc-catalog-card__actions {
    margin-top: auto;
    padding-top: 6px;
}

.anc-catalog-v2 .anc-catalog-card__link--disabled {
    margin: auto 0 0;
    padding: 0;
    background: transparent;
    color: var(--hd-muted);
}

.anc-catalog-v2 .anc-catalog-card__link--disabled:hover {
    background: transparent;
    color: var(--hd-muted);
}

.anc-catalog-v2 :is(.anc-catalog-upcoming, .anc-method-panel) {
    border: 1px solid var(--hd-border);
    border-radius: 12px;
    background: var(--hd-surface);
}

.anc-catalog-v2 .anc-catalog-upcoming {
    margin-top: 24px;
}

.anc-catalog-v2 :is(.anc-catalog-upcoming, .anc-method-panel) > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 14px 18px;
    color: var(--hd-primary);
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.anc-catalog-v2 :is(.anc-catalog-upcoming, .anc-method-panel) > summary::-webkit-details-marker {
    display: none;
}

.anc-catalog-v2 .anc-catalog-upcoming small {
    display: block;
    color: var(--hd-muted);
}

.anc-catalog-v2 :is(.anc-catalog-upcoming, .anc-method-panel)[open] > summary {
    border-bottom: 1px solid var(--hd-border);
}

.anc-catalog-v2 .anc-catalog-upcoming[open] > summary > .dna-icon {
    transform: rotate(180deg);
}

.anc-catalog-v2 .anc-method-panel[open] > summary > .dna-icon-plus {
    transform: rotate(45deg);
}

.anc-catalog-v2 .anc-catalog-grid--upcoming {
    padding: clamp(10px, 2vw, 20px);
}

.anc-catalog-v2 .anc-method-list {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.anc-catalog-v2 .anc-method-panel__content {
    display: grid;
    align-items: center;
    gap: 16px;
    padding: clamp(14px, 3vw, 24px);
}

.anc-catalog-v2 .anc-method-note {
    border-inline-start: 3px solid var(--hd-gold);
    padding-inline-start: 12px;
}

.anc-catalog-v2 :is(.anc-method-overview article, .anc-process-steps li, .anc-process-expectations article, .anc-method-figure) {
    margin: 0;
    min-width: 0;
    padding: clamp(14px, 3vw, 24px);
    border: 1px solid var(--hd-border);
    border-radius: 12px;
    background: var(--hd-surface);
}

.anc-catalog-v2 .anc-method-figure {
    background: var(--hd-cream);
}

.anc-catalog-v2 :is(.anc-methodology-link, .anc-catalog-final-cta, .anc-process-expectations) {
    margin-top: 24px;
}

.anc-catalog-v2 .anc-process-steps {
    list-style: none;
    padding: 0;
}

.anc-catalog-v2 .anc-process-number {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: 0 6px 8px 0;
    border-radius: 50%;
    background: var(--hd-sage);
    color: var(--hd-primary);
    font-weight: 700;
}

.anc-catalog-v2 .anc-catalog-footer-messages {
    padding-block: var(--catalog-space);
}

.anc-catalog-v2 .anc-catalog-back-link {
    display: block;
    width: fit-content;
    margin: 0 auto;
    padding: 12px;
}

.anc-catalog-v2 .anc-method-figure figcaption {
    color: var(--hd-muted);
    font-size: 0.76rem;
    margin-top: 1rem;
    text-align: center;
}

.anc-catalog-v2 .anc-chromosome-track,
.anc-catalog-v2 .anc-composition-bar,
.anc-catalog-v2 .anc-ibs-track {
    background: var(--hd-sand);
    border: 1px solid var(--hd-sage-strong);
    border-radius: 999px;
    display: flex;
    height: 24px;
    margin: 1rem 0;
    overflow: hidden;
}

.anc-catalog-v2 .anc-chromosome-track i,
.anc-catalog-v2 .anc-composition-bar i,
.anc-catalog-v2 .anc-ibs-track i {
    display: block;
    flex: 1;
    height: 100%;
}

.anc-catalog-v2 .anc-method-figure .segment-a,
.anc-catalog-v2 .anc-method-legend .segment-a,
.anc-catalog-v2 .cluster-a circle {
    background: var(--hd-gold);
    fill: var(--hd-gold);
}

.anc-catalog-v2 .anc-method-figure .segment-b,
.anc-catalog-v2 .anc-method-legend .segment-b,
.anc-catalog-v2 .cluster-b circle {
    background: #50766d;
    fill: #50766d;
}

.anc-catalog-v2 .anc-method-figure .segment-c,
.anc-catalog-v2 .anc-method-legend .segment-c,
.anc-catalog-v2 .cluster-c circle {
    background: #79647a;
    fill: #79647a;
}

.anc-catalog-v2 .anc-method-figure .segment-d,
.anc-catalog-v2 .anc-method-legend .segment-d,
.anc-catalog-v2 .cluster-d circle {
    background: #546d8d;
    fill: #546d8d;
}

.anc-catalog-v2 .anc-method-figure .segment-e,
.anc-catalog-v2 .anc-method-legend .segment-e {
    background: #aa6646;
}

.anc-catalog-v2 .anc-chromosome-track i.wide {
    flex: 1.7;
}

.anc-catalog-v2 .anc-composition-bar .size-32 { flex: 32; }
.anc-catalog-v2 .anc-composition-bar .size-25 { flex: 25; }
.anc-catalog-v2 .anc-composition-bar .size-20 { flex: 20; }
.anc-catalog-v2 .anc-composition-bar .size-14 { flex: 14; }
.anc-catalog-v2 .anc-composition-bar .size-9 { flex: 9; }

.anc-catalog-v2 .anc-method-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
}

.anc-catalog-v2 .anc-method-legend li {
    align-items: center;
    color: var(--hd-muted);
    display: flex;
    font-size: 0.72rem;
    gap: 0.35rem;
}

.anc-catalog-v2 .anc-method-legend i {
    border-radius: 3px;
    display: inline-block;
    height: 10px;
    width: 10px;
}

.anc-catalog-v2 .anc-method-figure svg {
    height: auto;
    width: 100%;
}

/* Figure strokes and labels retinted for the light background */
.anc-catalog-v2 .anc-method-figure svg .axis,
.anc-catalog-v2 .anc-method-figure svg .tree-lines path {
    fill: none;
    stroke: var(--hd-primary);
    stroke-width: 2;
}

.anc-catalog-v2 .anc-method-figure svg text {
    fill: var(--hd-muted);
    font-family: var(--dng-font-sans, Inter, sans-serif);
    font-size: 11px;
    text-anchor: middle;
}

.anc-catalog-v2 .anc-method-figure svg .user-point,
.anc-catalog-v2 .anc-method-figure svg .tree-nodes .highlight {
    fill: var(--hd-primary);
    stroke: var(--hd-cream);
    stroke-width: 3;
}

.anc-catalog-v2 .anc-method-figure svg .tree-nodes circle {
    fill: var(--hd-sand);
    stroke: var(--hd-primary);
    stroke-width: 2;
}

.anc-catalog-v2 .anc-method-figure svg .tree-nodes .highlight {
    fill: var(--hd-primary);
}

.anc-catalog-v2 .anc-method-figure svg .tree-labels text {
    fill: var(--hd-ink);
    font-size: 10px;
    font-weight: 800;
}

.anc-catalog-v2 .anc-method-figure svg .highlight-label {
    fill: var(--hd-primary);
    font-weight: 700;
}

.anc-catalog-v2 .anc-ibs-label {
    color: var(--hd-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.anc-catalog-v2 .anc-ibs-track i:nth-child(1) { flex: 1.2; background: #546d8d; }
.anc-catalog-v2 .anc-ibs-track i:nth-child(2) { flex: 1.5; }
.anc-catalog-v2 .anc-ibs-track i:nth-child(3) { flex: 0.8; background: #79647a; }
.anc-catalog-v2 .anc-ibs-track i:nth-child(4) { flex: 0.9; }
.anc-catalog-v2 .anc-ibs-track i:nth-child(5) { flex: 1; background: #50766d; }
.anc-catalog-v2 .anc-ibs-track i.match { background: var(--hd-gold); }

.anc-catalog-v2 .anc-ibs-connectors {
    display: flex;
    height: 34px;
    justify-content: space-around;
    padding-inline: 25%;
}

.anc-catalog-v2 .anc-ibs-connectors i {
    border-left: 2px dashed var(--hd-primary);
}

@media (min-width: 768px) {
    .anc-catalog-v2 .anc-catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .anc-catalog-v2 :is(.anc-method-overview, .anc-process-steps, .anc-process-expectations) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .anc-catalog-v2 .anc-method-panel__content {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .anc-catalog-v2 .anc-catalog-hero__layout {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    }
}

@media print {
    .anc-catalog-v2 :is(.anc-catalog-skip-link, .anc-catalog-actions, .anc-catalog-card__actions, .anc-catalog-back-link) {
        display: none;
    }

    .anc-catalog-v2 .anc-catalog-card {
        break-inside: avoid;
    }
}
