@import url("https://repo.0x8e.net/tetratto/crates/app/src/public/css/utility.css");

:root {
    color-scheme: light dark;
    --color-text: hsl(0, 0%, 5%);

    --color-super-lowered: oklch(87.1% 0.006 286.286);
    --color-super-lowered-75: oklch(87.1% 0.006 286.286 / 75%);
    --color-lowered: oklch(96.7% 0.001 286.375);
    --color-surface: oklch(97% 0.001 106.424);
    --color-raised: oklch(98.4% 0.003 247.858);
    --color-raised-75: oklch(98.4% 0.003 247.858 / 75%);
    --color-super-raised: oklch(96.8% 0.007 247.896);
    --color-super-raised-75: oklch(96.8% 0.007 247.896 / 75%);
    --color-primary: #6383ff;

    --color-link: #2949b2;
    --color-shadow: rgba(0, 0, 0, 0.15);
    --color-red: hsl(0, 84%, 40%);
    --color-green: hsl(100, 84%, 20%);
    --color-yellow: oklch(47% 0.157 37.304);
    --color-purple: hsl(284, 84%, 20%);
    --color-green-lowered: hsl(100, 84%, 15%);
    --color-red-lowered: hsl(0, 84%, 35%);

    /*--radius: 6px;*/
    --radius: 0;

    --pad-1: 0.2rem;
    --pad-2: 0.35rem;
    --pad-3: 0.5rem;
    --pad-4: 1rem;
}

html,
body {
    line-height: 1.5;
    letter-spacing: 0.15px;
    font-family:
        "Inter",
        "Roboto",
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        system-ui,
        sans-serif,
        "Apple Color Emoji",
        "Segoe UI Emoji",
        "Segoe UI Symbol",
        "Noto Color Emoji";
    color: var(--color-text);
    background: var(--color-surface);
    overflow: auto auto;
    height: 100dvh;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-size: 16px;
    font-family: monospace;
}

.dark,
.dark * {
    --color-super-lowered: oklch(44.2% 0.017 285.786);
    --color-super-lowered-75: oklch(44.2% 0.017 285.786 / 75%);
    --color-lowered: oklch(37% 0.013 285.805);
    --color-surface: oklch(21% 0.006 285.885);
    --color-raised: oklch(27.4% 0.006 286.033);
    --color-raised-75: oklch(27.4% 0.006 286.033 / 75%);
    --color-super-raised: oklch(0.2948 0.0066 286.03);
    --color-super-raised-75: oklch(0.2948 0.0066 286.03 / 75%);
    --color-text: hsl(0, 0%, 95%);

    --color-link: #56c8ff;
    --color-red: hsl(0, 94%, 72%);
    --color-green: hsl(100, 94%, 82%);
    --color-yellow: oklch(90.1% 0.076 70.697);
    --color-purple: hsl(284, 94%, 82%);

    .logo {
        filter: invert(1);
    }
}

/* misc layout */
.container {
    margin: 0 !important;
    width: 100%;
}

#content_rect {
    margin: 10px auto 0 !important;
}

.content_container {
    margin: 0 auto var(--pad-2);
    width: 100%;
}

article.content_container {
    margin: 0;
    max-width: unset;
    width: 100dvw;
}

.content_container.no_margin {
    margin: 0 auto !important;
}

#messages {
    margin-bottom: 0 !important;
}

#messages:has(+ .tab_bar) {
    margin-bottom: 1rem !important;
}

#messages.full,
body:has(.page_header) #messages {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
}

.card.message,
#messages.full li,
body:has(.page_header) #messages li {
    --border-color: transparent;
    padding: var(--pad-4);
    width: 100%;
    border-bottom: solid 1px var(--border-color);

    &:not(#messages *) {
        border-radius: var(--radius);
        border: solid 1px var(--border-color);
    }

    &.green {
        --border-color: oklch(72.3% 0.219 149.579 / 50%);
        background: oklch(79.2% 0.209 151.711 / 25%);
    }

    &.red {
        --border-color: oklch(64.5% 0.246 16.439 / 25%);
        background: oklch(71.2% 0.194 13.428 / 25%);
    }

    &.yellow {
        --border-color: oklch(82.8% 0.189 84.429 / 50%);
        background: oklch(87.9% 0.169 91.605 / 25%);
    }

    &.purple {
        --border-color: oklch(71.4% 0.203 305.504 / 25%);
        background: oklch(71.4% 0.203 305.504 / 25%);
    }
}

.logo {
    pointer-events: none;
}

.logo img {
    width: 50%;
    margin-bottom: 2rem;
}

main {
    margin: var(--pad-4) auto 0;
    width: 120ch;
    height: calc(100dvh - var(--pad-4) * 4);

    &.condensed {
        width: 80ch;
    }

    @media screen and (max-width: 900px) {
        & {
            margin: var(--pad-4) 0;
            width: 100dvw !important;
        }

        & .logo img {
            width: 75%;
        }
    }
}

/* typo */
.gap_ch {
    gap: 1ch;
}

.no_p_margin p:last-child {
    margin: 0 !important;
}

span,
i,
b {
    font-size: inherit;
}

p,
ul,
ol {
    margin-bottom: var(--pad-4) !important;

    &:last-child {
        margin-bottom: 0 !important;
    }
}

ul,
ol {
    margin: var(--pad-2) 0 var(--pad-2) var(--pad-4);
}

pre {
    padding: var(--pad-2) var(--pad-4);
    border-left: solid 5px var(--color-primary);
    background: var(--color-surface);
    border-radius: var(--radius);
    margin-bottom: var(--pad-4);
}

code {
    padding: 0;
}

pre,
code {
    font-family: "Jetbrains Mono", "Fire Code", monospace;
    width: 100%;
    max-width: 100%;
    overflow: auto;
    border-radius: var(--radius);
    font-size: 0.8rem !important;
    color: inherit;
}

code * {
    font-size: 0.8rem !important;
}

code:not(pre *) {
    padding: var(--pad-1) var(--pad-2);
    background: oklch(98% 0.016 73.684 / 25%);
    color: oklch(90.1% 0.076 70.697);
    border-radius: var(--radius);
    white-space: break-spaces;
}

code:not(pre *):not(.dark *) {
    background: oklch(83.7% 0.128 66.29 / 25%);
    color: oklch(47% 0.157 37.304);
}

svg.icon {
    stroke: currentColor;
    width: 18px;
    height: 1em;
}

.filled svg.icon {
    fill: currentColor;
}

.big_icon svg.icon {
    width: 18px;
    height: 18px;
    position: absolute;
}

img.icon {
    width: 18px;
    height: 1em;
}

button svg {
    pointer-events: none;
}

hr {
    border-top: solid 1px var(--color-super-lowered) !important;
    max-width: 80%;
    border-left: 0;
    border-bottom: 0;
    border-right: 0;
}

hr.margin,
.container hr {
    margin: 0 0 var(--pad-4);
}

span.img_sizer {
    display: inline-block;
}

p,
li,
span,
code {
    max-width: 100%;
    overflow-wrap: normal;
    text-wrap: stable;
    word-wrap: break-word;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: var(--pad-4);
}

h6 {
    font-size: var(--pad-3);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: var(--pad-4) 0;
    font-weight: 700;
    width: -moz-max-content;
    position: relative;
    max-width: 100%;

    & * {
        font-size: inherit;
    }
}

h1 {
    text-align: center;
    margin: 2rem 0;
    width: 100%;
}

a {
    text-decoration: none;
    color: var(--color-link);
}

.color_block a {
    color: inherit;
}

a.flush {
    color: inherit;
}

a:hover {
    text-decoration: underline dotted currentColor;
}

img {
    display: inline;
    max-width: 100%;
    vertical-align: middle;
}

blockquote {
    padding-left: 1rem;
    border-left: solid 5px var(--color-green);
    color: var(--color-green);
    opacity: 75%;
}

p,
span {
    font-size: inherit;
}

.fade {
    opacity: 75%;
}

/* button */
.button {
    display: flex;
    justify-content: center;
    align-items: center;
    appearance: none;
    outline: none;
    border: none;
    color: inherit;
    transition:
        background 0.15s,
        border-color 0.15s;
    cursor: pointer;
    border-radius: var(--radius);
    width: max-content;
    height: 32px;
    padding: 0 var(--pad-4);
    background: var(--color-raised);
    border: solid 1px var(--color-super-lowered);
    text-decoration: none !important;

    &:hover {
        background: var(--color-super-raised);
    }
}

#upload_button {
    height: 80px;
    width: 35rem;
    max-width: 90%;
    color: hsl(100, 86%, 14%);
    border: solid 1px hsla(100, 75%, 37%, 50%);
    background: hsla(100, 75%, 37%, 25%);
    font-size: 1.5em;

    &:hover {
        border: solid 1px hsla(100, 75%, 37%, 60%);
        background: hsla(100, 75%, 37%, 30%);
    }

    &:is(.dark *) {
        color: hsl(100, 86%, 80%);
        border: solid 1px oklch(72.3% 0.219 149.579 / 50%);
        background: oklch(79.2% 0.209 151.711 / 25%);

        &:hover {
            border: solid 1px oklch(72.3% 0.219 149.579 / 60%);
            background: oklch(79.2% 0.209 151.711 / 30%);
        }
    }
}

/* inputs */
input,
textarea,
select {
    appearance: none;
    border: solid 1px var(--color-super-lowered);
    outline: none;
    padding: var(--pad-3);
    background: var(--color-raised);
    border-radius: var(--radius);
    font-family: inherit;
    color: inherit !important;
    box-shadow: none;
    transition:
        background 0.15s,
        border-color 0.15s,
        box-shadow 0.15s;
    height: 32px;

    &:focus {
        background: var(--color-super-raised);
        border-color: var(--color-primary);
    }
}

input {
    --h: 32px;
    height: var(--h);
}

input[type="checkbox"],
input[type="range"],
input[type="radio"],
select {
    appearance: auto;
}

textarea {
    resize: vertical;
    min-height: 10rem;
}

/* card */
.card {
    border: solid 1px var(--color-super-lowered);
    background: var(--color-raised);
    padding: var(--pad-4);
    border-radius: var(--radius);
}

/* table */
table {
    table-layout: fixed;
    border-spacing: 0;
    border-collapse: separate;
    min-width: 100%;

    & th,
    & td {
        text-align: left;
        white-space: normal;
        vertical-align: middle;
        padding: 0 0.4rem;
    }

    & th {
        vertical-align: bottom;
    }

    & tr:hover :is(td, th) {
        background: var(--color-raised-75);
    }

    & img {
        max-width: clamp(50px, 80%, 80px);
    }
}

.table_wrapper {
    overflow: auto;
}

/* footer */
footer a:not(:first-child) {
    display: list-item;
    margin-left: 0.5ch;
}
