.fm-search {
    --fm-color-text: #000d4d;
    --fm-color-text-muted: rgba(0, 3, 69, 0.7);
    --fm-color-text-subtle: rgba(0, 3, 69, 0.5);
    --fm-color-primary: #007bff;
    --fm-color-primary-subtle: #ecf3ff;
    --fm-color-on-primary: #ffffff;
    --fm-color-surface: #ffffff;
    --fm-color-surface-highlight: #ecf3ff;
    --fm-color-border: #cbcddf;
    --fm-color-border-focus: #007bff;
    --fm-color-danger: #ff0000;
    --fm-color-success: #4a9400;
    --fm-shadow-sm: 0 12px 24px rgba(0, 0, 0, 0.08);
    --fm-shadow-md: 0 24px 48px rgba(0, 0, 0, 0.08);
    --fm-shadow-focus: 0 0 0 4px #ecf3ff;
    --fm-radius-sm: 4px;
    --fm-radius-md: 8px;

    position: relative;
    z-index: 5;
    font-family: Lato, system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--fm-color-text);
}

/* Same navy hero as the booking search page; it also covers the row background set in SiteOrigin */
.fm-hero {
    position: relative;
    z-index: 1;
    padding: 0 0 48px;
    background: #002080;
    color: #ffffff;
    font-family: Lato, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* The car photo sits behind the headline with its bottom edge at the end of the texts, right above the form */
.fm-hero__top {
    padding: 136px 0 32px;
    background: url('hero-background.jpg') center bottom / clamp(760px, 100%, 1600px) auto no-repeat;
}

.fm-hero__intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-shadow: 0 2px 12px rgba(0, 13, 77, 0.6);
}

.fm-hero__rating {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 0 16px;
    padding: 4px 12px 4px 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    font-size: 12px;
    line-height: 16px;
    color: #ffffff;
}

.fm-hero__rating-source {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 2px;
    border-radius: 50%;
    background: #ffffff;
}

.fm-hero__rating-logo {
    width: 16px;
    height: 16px;
}

.fm-hero__rating-average {
    font-size: 18px;
    line-height: 22px;
    font-weight: 700;
}

.fm-hero__stars {
    display: inline-flex;
    gap: 1px;
    margin-right: 6px;
    color: #ffae00;
}

.fm-hero__stars svg {
    width: 14px;
    height: 14px;
}

.fm-hero__rating-count strong {
    font-weight: 700;
}

.fm-hero__title {
    margin: 0;
    font-size: 32px;
    line-height: 34px;
    font-weight: 700;
    color: #ffffff;
}

.fm-hero__title-highlight {
    color: #007bff;
}

.fm-hero__title-desktop,
.fm-hero__subtitle {
    display: none;
}

.fm-hero .fm-search__card {
    margin: 0 auto;
}

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

.fm-search__card {
    max-width: 480px;
    margin: 0;
    padding: 12px;
    border-radius: var(--fm-radius-md);
    background: var(--fm-color-primary-subtle);
    box-shadow: var(--fm-shadow-sm);
}

.fm-search__ticket-types {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.fm-search__radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    line-height: 20px;
    color: var(--fm-color-text);
    cursor: pointer;
}

.fm-search__radio input {
    appearance: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1px solid var(--fm-color-border);
    border-radius: 50%;
    background: var(--fm-color-surface);
    cursor: pointer;
}

.fm-search__radio input:checked {
    border: 2px solid var(--fm-color-primary);
    background: radial-gradient(circle, var(--fm-color-primary) 0 5px, var(--fm-color-surface) 6px);
}

.fm-search__radio input:focus-visible {
    outline: none;
    box-shadow: var(--fm-shadow-focus);
}

.fm-search__fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fm-search__field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.fm-search__label {
    display: block;
    margin: 0;
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
    color: var(--fm-color-text-muted);
}

.fm-search__control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 0 8px;
    border: 1px solid var(--fm-color-border);
    border-radius: var(--fm-radius-sm);
    background: var(--fm-color-surface);
    color: var(--fm-color-text);
    font: inherit;
    text-align: left;
}

.fm-search__control:focus-within,
.fm-search__control--button:focus-visible {
    outline: none;
    border-color: var(--fm-color-border-focus);
    box-shadow: var(--fm-shadow-focus);
}

.fm-search__field--invalid .fm-search__control {
    border-color: var(--fm-color-danger);
}

.fm-search__control--button {
    justify-content: space-between;
    cursor: pointer;
}

.fm-search__input {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 15px;
    color: var(--fm-color-text);
}

.fm-search__input::placeholder {
    color: var(--fm-color-text-subtle);
}

.fm-search__input:focus {
    outline: none;
}

.fm-search__value {
    font-size: 15px;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fm-search__promo {
    font-size: 12px;
    line-height: 16px;
    color: var(--fm-color-text);
}

.fm-search__promo strong {
    font-weight: 400;
    color: var(--fm-color-primary);
}

.fm-search__field--promo .fm-search__value {
    display: none;
}

.fm-search__field--promo .fm-search__icon {
    display: none;
}

.fm-search__icon {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--fm-color-primary);
}

.fm-search__place-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    color: var(--fm-color-primary);
}

.fm-search__place-icon[hidden] {
    display: none;
}

.fm-search__place-icon svg,
.fm-search__suggestion-icon svg {
    width: 16px;
    height: 16px;
}

.fm-search__error {
    margin: 0;
    font-size: 12px;
    line-height: 16px;
    color: var(--fm-color-danger);
}

.fm-search__error[hidden],
.fm-search__dropdown[hidden],
.fm-search__popover[hidden],
.fm-search__promo[hidden],
.fm-search__dropdown-title[hidden],
.fm-search__dropdown-status[hidden] {
    display: none;
}

.fm-search__quick-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.fm-search__chip {
    padding: 4px 6px;
    border: 1px solid var(--fm-color-primary);
    border-radius: var(--fm-radius-sm);
    background: transparent;
    font: inherit;
    font-size: 12px;
    line-height: 16px;
    color: var(--fm-color-primary);
    cursor: pointer;
}

.fm-search__chip:hover,
.fm-search__chip:focus-visible {
    outline: none;
    background: var(--fm-color-surface);
}

.fm-search__dropdown,
.fm-search__popover {
    position: absolute;
    top: calc(16px + 4px + 40px + 4px);
    left: 0;
    z-index: 20;
    width: 100%;
    min-width: 280px;
    padding: 12px;
    border-radius: var(--fm-radius-md);
    background: var(--fm-color-surface);
    box-shadow: var(--fm-shadow-md);
}

.fm-search__dropdown {
    padding: 8px 0;
}

.fm-search__dropdown-title,
.fm-search__dropdown-status {
    margin: 0;
    padding: 4px 12px;
    font-size: 12px;
    line-height: 16px;
    color: var(--fm-color-text-muted);
}

.fm-search__suggestions {
    max-height: 320px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.fm-search__suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 15px;
    line-height: 20px;
    cursor: pointer;
}

.fm-search__suggestion:hover,
.fm-search__suggestion[aria-selected='true'] {
    background: var(--fm-color-surface-highlight);
}

.fm-search__suggestion-icon {
    display: inline-flex;
    flex: none;
    width: 16px;
    color: var(--fm-color-primary);
}

.fm-search__suggestion-label {
    flex: 1;
    min-width: 0;
}

.fm-search__badge {
    flex: none;
    padding: 2px 6px;
    border-radius: var(--fm-radius-sm);
    background: var(--fm-color-primary-subtle);
    font-size: 10px;
    line-height: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--fm-color-primary);
}

.fm-search__popover {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fm-search__popover-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
}

.fm-search__native {
    height: 40px;
    padding: 0 8px;
    border: 1px solid var(--fm-color-border);
    border-radius: var(--fm-radius-sm);
    font: inherit;
    font-size: 15px;
    color: var(--fm-color-text);
}

.fm-search__native:focus {
    outline: none;
    border-color: var(--fm-color-border-focus);
    box-shadow: var(--fm-shadow-focus);
}

.fm-search__button,
.fm-search__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--fm-radius-sm);
    background: var(--fm-color-primary);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    color: var(--fm-color-on-primary);
    cursor: pointer;
}

.fm-search__button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fm-search__submit .fm-search__icon {
    color: currentColor;
}

.fm-search__submit:focus-visible,
.fm-search__button:focus-visible {
    outline: none;
    box-shadow: var(--fm-shadow-focus);
}

.fm-search__counter {
    display: grid;
    grid-template-columns: 1fr 32px 32px 32px;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.fm-search__counter--students {
    padding-top: 12px;
    border-top: 1px solid var(--fm-color-border);
}

.fm-search__counter-button {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--fm-color-primary);
    border-radius: 50%;
    background: var(--fm-color-surface);
    font-size: 18px;
    line-height: 1;
    color: var(--fm-color-primary);
    cursor: pointer;
}

.fm-search__counter-button:disabled {
    border-color: var(--fm-color-border);
    color: var(--fm-color-border);
    cursor: not-allowed;
}

.fm-search__counter-value {
    text-align: center;
    font-weight: 700;
}

.fm-search__dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.fm-search__field--return .fm-search__popover {
    right: 0;
    left: auto;
}

.fm-search__submit {
    width: 100%;
}

@media (max-width: 767.98px) {
    /* Room for the EU badge pinned to the bottom right of the hero row, so it does not cover the search button */
    .fm-hero {
        padding-bottom: 104px;
    }

    .fm-hero__top {
        padding: 96px 0 24px;
    }
}

@media (min-width: 992px) {
    .fm-hero {
        padding-bottom: 96px;
    }

    .fm-hero__top {
        padding: 160px 0 48px;
    }

    .fm-hero__rating {
        margin-bottom: 8px;
    }

    .fm-hero__title {
        font-size: 48px;
        line-height: 54px;
        letter-spacing: -0.5px;
    }

    .fm-hero__title-desktop {
        display: inline;
    }

    .fm-hero__title-mobile {
        display: none;
    }

    .fm-hero__subtitle {
        display: block;
        margin: 32px 0 0;
        font-size: 18px;
        line-height: 22px;
        color: #ffffff;
    }

    .fm-search__card {
        max-width: none;
        padding: 16px;
    }

    .fm-search__fields {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.8fr) minmax(0, 0.9fr) minmax(0, 0.85fr);
        align-items: start;
        gap: 12px;
    }

    .fm-search__dates {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .fm-search__actions {
        padding-top: 20px;
    }

    .fm-search__field--passengers .fm-search__popover {
        right: 0;
        left: auto;
    }
}

/* Past 1600px the photo no longer spans the screen, so its side edges fade into the navy */
@media (min-width: 1600px) {
    .fm-hero__top {
        background:
            linear-gradient(90deg, #002080, rgba(0, 32, 128, 0) 15%, rgba(0, 32, 128, 0) 85%, #002080) center bottom / 1600px 100% no-repeat,
            url('hero-background.jpg') center bottom / 1600px auto no-repeat;
    }
}
