/* parkrun finder (/parkrun). Builds on tools.css (.tp-*); the suggestion list
   (.prs-*) is in parkrun-search.css, shared with the My Races sidebar card. */

/* ---- hero: the search lives in it ---- */
.pr-page .tp-hero { overflow: visible; z-index: 5; }
.pr-page .tp-hero-img { clip-path: inset(0); }
.pr-page .tp-hero-inner { padding-bottom: 40px; }
.pr-page .tp-hero-lead { margin-bottom: 22px; }

.pr-search { display: flex; gap: 10px; align-items: stretch; max-width: 640px; }
.pr-combo { position: relative; flex: 1 1 auto; min-width: 0; }
.pr-combo input {
    width: 100%; height: 56px; padding: 0 48px 0 18px; box-sizing: border-box;
    font: inherit; font-size: 1.08rem; color: var(--rs-text); caret-color: var(--rs-text);
    background: #fff; border: 2px solid transparent; border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}
.pr-combo input:focus { outline: none; border-color: var(--rs-accent); }
.pr-combo input::placeholder { color: #6b6b6b; }
.pr-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; display: grid; place-items: center;
    border: 0; border-radius: 10px; background: transparent; color: var(--rs-text-muted); cursor: pointer;
}
.pr-clear[hidden] { display: none; }
.pr-clear:hover { background: var(--rs-bg-elevated); color: var(--rs-text); }
.pr-clear:focus-visible { outline: 2px solid var(--rs-text); outline-offset: -2px; }

.pr-locate {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 56px; padding: 0 20px; white-space: nowrap;
    font: inherit; font-weight: 700; font-size: 1rem;
    color: var(--rs-accent-text); background: var(--rs-accent);
    border: 0; border-radius: 14px; cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
    transition: background-color 0.15s ease, transform 0.15s ease;
}
.pr-locate:hover { background: var(--rs-accent-hover); }
.pr-locate:active { transform: translateY(1px); }
.pr-locate:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.pr-locate:disabled { cursor: progress; }
.pr-locate.is-busy svg { animation: pr-pulse 1s ease-in-out infinite; }
@keyframes pr-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pr-locate.is-busy svg { animation: none; } }

/* ---- results ---- */
.pr-body { max-width: 1120px; }
.pr-finder { margin-top: 28px; }
.pr-status-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pr-status {
    margin: 0; font-family: var(--font-display); font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; scroll-margin-top: 110px;
}
.pr-reset {
    padding: 8px 2px; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--rs-text);
    text-decoration: underline; text-decoration-color: var(--rs-border-dark); text-underline-offset: 4px;
}
.pr-reset:hover { text-decoration-color: var(--rs-text); }
.pr-hint { margin: 6px 0 0; color: var(--rs-text-secondary); }

.pr-layout { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 18px; }
.pr-layout.has-results { grid-template-columns: minmax(300px, 380px) 1fr; align-items: start; }
.pr-results { margin: 0; padding: 0; list-style: none; display: none; counter-reset: none; }
.has-results .pr-results { display: block; }

.pr-map-wrap { position: sticky; top: 86px; }
.pr-map {
    height: 560px; border-radius: 16px; border: 1px solid var(--rs-border);
    background: #aad3df; z-index: 0;
}
.pr-layout:not(.has-results) .pr-map { height: 480px; }

.pr-item {
    display: grid; grid-template-columns: 30px 1fr; gap: 12px;
    padding: 14px 10px 14px 8px; border-radius: 12px;
    transition: background-color 0.15s ease;
}
.pr-item + .pr-item { border-top: 1px solid var(--rs-border-light); }
.pr-item:hover, .pr-item.is-flagged { background: var(--rs-bg-elevated); }
.pr-num, .pr-pin span {
    display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
    font-weight: 800; font-size: 0.85rem; font-variant-numeric: tabular-nums;
    background: var(--rs-accent); color: var(--rs-accent-text); box-shadow: 0 0 0 2px #161616;
}
.pr-num { margin-top: 1px; }
.pr-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pr-item-name {
    padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
    font: inherit; font-weight: 700; font-size: 1.05rem; color: var(--rs-text);
}
.pr-item-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.pr-km { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--rs-text-secondary); white-space: nowrap; }
.pr-item-where { margin-top: 2px; font-size: 0.9rem; color: var(--rs-text-muted); }
.pr-time { font-weight: 700; color: var(--rs-text); font-variant-numeric: tabular-nums; }
.pr-item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 10px; font-size: 0.9rem; }
.pr-links { display: inline-flex; gap: 16px; white-space: nowrap; }
.tp-body .pr-item-actions a {
    display: inline-flex; align-items: center; gap: 4px; min-height: 32px;
    color: var(--rs-text); text-decoration: underline; text-decoration-color: var(--rs-border-dark); text-underline-offset: 3px;
}
.tp-body .pr-item-actions a:hover { text-decoration-color: var(--rs-text); }
.pr-ext { flex: none; opacity: 0.7; }
.pr-save {
    display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
    font: inherit; font-size: 0.88rem; font-weight: 700; color: var(--rs-accent-text);
    background: var(--rs-accent); border: 0; border-radius: 999px; cursor: pointer;
}
.pr-save:hover { background: var(--rs-accent-hover); }
.pr-save:disabled { opacity: 0.6; cursor: progress; }
.pr-save.is-saved { background: #161616; color: var(--rs-accent); }
.pr-save.is-saved:hover { background: #333; }
.pr-more-dates {
    padding: 4px 0; border: 0; background: none; cursor: pointer; min-height: 34px;
    font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--rs-text);
    text-decoration: underline; text-decoration-color: var(--rs-border-dark); text-underline-offset: 3px;
}
.pr-more-dates:hover { text-decoration-color: var(--rs-text); }
.pr-dates { margin-top: 4px; }
.pr-dates .pr-card-label { margin: 10px 0 8px; }
.pr-dates-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 320px; }
.pr-sat.is-other { border-style: dashed; }
.pr-saved { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; font-weight: 700; color: #0f7a52; }

/* numbered map pins (Leaflet divIcon) */
.pr-pin { background: none; border: 0; }
.pr-pin span { width: 26px; height: 26px; transition: transform 0.15s ease; }
.pr-pin.is-focus span, .pr-pin.is-hover span { transform: scale(1.25); background: #161616; color: var(--rs-accent); box-shadow: 0 0 0 2px var(--rs-accent); }

.pr-pop { display: grid; gap: 2px; font: 0.92rem/1.45 var(--font-body); }
.pr-pop span { color: var(--rs-text-muted); }
.pr-pop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; }
.pr-pop-more {
    padding: 4px 0; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: 0.88rem; font-weight: 600; color: #161616;
    text-decoration: underline; text-underline-offset: 3px;
}
.pr-pop a { margin-top: 6px; color: #161616; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.pr-map .leaflet-popup-content { margin: 12px 16px; }
.pr-map .leaflet-control-attribution { font-size: 0.7rem; }
.pr-map-hint {
    position: absolute; inset: 0; z-index: 1000; display: grid; place-items: center; pointer-events: none;
    font-weight: 700; font-size: 1.05rem; color: #fff; background: rgba(22, 22, 22, 0.55);
    opacity: 0; transition: opacity 0.25s ease;
}
.pr-map-hint.is-on { opacity: 1; }

/* ---- by state ---- */
.pr-states { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; align-items: start; }
.pr-state { background: var(--rs-bg-card); border: 1px solid var(--rs-border); border-radius: 12px; }
.pr-state summary {
    display: flex; justify-content: space-between; align-items: center; min-height: 52px; box-sizing: border-box;
    padding: 12px 18px; cursor: pointer; font-weight: 700; list-style: none; border-radius: 12px;
}
.pr-state summary::-webkit-details-marker { display: none; }
.pr-state summary::after {
    content: ''; width: 9px; height: 9px; margin-left: 14px; flex: none;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.2s ease;
}
.pr-state[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.pr-state summary:focus-visible { outline: 2px solid var(--rs-text); outline-offset: 2px; }
.pr-count { margin-left: auto; font-weight: 600; color: var(--rs-text-muted); font-variant-numeric: tabular-nums; }
.pr-state ul { margin: 0; padding: 0 18px 12px; list-style: none; }
.pr-state li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 8px 0; border-top: 1px solid var(--rs-border-light); }
.pr-where { color: var(--rs-text-muted); font-size: 0.88rem; }

/* ---- FAQ ---- */
.pr-faq-q { margin: 26px 0 6px; font-size: 1.08rem; }
.pr-faq-a { max-width: 68ch; margin: 0; }
.pr-more { margin-top: 28px; }

.pr-credit { margin-top: 48px; font-size: 0.8rem; color: var(--rs-text-muted); }

/* ---- phones ---- */
@media (max-width: 760px) {
    .pr-page .tp-hero-inner { padding-bottom: 28px; }
    .pr-page .tp-hero-title { font-size: 2.2rem; margin-bottom: 10px; }
    .pr-page .tp-hero-lead { font-size: 0.98rem; margin-bottom: 18px; }
    .pr-page .tp-crumbs { display: none; }
    .pr-search { flex-wrap: wrap; }
    .pr-locate { flex: 1 1 100%; height: 50px; }
    .pr-layout.has-results { grid-template-columns: 1fr; }
    .pr-map-wrap { position: static; }
    .pr-map, .pr-layout:not(.has-results) .pr-map { height: 340px; }
    .pr-states { grid-template-columns: 1fr; }
}
