/* The national Regions directory, beneath the portal's existing breadcrumb. */
#page .container.regions-atlas-index {
    --atlas-inset: clamp(16px, 4.4vw, 52px);
    --atlas-ink: #123c54;
    --atlas-muted: #526566;
    --atlas-line: #d8dcd0;
    padding-inline: var(--atlas-inset);
}

#page .regions-atlas {
    display: grid;
    container-type: inline-size;
    grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
    column-gap: clamp(16px, 3.3vw, 42px);
    margin-inline: calc(0px - var(--atlas-inset));
    padding-inline: var(--atlas-inset);
    color: var(--atlas-ink);
    background: linear-gradient(102deg, #f7f4e9 34%, #edeedc);
}

#page .regions-atlas > h1.section-title {
    grid-area: 1 / 1;
    align-self: end;
    min-width: 0;
    margin: 0;
    padding: clamp(26px, 3.6vw, 46px) 0 0;
    color: var(--atlas-ink);
    /* The portal specifies its sans-serif heading font with !important. */
    font-family: Georgia, "Times New Roman", var(--portal-font-family) !important;
    /* The portal container stays the same width across much of a tablet's
       viewport range. Size the title to the available spread at each width. */
    font-size: clamp(48px, 7vw, 99px);
    font-size: clamp(48px, 9.3cqi, 99px);
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: -.047em;
    text-align: left;
    text-wrap: balance;
}

#page .regions-atlas > h1.section-title::before {
    content: "";
    display: block;
    width: 42px;
    height: 3px;
    margin-bottom: 12px;
    background: #cc622d;
}

/* Keep the non-JavaScript directory headed and usable before the filter loads. */
#page .regions-atlas-index:not(.directory-card-index) .regions-atlas {
    margin-bottom: 16px;
}
#page .regions-atlas-index:not(.directory-card-index) .regions-atlas > h1 {
    align-self: center;
    padding-bottom: clamp(26px, 3.6vw, 46px);
}

#page .regions-atlas-chart {
    position: relative;
    grid-area: 1 / 2 / 4 / 3;
    display: grid;
    place-items: center;
    min-width: 0;
    padding: 14px 8%;
    pointer-events: none;
}
#page .regions-atlas-chart::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(to right, #afc0ae 1px, transparent 1px),
                      linear-gradient(to bottom, #afc0ae 1px, transparent 1px);
    background-size: 32px 32px;
    opacity: .55;
    mask-image: radial-gradient(ellipse at 52% 48%, #000 14%, transparent 81%);
}
#page .regions-atlas-map {
    position: relative;
    display: block;
    width: 100%;
    height: clamp(190px, 24vw, 285px);
    object-fit: contain;
}

/* Keep the shared search landmark, input, live result count and clear action. */
#page .regions-atlas-index .regions-atlas > .directory-search {
    grid-area: 2 / 1 / 5 / 2;
    margin: 0;
    padding: 0;
    min-width: 0;
    width: 100%;
    max-width: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: var(--atlas-ink);
}
#page .regions-atlas-index .regions-atlas .directory-search-label {
    align-self: end;
    min-width: 0;
    margin: 0 0 8px;
    padding-top: 18px;
    color: var(--atlas-ink);
    font-size: 16px;
    line-height: 1.45;
}
#page .regions-atlas-index .regions-atlas .directory-search-controls {
    align-self: start;
    width: 100%;
    max-width: 465px;
    padding-bottom: clamp(24px, 3.2vw, 42px);
}
#page .regions-atlas-index .regions-atlas .directory-search-input {
    min-height: 46px;
    min-width: 0;
    border-color: #6a8580;
    border-radius: 6px;
    background-color: #fffefa;
    color: var(--atlas-ink);
}
/* A native input hint occupies one line. Let the translated hint wrap in
   the same cell as the input, including when the visitor enlarges the text. */
#page .regions-atlas-index .regions-atlas .regions-atlas-search-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}
#page .regions-atlas .regions-atlas-search-field > input,
#page .regions-atlas .regions-atlas-search-field > .regions-atlas-search-hint {
    grid-area: 1 / 1;
    font-size: max(16px, 1em);
    line-height: 1.5;
}
#page .regions-atlas .regions-atlas-search-field > input::placeholder { opacity: 0; }
#page .regions-atlas .regions-atlas-search-hint[hidden] {
    display: block;
    align-self: center;
    min-width: 0;
    margin: 1px;
    padding: 12px 14px 12px 42px;
    color: #526879;
    overflow-wrap: anywhere;
    pointer-events: none;
}
#page .regions-atlas .regions-atlas-search-field > input:not(:placeholder-shown) + .regions-atlas-search-hint {
    visibility: hidden;
}
#page .regions-atlas-index .regions-atlas .directory-search-meta {
    align-self: stretch;
    justify-content: flex-start;
    min-width: 0;
    margin: 0;
    padding-block: 12px;
}
#page .regions-atlas-index .regions-atlas .directory-search-status {
    min-width: 0;
    color: var(--atlas-muted);
}
#page .regions-atlas-index .regions-atlas .directory-search-meta::after {
    content: "";
    flex: 1 0 16px;
    height: 1px;
    background: var(--atlas-line);
}

/* Each search child aligns with the hero tracks, including the full-width
   results strip. Browsers without subgrid keep the filter below the title. */
@supports (grid-template-rows: subgrid) {
    #page .regions-atlas-index .regions-atlas > .directory-search {
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: subgrid;
        grid-template-rows: subgrid;
    }
    #page .regions-atlas .directory-search-label { grid-area: 1 / 1; }
    #page .regions-atlas .directory-search-controls { grid-area: 2 / 1; }
    #page .regions-atlas-index .regions-atlas .directory-search-meta {
        grid-area: 3 / 1 / 4 / -1;
        margin-inline: calc(0px - var(--atlas-inset));
        padding-inline: var(--atlas-inset);
        border-top: 1px solid var(--atlas-line);
        background: #fff;
    }
}

@media (max-width: 599px) {
    #page .regions-atlas {
        grid-template-columns: minmax(0, 1fr) clamp(65px, 24vw, 110px);
        column-gap: 12px;
        padding-top: 16px;
    }
    #page .regions-atlas > h1.section-title {
        align-self: center;
        padding: 0;
        font-size: clamp(34px, 12vw, 60px);
    }
    #page .regions-atlas > h1.section-title::before { width: 30px; margin-bottom: 8px; }
    #page .regions-atlas-chart { grid-area: 1 / 2; align-self: center; padding: 0; }
    #page .regions-atlas-chart::before { background-size: 15px 15px; }
    #page .regions-atlas-map { height: auto; aspect-ratio: 1; }
    #page .regions-atlas-index .regions-atlas > .directory-search,
    #page .regions-atlas .directory-search-label,
    #page .regions-atlas .directory-search-controls { grid-column: 1 / -1; }
    #page .regions-atlas-index .regions-atlas .directory-search-label { padding-top: 12px; }
    #page .regions-atlas-index .regions-atlas .directory-search-controls { max-width: none; padding-bottom: 22px; }
    #page .regions-atlas-index:not(.directory-card-index) .regions-atlas { padding-bottom: 16px; }
    #page .regions-atlas-index:not(.directory-card-index) .regions-atlas > h1 { padding: 0; }
}

/* On short, wide screens keep the search field and its feedback in view together. */
@media (min-width: 600px) and (max-height: 350px) {
    #page .regions-atlas-index .regions-atlas .directory-search-controls { padding-bottom: 6px; }
    #page .regions-atlas-index .regions-atlas .directory-search-meta { padding-block: 6px; }
}
@media (min-width: 600px) and (max-height: 299px) {
    #page .regions-atlas-index .regions-atlas .directory-search-controls { padding-bottom: 0; }
    #page .regions-atlas-index .regions-atlas .directory-search-meta { padding-block: 0; }
    #page .regions-atlas-index .regions-atlas .directory-search-status { align-self: flex-start; }
}
