:root {
    --primary-accent: black;
    --primary-highlight: #00bbcb;
    --success-border: #4caf50;
    --success-bg: #f1f8f4;
    --success-color: #2e7d32;
    --error-bg: #fff5f5;
    --error-border: #fc8181;
    --error-color: #c53030;
    --result-bg: #f7fafc;
    --result-border: #cbd5e0;
}

legend {
    margin-bottom: 1rem;
}

/*
-------------------------------
    checkboxes
-------------------------------
*/


label.checkbox-label {
    display: grid;
    gap: 1em;
    align-items: center;
    font-size: 2rem;
    grid-template-columns: 1rem auto;
    cursor: pointer;
    width: fit-content;
}


label.checkbox-label input {
        border-radius: 0;
    }


label.checkbox-label span {
        font-size: 1.2rem;
        margin-bottom: 0.2em;
    }


:is(label.checkbox-label:focus,label.checkbox-label:focus-within) input[type="checkbox"] {
            outline-color: var(--primary-accent);
            border-color: var(--primary-accent);
            outline-offset: 2px;
        }

input[type="checkbox"] {
    appearance: none;
    background-color: #fff;
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1.15em;
    height: 1.15em;
    border: 2px solid currentColor;
    transform: translateY(-0.075em);
    position: relative;
    cursor: pointer;
    transition: none;
}

input[type="checkbox"]::before {
        content: '';
        position: absolute;
        background: var(--primary-accent);
        width: 5px;
        height: 25px;
        top: 50%;
        left: 50%;
        transition: transform 150ms;
        transform-origin: center;
        transform: translate(-50%, -50%) rotate(45deg) scale(0);
    }

input[type="checkbox"]::after {
        content: '';
        position: absolute;
        background: var(--primary-accent);
        width: 5px;
        height: 25px;
        top: 50%;
        left: 50%;
        transition: transform 150ms;
        transform-origin: center;
        transform: translate(-50%, -50%) rotate(-45deg) scale(0);
    }

input[type="checkbox"]:checked::before {
        transform: translate(-50%, -50%) rotate(45deg) scale(1);
    }

input[type="checkbox"]:checked::after {
        transform: translate(-50%, -50%) rotate(-45deg) scale(1);
    }

/* Remove focus ring and border change only when clicking with mouse */

input[type="checkbox"]:focus:not(:focus-visible) {
        outline: none;
        border-color: currentColor;
    }

/* Keep focus ring for keyboard navigation */

input[type="checkbox"]:focus-visible {
        outline: 2px solid var(--primary-highlight);
        outline-offset: 2px;
    }

/*
-------------------------------
    /checkboxes
-------------------------------
*/

.input-output {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.result {
    display: flex;
    justify-content: start;
    gap: 1rem;
    align-items: baseline;
}

body {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    line-height: 1.6;
    max-width: 40rem;
    margin: 0 auto;
    padding: 2rem 1rem;
}

h1 {
    margin-bottom: 1rem;
    border-bottom: 2px solid;
}

h1:first-child {
        margin-top: 0;
    }

h2:first-child {
        margin-top: 0;
    }

p {
    margin: 0.5rem 0;
}

code {
    background-color: #edf2f7;
    padding: 0.2rem 0.4rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

ul {
    list-style: none;
    padding: 0;
}

li {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background-color: #f7fafc;
}

.app {
    max-width: 100%;
}

.description {
    margin-bottom: 2rem;
}

label {
    display: block;
    margin-bottom: 1rem;
}

.label-text {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input {
    width: 100%;
    border-radius: 0;
    border: 1px solid;
    padding: 0.6rem;
    font-size: 1rem;
    transition: outline-color 0.2s, border-color 0.2s;
    outline: 2px solid transparent;
    font-family: 'Courier New', Courier, monospace;
}

input:focus {
        outline-color: var(--primary-accent);
        border-color: var(--primary-accent);
        outline-offset: 2px;
    }

input[type="checkbox"] {
        padding: 0;
    }

.result-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    text-decoration: 2px underline;
    text-underline-offset: 4px;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
}

.error {
    padding: 1rem;
    background-color: var(--error-bg);
    border: 2px solid var(--error-border);
    color: var(--error-color);
}

.error strong {
        font-weight: 600;
    }
/*
see https://www.joshwcomeau.com/css/custom-css-reset/
*/

/* 1. Box-sizing model */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* 3. Enable keyword animations */
    interpolate-size: allow-keywords;
}


* {
    /* 2. Remove default margin */
    margin: 0;

    /*
        3. Add accessible line-height 
        see https://kittygiraudel.com/2020/05/18/using-calc-to-figure-out-optimal-line-height/
    */
    line-height: calc(2px + 2ex + 2px);
}

body {
    /* 4. Improve text rendering */
    -webkit-font-smoothing: antialiased;
}

/* 5. Improve media defaults */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

/* 6. Inherit fonts for form controls */
input, button, textarea, select {
    font: inherit;
}

/* 7. Avoid text overflows */
p {
    text-wrap: pretty;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* 8. Improve line wrapping */
h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
    overflow-wrap: break-word;
}


/*
  9. Create a root stacking context

  __OPTIONAL__

  see https://www.joshwcomeau.com/css/custom-css-reset/#nine-root-stacking-context-10
  see https://www.joshwcomeau.com/css/stacking-contexts/
*/
#root {
    isolation: isolate;
}

/* see https://gomakethings.com/how-to-animate-scrolling-to-anchor-links-with-one-line-of-css/#accessibility-concerns */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
