:root {
    --color-tabs-bg: #fafafa;
    --logo: #1b1b32;
    --bg: #24223c;
    --bg-h: #3f3b72;
    --white: #f5f4eb;

    --color-bg-button: #c8c0d9;
    --color-bg-button-hover: #b2a8c7;

    --input-focus-h: 244;
    --input-focus-s: 32%;
    --input-focus-l: 34%;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    max-width: 100vw;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: "Calibre", Sans-Serif;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

p {
    text-wrap: pretty;
}

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

#root {
    isolation: isolate;
}

h2 {
    @media (max-width: 676px) {
        font-size: 1rem;
    }
}

/* --- globals */
.htmx-indicator {
    opacity: 0;
    transition: opacity 300ms ease-in;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.card-wrapper.htmx-swapping {
    opacity: 0;
    transition: opacity 300ms ease-in;
}

.icon {
    width: 2rem;
    height: 2rem;

    &.action {
        cursor: pointer;
    }
}

/* --- button */
.button {
    background: var(--color-bg-button);
    border-radius: 6px !important;
    color: var(--bg);
    height: auto !important;
    line-height: 0 !important;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    display: inline-block;
    font-size: 0;
    height: 39px !important;
    line-height: 39px;
    font-size: 23px;
    font-weight: 600;
    overflow: hidden;
    position: relative;
    text-align: center;
    text-decoration: none;
    transition:
        background 0.25s cubic-bezier(0.33, 1, 0.68, 1),
        color 0.25s cubic-bezier(0.33, 1, 0.68, 1);
    user-select: none;
    margin: 0;
    min-width: 0;
    padding: 0;
    vertical-align: baseline;
    padding: 8px 20px;

    &:hover {
        background: var(--color-bg-button-hover);
        color: var(--bg-h);
    }

    &.mobile {
        display: none;
    }

    &.desktop {
        display: inline-block;
    }

    @media (max-width: 676px) {
        &.mobile {
            display: inline-block;
        }

        &.desktop {
            display: none;
        }
    }
}

/* --- tabs */
#tabs {
    max-width: 1800px;
    margin: 40px auto;

    @media (max-width: 1780px) {
        max-width: 1280px;
    }

    @media (max-width: 1450px) {
        max-width: 920px;
    }

    @media (max-width: 960px) {
        max-width: 560px;
        margin: 24px auto;
    }

    @media (max-width: 676px) {
        max-width: calc(100vw - 64px);
    }
}

#tabs > .tab-list div {
    &.desktop {
        display: flex;
        justify-content: center;
    }

    &.mobile {
        display: none;
    }

    @media (max-width: 960px) {
        &.mobile {
            display: flex;
            justify-content: center;
        }

        &.desktop {
            display: none;
        }
    }
}

#tabs > .tab-list div button {
    cursor: pointer;
    color: var(--color-bg-button-hover);
    background: transparent;
    font-size: 23px;
    line-height: 23px;
    font-weight: 600;
    letter-spacing: -0.006em;
    line-height: 42px;
    padding: 4px 20px 2px 20px;
    transition:
        background 0.25s cubic-bezier(0.33, 1, 0.68, 1),
        color 0.25s cubic-bezier(0.33, 1, 0.68, 1);
    border: 0;
    border-radius: 6px 6px 0 0;

    &:hover {
        color: var(--bg-h);
        background: var(--color-bg-button);
    }

    &.selected {
        border-top: 3px solid var(--color-bg-button);
        border-left: 3px solid var(--color-bg-button);
        border-right: 3px solid var(--color-bg-button);
        background-color: var(--color-tabs-bg);
        color: var(--bg);
    }

    & svg.lucide {
        margin: 8px 4px;
    }
}

#tabs > .tab-content {
    max-width: calc(100vw - 32px);
    padding: 8px;
    margin-top: -3px; /* overlaps the tab to hide border */
    margin-bottom: 16px;
    margin-left: auto;
    margin-right: auto;
    background-color: var(--color-tabs-bg);
    border: 3px solid var(--color-bg-button);
    border-radius: 6px;

    @media (max-width: 676px) {
        padding: 8px 16px;
    }

    @media (max-width: 425px) {
        max-width: calc(100vw - 16px);
        padding: 4px 8px;
    }

    h3 {
        margin: 24px 0 0 0;
        text-align: center;
        clear: both;
        color: #261b23;
        font-size: 26px;
        font-weight: 700;
        letter-spacing: -0.01em;
        line-height: 31px;
        margin-left: auto;
        margin-right: auto;
        text-decoration: underline;
        text-decoration-thickness: auto;
        text-decoration-thickness: 2px;
        transition: color 0.25s cubic-bezier(0.33, 1, 0.68, 1);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 340px;

        @media (max-width: 676px) {
            line-height: 25px;
            margin-top: 16px;
            font-size: 20px;
            font-weight: 700;
        }
    }
}

/* --- ranking */
table {
    border-collapse: collapse;
    min-width: 240px;
    max-width: 640px;
    margin: 8px auto;
}

td,
th {
    padding: 4px 8px;
    text-align: left;

    &:last-child {
        text-align: right;
    }
}

tr {
    border-bottom: 1px solid #ddd;
}

/* --- form */
form {
    max-width: 100%;
}

#form-sticker,
#form-password-reset {
    width: 360px;
    margin: 16px auto;
    display: flex;
    flex-direction: column;
    gap: 8px;

    pre {
        padding: 4px 0 4px 16px;
        margin: 0 auto;
        white-space: pre-line;
    }

    @media (max-width: 676px) {
        margin: 8px auto;
    }
}

details {
    @media (max-width: 676px) {
        width: 300px;
    }
}

#stickers {
    width: 75%;
    margin: 40px auto;
}

#list {
    margin: 8px auto;

    > .card-wrapper {
        position: relative;
        left: 32px;

        @media (max-width: 676px) {
            left: 24px;
        }

        @media (max-width: 580px) {
            left: 32px;
        }

        @media (max-width: 450px) {
            left: -8px;
        }

        @media (max-width: 430px) {
            left: -12px;
        }

        @media (max-width: 410px) {
            left: -16px;
        }

        .card {
            margin-right: 8px;
        }
    }
}

/* --- list */
.search-bar {
    width: fit-content;
    margin: 16px auto;
    display: flex;
    align-items: center;
    position: relative;
    left: calc(0.5rem + 8px);

    @media (max-width: 425px) {
        left: 4px;
    }

    input {
        padding: 0.25em 0.5em 0.25em 44px;
        background: transparent url("assets/search.svg") no-repeat 12px center;
    }

    span {
        margin: 0 8px;

        img {
            width: 1.25rem;
        }
    }
}

#search-results {
    width: fit-content;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    column-gap: 8px;
    row-gap: 16px;

    @media (max-width: 1780px) {
        grid-template-columns: 1fr 1fr 1fr;
    }

    @media (max-width: 1450px) {
        grid-template-columns: 1fr 1fr;
    }

    @media (max-width: 960px) {
        grid-template-columns: 1fr;
        position: relative;
        right: 6px;
    }

    @media (max-width: 425px) {
        right: 0px;
    }
}

/* --- components --- */
/* --- card */
.card-wrapper {
    margin: 0 auto;
    width: fit-content;
    display: flex;
    align-items: center;

    .icons {
        width: fit-content;
        display: flex;
        gap: 4px;
    }

    @media (max-width: 540px) {
        max-width: 288px;
    }
}

.card {
    height: 160px;
    width: 366px;
    position: relative;
    margin: 16px;

    @media (max-width: 540px) {
        margin: 16px auto 16px auto;
    }
}

.card a {
    height: 100%;
    width: 100%;
    position: absolute;
    display: block;
    color: #d30001;
    text-decoration: none;
    transition: color 0.25s cubic-bezier(0.33, 1, 0.68, 1);

    &:hover .card__body {
        box-shadow:
            0 3px 15px 2px rgba(63, 59, 114, 1),
            0 1px 1px rgba(63, 59, 114, 1),
            0 0 0 3px rgba(63, 59, 114, 1);
        transform: translateY(-3px);
    }
}

.card__body {
    height: 100%;
    width: 100%;
    position: absolute;
    align-items: center;
    background: #ffffff;
    border-radius: 8px;
    box-shadow:
        0 3px 15px 2px rgba(38, 27, 35, 0.05),
        0 1px 1px rgba(38, 27, 35, 0.02),
        0 0 0 3px rgba(38, 27, 35, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition:
        background 0.25s cubic-bezier(0.33, 1, 0.68, 1),
        box-shadow 0.25s cubic-bezier(0.33, 1, 0.68, 1),
        transform 0.25s cubic-bezier(0.33, 1, 0.68, 1);
}

.card__label {
    position: absolute;
    text-align: center;
    top: -15px;
    width: 100%;
    z-index: 1;
}

.card__label h6 {
    background: var(--color-bg-button-hover);
    border-radius: 3px;
    color: #ffffff;
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 21px;
    padding: 3px 23px;
    position: relative;
    text-align: center;
    text-transform: uppercase;
    transition: background 0.25s cubic-bezier(0.33, 1, 0.68, 1);
}

.card__headline {
    padding-bottom: 6px;
    padding-top: 16px;
    margin-left: 30px;
    margin-right: 30px;
    text-align: center;
    overflow-wrap: break-word; /* ensure long words break */
    word-break: break-word; /* fallback */
}

.card__headline h3 {
    clear: both;
    color: #261b23;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 31px;
    margin-left: auto;
    margin-right: auto;
    text-decoration: underline;
    text-decoration-thickness: auto;
    text-decoration-thickness: 2px;
    transition: color 0.25s cubic-bezier(0.33, 1, 0.68, 1);
    /* white-space: nowrap; */
    display: block;
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    box-sizing: border-box;

    @media (max-width: 676px) {
        font-size: 13px;
        max-width: 320px;
        left: 0px;
    }
}

.card__content {
    padding-bottom: 35px;
    margin-left: 30px;
    margin-right: 30px;
    text-align: center;
}

.card__content p {
    clear: both;
    color: #5a5153;
    font-size: 18px;
    line-height: 23px;
    margin-left: auto;
    margin-right: auto;
    transition: color 0.25s cubic-bezier(0.33, 1, 0.68, 1);
}

/* --- feedback msg */
.feedback-message {
    .msg {
        font-weight: 600;
        display: inline-flex;
        align-items: center;

        .icon {
            margin: 0 4px 0 0;
            font-size: 1.3em;
            width: 1em;
            height: 1em;
            position: relative;
            top: -1px;
        }
    }
}

/* --- input general */
input {
    padding: 0.25em 0.5em;
    background-color: #fff;
    border: 1px solid var(--bg);
    border-radius: 4px;
    transition: 180ms box-shadow ease-in-out;
}

input:focus {
    outline: 2px solid transparent;
    border-color: hsl(
        var(--input-focus-h),
        var(--input-focus-s),
        var(--input-focus-l)
    );
    box-shadow: 0 0 0 1px
        hsla(
            var(--input-focus-h),
            var(--input-focus-s),
            var(--input-focus-l),
            0.8
        );
}

/* --- header */
nav {
    width: 100vw;
    height: 60px;
    padding: 0 24px;
    background-color: var(--bg-h);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- footer */
.footer {
    overflow: hidden;
    position: relative;
    margin-top: auto;
    padding: 80px 0;
    background: var(--bg-h);
    color: var(--white);
    display: block;

    &:before {
        background-image: url(assets/shape-top-up-left.svg);
        background-position: left top;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        content: "";
        height: 10vw;
        left: 0;
        max-height: 160px;
        position: absolute;
        top: -1px;
        width: 100%;
        filter: brightness(0) invert(1);
    }
}

.footer__logo {
    margin-left: 30px;
    margin-right: 30px;
    position: relative;
    text-align: center;
    width: calc(100% - 60px);

    &:after {
        background: url(assets/logo_retro.svg) center center no-repeat;
        content: "";
        height: 90px;
        width: 90px;
        position: absolute;
        left: calc(50%);
        bottom: -24px;
    }
}

@media (min-width: 1024px) {
    .footer__logo {
        margin-left: 60px;
        margin-right: 60px;
        width: calc(100% - 120px);
    }
}
