:root {
    --bg: #e6e4c8;
    --card-bg: #bbb9a2;
    --fg: #22322e;
    --special-fg: #22322e;
    --fg-light: #2f423c;
    --accent: #3a7f72;
    --radius: 6px;

    --glass-bg: rgba(255, 255, 245, 0.48);
    --glass-border: rgba(0, 0, 0, 0.08);
}

html.dark-mode {
    --bg: #0e1210;
    --card-bg: #22322e;
    --fg: #e6e4c8;
    --special-fg: #22322e;
    --fg-light: #e6e4c8;
    --accent: #5fe0c2;

    --glass-bg: rgba(16, 20, 18, 0.42);
    --glass-border: rgba(255, 255, 255, 0.08);
}


body {
    background-color: var(--bg);
    color: var(--fg-light);
    font-family: "JetBrains Mono", monospace;
    margin: 0;
    overflow-x: hidden;
    line-height: 1.5;
}

.header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 2rem;
    gap: 1.5rem;

    background: rgba(30, 40, 35, 0.55);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.4s ease, border-color 0.3s ease;
}

html:not(.dark-mode) .header {
    background: rgba(255, 255, 245, 0.45);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

@supports (backdrop-filter: blur(10px)) {
    body.scrolled .header {
        background: rgba(30, 40, 35, 0.35);
        transition: background 0.3s ease;
    }
}

.header .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.header .logo img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: contain;
    transition: transform 0.25s ease;
}

.header .logo span {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--fg);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.4rem;
}
.nav-links a {
    text-decoration: none;
    color: var(--fg);
    font-weight: 600;
    position: relative;
    transition: color 0.25s ease;
}
.nav-links a::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.25s ease;
}
.nav-links a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}
.nav-links a:hover {
    color: var(--accent);
}

#theme-toggle {
    border: 1px solid color-mix(in oklab, var(--fg) 30%, transparent);
    border-radius: 8px;
    background: color-mix(in oklab, var(--bg) 85%, transparent);
    color: var(--fg);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(8px);
}
#theme-toggle:hover {
    border-color: var(--accent);
    background: color-mix(in oklab, var(--bg) 60%, var(--accent) 8%);
    transform: translateY(-1px);
}
#theme-icon {
    font-size: 1.3rem;
    line-height: 1;
}

html:not(.dark-mode) .body{
    background-color: var(--bg);
    color: var(--fg-light);
}

html:not(.dark-mode) .header {
    background: color-mix(in oklab, var(--bg) 94%, white 8%);
    border-bottom: 1px solid color-mix(in oklab, var(--fg) 15%, transparent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

html:not(.dark-mode) .header .logo span,
html:not(.dark-mode) .nav-links a,
html:not(.dark-mode) #theme-toggle {
    color: var(--fg);
}
html:not(.dark-mode) .nav-links a:hover {
    color: var(--accent);
}

html:not(.dark-mode) .hero h1 {
    color: var(--accent);
}
html:not(.dark-mode) .hero p {
    color: var(--fg-light);
    opacity: 0.85;
}

html:not(.dark-mode) footer {
    border-top: 1px solid rgba(0,0,0,0.1);
    color: var(--fg);
    opacity: 0.8;
}

.hero {
    text-align: center;
    padding: 5rem 2rem 3rem;
}
.hero h1 {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 600;
    color: var(--accent);
}
.hero p {
    max-width: 60ch;
    margin: 1rem auto 0;
    color: var(--fg-light);
    opacity: .85;
}

h2 {
    color: var(--accent);
    border-left: 3px solid var(--accent);
    padding-left: .5rem;
    margin-top: 3rem;
}

section {
    padding: 3rem 2rem;
}

.mode-light,
.mode-dark {
    display: block;
    width: 100%;
    height: auto;
}

.mode-dark { display: none !important; }

@media (prefers-color-scheme: dark) {
    html:not(.dark-mode) .mode-light { display: none !important; }
    html:not(.dark-mode) .mode-dark  { display: block !important; }
}

section {
    position: relative;
    max-width: 1000px;
    margin: 4rem auto;
    padding: 2.6rem 2rem 2rem;
    border-radius: var(--radius);
    background: var(--section-bg);
    border: 1px solid color-mix(in oklab, var(--fg) 20%, transparent);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: none;
}

section.active {
    display: block;
}

section + section {
    margin-top: 6rem;
}


section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2.2rem;
    display: block;
    background: color-mix(in oklab, var(--accent) 6%, transparent);
    border-bottom: 1px solid color-mix(in oklab, var(--fg) 20%, transparent);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.tabbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.4rem;
    padding: 0.35rem 1.2rem 0 0.8rem;
    height: 2.3rem;
    z-index: 3;
}

.tab {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.4rem 1rem 0.3rem;
    border-radius: var(--radius) var(--radius) 0 0;
    background: color-mix(in oklab, var(--accent) 8%, var(--bg) 85%);
    border: 1px solid color-mix(in oklab, var(--fg) 25%, transparent);
    border-bottom: none;
    color: color-mix(in oklab, var(--accent) 65%, var(--fg));
    opacity: 0.6;
    cursor: default;
    transition: all 0.25s ease;
    margin-bottom: 0.45rem;
}

.tab:hover {
    opacity: 0.8;
    background: color-mix(in oklab, var(--accent) 15%, var(--bg) 80%);
}

.tab.active {
    background: color-mix(in oklab, var(--bg) 94%, var(--fg) 2%);
    color: var(--fg);
    opacity: 1;
    z-index: 4;
    border: 1px solid color-mix(in oklab, var(--fg) 25%, transparent);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    position: relative;
    margin-bottom: 0.4rem;
    box-shadow: 0 1px 0 color-mix(in oklab, var(--bg) 94%, var(--fg) 6%);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

html:not(.dark-mode) .tab {
    background: color-mix(in oklab, var(--bg) 80%, white 10%);
    color: color-mix(in oklab, var(--fg) 70%, var(--accent));
    opacity: 0.7;
}
html:not(.dark-mode) .tab.active {
    background: color-mix(in oklab, var(--bg) 96%, white 3%);
    color: var(--fg);
}

:root {
    --section-bg: color-mix(in oklab, var(--bg) 96%, var(--fg) 2%);
}
html.dark-mode {
    --section-bg: color-mix(in oklab, var(--bg) 95%, var(--fg) 4%);
}

.tab.active {
    background: var(--section-bg);
    color: var(--fg);
    opacity: 1;
    z-index: 4;
    border: 1px solid color-mix(in oklab, var(--fg) 30%, transparent);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    position: relative;
    margin-bottom: 0.4rem;
    box-shadow: 0 1px 0 var(--section-bg);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: particlesMove 60s linear infinite;
    opacity: 0.15;
}

body::before {
    background-image:
            radial-gradient(circle 1px at 10% 20%, var(--accent) 100%, transparent 0),
            radial-gradient(circle 1px at 80% 70%, var(--accent) 100%, transparent 0),
            radial-gradient(circle 1px at 40% 90%, var(--accent) 100%, transparent 0),
            radial-gradient(circle 1px at 70% 40%, var(--accent) 100%, transparent 0),
            radial-gradient(circle 1px at 30% 30%, var(--accent) 100%, transparent 0);
    animation-duration: 90s;
}

body::after {
    background-image:
            radial-gradient(circle 2px at 20% 80%, var(--accent) 100%, transparent 0),
            radial-gradient(circle 2px at 60% 25%, var(--accent) 100%, transparent 0),
            radial-gradient(circle 2px at 85% 50%, var(--accent) 100%, transparent 0);
    animation-duration: 120s;
    opacity: 0.08;
}

@keyframes particlesMove {
    0%   { background-position: 0 0, 0 0; }
    50%  { background-position: 100px 200px, -100px 100px; }
    100% { background-position: 0 0, 0 0; }
}

.editor-area {
    background: var(--section-bg);
    color: var(--fg-light);
    font-family: "JetBrains Mono", monospace;
    text-align: left;
    padding: 1.5rem;
    border-radius: 0 0 var(--radius) var(--radius);
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
    line-height: 1.5;
    min-height: 300px;
    overflow-y: auto;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.tab .tab-close,
section .section-close {
    display: none;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1;
    user-select: none;
    color: color-mix(in oklab, var(--fg) 70%, transparent);
}

.tab.active .tab-close,
section.active .section-close {
    display: inline;
}

.tab.active .tab-close:hover,
section.active .section-close {
    color: var(--accent);
}

.tab .tab-close,
section .section-close {
    padding: 0 .2rem;
    border-radius: 4px;
}

.tab.active .tab-close:hover,
section.active .section-close:hover {
    background: color-mix(in oklab, var(--bg) 85%, var(--fg) 15%);
}

.section-close {
    margin-left: auto;
    display: flex;
    width: 1rem;
    height: 1rem;
    justify-content: center;
    align-content: center;
    align-self: center;
    border-radius: var(--radius);
    transition: transform .15s ease, background .2s ease, color .2s ease;
    background: transparent;
    border: 0;
    margin-right: 1.5rem !important;
    margin-bottom: .7rem !important;
    padding: .2rem .05rem .2rem .2rem !important;
    line-height: 1 !important;
    text-align: center;
}

section:not(.active) .section-close {
    display: none;
}

.terminal-prompt {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9rem;
    color: var(--accent);
    background: color-mix(in oklab, var(--bg) 96%, var(--fg) 2%);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow: hidden;
    user-select: none;
}

.cursor {
    width: 0.6ch;
    height: 1em;
    background: var(--accent);
    display: inline-block;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.prompt-path {
    color: color-mix(in oklab, var(--accent) 60%, var(--fg));
}
.prompt-dir {
    color: color-mix(in oklab, var(--fg) 70%, var(--accent));
}

.prompt-cmd {
    color: var(--fg-light);
    margin-left: 0.4rem;
}

.editor-area {
    transition: opacity 0.25s ease;
}
.editor-area.updating {
    opacity: 0.3;
}

.header.shrink {
    height: 72px;
    flex-direction: row;
    justify-content: space-between;
    padding: 0.8rem 2rem;
}

.logo.boot strong {
    font-size: clamp(2rem, 5vw, 3rem);
}

.header:not(.splash) .logo.boot strong {
    transition: font-size 0.5s ease !important;
    font-size: clamp(1.5rem, 1.75rem, 2.5rem) !important;
}

.header:not(.splash) .logo.boot .boot-logo {
    height: clamp(3rem, 3rem, 4rem) !important;
    width: clamp(3rem, 3rem, 4rem) !important;
}

.nav-links {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.header.shrink .nav-links {
    opacity: 1;
    transform: translateY(0);
}

.header.slide-up {
    transform: translateY(-100vh);
}

.header.fixed-top {
    position: sticky;
    top: 0;
    transform: none;
    height: 72px;
    flex-direction: row;
    justify-content: space-between;
    padding: 0.8rem 2rem;
    transition: none;
}

body.lock-scroll {
    overflow: hidden;
}

body.unlock-scroll {
    overflow: auto;
}

.header.locked {
    position: sticky;
    top: 0;
    height: fit-content;
    flex-direction: row;
    justify-content: space-between;
    padding: 0.8rem 2rem;
    transition: height 0.8s ease, background 0.8s ease;
}

body.no-scroll-up {
    overscroll-behavior: none;
}

body.freeze-scroll {
    overflow: hidden;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 2rem;

    background: transparent !important;

    isolation: isolate;
    overflow: hidden;

    --logo-size: 2rem;
}

.header.splash {
    position: relative;
    height: 100vh;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: height 0.8s ease, background 0.6s ease;

    --logo-size: 20rem;
}

.header.splash .logo.boot {
    display: flex;
    flex-direction: column;
}

.header:not(.splash) .logo.boot {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.header:not(.splash) .flex-nav {
    display: flex;
    flex-direction: column;
    align-items: start;
}

.header:not(.splash) {
    align-items: start;
    justify-items: start;
    padding-bottom: 2rem;
}

.boot-logo {
    width: var(--logo-size) !important;
    height: var(--logo-size) !important;
    border-radius: 50%;
    object-fit: contain;
}

.logo.boot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo.boot strong {
    position: relative;
    display: inline-block;
    color: var(--accent);
    letter-spacing: .06em;
    transition:
            font-size .6s ease,
            letter-spacing .6s ease,
            transform .1s ease-out,
            opacity .3s ease-out;
    will-change: transform, opacity;
}

.nav-links {
    opacity: 0;
    transition: opacity .5s ease;
}
.header:not(.splash) .nav-links {
    opacity: 1;
    align-self: start;
    margin-top: -1rem !important;
}

.logo.boot strong.slide-left {
    animation: moveLeftUltra 0.4s cubic-bezier(0.7, 0, 0.3, 1) forwards;
    font-size: 2rem;
}

@keyframes moveLeftUltra {
    0% { transform: translateY(0) translateX(0); }
    40% { transform: translateY(-6px) translateX(-16px); }
    100% { transform: translateY(0) translateX(0); }
}

.header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transition: background 0.35s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    pointer-events: none;
}

@supports not (backdrop-filter: blur(1px)) {
    .header::before {
        background: color-mix(in oklab, var(--glass-bg) 80%, transparent);
    }
}

body.scrolled .header::before {
    background: color-mix(in oklab, var(--glass-bg) 80%, transparent);
}

body:has(.hero.active):not(:has(section.active:not(.hero))):not(:has(.header.splash)) {
    height: 100vh;
    overflow: hidden;
}

body:has(.hero.active):not(:has(section.active:not(.hero))):not(:has(.header.splash)) main {
    margin: 0;
    padding: 0;
}

body:has(.hero.active):not(:has(section.active:not(.hero))):not(:has(.header.splash)) .hero {
    margin-top: 0.5rem !important;
    margin-bottom: 3.5rem !important;
}

body:has(.hero.active):not(:has(section.active:not(.hero))):not(:has(.header.splash)) footer {
    bottom: 0 !important;
}

.project-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

.project-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 17rem;
    height: 17rem;
    border-radius: var(--radius);
    background: color-mix(in oklab, var(--section-bg) 95%, var(--accent) 5%);
    border: 1px solid color-mix(in oklab, var(--fg) 20%, transparent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.25s ease;
    cursor: pointer;
    text-align: center;
}

.project-tile img {
    width: 10rem;
    height: 10rem;
    object-fit: contain;
    margin-bottom: 0.6rem;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.project-tile span {
    font-weight: 600;
    color: var(--fg);
    font-size: 0.9rem;
}

.project-tile:hover {
    transform: translateY(-4px);
    background: color-mix(in oklab, var(--accent) 10%, var(--section-bg) 90%);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}