html {
    scroll-behavior: smooth;
}

/* fs must be 16px or more to prevent auto zooming on safari when focused */
input[type="text"],
input[type="number"],
textarea {
    font-size: 16px;
}

.content {
    max-width: 90%;
    width: min(90%, 500px);
    margin: auto;
}

.container {
    margin-top: 2rem;
}

form {
    margin: 3rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 5rem;
}

fieldset {
    border: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    transition: background-color 0.25s ease-in-out;
}

fieldset.failed-validation {
    background-color: rgb(var(--clr-accent) / 0.3);
}

.question-title {
    margin-bottom: 1.8rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.question-container {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
}

span.small {
    font-weight: lighter;
    font-size: 0.8em;
}

.preference {
    opacity: 0;
    max-height: 0;
    transition: all 0.35s ease-in-out;
    overflow: hidden;
    margin-bottom: -5rem;
}

.preference.active {
    opacity: 1;
    max-height: 400rem;
    margin-bottom: 0;
}

.compare {
    opacity: 0;
    max-height: 0;
    transition: all 0.35s ease-in-out;
    overflow: hidden;
    margin-bottom: -5rem;
}

.compare.active {
    opacity: 1;
    max-height: 400rem;
    margin-bottom: 0;
}

/* text inputs */

input[type=text],
input[type=number] {
    border: 0;
    border-bottom: 1px solid #fafafa;
    padding: 0.3rem;
    margin-bottom: 2.5rem;
    width: 100%;
    border-radius: 0;
    background: transparent;
    color: rgb(255 255 255 / 0.8);
    font-size: 1.1rem;
}

input[type=text] {
    margin-bottom: 0;
}


input[type=text]:focus,
input[type=text]:not(:placeholder-shown),
input[type=number]:focus,
input[type=number]:not(:placeholder-shown) {
    outline: none;
    border-bottom-color: rgb(var(--clr-accent-3));
}

.text-input-container {
    width: 100%;
    position: relative;
}

input[type=text] + label,
input[type=number] + label {
    position: absolute;
    top: 0px;
    left: 0px;
    pointer-events: none;
}

input[type=text] + label,
input[type=number] + label {
    transition: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    /* this is critical for the effect! */
    display: inline-block; 
}

input[type=text]:focus + label,
input[type=text]:not(:placeholder-shown) + label,
input[type=number]:focus + label,
input[type=number]:not(:placeholder-shown) + label {
    color: rgb(var(--clr-accent-3));
    transform: translateY(-1.35rem);
}

/* radio and checkbox inputs */

input[type="radio"],
input[type="checkbox"] {
    /* Add if not using autoprefixer */
    -webkit-appearance: none;
    appearance: none;
    visibility: hidden;
    /* For iOS < 15 to remove gradient background */
    /* background-color: #fff; */
    /* Not removed via appearance */
    margin: 0;
    padding: 0;
    width: 0;
}

input[type=radio] + label,
input[type="checkbox"] + label {
    padding: 1em 1.4em;
    border: 1px solid black;
    border-radius: 0.3rem;
    cursor: pointer;
    width: auto;
    font-weight: bold;
    box-shadow: 2px 2px 10px rgba(0,0,0,.6);
    position: relative;
    background-color: rgb(var(--clr-bg-darker));
}

input[type=radio] + label:hover,
input[type="checkbox"] + label:hover {
    background-color: rgb(255 255 255 / 0.05);
}

input[type=radio] + label:before,
input[type="checkbox"] + label:before {
    content: '';
    position: absolute;
    left: 0px;
    right: 0px;
    bottom: 0px;
    top: 0px;
    border-radius: 0.3rem;
    box-shadow: inset 2px 2px 2px 0px rgba(255,255,255,.3), inset -2px -2px 2px 0 rgba(0,0,0,.7);
    z-index: 0;
  }

input[type=radio]:checked + label,
input[type="checkbox"]:checked + label {
    box-shadow: 1px 1px 5px rgba(0,0,0,.7);
    background-color: rgb(var(--clr-accent) / 0.5);
}

input[type=radio]:checked + label:before,
input[type="checkbox"]:checked + label:before {
    box-shadow: 2px 2px 2px 0px rgba(255,255,255,.2), inset 2px 2px 4px 0px rgba(0,0,0,.9);
}

input[type=range] {
    padding: 0;
    margin: 0;
    width: 100%;
    cursor: pointer;
}

/*Chrome*/
input[type='range'] {
    appearance: none;
    -webkit-appearance: none;
    background-color: rgb(var(--clr-accent) / 0.7);
    overflow: hidden;
    width: 100%;
    height: 25px;
    border-radius: 20rem;
}

input[type='range']::-webkit-slider-runnable-track {
    appearance: none;
    -webkit-appearance: none;
}

input[type='range']::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    /* background: rgb(var(--clr-bg-darker)); */
    background: white;
    border-radius: 50%;
    box-shadow: -210px 0 0 200px #57c2a9;
    cursor: pointer;
    height: 25px;
    width: 25px;
    border: 4px solid rgb(var(--clr-bg) / 0.7);
}

/* firefox */
input[type='range']::-moz-range-thumb {
    background: white;
    border-radius: 50%;
    box-shadow: -210px 0 0 200px #57c2a9;
    cursor: pointer;
    height: 25px;
    width: 25px;
    border: 4px solid rgb(var(--clr-bg) / 0.7);
}

input[type="range"]::-moz-range-track {
    appearance: none;
}

input[type="range"]::-moz-range-progress {
    background-color: #57c2a9;
    height: 20px
}

input[type="range"]::-ms-fill-upper {
    appearance: none;
}

input[type="range"]::-ms-fill-lower {
    background-color: #57c2a9;
}

.range-input {
    padding: 1rem;
    margin-bottom: 1rem;
}

.range-input:nth-child(2n) {
    background-color: rgb(255 255 255 / 0.05);
}

.range-input:nth-child(2n-1) {
    background-color: rgb(255 255 255 / 0.02);
}

.range-input__question-subtitle {
    margin-bottom: 0.8rem;
    font-size: 1.3em;
}

.range-input__range {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    text-align: center;
}

.range-input__label-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.range-input__beer-label {
    display: block;
    justify-content: center;
    align-items: center;
    color: rgb(255 255 255 / 0.5);
    font-size: 0.9em;
}

.range-input__meter {
    display: flex;
    gap: 0.2rem;
    justify-content: center;
    align-items: center;
}

.meter-square {
    height: 0.3rem;
    flex: 1;
    background-color: green;
    opacity: 0.3;
    transition: opacity 0.15s ease-in-out;
}

.meter-square.active {
    opacity: 1;
}

.range-input__subheading {
    margin: 1.5rem 0 1rem 0;
    text-align: center;
    font-size: 1.1em;
}

#detect-flaws-container {
    opacity: 0;
    max-height: 0;
    transition: all 0.35s ease-in-out;
    overflow: hidden;
    margin-bottom: -5rem;
}

#detect-flaws-container.active {
    opacity: 1;
    max-height: 400rem;
    margin-bottom: 0;
}

#flaws {
    opacity: 0;
    max-height: 0;
    transition: all 0.35s ease-in-out;
    overflow: hidden;
    margin-bottom: -5rem;
}

#flaws.active {
    opacity: 1;
    max-height: 400rem;
    margin-bottom: 0;
}

.flaw-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}


@media (max-width: 480px) {
    .flaw-panel {
        font-size: 0.8em;
    }
}

.flaw {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0.5rem;
}

.flaw:nth-child(2n-1) {
    background-color: rgb(255 255 255 / 0.05);
}

.flaw:nth-child(2n) {
    background-color: rgb(0 0 0 / 0.1);
}

.flaw__type--name {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 0.25rem;
}

.flaw__type--description {
    font-weight: 400;
    font-size: 0.85em;
    color: rgb(var(--clr-text) / 0.65);
}

.flaw__choices {
    display: flex;
    justify-content: end;
    gap: 0.25rem;
}

.flaw__choices .flaw__label {
    text-align: center;
    font-weight: normal;
}

.flaw__choices .flaw__label .icon {
    display: none;
}

/* beer scores out of 5 stars */

.scores {
    opacity: 0;
    max-height: 0;
    transition: all 0.35s ease-in-out;
    overflow: hidden;
    margin-bottom: -5rem;
}

.scores.active {
    opacity: 1;
    max-height: 400rem;
    margin-bottom: 0;
}

fieldset.score {
    border: none;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 0;
    justify-content: center;
    align-items: center;
}

.scores__beer-label {
    justify-self: end;
    margin-right: 0.5em;
    text-align: center;
}

.scores__beer-label .alternate {
    display: none;
}

.scores__star-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.scores__star-container .scores__star {
    -webkit-appearance: none;
    appearance: none;
    visibility: hidden;
}

.scores__star-container .scores__star:checked ~ label {
    /* color: rgb(var(--clr-accent)); */
    color: gold;
}

.scores__star-container .scores__star + label {
    font-size: 0;
    border: none;
    display: inline;
    font-weight: normal;
    position: relative;
    box-shadow: none;
    background-color: transparent;
}

.scores__star-container .scores__star + label:before {
    content: '★';
    font-size: 3rem;
    box-shadow: none;
    position: relative;
    display: flex;
    transform: translateY(-5px);
}

.scores__star-container .scores__star:checked + label {
    box-shadow: none;
    background-color: transparent;
}

.scores__star-container .scores__star:checked + label:before {
    box-shadow: none;
}

.scores__star-container .scores__star + label[for="star5"] { order: 5; }
.scores__star-container .scores__star + label[for="star4"] { order: 4; }
.scores__star-container .scores__star + label[for="star3"] { order: 3; }
.scores__star-container .scores__star + label[for="star2"] { order: 2; }
.scores__star-container .scores__star + label[for="star1"] { order: 1; }

.scores__star-container .scores__star + label[for="star10"] { order: 5; }
.scores__star-container .scores__star + label[for="star9"] { order: 4; }
.scores__star-container .scores__star + label[for="star8"] { order: 3; }
.scores__star-container .scores__star + label[for="star7"] { order: 2; }
.scores__star-container .scores__star + label[for="star6"] { order: 1; }

.scores__star-container .scores__star + label:hover,
.scores__star-container .scores__star + label:hover ~ label {
    color: gold;
    background-color: transparent;
}

#comments {
    min-height: 6rem;
}

input[type=submit].button {
    background-color: rgb(var(--clr-accent));
    font-weight: bold;
    font-size: 1.1rem;
}

input[type=submit].button:hover {
    background-color: rgb(var(--clr-accent) / 0.7);
}
