@import url("https://repodelivery.tetratto.com/tetratto-aux/lexend.css");

:root {
    color-scheme: light dark;
    --hue: 16;
    --sat: 6%;
    --lit: 0%;
    --color-surface: hsl(var(--hue), var(--sat), calc(90% - var(--lit)));
    --color-lowered: hsl(var(--hue), var(--sat), calc(86% - var(--lit)));
    --color-raised: hsl(var(--hue), var(--sat), calc(96% - var(--lit)));
    --color-super-lowered: hsl(var(--hue), var(--sat), calc(82% - var(--lit)));
    --color-super-raised: hsl(var(--hue), var(--sat), calc(99% - var(--lit)));
    --color-text: hsl(0, 0%, 9%);
    --color-text-raised: var(--color-text);
    --color-text-lowered: var(--color-text);

    --color-link: #2949b2;
    --color-shadow: rgba(0, 0, 0, 0.08);
    --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%);

    --color-primary: hsl(25, 95%, 53%);
    --color-primary-lowered: hsl(25, 95%, 49%);
    --color-text-primary: hsl(0, 0%, 5%);

    --shadow-x-offset: 0;
    --shadow-y-offset: 0.125rem;
    --shadow-size: var(--pad-1);

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

    --radius: 6px;
    --nav-height: 42.4px;
}

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

.dark,
.dark * {
    --hue: 266;
    --sat: 14%;
    --lit: 12%;
    --color-surface: hsl(var(--hue), var(--sat), calc(0% + var(--lit)));
    --color-lowered: hsl(var(--hue), var(--sat), calc(6% + var(--lit)));
    --color-raised: hsl(var(--hue), var(--sat), calc(2% + var(--lit)));
    --color-super-lowered: hsl(var(--hue), var(--sat), calc(12% + var(--lit)));
    --color-super-raised: hsl(var(--hue), var(--sat), calc(4% + var(--lit)));
    --color-text: hsl(0, 0%, 91%);

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

    --color-primary: hsl(25, 95%, 63%);
    --color-primary-lowered: hsl(25, 95%, 59%);
    --color-text-primary: hsl(0, 0%, 5%);
}

html,
body {
    line-height: 1.5;
    letter-spacing: 0.15px;
    font-family:
        "Lexend",
        "Inter",
        "Poppins",
        "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;
}

main {
    width: 80ch;
    margin: var(--pad-4) auto;
    padding: var(--pad-3) var(--pad-4);
}

article {
    margin: var(--pad-2) 0;
    height: calc(100dvh - var(--pad-4) - var(--nav-height) * 2);
}

.tab {
    /* flex: 1 0 auto; */
    flex: 0 0 auto;
    overflow: auto;
}

.tabs:not(.short) .tab {
    height: 100%;
}

.tabs {
    overflow: auto;
    width: 100%;
}

.fadein {
    animation: fadein ease-in-out 1 0.5s forwards running;
}

nav {
    height: var(--nav-height);
}

nav.sticky {
    background: var(--color-raised);
    position: sticky;
    z-index: 2;
    top: 0;
}

nav:not(.sticky) {
    padding: var(--pad-1);
}

@media screen and (max-width: 900px) {
    main,
    article,
    nav,
    header,
    footer {
        width: 100%;
    }

    article {
        margin-top: 0;
    }

    main {
        padding: 0;
    }

    .flex_collapse_rev {
        flex-direction: column-reverse !important;
    }
}

.container {
    margin: 10px auto 0;
    width: 100%;
}

.container.small {
    margin: 0 auto;
    max-width: 42ch;
}

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

@media screen and (min-width: 500px) {
    .content_container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .content_container {
        max-width: 720px;
    }
}

@media (min-width: 900px) {
    .content_container {
        max-width: 960px;
    }

    @media (min-width: 1200px) {
        article {
            padding: 0;
        }

        .content_container {
            max-width: 1100px;
        }
    }
}

video {
    max-width: 100%;
    border-radius: var(--radius);
}

/* card */
.card {
    padding: var(--pad-4);
    background: var(--color-raised);
    color: var(--color-text);
}

.card_nest:not(.reverse) .card:nth-child(1) {
    background: var(--color-super-raised);
    padding: var(--pad-2) var(--pad-4);
}

.card_nest.reverse .card:nth-child(2) {
    background: var(--color-super-raised);
    padding: var(--pad-2) var(--pad-4);
}

.card.surface {
    background: var(--color-surface);
}

.card .card {
    border-radius: var(--radius);
}

.cool_ass_3d_effect {
    position: relative;
    transition-property: transform, box-shadow;
    transition-duration: 500ms;
    transition-timing-function: ease-out;
    transform: rotate3d(0);
    box-shadow: 0 0 2px var(--color-shadow);

    &:hover {
        transition-duration: 250ms;
        box-shadow: 0 0 8px var(--color-shadow);
    }
}

/* button */
.button {
    --h: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--pad-2);
    padding: var(--pad-2) calc(var(--pad-3) * 1.5);
    cursor: pointer;
    background: var(--color-raised);
    color: var(--color-text);
    outline: none;
    border: none;
    width: max-content;
    height: var(--h);
    line-height: var(--h);
    transition: background 0.15s;
    text-decoration: none !important;
    user-select: none;
    appearance: none;
    overflow: hidden;
    position: relative;
}

.button.border {
    border: solid 1px var(--color-super-lowered);
}

.button.border:hover {
    border-color: var(--color-primary);
}

.button:not(.tab, .dropdown .inner *, .square) {
    border-radius: var(--radius);
}

.button:disabled {
    opacity: 50%;
    cursor: not-allowed;
}

.button.small {
    --h: 28px;
}

.button:not(:has(.button:hover)):not(.camo):hover {
    background: var(--color-super-raised);
}

.button.camo {
    background: transparent;
    color: inherit;
}

.bar .button:not(.simple).camo:hover {
    color: var(--color-link);
}

.button.simple {
    --size: 18px;
    font-weight: 600;
    padding: var(--pad-2) !important;
    border-radius: var(--radius);
    width: var(--size);
    height: var(--size);
    aspect-ratio: 1 / 1;
    font-size: 12px;
}

.button.surface {
    background: var(--color-surface);
}

.button.surface.simple:is(.camo *) {
    background: var(--color-super-raised);
}

.button.green:not(.dark *) {
    background: var(--color-green);
    color: white !important;

    &:hover {
        background: var(--color-green-lowered) !important;
    }
}

.button.red:not(.dark *) {
    background: var(--color-red);
    color: white !important;

    &:hover {
        background: var(--color-red-lowered) !important;
    }
}

.button.primary {
    color: var(--color-text-primary) !important;
    background: var(--color-primary);
}

.button.primary:hover {
    background: var(--color-primary-lowered) !important;
}

.button.big {
    --h: 48px;
    width: 100%;
}

.button.icon_only {
    width: var(--h);
}

/* dropdown */
.dropdown {
    position: relative;
}

.dropdown .inner {
    display: none;
    flex-direction: column;
    box-shadow: var(--shadow-x-offset) var(--shadow-y-offset) var(--shadow-size)
        var(--color-shadow);
    background: var(--color-raised);
    color: inherit;
    position: absolute;
    z-index: 2;
    top: calc(100% + 5px);
    right: 0;
    width: max-content;
    max-width: 15rem;
    border-radius: var(--radius);
    overflow: hidden;
}

.dropdown .inner.surface {
    background: var(--color-surface);
}

.dropdown .inner.left {
    right: unset;
    left: 0;
}

.dropdown .inner.open {
    display: flex;
}

.dropdown .inner .button,
.dropdown .inner .title {
    padding: var(--pad-3) var(--pad-4);
    justify-content: flex-start;
    width: 100%;
}

.dropdown .inner .title {
    font-weight: 600;
    font-size: 14px;
}

.dropdown:has(.inner.open) .button:nth-child(1):not(.inner *) {
    background: var(--color-raised);
}

.dropdown .inner.top {
    top: unset;
    bottom: 100%;
}

.dropdown .inner.left {
    left: 0;
    right: unset;
}

nav .dropdown .inner {
    top: calc(100% + var(--pad-3));
}

/* input */
input,
textarea,
select {
    --h: 36px;
    padding: var(--pad-2) calc(var(--pad-3) * 1.5);
    background: var(--color-raised);
    color: var(--color-text);
    outline: none;
    border: none;
    width: max-content;
    transition:
        background 0.15s,
        border 0.15s;
    height: var(--h);
    line-height: var(--h);
    border-left: solid 0px transparent;
    width: 100%;
    resize: vertical;
    border-radius: var(--radius);
}

input:not([type="checkbox"]):focus {
    outline: solid 2px var(--color-primary);
    box-shadow: 0 0 0 4px oklch(70.5% 0.213 47.604 / 25%);
    background: var(--color-super-raised);
}

input:user-invalid,
input[data-invalid] {
    border-left: inset 5px var(--color-red);
}

input.surface,
textarea.surface,
select.surface {
    background: var(--color-surface);
}

input[type="checkbox"] {
    height: max-content;
}

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

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

.post_right:not(.repost) {
    max-width: calc(100% - 52px);
}

.rhs {
    width: 100% !important;
}

.name {
    max-width: 250px;
    overflow: hidden;
    /* overflow-wrap: break-word; */
    overflow-wrap: anywhere;
    text-overflow: ellipsis;
}

@media screen and (min-width: 901px) {
    .name.shorter {
        max-width: 200px;
    }

    .name.lg\:long {
        max-width: unset;
    }

    .rhs {
        width: calc(100% - 23rem) !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;
}

button svg {
    pointer-events: none;
}

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

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

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;
}

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

.img_sizer img {
    width: 100%;
    height: 100%;
}

.avatar {
    --size: 18px;
    width: var(--size);
    height: var(--size);
    border-radius: var(--radius);
    aspect-ratio: 1 / 1;
}

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

p,
span {
    font-size: inherit;
}

/* extra */
@keyframes fadein {
    from {
        opacity: 0%;
    }

    to {
        opacity: 100%;
    }
}

.loader {
    animation: spin linear infinite 2s forwards running;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes spin {
    from {
        transform: rotateZ(0deg);
    }

    to {
        transform: rotateZ(360deg);
    }
}

.items-end {
    align-items: flex-end;
}

.gap_ch {
    gap: 1ch;
}

/* table */
table {
    width: 100%;
    table-layout: auto;
    margin: var(--pad-4) 0;
    border-collapse: separate;
    border-spacing: 0;
    border: solid 1px var(--color-super-raised);
}

table td,
table th {
    padding: var(--pad-2) var(--pad-4);
}

table tr:not(thead *):nth-child(odd) {
    background: var(--color-super-raised);
}

table thead th {
    text-align: left;
}

/* details */
details {
    width: 100%;
    margin: var(--pad-4) 0;
}

details summary {
    background: var(--color-super-raised);
    padding: var(--pad-2) var(--pad-4);
    cursor: pointer;
}

details .content {
    padding: var(--pad-4);
    background: var(--color-surface);
}

/* dialog */
dialog {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-x-offset) var(--shadow-y-offset) var(--shadow-size)
        var(--color-shadow);
    animation: fadein ease-in-out 1 0.25s forwards running;
    max-width: 95%;
    width: 30rem;
    margin: auto;
    padding: var(--pad-4);
    border: 0;
    border-radius: var(--radius);
}

dialog .inner {
    display: flex;
    flex-direction: column;
    gap: var(--pad-2);
}

dialog::backdrop {
    background: hsla(0, 0%, 0%, 25%);
    backdrop-filter: blur(2px);
}

dialog:is(.dark *)::backdrop {
    background: hsla(0, 0%, 100%, 15%);
}

/* menus */
menu {
    display: flex;
}

menu .button {
    justify-content: flex-start;
    width: 100%;
}

menu .button.active {
    background: var(--color-super-raised);
}

menu.col {
    flex-direction: column;
    width: 25rem;
    max-width: 100%;
}

/* messages */
.message {
    align-items: flex-end;
}

.message:not(.mine) {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.message .body {
    padding: var(--pad-2) var(--pad-3);
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: var(--radius);
    min-height: 36px;
}

.message.mine .body {
    background: var(--color-primary);
    color: var(--color-text-primary);
    border-bottom-right-radius: 0;
}

.message:not(.mine) .body {
    border-bottom-left-radius: 0;
}

.message:hover .dropdown.hidden,
.message:focus .dropdown.hidden,
.message:has(.open) .dropdown.hidden {
    display: flex !important;
}

.message img {
    max-width: 50dvw;
    max-height: 25dvh;
}

.message .upload {
    border-radius: var(--radius);
    box-shadow: var(--shadow-x-offset) var(--shadow-y-offset) var(--shadow-size)
        var(--color-shadow);
}

.message .body p:last-of-type {
    margin: 0 !important;
}

.message_reply_wrapper .message {
    opacity: 75%;
    padding: 0 4px;

    & .body {
        min-height: unset;
        height: 26px !important;
        overflow: hidden;
    }

    & p {
        font-size: 10px;
    }

    & .avatar {
        --size: 18px !important;
    }
}
