/**
 * Copyright (c) 2026 DNA Genics, S.L. All rights reserved.
 *
 * Historical Atlas collection explorer, filters, map, and profile-card styling.
 */

.hat-page--collection {
    background: var(--hat-bg);
}

.hat-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1.4rem;
    color: var(--hat-muted) !important;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none !important;
}

.hat-back-link:hover,
.hat-back-link:focus {
    color: var(--hat-gold-light) !important;
}

.hat-collection-hero {
    padding: 4.5rem 0 5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--hat-border);
    background-color: #101612;
    background-image: url('/img/ui/backgrounds/homepage-deep-time-social.webp');
    background-position: right center;
    background-repeat: no-repeat;
    background-size: auto 100%;
    background-blend-mode: soft-light;
}

.hat-collection-hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.7fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: end;
}

.hat-collection-hero h1 {
    max-width: 900px;
    margin: 0.7rem 0 0.55rem;
    font-size: clamp(2.6rem, 5.2vw, 5.2rem);
    letter-spacing: -0.035em;
}

.hat-collection-hero__subtitle {
    margin: 0 0 1.4rem;
    color: var(--hat-gold-light) !important;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(1.15rem, 2vw, 1.5rem);
}

.hat-collection-hero__description {
    max-width: 780px;
    margin: 0;
    font-size: 1.08rem;
}

.hat-collection-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    padding: 1.25rem;
    border: 1px solid var(--hat-border);
    background: rgba(13, 18, 16, 0.86);
}

.hat-collection-summary div {
    min-width: 0;
    padding: 0.75rem;
}

.hat-collection-summary dt {
    color: var(--hat-gold-light);
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.55rem;
}

.hat-collection-summary dd {
    margin: 0.1rem 0 0;
    color: var(--hat-muted);
    font-size: 0.78rem;
    line-height: 1.25;
}

.hat-explorer {
    padding: 4.75rem 0;
}

.hat-explorer__container {
    max-width: 1780px;
    padding-right: clamp(1rem, 3vw, 3rem);
    padding-left: clamp(1rem, 3vw, 3rem);
}

.hat-explorer__header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.8rem;
}

.hat-explorer__header h2 {
    margin: 0.55rem 0 0;
    font-size: clamp(1.9rem, 3vw, 2.8rem);
}

.hat-results-count {
    flex: 0 0 auto;
    margin: 0 0 0.4rem;
    color: var(--hat-muted) !important;
    font-size: 0.9rem;
}

.hat-filterbar {
    display: grid;
    grid-template-columns: minmax(260px, 1.6fr) repeat(3, minmax(155px, 0.6fr)) auto;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
    padding: 0.9rem;
    border: 1px solid var(--hat-border);
    background: var(--hat-bg-raised);
}

.hat-filterbar label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    color: var(--hat-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hat-filterbar input,
.hat-filterbar select {
    width: 100%;
    min-height: 46px;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 3px;
    outline: 0;
    background: #0d1210;
    color: var(--hat-text);
    font: inherit;
    font-size: 0.92rem;
    letter-spacing: 0;
    text-transform: none;
}

.hat-filterbar input:focus,
.hat-filterbar select:focus {
    border-color: var(--hat-gold);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.14);
}

.hat-search-field {
    position: relative;
    justify-content: flex-end;
}

.hat-search-field .dna-icon {
    position: absolute;
    bottom: 0.9rem;
    left: 0.85rem;
    color: var(--hat-muted);
    font-size: 0.95rem;
}

.hat-search-field input {
    padding-left: 2.35rem;
}

.hat-filter-clear {
    align-self: end;
    min-height: 46px;
    padding: 0.65rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 3px;
    background: transparent;
    color: var(--hat-text-soft);
    font-weight: 700;
}

.hat-filter-clear:hover,
.hat-filter-clear:focus {
    border-color: var(--hat-gold);
    color: var(--hat-gold-light);
}

.hat-explorer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.22fr) minmax(380px, 0.78fr);
    gap: 1rem;
    align-items: start;
}

.hat-map-panel {
    position: sticky;
    top: 94px;
    overflow: hidden;
    border: 1px solid var(--hat-border);
    background: var(--hat-bg-raised);
}

.hat-map {
    width: 100%;
    height: min(72vh, 760px);
    min-height: 560px;
    background: #111814;
}

.hat-map-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--hat-border);
    color: var(--hat-muted) !important;
    font-size: 0.79rem;
    line-height: 1.4;
}

.hat-map-notice .dna-icon {
    flex: 0 0 auto;
    margin-top: 0.15rem;
    color: var(--hat-gold-light);
}

.hat-profile-list {
    display: grid;
    gap: 0.8rem;
}

.hat-profile-card {
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: var(--hat-bg-card);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.14);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.hat-profile-card:hover,
.hat-profile-card:focus-within {
    border-color: var(--hat-border-strong);
    transform: translateY(-1px);
}

.hat-profile-card[hidden] {
    display: none;
}

.hat-profile-card__heading {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 0.9rem;
}

.hat-profile-monogram {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--hat-border-strong);
    border-radius: 50%;
    background: #0e1511;
    color: var(--hat-gold-light);
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
}

.hat-profile-card__region {
    color: var(--hat-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.hat-profile-card h3 {
    margin: 0.15rem 0 0;
    font-size: 1.36rem;
}

.hat-profile-card h3 a {
    color: var(--hat-text);
    text-decoration: none;
}

.hat-profile-card h3 a:hover,
.hat-profile-card h3 a:focus {
    color: var(--hat-gold-light);
}

.hat-profile-card__native-name {
    margin: 0.15rem 0 0;
    color: var(--hat-gold-light) !important;
    font-size: 0.88rem;
}

.hat-profile-card > p {
    margin: 0 0 1rem;
    font-size: 0.91rem;
    line-height: 1.52;
}

.hat-profile-card__classification {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.9rem;
}

.hat-profile-card__classification span {
    padding: 0.28rem 0.5rem;
    border: 1px solid rgba(212, 160, 23, 0.24);
    border-radius: 999px;
    color: var(--hat-text-soft);
    font-size: 0.7rem;
    line-height: 1.25;
}

.hat-profile-card__meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1rem;
    margin: 0;
}

.hat-profile-card__meta dt {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--hat-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.hat-profile-card__meta dd {
    margin: 0.18rem 0 0;
    color: var(--hat-text-soft);
    font-size: 0.82rem;
}

.hat-profile-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--hat-muted);
    font-size: 0.79rem;
}

.hat-profile-card__footer a {
    flex: 0 0 auto;
    font-weight: 700;
    text-decoration: none;
}

.hat-no-results {
    padding: 4rem 1.5rem;
    border: 1px dashed var(--hat-border-strong);
    text-align: center;
}

.hat-no-results .dna-icon {
    color: var(--hat-gold-light);
    font-size: 2rem;
}

.hat-no-results h3 {
    margin: 1rem 0 0.4rem;
}

.hat-no-results p {
    margin: 0;
}

.hat-collection-context {
    padding: 5rem 0;
    border-top: 1px solid var(--hat-border);
    background: var(--hat-bg-raised);
}

.hat-evidence-context {
    padding: 5rem 0;
    border-top: 1px solid var(--hat-border);
    background: var(--hat-bg);
}

.hat-context-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.hat-context-card-grid article {
    padding: 1.35rem;
    border: 1px solid var(--hat-border);
    border-top: 2px solid var(--hat-gold);
    background: var(--hat-bg-card);
}

.hat-context-card-grid h3 {
    margin-bottom: 0.65rem;
    font-size: 1.18rem;
}

.hat-context-card-grid p {
    margin: 0;
    font-size: 0.9rem;
}

.hat-context-card__sources {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.85rem;
    font-size: 0.76rem;
    font-weight: 700;
}

.hat-collection-source-list {
    display: grid;
    gap: 0.5rem;
    margin: 1.25rem 0 0;
    padding: 1rem 1rem 1rem 2.5rem;
    border: 1px solid var(--hat-border);
    background: var(--hat-bg-raised);
    color: var(--hat-muted);
    font-size: 0.82rem;
}

.hat-collection-source-list li > span {
    margin-right: 0.45rem;
    color: var(--hat-gold-light);
    font-weight: 700;
}

.hat-context-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: clamp(2rem, 7vw, 6rem);
    align-items: start;
}

.hat-context-grid h2 {
    max-width: 720px;
    margin: 0.65rem 0 1rem;
    font-size: clamp(2rem, 4vw, 3.25rem);
}

.hat-context-note {
    padding: 1.5rem;
    border-left: 3px solid var(--hat-jade);
    background: var(--hat-bg-card);
}

.hat-context-note h3 {
    font-size: 1.3rem;
}

.hat-context-note p:last-child {
    margin-bottom: 0;
}

.hat-map .leaflet-control-zoom a {
    border-color: #3b453e;
    background: #171f1a;
    color: var(--hat-text);
}

.hat-map .leaflet-control-attribution {
    background: rgba(13, 18, 16, 0.86);
    color: #aaa59b;
}

.hat-map .leaflet-control-attribution a {
    color: var(--hat-gold-light);
}

.hat-map-marker {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 2px solid #f1d27d;
    border-radius: 50% 50% 50% 8px;
    background: #b78310;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    color: #171109;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 0.9rem;
    font-weight: 700;
    transform: rotate(-45deg);
}

.hat-map-marker span {
    transform: rotate(45deg);
}

.hat-map-marker--hidden {
    display: none;
}

.hat-map .leaflet-popup-content-wrapper,
.hat-map .leaflet-popup-tip {
    border: 1px solid var(--hat-border-strong);
    background: #18211c;
    color: var(--hat-text);
}

.hat-map .leaflet-popup-content {
    min-width: 210px;
    margin: 0.9rem 1rem;
}

.hat-map-popup__region {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--hat-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hat-map-popup strong {
    display: block;
    color: var(--hat-text);
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.05rem;
}

.hat-map-popup p {
    margin: 0.3rem 0 0.7rem;
    color: var(--hat-text-soft);
    font-size: 0.8rem;
}

.hat-map-popup small {
    display: block;
    margin: 0.25rem 0;
    color: var(--hat-muted);
    font-size: 0.72rem;
}

.hat-map-popup small:last-of-type {
    margin-bottom: 0.7rem;
}

.hat-map-popup a {
    font-weight: 700;
}

@media (max-width: 1199.98px) {
    .hat-explorer-grid {
        grid-template-columns: minmax(0, 1fr) minmax(340px, 0.82fr);
    }

    .hat-filterbar {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .hat-filter-clear {
        grid-column: 1 / -1;
    }
}

@media (max-width: 991.98px) {
    .hat-collection-hero__grid,
    .hat-context-grid {
        grid-template-columns: 1fr;
    }

    .hat-collection-summary {
        max-width: 620px;
    }

    .hat-explorer-grid {
        grid-template-columns: 1fr;
    }

    .hat-map-panel {
        position: relative;
        top: auto;
    }

    .hat-map {
        height: 520px;
        min-height: 0;
    }

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

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

@media (max-width: 767.98px) {
    .hat-collection-hero {
        padding: 3rem 0 3.5rem;
        background-image: none;
    }

    .hat-explorer {
        padding: 3.5rem 0;
    }

    .hat-explorer__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .hat-filterbar {
        grid-template-columns: 1fr;
    }

    .hat-filter-clear {
        grid-column: auto;
    }

    .hat-map {
        height: 430px;
    }

    .hat-profile-list {
        grid-template-columns: 1fr;
    }

    .hat-context-card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hat-collection-summary,
    .hat-profile-card__meta {
        grid-template-columns: 1fr;
    }

    .hat-map {
        height: 380px;
    }

    .hat-profile-card__footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hat-profile-card {
        transition: none;
    }
}

@media print {
    .hat-filterbar,
    .hat-map-panel {
        display: none;
    }

    .hat-profile-list {
        grid-template-columns: repeat(2, 1fr);
    }
}
