/**
 * Copyright (c) 2026 DNA Genics, S.L. All rights reserved.
 *
 * Shared Ancestry Reports catalog styling and the standalone Heritage page shell.
 * Provides accessible filtering, readable report cards, and responsive discovery.
 */

/* Page and hero */
.dbc-page--ancestry-reports .dbc-timeline,
.dbc-page--ancestry-reports .dbc-scroll-indicator,
.dbc-page--ancestry-reports .dbc-page-nav,
.dbc-page--ancestry-reports .dbc-bottom-nav {
    display: none !important;
}

.dbc-page--ancestry-reports .dbc-hero {
    min-height: 52vh;
    max-height: none;
    margin-bottom: var(--dbc-space-lg);
}

.dbc-page--ancestry-reports .dbc-hero-content {
    max-width: 900px;
    padding-bottom: 3rem;
}

.dbc-page--ancestry-reports .dbc-hero-subtitle {
    max-width: 690px;
}

.dbc-page--ancestry-reports .dbc-hero-actions {
    justify-content: center;
    align-items: center;
}

.dbc-page--ancestry-reports .dbc-hero-overlay,
.dbc-page--ancestry-reports .dbc-animate,
.dbc-page--ancestry-reports .dbc-scroll-animate {
    opacity: 1;
    transform: none;
    animation: none;
}

.ancestry-legacy-anchor {
    position: relative;
    top: -100px;
    display: block;
    width: 1px;
    height: 0;
    overflow: hidden;
    visibility: hidden;
}

.ancestry-catalog-section {
    margin-bottom: var(--dbc-space-xl);
}

/* Question shortcuts */
.ancestry-question-shortcuts {
    display: grid;
    grid-template-columns: minmax(190px, 0.7fr) minmax(0, 2.3fr);
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1.25rem;
    border: 1px solid rgba(201, 169, 98, 0.18);
    border-radius: var(--dbc-radius-lg);
    background: #17130f;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.2);
}

.ancestry-question-shortcuts__intro {
    min-width: 0;
}

.ancestry-question-shortcuts__eyebrow,
.ancestry-filter-group__label,
.ancestry-report-card__category {
    display: block;
    color: var(--dbc-amber-light);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.ancestry-question-shortcuts__intro h3 {
    margin: 0.25rem 0 0;
    color: var(--dbc-text-light);
    font-family: var(--dbc-font-serif);
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    line-height: 1.15;
}

.ancestry-question-shortcuts__list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.ancestry-question-shortcut {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 52px;
    padding: 0.75rem;
    border: 1px solid rgba(201, 169, 98, 0.17);
    border-radius: var(--dbc-radius-md);
    background: #211b15;
    color: var(--dbc-text-light);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
    transition:
        border-color var(--dbc-transition-fast),
        background-color var(--dbc-transition-fast),
        transform var(--dbc-transition-fast);
}

.ancestry-question-shortcut .dna-icon {
    flex: 0 0 auto;
    color: var(--dbc-amber-light);
    font-size: 1.05rem;
}

.ancestry-question-shortcut:hover {
    border-color: rgba(201, 169, 98, 0.46);
    background: #2a2119;
    color: var(--dbc-text-light);
    transform: translateY(-2px);
}

/* Finder */
.ancestry-report-finder {
    display: grid;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 1.25rem;
    border: 1px solid rgba(201, 169, 98, 0.18);
    border-radius: var(--dbc-radius-lg);
    background: #17130f;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.2);
}

.ancestry-report-finder__search-wrap > label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dbc-text-light);
    font-weight: 800;
}

.ancestry-report-finder__search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 52px;
    padding: 0 0.95rem;
    border: 1px solid rgba(201, 169, 98, 0.24);
    border-radius: var(--dbc-radius-md);
    background: #0c0a08;
    color: var(--dbc-amber-light);
}

.ancestry-report-finder__search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--dbc-text-light);
    font-size: 1rem;
}

.ancestry-report-finder__search input::placeholder {
    color: rgba(245, 243, 239, 0.58);
}

.ancestry-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -0.7rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--dbc-text-light-muted);
}

.ancestry-search-clear:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--dbc-text-light);
}

.ancestry-filter-group {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 0.8rem;
    align-items: center;
}

.ancestry-filter-group__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ancestry-filter-btn {
    min-height: 44px;
    padding: 0.55rem 0.9rem;
    border: 1px solid rgba(201, 169, 98, 0.2);
    border-radius: 999px;
    background: #211b15;
    color: var(--dbc-text-light-muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition:
        color var(--dbc-transition-fast),
        background-color var(--dbc-transition-fast),
        border-color var(--dbc-transition-fast);
}

.ancestry-filter-btn:hover {
    border-color: rgba(201, 169, 98, 0.5);
    color: var(--dbc-text-light);
}

.ancestry-filter-btn.active,
.ancestry-filter-btn[aria-pressed='true'] {
    border-color: var(--dbc-amber);
    background: var(--dbc-amber);
    color: var(--dbc-earth-deep);
}

.ancestry-catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 44px;
    margin-bottom: 0.85rem;
}

.ancestry-catalog-summary {
    margin: 0;
    color: var(--dbc-text-light-muted);
    font-size: 0.92rem;
}

.ancestry-catalog-summary span:first-child {
    color: var(--dbc-amber-light);
    font-weight: 800;
}

.ancestry-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 0;
    background: transparent;
    color: var(--dbc-amber-light);
    font-size: 0.86rem;
    font-weight: 800;
}

.ancestry-reset-btn:hover {
    color: var(--dbc-text-light);
    text-decoration: underline;
}

/* Catalog cards */
.ancestry-catalog-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.ancestry-catalog-groups {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.ancestry-catalog-group[hidden] {
    display: none;
}

.ancestry-catalog-group__title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 1.25rem;
    font-weight: 600;
}

.ancestry-catalog-group__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    font-size: 0.8rem;
    font-weight: 600;
}

.ancestry-report-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 410px;
    overflow: hidden;
    border: 1px solid rgba(201, 169, 98, 0.17);
    border-radius: var(--dbc-radius-lg);
    background: #17130f;
    color: var(--dbc-text-light);
    text-decoration: none;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
    transition:
        transform var(--dbc-transition-fast),
        border-color var(--dbc-transition-fast),
        box-shadow var(--dbc-transition-fast);
}

.ancestry-report-card:hover,
.ancestry-report-card:focus {
    border-color: rgba(201, 169, 98, 0.48);
    color: var(--dbc-text-light);
    text-decoration: none;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.28);
    transform: translateY(-3px);
}

.ancestry-report-card__media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #2a2119;
}

.ancestry-report-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.95) contrast(1.04) brightness(0.82);
    transition:
        transform var(--dbc-transition),
        filter var(--dbc-transition-fast);
}

.ancestry-report-card:hover .ancestry-report-card__media img,
.ancestry-report-card:focus .ancestry-report-card__media img {
    filter: saturate(1.05) contrast(1.05) brightness(0.9);
    transform: scale(1.035);
}

.ancestry-report-card.is-locked .ancestry-report-card__media img {
    filter: saturate(0.58) contrast(1.02) brightness(0.68);
}

.ancestry-report-card.is-image-missing .ancestry-report-card__media::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: #2a2119;
}

.ancestry-report-card__status {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 28px;
    padding: 0.3rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(8, 7, 6, 0.88);
    color: var(--dbc-text-light);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ancestry-report-card.is-ready .ancestry-report-card__status {
    border-color: rgba(154, 184, 148, 0.5);
    color: var(--dbc-sage-light);
}

.ancestry-report-card.is-locked .ancestry-report-card__status {
    border-color: rgba(201, 169, 98, 0.45);
    color: var(--dbc-amber-light);
}

.ancestry-report-card.is-information .ancestry-report-card__status {
    border-color: rgba(140, 167, 204, 0.5);
    color: #b5c9e4;
}

.ancestry-report-card__content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 1rem;
}

.ancestry-report-card__category {
    margin-bottom: 0.35rem;
}

.ancestry-report-card__title {
    display: block;
    color: var(--dbc-text-light);
    font-family: var(--dbc-font-serif);
    font-size: clamp(1.25rem, 1.6vw, 1.55rem);
    font-weight: 600;
    line-height: 1.15;
}

.ancestry-report-card__description {
    display: -webkit-box;
    margin-top: 0.55rem;
    overflow: hidden;
    color: rgba(245, 243, 239, 0.82);
    font-size: 0.94rem;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.ancestry-report-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.85rem;
}

.ancestry-report-card__badges span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0.25rem 0.55rem;
    border: 1px solid rgba(201, 169, 98, 0.2);
    border-radius: 999px;
    background: #211b15;
    color: var(--dbc-text-light-muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.ancestry-report-card__action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    color: var(--dbc-amber-light);
    font-size: 0.86rem;
    font-weight: 800;
}

.ancestry-report-card.is-ready .ancestry-report-card__action {
    color: var(--dbc-sage-light);
}

.ancestry-report-card.is-hidden {
    display: none;
}

/* Empty state and footer */
.ancestry-empty-state {
    margin-top: 1rem;
    padding: 2.75rem 1rem;
    border: 1px dashed rgba(201, 169, 98, 0.32);
    border-radius: var(--dbc-radius-lg);
    background: #17130f;
    color: var(--dbc-text-light-muted);
    text-align: center;
}

.ancestry-empty-state > .dna-icon {
    margin-bottom: 0.8rem;
    color: var(--dbc-amber-light);
    font-size: 1.9rem;
}

.ancestry-empty-state h3 {
    margin: 0 0 0.4rem;
    color: var(--dbc-text-light);
    font-family: var(--dbc-font-serif);
    font-size: 1.5rem;
}

.ancestry-empty-state p {
    margin: 0 0 1.2rem;
}

.dbc-page--ancestry-reports .ancestry-catalog-cta {
    margin-bottom: 0;
}

/* Focus and responsive behavior */
.ancestry-question-shortcut:focus-visible,
.ancestry-filter-btn:focus-visible,
.ancestry-search-clear:focus-visible,
.ancestry-reset-btn:focus-visible,
.ancestry-report-card:focus-visible,
.ancestry-empty-state button:focus-visible,
.ancestry-report-finder__search:focus-within {
    outline: 2px solid var(--dbc-amber-light);
    outline-offset: 3px;
}

@media (max-width: 1199.98px) {
    .ancestry-question-shortcuts {
        grid-template-columns: 1fr;
    }

    .ancestry-question-shortcuts__list,
    .ancestry-catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .dbc-page--ancestry-reports .dbc-hero {
        min-height: 62vh;
    }

    .dbc-page--ancestry-reports .dbc-hero-content {
        padding-bottom: 2rem;
    }

    .ancestry-question-shortcuts,
    .ancestry-report-finder {
        padding: 1rem;
    }

    .ancestry-question-shortcuts__list {
        display: flex;
        overflow-x: auto;
        gap: 0.65rem;
        padding: 0.15rem 0 0.55rem;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
    }

    .ancestry-question-shortcut {
        flex: 0 0 230px;
        scroll-snap-align: start;
    }

    .ancestry-filter-group {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .ancestry-filter-group__buttons {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0.15rem 0 0.55rem;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
    }

    .ancestry-filter-btn {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .ancestry-catalog-grid {
        grid-template-columns: 1fr;
    }

    .ancestry-report-card {
        min-height: 0;
    }

    .ancestry-catalog-toolbar {
        align-items: flex-start;
    }

    .dbc-page--ancestry-reports .ancestry-catalog-cta {
        margin-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ancestry-question-shortcut,
    .ancestry-report-card,
    .ancestry-report-card__media img {
        transition: none;
    }

    .ancestry-question-shortcut:hover,
    .ancestry-report-card:hover {
        transform: none;
    }
}

/* Standalone Heritage host. Keep these overrides scoped so the shared catalog
   retains its existing presentation in other dashboard views. */
.ancestry-reports-page.hd-page {
    min-height: 100vh;
    font-family: var(--hd-sans);
    /* The root padding is the total clearance for the fixed navbar. */
    padding-top: calc(var(--nav-height, 72px) + 8px);
}

.ancestry-reports-page .hd-container {
    padding-top: 8px;
}

.ancestry-reports-page.hd-page .hd-discover.dbc-page {
    min-height: 0;
    margin-top: 32px;
    margin-bottom: 40px;
    border-top: 0;
    scroll-margin-top: calc(var(--nav-height, 72px) + 24px);
}

.ancestry-reports-page .hd-discover::before {
    display: none;
}

.ancestry-reports-page .hd-discover__head > div:first-child {
    flex: 1 1 460px;
    min-width: 0;
}

.ancestry-reports-page .hd-section-sub {
    max-width: 65ch;
}

.ancestry-reports-page .hd-quick-search {
    min-width: 0;
    max-width: 100%;
}

.ancestry-reports-page .hd-quick-search__chips {
    padding: 3px;
}

.ancestry-reports-stats {
    margin: 16px 0 0;
}

.ancestry-reports-stats > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--hd-border);
}

.ancestry-reports-stats dt {
    color: var(--hd-muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.ancestry-reports-stats dd {
    margin: 0;
    color: var(--hd-forest);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
}

.ancestry-reports-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 32px;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    background: var(--hd-sand);
}

.ancestry-reports-footer > div:first-child {
    flex: 1 1 400px;
    min-width: 0;
}

/* The base empty-state heading and button assume a dark catalog. */
.ancestry-reports-page .ancestry-empty-state h3 {
    color: var(--hd-charcoal);
    font-family: var(--hd-serif);
}

.ancestry-reports-page .ancestry-empty-state > .dna-icon {
    color: var(--hd-sage-strong);
}

.ancestry-reports-page .ancestry-empty-state .dbc-btn {
    min-height: 44px;
    padding: 12px 22px;
    border: 1px solid var(--hd-border);
    border-radius: 10px;
    background: var(--hd-sand);
    color: var(--hd-ink);
    font-size: 0.92rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
}

.ancestry-reports-page .ancestry-empty-state .dbc-btn:hover {
    background: var(--hd-sand-strong);
    border-color: var(--hd-sand-strong);
    color: var(--hd-ink);
    transform: none;
}

/* Comfortable targets and visible focus on the light page. */
.ancestry-reports-page.hd-page .hd-discover .ancestry-question-shortcut,
.ancestry-reports-page.hd-page .hd-discover .ancestry-filter-btn,
.ancestry-reports-page.hd-page .hd-discover .ancestry-reset-btn,
.ancestry-reports-page .hd-btn,
.ancestry-reports-page .hd-chip {
    min-height: 44px;
}

.ancestry-reports-page.hd-page .hd-discover .ancestry-search-clear {
    width: 44px;
    height: 44px;
}

.ancestry-reports-page.hd-page :is(
    .hd-btn,
    .hd-chip,
    .ancestry-question-shortcut,
    .ancestry-filter-btn,
    .ancestry-search-clear,
    .ancestry-reset-btn,
    .ancestry-report-card,
    .ancestry-empty-state button,
    [data-report-catalog-heading]
):focus-visible,
.ancestry-reports-page.hd-page .hd-discover .ancestry-report-finder__search:focus-within {
    outline: 2px solid var(--hd-forest);
    outline-offset: 3px;
}

/* Allow longer localized titles the same cover space as English titles. */
.hd-page .hd-discover.ancestry-catalog-section--heritage-product-cards .ancestry-catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ancestry-catalog-section--heritage-product-cards .heritage-product-card .heritage-product-cover {
    --heritage-cover-title-top: clamp(2.6rem, 16cqi, 4rem);
}

.ancestry-catalog-section--heritage-product-cards .heritage-product-card .heritage-product-cover__title {
    width: 49%;
    font-size: clamp(1rem, 6.5cqi, 2rem);
}

.ancestry-report-card__metadata {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem 0.75rem;
}

.hd-page .hd-discover .heritage-product-card .ancestry-report-card__metadata .ancestry-report-card__category {
    margin: 0;
}

.hd-page .hd-discover .heritage-product-card .ancestry-report-card__metadata .ancestry-report-card__status {
    position: static;
}

.hd-page .hd-discover .heritage-product-card .heritage-product-card__body .ancestry-report-card__badges {
    margin-bottom: 0.75rem;
}

.hd-page .hd-discover.ancestry-catalog-section--heritage-product-cards .ancestry-report-card.heritage-product-card .heritage-product-card__action {
    min-height: 36px;
    align-self: flex-end;
    padding: 0.375rem 0.75rem;
    color: #fff;
}

@media (max-width: 991px) {
    .hd-page .hd-discover.ancestry-catalog-section--heritage-product-cards .ancestry-catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .hd-page .hd-discover.ancestry-catalog-section--heritage-product-cards .ancestry-catalog-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 767.98px) {
    .ancestry-reports-page.hd-page {
        padding-top: calc(var(--nav-height-mobile, 64px) + 8px);
    }

    .ancestry-reports-page .hd-container {
        padding-top: 0;
    }

    .ancestry-reports-page.hd-page .hd-discover.dbc-page {
        margin-top: 24px;
        scroll-margin-top: calc(var(--nav-height-mobile, 64px) + 24px);
    }

    .ancestry-reports-page.hd-page .hd-discover .ancestry-question-shortcuts__intro {
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .ancestry-reports-page.hd-page .hd-discover .ancestry-question-shortcuts__list {
        flex-wrap: nowrap;
        padding-top: 3px;
    }

    .ancestry-reports-page.hd-page .hd-discover .ancestry-question-shortcut {
        flex: 0 0 auto;
    }

    .ancestry-reports-footer {
        padding: 24px 20px;
    }
}

@media (max-width: 575.98px) {
    .ancestry-reports-page .hd-hero__actions,
    .ancestry-reports-page .hd-hero__actions .hd-btn {
        width: 100%;
    }

    .ancestry-reports-page .hd-hero__actions .hd-btn {
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ancestry-reports-page *,
    .ancestry-reports-page *::before,
    .ancestry-reports-page *::after {
        animation: none !important;
        transition: none !important;
    }
}
