:root {
    color-scheme: dark;
    --bg: #000000;
    --surface: #000000;
    --surface-hover: #000000;
    --border: #000000;
    --frame: #000000;
    --text: #ffffff;
    --muted: #797979;
    --accent: #ffffff;
    --accent-contrast: #000000;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --header-bg: #000000;
    --o1: 280px;
    --section-entry-blur: 8px;
    --card-bg: linear-gradient(135deg, #727272, #ffffff, #6d6d6d);
    --card-border: var(--border);
    --card-text: #17171c;
    --card-muted: #5c5c66;
    --card-logo: #000000;
    --card-btn-border: #000000;
    --card-btn-text: #000000;
    --card-btn-hover-bg: #000000;
    --card-btn-hover-text: #ffffff;
    --card-shimmer: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(194, 194, 194, 0.185), rgba(255, 255, 255, 0.4));
}

html:has(#theme-switch:checked) {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-hover: #e9e9e9;
    --border: rgba(0, 0, 0, 0.199);
    --frame: #000000;
    --text: #000000;
    --muted: #765C58;
    --accent: #541a8a;
    --accent-contrast: #ffffff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.603);
    --header-bg: rgba(255, 255, 255, 0.199);
    --card-bg: linear-gradient(135deg, #141414, #3a3a3a, #141414, #202026);
    --card-border: var(--border);
    --card-text: #eaeaea;
    --card-muted: #9a9a9a;
    --card-logo: #ffffff;
    --card-btn-border: #ffffff;
    --card-btn-text: #ffffff;
    --card-btn-hover-bg: #ffffff;
    --card-btn-hover-text: #17171c;
    --card-shimmer: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.1));
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 1rem;
    line-height: 1.65;
    background-color: var(--bg);
    color: var(--text);
    overflow-y: auto;
    overflow-x: clip;
    transition: background-color 0.3s ease, color 0.3s ease;
}

main {
    flex: 1;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease,
        border-color 0.2s ease, transform 0.2s ease;
}

a:hover {
    color: var(--text);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

::selection {
    background-color: var(--accent);
    color: var(--accent-contrast);
}

h1,
h2,
h3 {
    line-height: 1.2;
    font-weight: 700;
}

h2,
h3,
.section-intro,
.project-stack-title,
.project-stack-desc {
    transition: color 0.3s ease;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 100;
    padding: 0.6rem 1rem;
    background-color: var(--accent);
    color: var(--accent-contrast);
    font-size: 0.85rem;
}

.skip-link:focus {
    top: 0;
    color: var(--accent-contrast);
}

header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--header-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

nav {
    max-width: 1100px;
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.nav-brand:hover {
    color: var(--accent);
}

.nav-brand img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.theme-toggle {
    position: relative;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--accent);
}

html:has(#theme-switch:focus-visible) .theme-toggle {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.theme-switch-input {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.socket {
    box-shadow: -0.05em 0.1em 0.2em -0.2em white;
    background: light-dark(hsl(0 0% 90%), hsl(0 0% 0%));
    position: relative;
    inset: 0;
}

.socket-shadow {
    position: absolute;
    inset: 0;
    opacity: 0;
    border-radius: inherit;
    box-shadow: 0em 0.075em 0.1em 0em white;
}

.theme-icon-dark,
.theme-icon-light {
    position: absolute;
    width: 20px;
    height: 20px;
    color: var(--text);
    opacity: 0;
    pointer-events: none;
    transition: color 0.2s ease, opacity 0.3s ease;
}

.theme-toggle:hover .theme-icon-dark,
.theme-toggle:hover .theme-icon-light {
    color: var(--accent);
}

.theme-icon-dark {
    opacity: 1;
}

html:has(#theme-switch:checked) .theme-icon-dark {
    opacity: 0;
}

html:has(#theme-switch:checked) .theme-icon-light {
    opacity: 1;
}

section {
    max-width: 1100px;
    margin-inline: auto;
    padding: 4.5rem 1.5rem;
}

section h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
}

#projects h2 {
    text-align: center;
}

.section-intro {
    margin-top: 0.5rem;
    margin-bottom: 2.5rem;
    text-align: center;
    color: var(--muted);
}

.projects-stack {
    position: relative;
}

.projects-grid {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
    perspective: 1500px;
    perspective-origin: center center;
    margin-top: 2rem;
}

.project-stack-card {
    position: absolute;
    width: 340px;
    max-width: 85vw;
    transform-style: preserve-3d;
    will-change: transform, filter;
    transition: transform 0.7s cubic-bezier(0.83, 0, 0.17, 1),
        opacity 0.7s ease,
        filter 0.7s ease;
}

.project-stack-card-hit {
    position: absolute;
    inset: 0;
    z-index: 2;
    cursor: pointer;
}

.project-stack-card-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    padding: 1.75rem 1.5rem;
    background: var(--card-bg);
    background-size: 300% 300%;
    border: 2px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: projectCardShimmer 4s ease infinite;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.project-stack-card:hover .project-stack-card-inner {
    border-color: var(--accent);
}

.project-stack-card-inner::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--card-shimmer);
    background-size: 200% 200%;
    animation: projectCardShimmer 4s ease infinite;
    pointer-events: none;
    z-index: 0;
}

.project-stack-header,
.project-stack-desc,
.project-card-stats {
    position: relative;
    z-index: 1;
}

.project-stack-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--accent), transparent 60%);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    filter: blur(15px);
    border-radius: inherit;
    transition: opacity 0.5s ease;
}

.project-stack-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}

.project-stack-title {
    margin: 0;
    font-size: 1.05rem;
    color: var(--card-text);
}

.project-stack-desc {
    margin-bottom: 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--card-muted);
}

.project-stack-actions {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: flex-start;
    margin-top: auto;
}

.project-stack-actions a {
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--card-btn-border);
    color: var(--card-btn-text);
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease,
        border-color 0.2s ease;
}

.project-stack-actions a:hover {
    background-color: var(--card-btn-hover-bg);
    color: var(--card-btn-hover-text);
}

.project-card-logo-wrap {
    display: block;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: var(--card-logo);
    overflow: hidden;
    transition: background-color 0.3s ease;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.project-card-logo-wrap--7dc {
    mask-image: url('assets/7DC.svg');
    -webkit-mask-image: url('assets/7DC.svg');
}

.project-card-logo-wrap--7tv {
    mask-image: url('assets/7TV.svg');
    -webkit-mask-image: url('assets/7TV.svg');
}

.project-stack-radio {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.projects-stack:has(#project-radio-0:checked) .project-stack-card[data-index="0"] {
    transform: translateZ(0) scale(1) rotateY(0);
    opacity: 1;
    z-index: 10;
    filter: blur(0);
}

.projects-stack:has(#project-radio-0:checked) .project-stack-card[data-index="1"] {
    transform: translateX(var(--o1)) translateZ(-120px) scale(0.85) rotateY(-15deg);
    opacity: 0.6;
    z-index: 9;
    filter: blur(3px);
}

.projects-stack:has(#project-radio-1:checked) .project-stack-card[data-index="0"] {
    transform: translateX(calc(var(--o1) * -1)) translateZ(-120px) scale(0.85) rotateY(15deg);
    opacity: 0.6;
    z-index: 9;
    filter: blur(3px);
}

.projects-stack:has(#project-radio-1:checked) .project-stack-card[data-index="1"] {
    transform: translateZ(0) scale(1) rotateY(0);
    opacity: 1;
    z-index: 10;
    filter: blur(0);
}

.projects-stack:has(#project-radio-0:checked) .project-stack-card[data-index="0"] .project-stack-glow,
.projects-stack:has(#project-radio-1:checked) .project-stack-card[data-index="1"] .project-stack-glow {
    opacity: 1;
}

.project-card-stats {
    margin-top: auto;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--card-text);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: #4a4a54;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-plus {
    font-size: 1rem;
    color: var(--accent);
    font-weight: 700;
    margin-left: 2px;
    display: none;
}

html:has(#theme-switch:checked) .stat-label {
    color: var(--card-muted);
}

footer {
    display: grid;
    gap: 1rem;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    transition: border-color 0.3s ease;
}

.bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-noise {
    position: absolute;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 9999;
    mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 1200'><filter id='s' x='-40%25' y='-40%25' width='180%25' height='180%25'><feTurbulence type='fractalNoise' baseFrequency='0.004' numOctaves='4' seed='12' result='n'/><feDisplacementMap in='SourceGraphic' in2='n' scale='200' result='d'/><feTurbulence type='fractalNoise' baseFrequency='0.028' numOctaves='2' seed='5' result='n2'/><feDisplacementMap in='d' in2='n2' scale='34'/></filter><circle cx='565' cy='615' r='480' fill='%23fff' filter='url(%23s)'><animateTransform attributeName='transform' type='rotate' values='-3 600 600;3 600 600;-3 600 600' dur='8s' repeatCount='indefinite'/><animate attributeName='r' values='470;500;470' dur='8s' repeatCount='indefinite'/></circle></svg>");
    mask-repeat: no-repeat;
    animation: theme-reveal 0.93s ease-in forwards;
}

@keyframes theme-reveal {
    from {
        mask-size: 1px 1px;
        mask-position: var(--tx, calc(100% - 22px)) var(--ty, 22px);
    }
    to {
        mask-size: var(--td, 300vmax) var(--td, 300vmax);
        mask-position: calc(var(--tx, calc(100% - 22px)) - var(--td, 300vmax) / 2)
            calc(var(--ty, 22px) - var(--td, 300vmax) / 2);
    }
}

@supports (animation-timeline: view()) {
    [data-animate="section-reveal"] {
        animation: section-reveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
        animation-timeline: view();
        animation-range: entry 0% entry 45%;
    }

    #projects {
        animation: section-reveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) both,
            section-blur 0.8s linear both;
        animation-timeline: view(), view();
        animation-range: entry 0% entry 45%, entry 0% entry 65%;
    }
}

@keyframes section-blur {
    from {
        filter: blur(var(--section-entry-blur));
    }

    to {
        filter: blur(0);
    }
}

.theme-toggle {
    --nav-in-x: calc(max((100vw - 1100px) / 2, 0px) + 32px);
    --nav-in-y: 0px;
    --nav-in-r: -360deg;
    animation: nav-in 0.6s ease-out both;
    animation-delay: 0.38s;
}

@keyframes nav-in {
    from {
        opacity: 0;
        transform: translate(var(--nav-in-x, 0px), var(--nav-in-y, -10px))
            rotate(var(--nav-in-r, 0deg));
    }
    to {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg);
    }
}

@keyframes section-reveal {
    from {
        opacity: 0;
        translate: 0 40px;
    }
    to {
        opacity: 1;
        translate: 0 0;
    }
}

@keyframes projectCardShimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@media (max-width: 640px) {
    :root {
        --o1: 150px;
    }
    .projects-grid {
        min-height: 300px;
    }
    .project-stack-card {
        width: 300px;
    }
    .project-stack-card-inner {
        min-height: 260px;
        padding: 1.25rem 1rem;
    }
    .project-stack-title {
        font-size: 0.95rem;
    }
    .project-stack-header {
        gap: 0.5rem;
    }
    .project-card-logo-wrap {
        width: 44px;
        height: 44px;
    }
}

#nuhUh {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    z-index: 120;
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--surface);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -16px) scale(0.94);
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

#nuhUh.show {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

#nuhUh picture {
    display: contents;
}

#nuhUh img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
    [data-animate] {
        opacity: 1 !important;
    }
}
