:root {
    --ff-base: 'Oswald', sans-serif;
}

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

body {
    font-family: var(--ff-base);
    font-weight: 300;
    line-height: 1.6;
}

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

header {
    margin-inline: .5rem;

    display: flex;
    flex-direction: column;
    gap: 1.3rem;
}

h1 {
    font-size: clamp(3rem, 10vw + .5rem, 8rem);
    font-weight: 700;
    line-height: 1.1;

    align-self: end;
}

header form {
    max-width: 250px;

    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

#input {
    padding: .3rem .5rem;
    font-family: inherit;
    font-size: 1.3rem;
    font-weight: 300;
    line-height: 1;
    border: 0;
    outline: 1px solid lightgrey;

    flex-basis: 100%;
    flex-grow: 1;
}

#input:focus {
    outline: 2px solid gray;
}

#search-btn {
    padding: .5rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 1px;
    background-color: lightgrey;
    border: 0;
    outline: 0;
    cursor: pointer;
}

#search-btn:focus,
#search-btn:hover {
    color: whitesmoke;
    background-color: gray;
}

.container {
    margin-block-start: 3rem;
    margin-inline: .5rem;

    display: grid;
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    row-gap: 5rem;
}

.country {
    margin-inline: auto;
    max-width: 320px;
    box-shadow: rgba(9, 30, 66, 0.25) 0px 1px 1px, rgba(9, 30, 66, 0.13) 0px 0px 1px 1px;
}

.country-info {
    padding: .5rem;
    font-weight: 300;
}

.country-info span {
    font-weight: 400;
}

.country-info h2 {
    line-height: 1.1;
    margin-bottom: .3em;
    font-weight: 700;
}

.neighbors {
    margin-inline: auto;
    max-width: max-content;
    height: 100%;

    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .3rem;

    position: relative;
}

/*.neighbors::before {
    content: 'Neighbor countries';
    position: absolute;
    top: -40px;
    font-size: 1.4rem;
    font-weight: 200;
    letter-spacing: 1px;
}*/

/*.neighbors:empty .neighbors::before {
    display: none
}*/

.neighbor {
    display: grid;
}

.neighbor > * {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
}

.neighbor-flag {
    width: 100%;
    height: 100%;
}

.neighbor-flag img {
    object-fit: cover;
}

.neighbor-name {
    padding: .2em;
    font-weight: 300;
    line-height: 1.1;
    align-self: end;
}

@media (min-width: 780px) {
    header {
        margin-top: .5em;

        flex-direction: row;
        align-items: center;
        gap: 5rem;
    }

    header h1 {
        line-height: 80px;
        align-self: start;
        order: 1;
    }

    .container {
        margin-block-start: 6rem;
        padding-inline-start: 7.5rem;

        grid-template-columns: auto auto;
        justify-content: start;
        align-items: start;
        column-gap: 5rem;
    }

    .country {
        margin-inline: unset;
    }

    .neighbors {
        margin-inline: unset;
        grid-template-columns: repeat(4, 170px);
        align-items: start;
        place-content: start;
    }
}