/*!
 * This Software is licensed under the terms of the MIT License.
 * A copy of the license is available at https://github.com/tanguylegazon/custom-css/blob/main/LICENSE.
 */

/* === Colors === */
:root {
    /* General */
    --bg-page: #f9fbfd; /* slate-040 */
    --text-primary: #334155; /* slate-700 */
    --bg-item: #d2dbe580; /* slate-270 50% */
    --bg-item-hover: #dde4ed80; /* slate-220 50% */
    --shadow-primary: #f1f5f9; /* slate-100 */
    --shadow-hover: #dde4ed; /* slate-240 */
    --btn-background-unchecked: #a9e0fd; /* lightBlue-230 */
    --btn-background-checked: #0376b4; /* lightBlue-650 */
    --btn-text-checked: #f0f9ff; /* lightBlue-050 */
    --btn-outline-checked-hover: #0376b4; /* lightBlue-800 */
    --btn-outline-hover: #bae6fd; /* lightBlue-200 */

    /* Banners */
    --bg-info: #eaf6ff; /* lightBlue-070 */
    --text-info: #94dafc; /* lightBlue-265 */
    --text-github: #dbe2eb; /* slate-230 */
}

/* === Spacing === */
:root {
    --font-size: 1.25em;
    --padding-x: calc(.68 * var(--font-size));
    --padding-y: calc(.56 * var(--font-size));
    --border-radius: calc(.624 * var(--font-size));
    --button-height: calc(2.08 * var(--font-size));
    --input-height: calc(2.08 * var(--font-size) - 2 * var(--padding-y));
    --btn-width: 20ch;
    --btn-height: calc(5 / 16 * var(--btn-width));
}

/* === Shadows === */
:root {
    --main-shadow: 0 0 1.2em .2em var(--shadow-primary);
    --main-hover-shadow: 0 .8em 3.8em .2em var(--shadow-hover);
}

/* === Transitions === */
:root {
    --duration-short: 150ms;
    --duration-normal: 200ms;
    --duration-long: 500ms;
}

* {
    max-width: 100vw;
    font-family: ui-sans-serif, system-ui, sans-serif;
}

html {
    width: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-page);
}

a, a:hover, a:active, a:focus, a:visited {
    text-decoration: none;
}

svg {
    fill: currentColor;
    overflow: visible;
}

.info-banner, .github-banner {
    position: absolute;
    display: flex;
    flex-direction: row;
    align-items: center;
    margin: 24px;
    font-weight: 600;
    border-radius: var(--border-radius);
}

.info-banner {
    top: 0;
    max-width: 28em;
    padding: var(--padding-y) var(--padding-x);
    gap: 1em;
    color: var(--text-info);
    background: var(--bg-info);
}

.info-banner svg {
    height: 1.8em;
}

.github-banner {
    bottom: 0;
    gap: .5em;
    color: var(--text-github);
    background: none;
    border-radius: var(--border-radius);
    transition: color var(--duration-short) ease;
    font-size: calc(.75 * var(--font-size));
}

.github-banner:hover {
    color: var(--text-primary);
}

.github-banner svg {
    height: 1.32em;
}

input[type="text"], button, .btn {
    backdrop-filter: blur(50px);
    background: var(--bg-item);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0 1.2em .2em var(--shadow-primary);
    color: var(--text-primary);
    font-size: var(--font-size);
    transition: background-color var(--duration-normal) ease;
}

button {
    display: flex;
    align-items: center;
    gap: .6em;
    height: var(--button-height);
    padding: .55em;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
}

button > svg {
    height: 100%;
}

button.small {
    font-size: calc(var(--font-size) * .7);
}

button.circle {
    aspect-ratio: 1;
    border-radius: 50%;
}

button.secondary {
    position: absolute;
    height: calc(var(--button-height) - 2px);
    padding: .68em;
    border-radius: calc(var(--border-radius) - 1px);
    box-shadow: none;
    background: none;
}

input[type="text"] {
    width: 23.6ch;
    padding: var(--padding-y) var(--padding-x);
    outline: none;
    height: var(--input-height);
}

input[type="text"]:hover,
input[type="text"]:focus,
button:not(.secondary):hover {
    background: var(--bg-item-hover);
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    align-content: center;
    text-align: center;
    height: var(--btn-height);
    width: var(--btn-width);
    padding: .08em 1em;
    border-radius: 1.125em;
    gap: calc(.6em);
    font-size: calc(.8 * var(--font-size));
    font-weight: bold;
    outline: .3em solid transparent;
    outline-offset: .15em;
    z-index: 1;
    cursor: pointer;
    user-select: none;
    transition: background-color var(--duration-short) linear, outline var(--duration-short) linear, box-shadow var(--duration-long) ease-out, z-index var(--duration-long) ease-out;
}

.btn svg {
    width: 1.6em;
}

input[type="checkbox"] + .btn {
    background: var(--btn-background-unchecked);
    color: #fff;
    user-select: none;
}

input[type="checkbox"]:checked + .btn {
    background: var(--btn-background-checked);
    color: var(--btn-text-checked);
    outline-color: var(--btn-outline-checked-hover);
}

@media (hover: hover) and (min-width: 600px) {
    .btn:hover {
        z-index: 10;
        box-shadow: var(--main-hover-shadow);
    }

    input[type="checkbox"] + .btn:hover {
        outline-color: var(--btn-outline-hover);
    }

    input[type="checkbox"]:checked + .btn:hover {
        outline-color: var(--btn-outline-checked-hover);
    }
}
