/* HEADER SEARCH BAR */
.search-bar {
    display: flex;
}
.search-bar input,
.search-btn,
.search-btn:before,
.search-btn:after {
    transition: all 0.25s ease-out;
}
.search-bar input,
.search-btn {
    width: 3em;
    height: 3em;
}
.search-bar input:invalid:not(:focus),
.search-btn {
    cursor: pointer;
}
.search-bar,
.search-bar input:focus,
.search-bar input:valid  {
    width: 100%;
}
.search-bar input:focus,
.search-bar input:not(:focus) + .search-btn:focus {
    outline: transparent;
}
.search-bar {
    margin: auto;

    justify-content: flex-end;
    max-width: 30em;
}
.search-bar input {
    background: transparent;
    border-radius: 1.5em;
    box-shadow: 0 0 0 0.4em #84aa46 inset;
    padding: 0.75em;
    transform: translate(0.5em,0.5em) scale(0.5);
    transform-origin: 100% 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.search-bar input::-webkit-search-decoration {
    -webkit-appearance: none;
}
.search-bar input:focus,
.search-bar input:valid {
    background: #fff;
    border-radius: 0.375em 0 0 0.375em;
    box-shadow: 0 0 0 0.1em #d9d9d9 inset;
    transform: scale(1);
}
.search-btn {
    background: #84aa46;
    border-radius: 0 0.75em 0.75em 0 / 0 1.5em 1.5em 0;
    padding: 0.75em;
    position: relative;
    transform: translate(0.25em,0.25em) rotate(45deg) scale(0.25,0.125);
    transform-origin: 0 50%;
}
.search-btn:before,
.search-btn:after {
    content: "";
    display: block;
    opacity: 0;
    position: absolute;
}
.search-btn:before {
    border-radius: 50%;
    box-shadow: 0 0 0 0.2em #f1f1f1 inset;
    top: 0.75em;
    left: 0.75em;
    width: 1.2em;
    height: 1.2em;
}
.search-btn:after {
    background: #f1f1f1;
    border-radius: 0 0.25em 0.25em 0;
    top: 51%;
    left: 51%;
    width: 0.75em;
    height: 0.25em;
    transform: translate(0.2em,0) rotate(45deg);
    transform-origin: 0 50%;
}
.search-btn span {
    display: inline-block;
    overflow: hidden;
    width: 1px;
    height: 1px;
}

/* Active state */
.search-bar input:focus + .search-btn,
.search-bar input:valid + .search-btn {
    background: #84aa46;
    border-radius: 0 0.375em 0.375em 0;
    transform: scale(1);
    margin-right:10px;
}
.search-bar input:focus + .search-btn:before,
.search-bar input:focus + .search-btn:after,
.search-bar input:valid + .search-btn:before,
.search-bar input:valid + .search-btn:after {
    opacity: 1;
}
.search-bar input:focus + .search-btn:hover,
.search-bar input:valid + .search-btn:hover,
.search-bar input:valid:not(:focus) + .search-btn:focus {
    background: #84aa46;
}
.search-bar input:focus + .search-btn:active,
.search-bar input:valid + .search-btn:active {
    transform: translateY(1px);
}

@media screen and (prefers-color-scheme: dark) {
    /*body, input {*/
    /*    color: #f1f1f1;*/
    /*}*/
    /*body {*/
    /*    background: #171717;*/
    /*}*/
    /*.search-bar input {*/
    /*    box-shadow: 0 0 0 0.4em #f1f1f1 inset;*/
    /*}*/
    /*.search-bar input:focus,*/
    /*.search-bar input:valid {*/
    /*    background: #3d3d3d;*/
    /*    box-shadow: 0 0 0 0.1em #3d3d3d inset;*/
    /*}*/
    /*.search-btn {*/
    /*    background: #f1f1f1;*/
    /*}*/
}

/* BMI CALCULATOR*/

.c-bmi {
    background-color: hsl(211, 20%, 92%);
    border-radius: 2.25rem;
    box-sizing: border-box;
    font-family: ui-sans-serif, system-ui, sans-serif;
    padding: 1rem 2rem;
    max-width: 42rem;
    width: 100%;
    margin: 0 auto;
    margin-bottom: 50px;
    -webkit-box-shadow: 0px 10px 14px -1px rgba(0,0,0,0.25);
    -moz-box-shadow: 0px 10px 14px -1px rgba(0,0,0,0.25);
    box-shadow: 0px 10px 14px -1px rgba(0,0,0,0.25);
}
.c-bmi fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}
.c-bmi__group-text {
    display: none;
    font-size: small;
    order: 2;
    padding: 1rem 0;
    text-align: left;
    width: 100%;
}
.c-bmi__groups {
    border: 0;
    flex-wrap: wrap;
    font-size: x-small;
    padding: 0;
    text-align: center;
    width: 100%;
}
.c-bmi__groups label {
    display: block;
    padding: .5rem;
    position: relative;
}

[for="bmi-g0"] { background-color: #4691e2; }
[for="bmi-g1"] { background-color: #0cb764; }
[for="bmi-g2"] { background-color: #febf18; }
[for="bmi-g3"] { background-color: #fc8711; }
[for="bmi-g4"] { background-color: #ff6455; }
[for="bmi-g5"] { background-color: #cc1100; color: #fff; }

.c-bmi__groups input:checked + label::before {
    background-color: #fff;
    clip-path: polygon(0% 0%,0% 100%,75.00% 50.00%);
    content: '';
    display: inline-block;
    height: 1rem;
    left: 0.5rem;
    position: absolute;
    top: 0.35rem;
    width: 1rem;
}
.c-bmi__groups input:checked + label + div {
    display: block;
    flex: 0 0 100%;
}
.c-bmi__label {
    display: block;
    font-size: medium;
    margin: 0 0 1rem 0;
    position: relative;
}
.c-bmi__label output {
    position: absolute;
    right: 0;
    top: 0;
}
.c-bmi__range {
    -webkit-appearance: none;
    appearance: none;
    background-color: transparent;
    outline: none;
    width: 100%;
}
.c-bmi__range::-webkit-slider-runnable-track {
    background-image: linear-gradient(to bottom, transparent 45%, lightslategray 45%, lightslategray 55%, transparent 55%);
}
.c-bmi__range::-moz-range-track {
    background-image: linear-gradient(to bottom, transparent 45%, lightslategray 45%, lightslategray 55%, transparent 55%);
}
.c-bmi__range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background-color: hsl(225,100%,20%);
    border-radius: 50%;
    height: 2rem;
    width: 2rem;
}
.c-bmi__range::-moz-range-thumb {
    appearance: none;
    background-color: hsl(225,100%,20%);
    border-radius: 50%;
    height: 2rem;
    width: 2rem;
}
.c-bmi__range:focus::-webkit-slider-thumb {
    background-color: hsl(225,30%,60%);
    box-shadow: inset 0 0 0 0.25rem hsl(225,100%,20%);
}
.c-bmi__range:focus::-moz-range-thumb {
    background-color: hsl(225,30%,60%);
    box-shadow: inset 0 0 0 0.25rem hsl(225,100%,20%);
}
.c-bmi__result {
    display: block;
    font-size: 200%;
    margin-bottom: 1.5rem;
    text-align: right;
}
.c-bmi [type="radio"] { display: none; }

/* RWD */
@media (min-width: 600px) {
    .c-bmi__groups { display: flex; }
    .c-bmi__groups input:checked + label::before {
        background-color: inherit;
        clip-path: polygon(0% 0%,100% 0%,50% 100%);
        left: 50%;
        top: -1rem;
        transform: translateX(-50%);
        width: 1.5rem;
    }
    .c-bmi__groups label { flex: 1; }
    [for="bmi-g0"] { border-radius: .25rem 0 0 .25rem; }
    [for="bmi-g5"] { border-radius: 0 .25rem .25rem 0; }
}