/**
 * Site styles: header, navigation, footer and PHP templates.
 * Loaded on the front end only (the editor never shows these parts).
 *
 * Colors and sizes come from theme.json, mostly settings.custom.header
 * and settings.custom.footer. Change those first.
 *
 * Breakpoints: 782px (mobile / desktop), 1080px (navigation collapses).
 *
 * Contents
 *   1. Layout
 *   2. Header
 *   3. Navigation (desktop)
 *   4. Navigation (mobile drawer)
 *   5. Transparent header
 *   6. Footer
 *   7. Templates
 *   8. Listing pages
 */


/* ------------------------------------------------------------------
 * 1. Layout
 * ------------------------------------------------------------------ */

.towns-container {
    width: 100%;
    max-width: calc(var(--wp--style--global--wide-size) + var(--wp--style--root--padding-left) + var(--wp--style--root--padding-right));
    padding-right: var(--wp--style--root--padding-right);
    padding-left: var(--wp--style--root--padding-left);
    margin-right: auto;
    margin-left: auto;
}

/* Keep the footer at the bottom on short pages. */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.towns-main {
    display: block;
    flex: 1 0 auto;
}

/* The page content wrapper already uses the global padding, so its first and
   last full-width blocks sit flush against the header and footer. */
.towns-main > article > .entry-content > :first-child {
    margin-block-start: 0;
}


/* ------------------------------------------------------------------
 * 2. Header
 * ------------------------------------------------------------------ */

.towns-header {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0);
    z-index: 1000;
    color: var(--wp--custom--header--text);
    background-color: var(--wp--custom--header--background);
    transition:
        background-color var(--wp--custom--transition--base),
        box-shadow var(--wp--custom--transition--base);
}

/* The admin bar stops being fixed on small screens. */
@media (max-width: 600px) {

    .towns-header {
        top: 0;
    }
}

.towns-header.is-scrolled {
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.08);
}

.towns-header__inner {
    display: flex;
    gap: var(--wp--preset--spacing--40);
    align-items: center;
    justify-content: space-between;
    min-height: var(--wp--custom--header--height);
}

.towns-header__brand {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
}

a.towns-logo {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

a.towns-logo:hover {
    color: inherit;
}

.towns-logo__image {
    display: block;
    width: auto;
    max-width: 220px;
    height: auto;
    max-height: var(--wp--custom--header--logo-height);
}

.towns-logo__text {
    font-family: var(--wp--preset--font-family--heading);
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.towns-header__panel {
    display: flex;
    flex: 1 1 auto;
    gap: var(--wp--preset--spacing--40);
    align-items: center;
    justify-content: flex-end;
}

.towns-header__actions {
    display: flex;
    flex: 0 0 auto;
    gap: var(--wp--preset--spacing--40);
    align-items: center;
}

.towns-header .towns-contact__phone {
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.towns-header__owner {
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
    text-decoration: none;
}

.towns-header__owner:hover {
    text-decoration: underline;
    text-underline-offset: 0.25em;
}

.towns-header .towns-contact__phone:hover {
    text-decoration: underline;
    text-underline-offset: 0.25em;
}

/* Header CTA: yellow on the dark blue header (settings.custom.header.cta*). */
.towns-header .towns-header__cta {
    color: var(--wp--custom--header--cta-text);
    background-color: var(--wp--custom--header--cta-background);
    border-color: var(--wp--custom--header--cta-background);
}

.towns-header .towns-header__cta:hover,
.towns-header .towns-header__cta:focus-visible {
    color: var(--wp--custom--header--cta-background);
    background-color: transparent;
    border-color: var(--wp--custom--header--cta-background);
}

/* Town picker (Towns Directory) beside the logo. The panel is styled by
   the plugin; the button follows the header colors. */
.towns-header__brand {
    gap: var(--wp--preset--spacing--30);
}

.towns-header .td-town-picker__button {
    padding: 0.3125rem 0.75rem;
    font-size: var(--wp--preset--font-size--small);
    color: inherit;
    border-color: rgba(255, 255, 255, 0.35);
}

.towns-header .td-town-picker__button:hover {
    border-color: var(--wp--custom--header--link-hover);
}

/* "Find a business" search: a white pill */
.towns-listing-search {
    display: flex;
    align-items: center;
    min-width: 0;
    color: var(--wp--preset--color--contrast);
    background-color: var(--wp--preset--color--base);
    border: 1px solid var(--wp--preset--color--border);
    border-radius: 999px;
}

.towns-listing-search:focus-within {
    outline: 2px solid var(--wp--custom--header--link-hover);
    outline-offset: 1px;
}

.towns-listing-search .towns-listing-search__input {
    width: 11rem;
    min-width: 0;
    padding: 0.4375rem 0 0.4375rem 1rem;
    font: inherit;
    font-size: var(--wp--preset--font-size--small);
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 999px 0 0 999px;
    box-shadow: none;
    outline: 0;
}

.towns-listing-search__input::placeholder {
    color: var(--wp--preset--color--muted);
    opacity: 1;
}

.towns-listing-search__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: inherit;
    cursor: pointer;
    background: none;
    border: 0;
    border-radius: 999px;
}

.towns-listing-search__button:focus-visible {
    outline: 2px solid currentcolor;
    outline-offset: -4px;
}

/* On light pages (search results) the box sits on the page colors. */
.towns-template__header .towns-listing-search {
    max-width: 480px;
}

.towns-template__header .towns-listing-search .towns-listing-search__input {
    flex: 1 1 auto;
    width: auto;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    font-size: var(--wp--preset--font-size--medium);
}

/* Town menu: the second row of the header inside a town. */
.towns-town-bar {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.towns-town-bar__inner {
    display: flex;
    gap: var(--wp--preset--spacing--40);
    align-items: center;
    min-height: 44px;
}

.towns-town-bar__name {
    flex: 0 0 auto;
    font-family: var(--wp--preset--font-family--heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--wp--custom--header--link-hover);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.towns-town-bar__menu {
    display: flex;
    gap: var(--wp--preset--spacing--40);
    min-width: 0;
    padding: 0;
    margin: 0;
    overflow-x: auto;
    list-style: none;
    scrollbar-width: none;
}

.towns-town-bar__menu::-webkit-scrollbar {
    display: none;
}

.towns-town-bar__menu a {
    display: block;
    padding: 0.625rem 0;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 500;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.towns-town-bar__menu a:hover,
.towns-town-bar__menu a[aria-current="page"] {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.4em;
}

@media (max-width: 600px) {

    .towns-town-bar__name {
        display: none;
    }

    /* Logo and town picker share the row with the menu button; the picker
       drops under the logo when the name is long. */
    .towns-header__brand {
        flex: 0 1 auto;
        flex-wrap: wrap;
        row-gap: var(--wp--preset--spacing--10);
        min-width: 0;
        padding-block: var(--wp--preset--spacing--10);
    }

    .towns-logo__text {
        font-size: 1.25rem;
    }
}

/* Hamburger: hidden on desktop. */
.towns-nav-toggle {
    display: none;
}


/* ------------------------------------------------------------------
 * 3. Navigation (desktop, 1080px and up)
 * ------------------------------------------------------------------ */

.towns-nav__menu,
.towns-nav__menu .sub-menu {
    padding: 0;
    margin: 0;
    list-style: none;
}

.towns-nav__menu a {
    color: inherit;
    text-decoration: none;
}

.towns-submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: inherit;
    cursor: pointer;
    background: none;
    border: 0;
}

.towns-submenu-toggle .towns-icon {
    width: 1rem;
    height: 1rem;
    transition: transform var(--wp--custom--transition--fast);
}

.towns-submenu-toggle[aria-expanded="true"] .towns-icon {
    transform: rotate(180deg);
}

@media (min-width: 1080px) {

    .towns-nav__menu {
        display: flex;
        gap: var(--wp--preset--spacing--10);
        align-items: center;
    }

    .towns-nav__menu li {
        position: relative;
        display: flex;
        align-items: center;
    }

    .towns-nav__menu > li > a {
        padding: 0.625rem 0.75rem;
        font-size: var(--wp--preset--font-size--medium);
        font-weight: 500;
        border-radius: var(--wp--custom--radius--small);
    }

    .towns-nav__menu > li > a:hover,
    .towns-nav__menu > li > a[aria-current="page"],
    .towns-nav__menu > li.current-menu-ancestor > a {
        color: var(--wp--custom--header--link-hover);
        text-decoration: underline;
        text-decoration-thickness: 1px;
        text-underline-offset: 0.4em;
    }

    .towns-nav__menu > li > .towns-submenu-toggle {
        margin-left: -0.375rem;
        width: 1.5rem;
        height: 2rem;
    }

    /* Dropdowns */
    .towns-nav__menu .sub-menu {
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 10;
        display: none;
        min-width: 220px;
        padding: var(--wp--preset--spacing--20) 0;
        background-color: var(--wp--custom--header--submenu-background);
        border-radius: var(--wp--custom--radius--small);
        box-shadow: var(--wp--preset--shadow--lg);
    }

    .towns-nav__menu li:hover > .sub-menu,
    .towns-nav__menu li:focus-within > .sub-menu,
    .towns-nav__menu .towns-submenu-toggle[aria-expanded="true"] + .sub-menu {
        display: block;
    }

    .towns-nav__menu .sub-menu li {
        justify-content: space-between;
    }

    .towns-nav__menu .sub-menu a {
        flex: 1 1 auto;
        padding: 0.625rem 1.25rem;
        font-size: var(--wp--preset--font-size--small);
        white-space: nowrap;
    }

    .towns-nav__menu .sub-menu a:hover,
    .towns-nav__menu .sub-menu a[aria-current="page"] {
        background-color: var(--wp--custom--header--submenu-hover);
    }

    .towns-nav__menu .sub-menu .towns-submenu-toggle {
        width: 2rem;
        height: 2rem;
        margin-right: 0.5rem;
    }

    .towns-nav__menu .sub-menu .towns-submenu-toggle .towns-icon {
        transform: rotate(-90deg);
    }

    /* Third level flies out to the side. */
    .towns-nav__menu .sub-menu .sub-menu {
        top: calc(var(--wp--preset--spacing--20) * -1);
        left: 100%;
    }

    /* site.js adds .is-flipped when a flyout would leave the screen. */
    .towns-nav__menu .sub-menu.is-flipped {
        right: 0;
        left: auto;
    }

    .towns-nav__menu .sub-menu .sub-menu.is-flipped {
        right: 100%;
    }
}


/* ------------------------------------------------------------------
 * 4. Navigation (mobile drawer, below 1080px)
 * ------------------------------------------------------------------ */

@media (max-width: 1079px) {

    .towns-header__inner {
        min-height: var(--wp--custom--header--height-mobile);
    }

    .towns-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        margin-right: -10px;
        color: inherit;
        cursor: pointer;
        background: none;
        border: 0;
    }

    /* Three bars drawn with one span and two pseudo-elements. */
    .towns-nav-toggle__bars,
    .towns-nav-toggle__bars::before,
    .towns-nav-toggle__bars::after {
        display: block;
        width: 22px;
        height: 2px;
        background-color: currentcolor;
        border-radius: 2px;
        transition: transform var(--wp--custom--transition--fast), opacity var(--wp--custom--transition--fast);
    }

    .towns-nav-toggle__bars {
        position: relative;
    }

    .towns-nav-toggle__bars::before,
    .towns-nav-toggle__bars::after {
        position: absolute;
        left: 0;
        content: "";
    }

    .towns-nav-toggle__bars::before {
        top: -7px;
    }

    .towns-nav-toggle__bars::after {
        top: 7px;
    }

    .towns-nav-toggle[aria-expanded="true"] .towns-nav-toggle__bars {
        background-color: transparent;
    }

    .towns-nav-toggle[aria-expanded="true"] .towns-nav-toggle__bars::before {
        transform: translateY(7px) rotate(45deg);
    }

    .towns-nav-toggle[aria-expanded="true"] .towns-nav-toggle__bars::after {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Drawer: full screen below the header. */
    .towns-header__panel {
        position: fixed;
        top: var(--towns-header-bottom, var(--wp--custom--header--height-mobile));
        right: 0;
        bottom: 0;
        left: 0;
        display: none;
        flex-direction: column;
        gap: var(--wp--preset--spacing--50);
        align-items: stretch;
        justify-content: flex-start;
        padding: var(--wp--preset--spacing--30) var(--wp--style--root--padding-right) var(--wp--preset--spacing--60) var(--wp--style--root--padding-left);
        overflow-y: auto;
        overscroll-behavior: contain;
        background-color: var(--wp--custom--header--background);
    }

    .towns-header.is-open .towns-header__panel {
        display: flex;
    }

    .towns-nav__menu li {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .towns-nav__menu a {
        display: block;
        padding: 1rem 0;
        font-size: var(--wp--preset--font-size--large);
        font-weight: 500;
    }

    .towns-nav__menu a[aria-current="page"] {
        text-decoration: underline;
        text-underline-offset: 0.3em;
    }

    .towns-submenu-toggle {
        width: 44px;
        height: 44px;
    }

    .towns-nav__menu .sub-menu {
        display: none;
        grid-column: 1 / -1;
        padding-bottom: var(--wp--preset--spacing--20);
        padding-left: var(--wp--preset--spacing--30);
    }

    .towns-submenu-toggle[aria-expanded="true"] + .sub-menu {
        display: block;
    }

    .towns-nav__menu .sub-menu li {
        border-bottom: 0;
    }

    .towns-nav__menu .sub-menu a {
        padding: 0.625rem 0;
        font-size: var(--wp--preset--font-size--medium);
    }

    .towns-header__actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .towns-header__actions .towns-listing-search {
        align-self: stretch;
    }

    .towns-header__actions .towns-listing-search .towns-listing-search__input {
        flex: 1 1 auto;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        font-size: var(--wp--preset--font-size--medium);
    }

    .towns-header .towns-contact__phone {
        font-size: var(--wp--preset--font-size--medium);
    }

    body.towns-menu-open {
        overflow: hidden;
    }
}


/* ------------------------------------------------------------------
 * 5. Transparent header
 * Turned on per page in the editor: Page > Page Settings.
 * ------------------------------------------------------------------ */

.has-transparent-header .towns-header {
    position: fixed;
    right: 0;
    left: 0;
    background-color: transparent;
}

.has-transparent-header .towns-header.is-scrolled,
.has-transparent-header .towns-header.is-open {
    background-color: var(--wp--custom--header--background);
}


/* ------------------------------------------------------------------
 * 6. Footer
 * ------------------------------------------------------------------ */

.towns-footer {
    font-size: var(--wp--preset--font-size--small);
    color: var(--wp--custom--footer--text);
    background-color: var(--wp--custom--footer--background);
}

.towns-footer a {
    color: inherit;
}

.towns-footer__main {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
    padding-top: var(--wp--preset--spacing--60);
    padding-bottom: var(--wp--preset--spacing--50);
}

.towns-footer__column {
    display: flex;
    flex: 1 1 160px;
    flex-direction: column;
    gap: var(--wp--preset--spacing--30);
}

.towns-footer__column--brand {
    flex: 1.6 1 240px;
}

.towns-footer__column--cta {
    flex: 0 0 auto;
}

.towns-footer__heading {
    margin: 0;
    font-family: var(--wp--preset--font-family--body);
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    line-height: 1.4;
    color: var(--wp--custom--footer--heading);
    text-transform: none;
    letter-spacing: 0;
}

.towns-footer__tagline {
    max-width: 320px;
    margin: 0;
    line-height: 1.6;
    color: var(--wp--custom--footer--muted);
}

.towns-footer .towns-logo__image {
    max-height: 56px;
}

.towns-footer__menu {
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--20);
    padding: 0;
    margin: 0;
    list-style: none;
}

.towns-footer__menu a {
    color: var(--wp--custom--footer--muted);
    text-decoration: none;
}

.towns-footer__menu a:hover {
    color: var(--wp--custom--footer--text);
    text-decoration: underline;
    text-underline-offset: 0.25em;
}

.towns-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
    align-items: center;
    justify-content: space-between;
    padding-top: var(--wp--preset--spacing--40);
    padding-bottom: var(--wp--preset--spacing--40);
    border-top: 1px solid var(--wp--custom--footer--divider);
}

.towns-footer__text {
    margin: 0;
    color: var(--wp--custom--footer--muted);
}

.towns-footer__text--right {
    text-align: right;
}

.towns-footer__text a {
    font-weight: 600;
    color: var(--wp--custom--footer--text);
}

@media (max-width: 781px) {
    .towns-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .towns-footer__text--right {
        text-align: left;
    }
}


/* ------------------------------------------------------------------
 * 7. Templates (archive, search, single post, 404)
 * ------------------------------------------------------------------ */

.towns-template {
    padding-top: var(--wp--preset--spacing--60);
    padding-bottom: var(--wp--preset--spacing--60);
}

.towns-template__header {
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--30);
    max-width: var(--wp--style--global--content-size);
    margin-bottom: var(--wp--preset--spacing--50);
}

.towns-template__title {
    margin: 0;
}

.towns-template__description {
    margin: 0;
    color: var(--wp--preset--color--contrast-alt);
}

.towns-template__description p {
    margin: 0;
}

.towns-single__header {
    padding-top: var(--wp--preset--spacing--60);
    padding-bottom: var(--wp--preset--spacing--40);
}

.towns-single__meta {
    margin: 0 0 var(--wp--preset--spacing--20);
    font-size: var(--wp--preset--font-size--x-small);
    font-weight: 600;
    color: var(--wp--preset--color--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.towns-single__title {
    margin: 0;
}

.towns-single__media {
    margin: 0 0 var(--wp--preset--spacing--50);
}

.towns-single__media img {
    display: block;
    width: 100%;
    border-radius: var(--wp--custom--radius--medium);
}

.towns-single .entry-content {
    padding-bottom: var(--wp--preset--spacing--60);
}


/* ------------------------------------------------------------------
 * 8. Listing pages (Towns Directory)
 * archive-listing.php, taxonomy-listing_*.php and single-listing.php.
 * Cards are styled in base.css (section 10).
 * ------------------------------------------------------------------ */

.towns-directory-hero {
    color: var(--wp--preset--color--base);
    background-color: var(--wp--preset--color--contrast);
}

.towns-directory-hero__inner {
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--30);
    padding-top: var(--wp--preset--spacing--60);
    padding-bottom: var(--wp--preset--spacing--60);
}

.towns-directory-hero__inner > * {
    margin: 0;
}

.towns-directory-hero h1 {
    color: var(--wp--preset--color--base);
}

.towns-directory-hero .towns-eyebrow {
    color: var(--wp--preset--color--accent);
}

.towns-directory-hero__description {
    max-width: 680px;
    font-size: var(--wp--preset--font-size--large);
    color: var(--wp--preset--color--frost);
}

.towns-directory-hero__description p {
    margin: 0;
}

.towns-directory-hero__scope a {
    font-size: var(--wp--preset--font-size--small);
    color: var(--wp--preset--color--frost);
}

/* Page heading on the town side pages Towns Directory makes */
.towns-page-heading {
    padding-top: var(--wp--preset--spacing--60);
    padding-bottom: var(--wp--preset--spacing--30);
}

.towns-page-heading > * {
    margin-top: 0;
    margin-bottom: 0;
}

/* Breadcrumbs (Towns Directory or Yoast SEO) */
.towns-breadcrumbs {
    font-size: var(--wp--preset--font-size--small);
}

.towns-breadcrumbs ol,
.towns-breadcrumbs p {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.towns-breadcrumbs a {
    color: inherit;
}

.towns-directory-hero .towns-breadcrumbs {
    color: var(--wp--preset--color--frost);
}

/* the plugin's muted grey is too dark on the navy hero */
.towns-directory-hero .td-breadcrumbs__item[aria-current="page"],
.towns-directory-hero .td-breadcrumbs__item + .td-breadcrumbs__item::before {
    color: var(--wp--preset--color--frost);
    opacity: 0.85;
}

.towns-directory {
    padding-top: var(--wp--preset--spacing--50);
    padding-bottom: var(--wp--preset--spacing--60);
}

.towns-directory__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wp--preset--spacing--30);
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: var(--wp--preset--spacing--50);
}

.towns-directory__filters {
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--30);
}

.towns-filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
    align-items: flex-start;
}

/* As tall as one row of chips, so the label lines up with the first row. */
.towns-filter__label {
    display: flex;
    flex: 0 0 4.5rem;
    align-items: center;
    min-height: 44px;
    margin: 0;
    font-size: var(--wp--preset--font-size--x-small);
    font-weight: 600;
    color: var(--wp--preset--color--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.towns-filter .towns-chips {
    flex: 1 1 0;
    min-width: 0;
}

@media (max-width: 600px) {

    .towns-filter__label {
        flex-basis: 100%;
        min-height: 0;
    }
}

.towns-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wp--preset--spacing--20);
    padding: 0;
    margin: 0;
    list-style: none;
}

a.towns-chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    box-sizing: border-box;
    padding: 0.5rem 1.125rem;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    color: var(--wp--preset--color--primary);
    text-decoration: none;
    border: 1px solid var(--wp--preset--color--primary);
    border-radius: var(--wp--custom--radius--pill);
}

a.towns-chip:hover,
a.towns-chip[aria-current="page"] {
    color: var(--wp--preset--color--on-primary);
    background-color: var(--wp--preset--color--primary);
}

.towns-sort {
    display: flex;
    gap: var(--wp--preset--spacing--20);
    align-items: center;
    font-size: var(--wp--preset--font-size--small);
}

.towns-sort a[aria-current="true"] {
    font-weight: 700;
    color: var(--wp--preset--color--contrast);
    text-decoration: none;
}

.towns-directory__layout {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wp--preset--spacing--50);
    align-items: flex-start;
}

.towns-directory__main {
    flex: 999 1 600px;
    min-width: 0;
}

.towns-directory__sidebar {
    display: flex;
    flex: 1 1 300px;
    flex-direction: column;
    gap: var(--wp--preset--spacing--40);
    align-items: center;
    max-width: 336px;
    margin-inline: auto;
}

.towns-widget {
    width: 100%;
}

.towns-widget > :first-child {
    margin-top: 0;
}

.towns-widget__title,
.towns-widget h2 {
    font-size: var(--wp--preset--font-size--large);
}

/* Listing grid: 4 across (3 beside the sidebar), 2 on tablets, 1 on phones. */
.towns-directory .td-listings {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
    margin-bottom: var(--wp--preset--spacing--50);
}

.towns-directory__layout.has-sidebar .td-listings {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1079px) {

    .towns-directory .td-listings,
    .towns-directory__layout.has-sidebar .td-listings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {

    .towns-directory .td-listings,
    .towns-directory__layout.has-sidebar .td-listings {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Shorter photos and tighter text in the directory grid. */
.towns-directory .towns-listing-card__media img {
    aspect-ratio: 16 / 10;
}

.towns-directory .towns-listing-card__body {
    padding: var(--wp--preset--spacing--30);
}

.towns-directory__empty {
    padding: var(--wp--preset--spacing--50);
    text-align: center;
    background-color: var(--wp--preset--color--surface);
    border-radius: var(--wp--custom--card--radius);
}

/* Single listing */
.towns-listing {
    padding-top: var(--wp--preset--spacing--50);
    padding-bottom: var(--wp--preset--spacing--60);
}

.towns-listing__header {
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--20);
    margin-bottom: var(--wp--preset--spacing--50);
}

.towns-listing__header > * {
    margin: 0;
}

.towns-listing__header .towns-listing-card__badges {
    margin-top: var(--wp--preset--spacing--10);
}

.towns-listing__layout {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wp--preset--spacing--50);
    align-items: flex-start;
}

.towns-listing__main {
    display: flex;
    flex: 999 1 560px;
    flex-direction: column;
    gap: var(--wp--preset--spacing--40);
    min-width: 0;
}

.towns-listing__main > * {
    margin: 0;
}

.towns-listing__image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--wp--custom--card--radius);
}

.towns-listing__summary {
    font-size: var(--wp--preset--font-size--large);
    line-height: 1.55;
}

.towns-listing__section h2 {
    margin: 0 0 var(--wp--preset--spacing--20);
    font-size: var(--wp--preset--font-size--x-large);
}

.towns-listing__section p {
    margin: 0;
}

.towns-listing__map iframe {
    display: block;
    width: 100%;
    min-height: 320px;
    border: 0;
    border-radius: var(--wp--custom--card--radius);
}

.towns-listing__aside {
    display: flex;
    flex: 1 1 320px;
    flex-direction: column;
    gap: var(--wp--preset--spacing--40);
}

.towns-listing__details {
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--30);
    padding: var(--wp--preset--spacing--40);
    background-color: var(--wp--preset--color--surface);
    border-radius: var(--wp--custom--card--radius);
}

.towns-listing__details h2 {
    margin: 0;
    font-size: var(--wp--preset--font-size--x-large);
}

.towns-listing__claim {
    margin: 0;
    font-size: var(--wp--preset--font-size--small);
    color: var(--wp--preset--color--muted);
}

.towns-listing__claim a {
    font-weight: 600;
}

.towns-listing__detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
}

.towns-listing__detail dt {
    font-size: var(--wp--preset--font-size--x-small);
    font-weight: 600;
    color: var(--wp--preset--color--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.towns-listing__detail dd {
    margin: 0;
}

.towns-listing__related {
    padding-top: var(--wp--preset--spacing--60);
    margin-top: var(--wp--preset--spacing--60);
    border-top: 1px solid var(--wp--preset--color--border);
}

.towns-listing__related-header {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wp--preset--spacing--30);
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: var(--wp--preset--spacing--40);
}

.towns-listing__related-header h2 {
    margin: 0;
}

.towns-template__scope {
    margin: 0;
    font-size: var(--wp--preset--font-size--small);
}

/* A town's side pages: space between the content and the footer */
.towns-town-subpage .towns-main {
    padding-bottom: 40px;
}
