/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    /* 4. Add accessible line-height */
    line-height: 1.5;
    /* 5. Improve text rendering */
    -webkit-font-smoothing: antialiased;
}

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

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

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
    text-wrap: pretty;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    text-wrap: balance;
}

/*
  10. Create a root stacking context
*/
#root,
#__next {
    isolation: isolate;
}

:root {
    --clr-bg-dark: oklch(0.92 0 110);
    --clr-bg: oklch(0.96 0 110);
    --clr-bg-light: oklch(1 0 110);
    --clr-text: oklch(0.15 0 110);
    --clr-text-muted: oklch(0.4 0 110);
    --clr-highlight: oklch(1 0 110);
    --clr-border: oklch(0.6 0 110);
    --clr-border-muted: oklch(0.7 0 110);

    --clr-primary: oklch(0.76 0.1 240);
    --clr-secondary: oklch(0.76 0.1 300);
    --clr-tertiary: oklch(0.76 0.1 270);

    --clr-danger: oklch(0.7 0.1 30);
    --clr-warning: oklch(0.7 0.1 100);
    --clr-success: oklch(0.7 0.1 160);
    --clr-info: oklch(0.7 0.1 260);

    --box-shadow: 0.1rem 0.1rem 0.5rem var(--clr-text-muted);
}

body.dark {
    /* oklch */
    --clr-bg-dark: oklch(0.05 0 110);
    --clr-bg: oklch(0.15 0 110);
    --clr-bg-light: oklch(0.25 0 110);
    --clr-text: oklch(0.96 0 110);
    --clr-text-muted: oklch(0.76 0 110);
    --clr-highlight: oklch(0.5 0 110);
    --clr-border: oklch(0.4 0 110);
    --clr-border-muted: oklch(0.3 0 110);

    --clr-primary: oklch(0.4 0.1 240);
    --clr-secondary: oklch(0.4 0.1 300);
    --clr-tertiary: oklch(0.4 0.1 270);

    --clr-danger: oklch(0.5 0.1 30);
    --clr-warning: oklch(0.5 0.1 100);
    --clr-success: oklch(0.5 0.1 160);
    --clr-info: oklch(0.5 0.1 260);

    --box-shadow: 0.5rem 0.5rem 1.5rem var(--clr-border-muted);
}

/* END of resets and theming */

body {
    font-family: Arial, Helvetica, sans-serif;
    height: 100dvh;
    width: 100dvw;

    display: flex;
    flex-direction: column;
    align-items: center;


    background-color: var(--clr-bg);
    color: var(--clr-text);
}

header {
    width: 100%;
    padding: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--clr-primary);
}

main {
    flex: 1;
    padding: 1rem;
}

footer {
    width: 100%;
    background-color: var(--clr-primary);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

form {
    padding: 1.5rem;
    border: 0.15rem solid var(--clr-border);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: var(--clr-bg-dark);
    box-shadow: var(--box-shadow);
}

label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

label * {
    display: block;
}

input {
    outline: none;
    padding: 0 0.5rem;
    border: 0.1rem solid var(--clr-border);
    border-radius: 0.5rem;
    width: 5rem;
    background-color: var(--clr-bg-light);
    color: var(--clr-text);
}

button {
    background-color: var(--clr-tertiary);
    color: var(--clr-text);
    border-radius: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* The switch - the box around the slider */
.switch {
    position: relative;
    display: inline-block;
    width: 2.2rem;
    height: 1.2rem;
    margin: 0 2rem;
}

.switch::before {
    content: "kg";
    position: relative;
    left: -1.5rem;
    top: -0.25rem;
    color: var(--clr-text-muted);
}

.switch::after {
    content: 'lbs';
    position: relative;
    top: -1.65rem;
    right: -2.5rem;
    color: var(--clr-text-muted);
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--clr-tertiary);
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 1rem;
    aspect-ratio: 1;
    left: 0.1rem;
    bottom: 0.1rem;
    background-color: var(--clr-text);
    -webkit-transition: .4s;
    transition: .4s;
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--clr-tertiary);
}

input:checked+.slider:before {
    -webkit-transform: translateX(1rem);
    -ms-transform: translateX(1rem);
    transform: translateX(1rem);
}

/* Rounded sliders */
.slider.round {
    border-radius: 1rem;
}

.slider.round:before {
    border-radius: 50%;
}

form fieldset {
    border-color: var(--clr-border);
    border-radius: 0.5rem;
    background-color: var(--clr-bg-light);
}

form output {
    font-size: 1.5rem;
    height: 1em;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

form output span {
    display: block;
}