:root {
    --bg: #f3f6f2;
    --paper: #ffffff;
    --ink: #142018;
    --muted: #526158;
    --line: #d5e0d8;
    --green: #0c6b3c;
    --green-dark: #084e2c;
    --cheap: #e5f6ec;
    --focus: #0c6b3c;
    --shadow: 0 1px 2px rgba(20, 32, 24, 0.05), 0 10px 28px rgba(20, 32, 24, 0.06);
    --radius: 16px;
    --max: 75.6rem;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

body.cookie-open {
    padding-bottom: calc(9.5rem + env(safe-area-inset-bottom));
}

img,
svg {
    max-width: 100%;
}

a {
    color: var(--green-dark);
}

a:hover {
    text-decoration: none;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: 0.75rem;
    top: 0.75rem;
    transform: translateY(-150%);
    background: #fff;
    color: var(--ink);
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    z-index: 20;
}

.skip-link:focus {
    transform: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    width: min(100% - 2rem, var(--max));
    margin-inline: auto;
}

.site-header {
    background: #fff;
    border-bottom: 3px solid var(--green);
}

.header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.85rem 0;
}

.wordmark,
.footer-mark {
    color: var(--ink);
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.wordmark span,
.footer-mark span {
    color: var(--green);
}

.header-search {
    display: flex;
    flex: 1 1 18rem;
    gap: 0.5rem;
    max-width: 34rem;
}

.header-search input,
.home-search input,
.filter-label input {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    font: inherit;
    font-size: 1rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
}

.header-search button,
.button,
.home-search button {
    min-height: 48px;
    font: inherit;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.65rem 1rem;
    border: 0;
    border-radius: 12px;
    background: var(--green);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button:hover,
.header-search button:hover,
.home-search button:hover {
    background: var(--green-dark);
}

.button-quiet {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}

.fpn-banner {
    display: block;
    flex: 0 0 auto;
    width: min(100% - 2rem, var(--max));
    margin: 0.75rem auto;
    overflow: hidden;
    background: #eef3ef;
    border: 1px dashed #9aafa2;
    border-radius: 12px;
    padding: 0.5rem 0.75rem 0.75rem;
}

.fpn-banner[hidden] {
    display: none;
}

.fpn-banner .adsbygoogle {
    display: block;
    min-height: 100px;
}

.fpn-banner-bottom {
    margin-top: 0;
}

.fpn-banner-label {
    margin: 0 0 0.25rem;
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.main-content {
    flex: 1;
    padding: 1.25rem 0 2.5rem;
}

.hero h1,
.place-head h1,
.prose h1,
.page-places h1,
.page-search h1,
.page-missing h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.lede {
    margin: 0 0 1rem;
    font-size: 1.125rem;
    color: var(--muted);
    max-width: 40rem;
}

.home-search label,
.filter-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.home-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.home-search-row input {
    flex: 1 1 14rem;
}

.updated,
.source-note,
.copyright {
    color: var(--muted);
    font-size: 0.95rem;
}

.averages,
.place-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin: 1.25rem 0;
}

.averages article,
.place-summary article,
.cheapest-uk,
.station,
.town-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.averages article,
.place-summary article {
    padding: 1rem 1.1rem;
}

.averages h2,
.place-summary h2,
.cheapest-uk h2,
.popular h2,
.neighbours h2,
.letter-group h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
}

.figure {
    margin: 0.2rem 0 0;
    font-size: clamp(1.8rem, 5vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.place-summary p {
    margin: 0.15rem 0 0;
}

.cheapest-uk {
    padding: 1rem 1.1rem;
    margin: 0.75rem 0 0;
}

.cheapest-uk + .popular {
    margin-top: 1.5rem;
}

.cheapest-uk ul {
    margin: 0.6rem 0 0;
    padding-left: 1.1rem;
}

.cheapest-uk li + li {
    margin-top: 0.35rem;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
}

.section-head h2,
.popular h2 {
    color: var(--ink);
    font-size: 1.35rem;
}

.town-grid,
.result-list,
.place-index,
.neighbour-list,
.station-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.town-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.town-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 48px;
    padding: 0.9rem 1rem;
    text-decoration: none;
    color: inherit;
}

.town-card:hover {
    border-color: var(--green);
}

.town-name {
    font-weight: 700;
    font-size: 1.05rem;
}

.town-prices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.8rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.crumbs a {
    color: var(--muted);
}

.sort-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
}

.sort-bar p {
    margin: 0;
}

.sort-bar div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sort-bar a,
.sort-bar [aria-current="true"] {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    text-decoration: none;
}

.sort-bar [aria-current="true"] {
    background: var(--green-dark);
    color: #fff;
    border-color: var(--green-dark);
}

.filter-label input {
    display: block;
    width: min(100%, 18rem);
    margin-top: 0.25rem;
}

.station-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.station[hidden] {
    display: none;
}

.station {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
}

.station h2 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.station-meta,
.station-when,
.price-extra {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.map-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-weight: 600;
}

.station-prices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.price-pair {
    margin: 0;
    padding: 0.65rem 0.7rem;
    border-radius: 12px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.price-pair span,
.price-pair em {
    font-size: 0.85rem;
    font-style: normal;
    color: var(--muted);
}

.price-pair strong {
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.price-pair.is-cheapest {
    background: var(--cheap);
}

.price-pair.is-cheapest em {
    color: var(--green-dark);
    font-weight: 700;
}

.price-extra {
    grid-column: 1 / -1;
}

.neighbours {
    margin-top: 1.75rem;
}

.neighbour-list,
.result-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.neighbour-list a,
.result-list a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.35rem 0.75rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
}

.result-list {
    flex-direction: column;
    align-items: stretch;
}

.result-list li,
.place-index li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.2rem 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
}

.result-list a,
.place-index a {
    font-weight: 700;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.result-list span,
.place-index span {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.letter-nav {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.5rem 0;
    background: var(--bg);
}

.letter-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    text-decoration: none;
    font-weight: 700;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.letter-group {
    margin-top: 1.25rem;
}

.letter-group h2 {
    color: var(--ink);
    font-size: 1.4rem;
}

.empty {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
}

.prose {
    max-width: 42rem;
}

.prose h2 {
    margin: 1.6rem 0 0.4rem;
    font-size: 1.25rem;
}

.prose p,
.prose li {
    font-size: 1.05rem;
}

.prose ul {
    padding-left: 1.2rem;
}

.site-footer .footer-mark {
    color: #fff;
}

.site-footer .footer-mark span {
    color: #c8f5d8;
}

.site-footer {
    background: var(--green-dark);
    color: #e7f3ec;
    margin-top: auto;
    padding: 1.5rem 0 1rem;
}

.footer-grid {
    display: grid;
    gap: 1rem;
}

.footer-note,
.site-footer .copyright {
    color: #c9e0d3;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}

.footer-links a,
.site-footer .linkish {
    color: #fff;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.site-footer .linkish {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.copyright {
    margin-bottom: 0;
}

.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(20, 32, 24, 0.08);
    padding: 0.85rem 0 calc(0.85rem + env(safe-area-inset-bottom));
}

.cookie-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.cookie-inner p {
    margin: 0;
    flex: 1 1 16rem;
}

.cookie-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .averages,
    .place-summary {
        grid-template-columns: repeat(3, 1fr);
    }

    .place-summary {
        grid-template-columns: 1fr 1fr;
    }

    .town-grid {
        grid-template-columns: 1fr 1fr;
    }

    .station {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .station-main {
        flex: 1 1 auto;
        min-width: 0;
    }

    .station-prices {
        flex: 0 0 18rem;
    }
}

@media (min-width: 960px) {
    .town-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .footer-grid {
        grid-template-columns: 1.4fr 1fr;
        align-items: start;
    }
}

@media (max-width: 480px) {
    .header-search {
        flex-basis: 100%;
        max-width: none;
    }

    .home-search-row .button,
    .header-search button {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto;
    }
}
