/* --------------------------------

File#: _1_radios-checkboxes
Title: Radios and Checkboxes
Descr: Custom radio and checkbox buttons
Usage: codyhouse.co/license

-------------------------------- */
:root {
    /* radios + checkboxes */
    --checkbox-radio-size: 16px;
    --checkbox-radio-gap: 0.375rem;
    /* gap between button and label */
    --checkbox-radio-border-width: 0.04125rem;
    --checkbox-radio-line-height: 1.4;
    /* radios */
    --radio-marker-size: 8px;
    /* checkboxes */
    --checkbox-marker-size: 10px;
    --checkbox-radius: 4px;
}
@media (min-width: 64rem) {
    :root {
        --checkbox-radio-gap: 0.5625rem;
    }
}

/* hide native buttons */
.radio,
.checkbox {
    position: absolute;
    padding: 0;
    margin: 0;
    margin-top: calc((1em * var(--checkbox-radio-line-height) - var(--checkbox-radio-size)) / 2);
    opacity: 0;
    height: var(--checkbox-radio-size);
    width: var(--checkbox-radio-size);
    pointer-events: none;
}

/* label */
.radio + label,
.checkbox + label {
    display: inline-block;
    line-height: 1;
    user-select: none;
    cursor: pointer;
    padding-left: calc(var(--checkbox-radio-size) + var(--checkbox-radio-gap));
}

/* custom inputs - basic style */
.radio + label::before,
.checkbox + label::before {
    content: "";
    box-sizing: border-box;
    display: inline-block;
    position: relative;
    vertical-align: middle;
    top: -0.1em;
    margin-left: calc(-1 * (var(--checkbox-radio-size) + var(--checkbox-radio-gap)));
    flex-shrink: 0;
    width: var(--checkbox-radio-size);
    height: var(--checkbox-radio-size);
    @apply bg-white;
    border-width: var(--checkbox-radio-border-width);
    @apply border-neutral-500;
    border-style: solid;
    @apply shadow-xs;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: var(--checkbox-radio-gap);
    transition: border 0.2s, -webkit-transform 0.2s;
    transition: transform 0.2s, border 0.2s;
    transition: transform 0.2s, border 0.2s, -webkit-transform 0.2s;
}

/* :hover */
.radio:not(:checked):not(:focus) + label:hover::before,
.checkbox:not(:checked):not(:focus) + label:hover::before {
    @apply border-neutral-600;
}

/* radio only style */
.radio + label::before {
    border-radius: 50%;
}

/* checkbox only style */
.checkbox + label::before {
    border-radius: var(--checkbox-radius);
}

/* :checked */
.radio:checked + label::before,
.checkbox:checked + label::before {
    @apply bg-primary-700;
    @apply shadow-xs;
    @apply border-primary-700;
    transition: -webkit-transform 0.2s;
    transition: transform 0.2s;
    transition: transform 0.2s, -webkit-transform 0.2s;
}

/* :active */
.radio:active + label::before,
.checkbox:active + label::before {
    -webkit-transform: scale(0.8);transform: scale(0.8);
    transition: -webkit-transform 0.2s;
    transition: transform 0.2s;
    transition: transform 0.2s, -webkit-transform 0.2s;
}

/* :checked:active */
.radio:checked:active + label::before,
.checkbox:checked:active + label::before {
    -webkit-transform: none;transform: none;
    transition: none;
}

/* radio button icon */
.radio:checked + label::before {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg class='nc-icon-wrapper' fill='%23ffffff'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23ffffff'%3E%3C/circle%3E%3C/g%3E%3C/svg%3E");
    background-size: var(--radio-marker-size);
}

/* checkbox button icon */
.checkbox:checked + label::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpolyline points='1 6.5 4 9.5 11 2.5' fill='none' stroke='%23FFFFFF' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/%3E%3C/svg%3E");
    background-size: var(--checkbox-marker-size);
}

/* :focus */
.radio:checked:active + label::before,
.checkbox:checked:active + label::before,
.radio:focus + label::before,
.checkbox:focus + label::before {
    @apply border-primary-700;
    box-shadow: 0 0 0 3px hsla(245 58% 51% / 0.2);
}
