/**
 * Community orchards map.
 *
 * Deliberately plain for now — this is the scaffold, and the legend, filters
 * and results list land on top of it.
 */

.orchard-map {
    margin: 0 0 1.5rem;
}

/* --- Search --- */

.orchard-map__search {
    margin: 0 0 .9rem;
}

.orchard-map__search-label {
    display: block;
    font-size: .9rem;
    font-weight: 700;
    margin-bottom: .3rem;
}

.orchard-map__search-row {
    display: flex;
    gap: .5rem;
    max-width: 30rem;
}

.orchard-map .orchard-map__search-field {
    flex: 1 1 auto;
    margin: 0;
    height: auto;
    padding: .5rem .65rem;
    border: 1px solid #c6cfc0;
    border-radius: 3px;
    font-size: .95rem;
    box-shadow: none;
}

.orchard-map .orchard-map__search-field:focus {
    border-color: #b7c200;
    outline: 2px solid rgba( 183, 194, 0, .35 );
    outline-offset: 1px;
}

.orchard-map .orchard-map__search-clear {
    flex: 0 0 auto;
    margin: 0;
    padding: .5rem .8rem;
    border: 1px solid #c6cfc0;
    border-radius: 3px;
    background: #f4f6ef;
    color: #3f4700;
    font-size: .85rem;
    line-height: 1.2;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.orchard-map .orchard-map__search-clear:hover,
.orchard-map .orchard-map__search-clear:focus {
    background: #e8ecdd;
    color: #23290a;
}

.orchard-map__search-hint {
    margin: .35rem 0 0;
    font-size: .82rem;
    color: #5c6a60;
}

/* --- Key and event filters --- */

/* Key and event filters each get their own row, with the titles lined up,
   rather than wrapping into each other at column widths. */
.orchard-map__filters {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin: 0 0 .75rem;
    padding: .65rem .8rem;
    border: 1px solid #dde4d8;
    border-radius: 3px;
    background: #f8faf5;
    font-size: .88rem;
    line-height: 1.4;
    color: #2f3a33;
}

.orchard-map .orchard-map__key,
.orchard-map .orchard-map__key-list,
.orchard-map .orchard-map__events {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem 1.25rem;
    margin: 0;
    padding: 0;
    border: 0;
    list-style: none;
}

.orchard-map .orchard-map__key-item,
.orchard-map .orchard-map__filter-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    padding: 0;
    font: inherit;
    color: inherit;
}

.orchard-map .orchard-map__filter-label {
    cursor: pointer;
}

.orchard-map__key-item img {
    display: inline-block;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.orchard-map .orchard-map__filters-title {
    min-width: 3.5rem;
    margin: 0;
    padding: 0;
    font-size: .78rem;
    font-weight: 700;
    line-height: inherit;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #5c6a60;
}

.orchard-map .orchard-map__filter {
    margin: 0;
    cursor: pointer;
}

.orchard-map__bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 .5rem;
}

.orchard-map__count {
    margin: 0;
    font-weight: 700;
}

.orchard-map__frame {
    position: relative;
    min-height: 320px;
    background: #eef2ea;
}

.orchard-map__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Sits over the canvas while the library and the data load. */
.orchard-map__status {
    position: absolute;
    inset: auto 0 0 0;
    margin: 0;
    padding: .6rem .9rem;
    background: rgba( 255, 255, 255, .92 );
    font-size: .9rem;
}

.orchard-map--failed .orchard-map__status {
    background: #f7e9e5;
    color: #a03f2c;
}

/* --- The results list, which follows the viewport --- */

.orchard-map__list {
    margin-top: 1.5rem;
}

.orchard-map__list-title {
    font-size: 1.05rem;
    margin: 0 0 .75rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid #dde4d8;
}

.orchard-map__results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax( 17rem, 1fr ) );
    gap: .9rem;
}

/* The theme gives list items a bottom margin; the grid handles spacing. */
.orchard-map__results > li {
    margin: 0;
}

.orchard-map__result {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    border: 1px solid #dde4d8;
    border-left: 3px solid #b7c200;
    border-radius: 3px;
    padding: .8rem .95rem .85rem;
    background: #fff;
}

.orchard-map__result-title {
    font-size: 1rem;
    line-height: 1.3;
    margin: 0;
}

.orchard-map__result-place {
    margin: 0;
    font-size: .85rem;
    color: #5c6a60;
}

/* Pinned to the bottom so cards of different heights line their actions up. */
.orchard-map__result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .9rem;
    margin: .6rem 0 0;
    padding-top: .55rem;
    border-top: 1px solid #eef2ea;
    font-size: .85rem;
    margin-top: auto;
}

/*
 * The theme's Foundation base styles every <button> white-on-lime, and
 * `button:hover, button:focus { color:#ffffff }` outranks a single class — so
 * these need the extra specificity and every state spelled out, or the label
 * disappears the moment you point at it.
 */
.orchard-map .orchard-map__show,
.orchard-map .orchard-map__page {
    display: inline-block;
    font: inherit;
    font-size: .85rem;
    line-height: 1.2;
    margin: 0;
    padding: .4rem .75rem;
    border: 1px solid #b7c200;
    border-radius: 3px;
    background: #b7c200;
    /* Dark on lime: white on this green is about 1.9:1 and unreadable. */
    color: #23290a;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color 150ms ease-out;
}

.orchard-map .orchard-map__show:hover,
.orchard-map .orchard-map__show:focus,
.orchard-map .orchard-map__page:hover:not([disabled]),
.orchard-map .orchard-map__page:focus:not([disabled]) {
    background: #a3ad00;
    border-color: #a3ad00;
    color: #23290a;
}

.orchard-map .orchard-map__show:focus-visible,
.orchard-map .orchard-map__page:focus-visible {
    outline: 2px solid #23290a;
    outline-offset: 2px;
}

.orchard-map .orchard-map__page[disabled] {
    background: #f1f3ec;
    border-color: #dde4d8;
    color: #96a08a;
    cursor: default;
}

/*
 * Three tiers, so the row reads in order rather than as three equal things:
 * "Show on map" solid, "Visit website" outlined, "Tell us more" a plain link.
 */
.orchard-map .orchard-map__visit {
    display: inline-block;
    padding: .4rem .75rem;
    border: 1px solid #b7c200;
    border-radius: 3px;
    background: #fff;
    color: #3f4700;
    font-size: .85rem;
    line-height: 1.2;
    text-decoration: none;
}

.orchard-map .orchard-map__visit:hover,
.orchard-map .orchard-map__visit:focus {
    background: #f4f6e6;
    color: #23290a;
}

.orchard-map .orchard-map__tell {
    font-size: .82rem;
    color: #5c6a60;
    text-decoration: underline;
}

.orchard-map .orchard-map__tell:hover,
.orchard-map .orchard-map__tell:focus {
    color: #23290a;
}

/* Titles are plain text now — no link colour to be inconsistent about. */
.orchard-map__result-title {
    color: inherit;
}

.orchard-map__empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1rem 0;
    color: #5c6a60;
}

.orchard-map__pagination {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: 1rem;
}

.orchard-map__page-of {
    font-size: .88rem;
    color: #5c6a60;
}

/* Google's info window supplies its own chrome, so only the contents here. */
.orchard-map__info {
    font-size: .95rem;
    line-height: 1.45;
    max-width: 18rem;
}

.orchard-map__title {
    font-weight: 700;
    margin-bottom: .25rem;
}

.orchard-map__ref span,
.orchard-map__website span {
    font-weight: 700;
}

.orchard-map__website a {
    word-break: break-word;
}

.orchard-map__place {
    margin-top: .25rem;
    color: #5c6a60;
}

/* Screen-reader-only announcements, e.g. when the map is moved by a button. */
.orchard-map__announce {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect( 0 0 0 0 );
    clip-path: inset( 50% );
    white-space: nowrap;
    border: 0;
}

/* --- Phones --- */

@media (max-width: 40rem) {

    /* Beats the inline height the shortcode sets. A map shorter than this is
       not worth panning; taller and the list below it is never discovered. */
    .orchard-map__frame {
        height: 60vh !important;
        min-height: 18rem;
    }

    .orchard-map__search-row {
        max-width: none;
    }

    .orchard-map__results {
        grid-template-columns: 1fr;
    }

    .orchard-map__result-actions {
        gap: .5rem;
    }

    .orchard-map__pagination {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .orchard-map__page-of {
        order: -1;
        width: 100%;
    }
}

/* Touch targets. Coarse pointers rather than narrow screens — a phone in
   landscape is wide and still being tapped. */
@media (pointer: coarse) {

    .orchard-map .orchard-map__show,
    .orchard-map .orchard-map__visit,
    .orchard-map .orchard-map__page,
    .orchard-map .orchard-map__search-clear {
        min-height: 44px;
        padding-top: .6rem;
        padding-bottom: .6rem;
    }

    .orchard-map .orchard-map__search-field {
        min-height: 44px;
        /* Under 16px, iOS zooms the page on focus and never zooms back. */
        font-size: 16px;
    }

    .orchard-map .orchard-map__filter-label {
        padding: .35rem 0;
    }

    .orchard-map .orchard-map__filter {
        width: 20px;
        height: 20px;
    }
}

/* Honour a reduced-motion preference in the one place we animate. */
@media (prefers-reduced-motion: reduce) {
    .orchard-map .orchard-map__show,
    .orchard-map .orchard-map__page {
        transition: none;
    }
}
