.tldr {
    --thread-axis: previous;
    position: relative;
    height: var(--view);
}

.tldr:focus {
    outline: none;
}

.tldr-stage {
    --fade-end: 60px;
    --fade-size: min(130px, 18%);
    --fade: linear-gradient(
        #000000 calc(100% - var(--fade-end) - var(--fade-size)),
        rgba(0, 0, 0, 0.84) calc(100% - var(--fade-end) - var(--fade-size) * 0.75),
        rgba(0, 0, 0, 0.5) calc(100% - var(--fade-end) - var(--fade-size) * 0.5),
        rgba(0, 0, 0, 0.16) calc(100% - var(--fade-end) - var(--fade-size) * 0.25),
        transparent calc(100% - var(--fade-end))
    );
    position: absolute;
    inset: var(--bar) 0 0;
    overflow: hidden;
    isolation: isolate;
    -webkit-mask-image: var(--fade);
    mask-image: var(--fade);
}

.tldr:has(.tldr-stage:not([data-state="booting"])) {
    --thread-hide: 1;
}

.tldr-head {
    --ink: var(--accent);
    position: absolute;
    top: 40px;
    right: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

:root[data-theme="dark"] .tldr-head {
    --ink: var(--fg);
}

.tldr-name {
    font-family: var(--font-name);
    font-weight: 900;
    font-size: min(21.3vw, 242px);
    line-height: 0.9;
    letter-spacing: -0.04em;
    color: transparent;
    -webkit-text-stroke: 1.5px var(--ink);
    user-select: none;
}

.tldr-name span {
    display: inline-block;
}

.tldr-social {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 12px;
}

.tldr-contact {
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: color-mix(in srgb, var(--panel) 78%, transparent);
    backdrop-filter: blur(12px);
    transition: border-color .2s;
}

.tldr-contact::before {
    content: "";
    width: 18px;
    height: 18px;
    background: var(--ink);
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
    transition: background .2s;
}

.tldr-contact:hover {
    border-color: var(--accent);
}

.tldr-contact:hover::before {
    background: var(--accent);
}

.tldr-figure {
    --smoke: 227, 30, 38;
    --smoke-alpha: 1.5;
    --puff-alpha: 2.6;
    --rise: 0;
    position: absolute;
    z-index: 1;
    right: 0;
    bottom: 60px;
    left: 0;
    height: min(470px, 60%);
    display: flex;
    justify-content: center;
    pointer-events: none;
}

:root[data-theme="dark"] .tldr-figure {
    --smoke: 255, 255, 255;
    --smoke-alpha: 2.4;
    --puff-alpha: 2.4;
}

.tldr-photo {
    flex: none;
    display: block;
    height: 100%;
    width: auto;
    max-width: none;
    transform-origin: 50% 20%;
    user-select: none;
}

.tldr-figure::before,
.tldr-figure::after {
    content: "";
    position: absolute;
    z-index: -1;
    left: 50%;
    translate: -50% calc((1 - var(--rise)) * 30%);
    opacity: var(--rise);
    will-change: transform;
}

.tldr-figure::before {
    top: -20%;
    height: 110%;
    aspect-ratio: 1.15;
    background:
        radial-gradient(34% 30% at 50% 38%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.2)), rgba(var(--smoke), calc(var(--smoke-alpha) * 0.1)) 45%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.03)) 75%, transparent),
        radial-gradient(26% 24% at 65% 30%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.15)), rgba(var(--smoke), calc(var(--smoke-alpha) * 0.07)) 45%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.02)) 75%, transparent),
        radial-gradient(30% 26% at 35% 33%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.12)), rgba(var(--smoke), calc(var(--smoke-alpha) * 0.06)) 45%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.02)) 75%, transparent);
    animation: tldr-smoke-high 11s ease-in-out infinite alternate;
}

.tldr-figure::after {
    top: -8%;
    height: 118%;
    aspect-ratio: 1.25;
    background:
        radial-gradient(42% 36% at 44% 52%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.18)), rgba(var(--smoke), calc(var(--smoke-alpha) * 0.09)) 45%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.025)) 75%, transparent),
        radial-gradient(48% 42% at 58% 48%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.14)), rgba(var(--smoke), calc(var(--smoke-alpha) * 0.07)) 45%, rgba(var(--smoke), calc(var(--smoke-alpha) * 0.02)) 75%, transparent 87.5%);
    animation: tldr-smoke-low 15s ease-in-out infinite alternate;
}

.tldr-smoke {
    position: absolute;
    z-index: -1;
    inset: 0;
    translate: 0 calc((1 - var(--rise)) * 30%);
    opacity: var(--rise);
}

.tldr-smoke i {
    position: absolute;
    top: var(--y);
    left: 50%;
    height: var(--size);
    aspect-ratio: 1.1;
    translate: -50% 0;
    background: rgba(var(--smoke), calc(var(--puff-alpha) * 0.38));
    -webkit-mask: url("../../img/smoke.webp") var(--tex) 0 / 300% 100% no-repeat;
    mask: url("../../img/smoke.webp") var(--tex) 0 / 300% 100% no-repeat;
    opacity: 0;
    animation: tldr-puff var(--time) linear var(--delay) infinite;
    will-change: transform, opacity;
}

.tldr-smoke i:nth-child(1) {
    --x: -28%;
    --sway: 16%;
    --spin: 24deg;
    --tex: 0%;
    --y: 30%;
    --size: 50%;
    --time: 9s;
    --delay: -0.2s;
}

.tldr-smoke i:nth-child(2) {
    --x: 26%;
    --sway: -14%;
    --spin: -28deg;
    --tex: 50%;
    --y: 34%;
    --size: 44%;
    --time: 10.5s;
    --delay: -2.9s;
}

.tldr-smoke i:nth-child(3) {
    --x: -6%;
    --sway: 20%;
    --spin: 18deg;
    --tex: 100%;
    --y: 24%;
    --size: 58%;
    --time: 12s;
    --delay: -0.2s;
}

.tldr-smoke i:nth-child(4) {
    --x: 38%;
    --sway: -10%;
    --spin: -20deg;
    --tex: 0%;
    --y: 40%;
    --size: 40%;
    --time: 8.5s;
    --delay: -2.2s;
}

.tldr-smoke i:nth-child(5) {
    --x: -40%;
    --sway: 12%;
    --spin: 30deg;
    --tex: 50%;
    --y: 38%;
    --size: 42%;
    --time: 11s;
    --delay: -0.8s;
}

.tldr-smoke i:nth-child(6) {
    --x: -50%;
    --sway: 14%;
    --spin: -22deg;
    --tex: 100%;
    --y: 54%;
    --size: 44%;
    --time: 12.5s;
    --delay: -12s;
}

.tldr-smoke i:nth-child(7) {
    --x: 48%;
    --sway: -16%;
    --spin: 26deg;
    --tex: 0%;
    --y: 58%;
    --size: 42%;
    --time: 13.5s;
    --delay: -12.5s;
}

.tldr-stage[data-state="booting"] .tldr-smoke i {
    animation: none;
}

@keyframes tldr-smoke-high {
    from {
        transform: translate(-8%, 3%) rotate(-12deg) scale(0.95);
    }

    to {
        transform: translate(9%, -5%) rotate(22deg) scale(1.18);
    }
}

@keyframes tldr-smoke-low {
    from {
        transform: translate(8%, 0) rotate(10deg) scale(1.1);
    }

    to {
        transform: translate(-9%, 4%) rotate(-20deg) scale(0.9);
    }
}

@keyframes tldr-puff {
    0% {
        opacity: 0;
        transform: translate(var(--x), 30%) rotate(0deg) scale(0.55);
    }

    25% {
        opacity: 1;
    }

    70% {
        opacity: 0.6;
    }

    100% {
        opacity: 0;
        transform: translate(calc(var(--x) + var(--sway)), -85%) rotate(var(--spin)) scale(1.6);
    }
}

.tldr-boot {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    pointer-events: none;
}

.tldr-loader {
    --thread-reach: 0.4667;
    position: relative;
    width: 150px;
    height: 150px;
}

.tldr-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    rotate: -90deg;
}

.tldr-ring circle {
    fill: none;
    stroke-width: calc(var(--thread-width) * 0.8);
}

.tldr-slot {
    stroke: var(--pending);
    opacity: 0.5;
}

.tldr-arc {
    --fill: 0;
    stroke: var(--accent);
    stroke-dasharray: calc(var(--fill) * 360px) 360px;
}

.tldr-face {
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--item-bg);
}

.tldr-face img {
    position: absolute;
    top: 0;
    left: 50%;
    height: 240%;
    width: auto;
    max-width: none;
    transform: translateX(-50%);
    opacity: 0.3;
    filter: grayscale(1) blur(6px);
}

.tldr-status {
    display: grid;
    place-items: center;
    min-height: 32px;
    margin: 0;
    text-align: center;
}

.tldr-done {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 24px;
    line-height: 32px;
    letter-spacing: -0.04em;
    visibility: hidden;
    opacity: 0;
}

.tldr-code {
    color: var(--accent-ink);
}

.tldr-dock {
    --frame: 1;
    position: fixed;
    z-index: 2;
    right: 12px;
    bottom: 20px;
    left: 12px;
    display: flex;
    gap: 2px;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--line) calc(var(--frame) * 100%), transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--panel) calc(var(--frame) * 78%), transparent);
    backdrop-filter: blur(calc(var(--frame) * 12px));
    box-shadow: 0 20px 40px -20px color-mix(in srgb, rgba(24, 24, 27, 0.35) calc(var(--frame) * 100%), transparent);
    transition: opacity .3s, visibility .3s;
}

.tldr-dock:not(.is-shown) {
    opacity: 0;
    visibility: hidden;
}

.tldr-link {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 2px;
    border: 0;
    border-radius: 12px;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: transform .2s, background .2s;
}

.tldr-link:hover {
    color: var(--fg);
    background: var(--item-bg);
    transform: translateY(-6px);
}

.tldr-stage:not([data-state="ready"]) ~ .tldr-dock {
    pointer-events: none;
}

.tldr-stage:not([data-state="ready"]) ~ .tldr-dock .tldr-link {
    transition: none;
}

.tldr-tile {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tldr-icon {
    width: 18px;
    height: 18px;
    background: #FFFFFF;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}

.tldr-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: min(11px, 2.8vw);
    line-height: 16px;
}

.tldr-up {
    --ink: var(--accent);
    position: fixed;
    z-index: 2;
    right: 12px;
    bottom: calc(var(--dock-space) - 12px);
    width: 48px;
    height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: color-mix(in srgb, var(--panel) 78%, transparent);
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 40px -20px rgba(24, 24, 27, 0.35);
    transition: opacity .3s, visibility .3s, border-color .2s;
}

:root[data-theme="dark"] .tldr-up {
    --ink: var(--fg);
}

.tldr-up:not(.is-shown) {
    opacity: 0;
    visibility: hidden;
}

.tldr-up::before {
    content: "";
    width: 20px;
    height: 20px;
    background: var(--ink);
    -webkit-mask: url("https://cdn.jsdelivr.net/npm/heroicons@2.1.5/20/solid/arrow-up.svg") center / contain no-repeat;
    mask: url("https://cdn.jsdelivr.net/npm/heroicons@2.1.5/20/solid/arrow-up.svg") center / contain no-repeat;
    transition: background .2s;
}

.tldr-up:hover {
    border-color: var(--accent);
}

.tldr-up:hover::before {
    background: var(--accent);
}

@media (min-width: 1200px) {
    .tldr-stage {
        --fade-end: 0px;
        --fade-size: min(170px, 20%);
    }

    .tldr-head {
        top: 24px;
        display: grid;
        justify-content: center;
        justify-items: start;
    }

    .tldr-name {
        -webkit-text-stroke-width: 2px;
    }

    .tldr-social {
        margin-left: 20px;
    }

    .tldr-figure {
        bottom: 0;
        height: min(660px, 78%);
    }

    .tldr-loader {
        width: 200px;
        height: 200px;
    }

    .tldr-ring circle {
        stroke-width: calc(var(--thread-width) * 0.6);
    }

    .tldr-face {
        inset: 18px;
    }

    .tldr-done {
        font-size: 32px;
        line-height: 40px;
    }

    .tldr-dock {
        right: auto;
        bottom: 40px;
        left: 50%;
        gap: 6px;
        padding: 8px;
        border-radius: 22px;
        transform: translateX(-50%);
    }

    .tldr-link {
        flex: none;
        width: 112px;
        gap: 8px;
        padding: 12px 8px 10px;
        border-radius: 14px;
    }

    .tldr-tile {
        width: 52px;
        height: 52px;
        border-radius: 14px;
    }

    .tldr-icon {
        width: 22px;
        height: 22px;
    }

    .tldr-label {
        font-size: 14px;
    }

    .tldr-up {
        right: 40px;
        bottom: 40px;
        width: 56px;
        height: 56px;
    }

    .tldr-up::before {
        width: 22px;
        height: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tldr-link {
        transition: none;
    }

    .tldr-figure::before,
    .tldr-figure::after {
        animation: none;
    }

    .tldr-smoke i {
        animation: none;
    }

    .tldr-link:hover {
        transform: none;
    }

    .tldr-up,
    .tldr-up::before {
        transition: none;
    }
}
