:root {
    /* Available colors */
    --color-dark-blue: hsl(224, 27%, 22%);
    --color-dark-grey: hsl(224, 38%, 14%);
    --color-orange: hsl(20, 86%, 59%);
    --color-blue: hsl(191, 76%, 46%);
    --color-teal: hsl(171, 61%, 45%);
    --color-grey: hsl(220, 7%, 83%);
    --color-light-grey: hsl(0, 0%, 94%);
    --color-green: hsl(145, 63%, 42%);
    --color-purple: hsl(282, 22%, 55%);
    --color-black: hsl(0, 0%, 0%);
    --color-white: hsl(0, 100%, 100%);

    /* Configuration */
    --border-radius: 6px;
    /* Colors light scheme */
    --color-accent: var(--color-green);
    --color-text: var(--color-dark-blue);
    --color-background: var(--color-light-grey);
    --color-top-results-background: var(--color-dark-blue);
    --color-top-results-text: var(--color-white);
    --color-result-card-background: var(--color-white);
    --color-result-card-text: var(--color-dark-blue);

    --card-shadow: 0 4px 24px 0 rgb(34 41 47 / 10%);
}

:root[data-color-scheme="dark"] {
    --color-text: var(--color-grey);
    --color-background: var(--color-dark-grey);
    --color-top-results-background: var(--color-grey);
    --color-top-results-text: var(--color-dark-blue);
    --color-result-card-background: var(--color-dark-blue);
    --color-result-card-text: var(--color-light-grey);

    --card-shadow: 0 4px 24px 0 rgb(34 41 47 / 24%);
    }
}

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

@keyframes fadein {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@font-face {
    font-family: "Open Sans";
    src: url(../fonts/OpenSans-VariableFont.ttf) format("truetype");
    font-weight: 200 900;
    font-stretch: normal;
    font-style: normal;
}

* {
    font-family: "Open Sans", Helvetica, Arial, Sans-Serif;
}

body {
    background: var(--color-background);
    font-weight: 400;
    line-height: 1.8;
    margin: 0;
    padding: 1em;
}

a:link,
a:visited,
ahover,
a:active,
a:focus {
    text-decoration: none;
    color: #000;
}

textarea:focus,
input:focus {
    outline: 0;
}

h1 {
    font-size: min(max(2em, 4vw), 3em);
    font-weight: 700;
    color: var(--color-text);
    margin: 20px 0 30px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
}

h2 {
    margin: 0;
}

.display-block {
    display: block !important;
}

.hidden {
    display: none !important;
}

#logo {
    height: 1.3em;
    vertical-align: -5px;
    margin: 0;
    fill: var(--color-accent);
}

.container {
    max-width: 960px;
    margin: 0 auto;
}

.masonry {
    columns: 3 300px;
    column-gap: 1em;
}

.masonry div {
    break-inside: avoid;
}

.result-wrapper,
#top-results-wrapper,
#introduction-wrapper {
    margin-bottom: 1em;
    box-shadow: var(--card-shadow);
}

#introduction-wrapper {
    padding: 15px;
    background: var(--color-accent);
    color: #fff;
    text-align: center;
    border-radius: var(--border-radius);
    animation-duration: 1s;
    animation-name: fadein;
    width: 80%;
    max-width: 640px;
    margin: 0 auto;
}

#title-wrapper,
#row-input,
#disclaimer {
    text-align: center;
}

.result-content,
.error-message,
#top-results {
    padding: 0 0 10px;
    background: var(--color-result-card-background);
    color: var(--color-result-card-text);
    border-radius: var(--border-radius);
    animation-duration: 0.5s;
    animation-name: fadein;
}

.synonym {
    display: flex;
    align-items: center;
}

.pointer {
    cursor: pointer;
}

.cursor-not-allowed {
    cursor: not-allowed !important;
}

.search-icon {
    display: inline-block;
    opacity: 0.5;
    height: 0.5em;
    width: 0.5em;
    margin-left: 0.25em;
    background-color: var(--color-result-card-text);
    mask-image: url(../img/magnifying-glass-solid.svg);
    -webkit-mask-image: url(../img/magnifying-glass-solid.svg);
}

.external-link {
    display: inline-block;
    background-image: url(../img/arrow-up-right-from-square-solid.svg);
    height: 0.75em;
    width: 0.75em;
    margin-left: 0.5em;
}

#row-input {
    margin: 0 0 20px 0;
}

#input-term {
    width: 50%;
    display: inline;
    padding: 6px 12px;
    border: 3px solid #9a9b9a;
    border-radius: 0;
    font-size: 0.9em;
    background-color: var(--color-result-card-background);
    color: var(--color-result-card-text);
}

#input-button {
    background: var(--color-text);
    color: var(--color-background);
    border: 0;
    height: 38px;
    width: 100px;
    font-size: 0.9em;
    font-weight: 700;
    margin: 0;
    cursor: pointer;
}

#result h2 {
    color: #fff;
    padding: 0.75em 0;
    font-size: 1em;
    font-weight: 700;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    display: flex;
    justify-content: center;
    align-items: center;
}

#top-results-wrapper h2 {
    color: var(--color-top-results-text);
    background: var(--color-top-results-background);
}

#top-results-wrapper ol li {
    animation-duration: 0.5s;
    animation-name: fadein;
}

#top-results-loading-spinner {
    animation-name: spin;
    animation-duration: 1000ms;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    height: 3em;
    fill: var(--color-text);
    margin: 35px auto 0 auto;
    display: block;
}

.result-list {
    list-style-type: none;
    margin: 15px 30px;
    padding: 0;
    overflow: hidden;
    position: relative;
}

#disclaimer {
    font-weight: 400;
    margin: 15px 0 15px 0;
    color: #adaeae;
}

#disclaimer a:link,
#disclaimer a:visited,
#disclaimer a:hover,
#disclaimer a:active,
#disclaimer a:focus {
    color: #adaeae;
}

.error-message {
    padding: 10px;
    background: #f56545;
    color: #fff;
    text-align: center;
    width: 80%;
    max-width: 640px;
    margin: 0 auto;
}

.error-message p {
    margin: 0;
}

#scroll-up {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    text-align: center;
    height: 40px;
    width: 40px;
    fill: #fafafb;
    background: #cccccc;
    cursor: pointer;
    border-radius: var(--border-radius);
    align-items: center;
    justify-content: center;
    animation-duration: 0.5s;
    animation-name: fadein;
}

#scroll-up-btn svg {
    height: 1.5em;
}

.show-more {
    display: none;
    border: 0;
    margin: 0 auto;
    background-color: transparent;
    cursor: pointer;
    color: #666;
    font-size: 0.7em;
}

.bottom-fading:after {
    background: linear-gradient(
        transparent 0%,
        var(--color-result-card-background)
    );
    content: "";
    width: 100%;
    height: 2em;
    position: absolute;
    left: 0;
    bottom: 0;
}

#dark-mode-toggle {
    position: absolute;
    z-index: 100;
    top: 1em;
    right: 1em;
    color: var(--color-text);
    border: 2px solid currentColor;
    padding: 4px;
    background: transparent;
    cursor: pointer;
    border-radius: 5px;
    width: 30px;
    height: 30px;
}
