:root {
    --bg: #1e1e2e;
    --bg-0: #11111b;
    --bg-1: #181825;
    --surface: #313244;
    --text: #cdd6f4;
    --muted: #6c7086;
    --overlay: #45475a;
    --green: #a6e3a1;
    --blue: #89b4fa;
    --mauve: #cba6f7;
    --peach: #fab387;
    --yellow: #f9e2af;
    --red: #f38ba8;
    --sky: #89dceb;
    --comment: #6c7086;
}
* { box-sizing: border-box; margin: 0; padding: 0; touch-action: manipulation; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
button, a, .tab {
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}
body {
    font-family: "IBM Plex Sans", system-ui, sans-serif;
    background: var(--bg-0);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.55;
}
code, .mono, .tree, .tabs, .titlebar, .statusbar, .ln, kbd {
    font-family: "JetBrains Mono", ui-monospace, monospace;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

.ide {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overflow: clip;
    display: grid;
    grid-template-rows: 38px minmax(0, 1fr) 26px;
}
.titlebar {
    background: var(--bg-1);
    border-bottom: 1px solid #111;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    font-size: 12px;
    color: var(--muted);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.dots i:nth-child(1) { background: #f38ba8; }
.dots i:nth-child(2) { background: #f9e2af; }
.dots i:nth-child(3) { background: #a6e3a1; }
.titlebar .file { color: var(--text); white-space: nowrap; }
.caret {
    display: inline-block;
    width: 7px;
    height: 13px;
    margin-left: 2px;
    vertical-align: -2px;
    background: var(--green);
    animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.titlebar .spacer { flex: 1; }
.ghost {
    background: transparent;
    border: 1px solid var(--surface);
    color: var(--text);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 11px;
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--overlay);
    border-radius: 6px;
    background: var(--bg-0);
    color: var(--sky);
}
.lang-switch svg { margin: 0 4px 0 6px; flex: none; }
.lang-switch button {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}
.lang-switch button:hover { background: var(--surface); }
.lang-switch button.on { background: var(--blue); color: #1e1e2e; }

.workspace {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 0;
}
.explorer {
    background: var(--bg-1);
    border-right: 1px solid #111;
    padding: 12px 0;
    font-size: 12px;
    overflow-y: auto;
    min-height: 0;
}
.explorer h2 {
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--muted);
    padding: 0 14px 8px;
    font-weight: 600;
}
.tree { list-style: none; }
.tree a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    color: var(--text);
    text-decoration: none;
}
.tree a:hover, .tree a.active { background: var(--surface); }
.tree .ext { color: var(--blue); }
.tree .ext.md { color: var(--blue); }
.tree .ext.yml { color: var(--yellow); }
.tree .ext.ts { color: var(--blue); }
.tree .ext.json { color: var(--yellow); }
.tree .ext.sh { color: var(--green); }

.editor {
    background: var(--bg);
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
    min-width: 0;
    min-height: 0;
}
.tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    overflow-x: auto;
    background: var(--bg-1);
    border-bottom: 1px solid #111;
    font-size: 12px;
}
.tabs { min-height: 36px; }
.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px 9px 14px;
    color: var(--muted);
    border-right: 1px solid #111;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--bg); color: var(--text); box-shadow: inset 0 1px 0 var(--blue); }
.tab-close {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 14px;
    line-height: 1;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
}
.tab-close:hover { background: var(--surface); opacity: 1; }

.pane { width: min(920px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 64px; }
section { display: none; padding: 28px 0; }
section.active { display: block; }
.empty {
    display: none;
    padding: 80px 0;
    text-align: center;
    color: var(--muted);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 13px;
}
.empty.show { display: block; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.crumb b { color: var(--mauve); font-weight: 500; }

.codebox {
    background: #181825;
    border: 1px solid var(--surface);
    border-radius: 8px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 40px 1fr;
    font-size: 13.5px;
    line-height: 1.7;
}
.ln {
    background: #1e1e2e;
    color: var(--muted);
    text-align: right;
    padding: 16px 8px;
    user-select: none;
}
.src { padding: 16px 16px 16px 12px; overflow-x: auto; }
.k { color: var(--mauve); }
.s { color: var(--green); }
.n { color: var(--peach); }
.f { color: var(--blue); }
.c { color: var(--comment); }
.p { color: var(--text); }
.ty { color: var(--yellow); }

.hero-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.btn {
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    border: 1px solid var(--surface);
    background: var(--surface);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
}
.btn.primary { background: #313244; color: var(--green); border-color: #3e4054; }
.btn:hover { text-decoration: none; filter: brightness(1.1); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.projects-grid { grid-template-columns: repeat(6, 1fr); }
.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }
.card {
    background: #181825;
    border: 1px solid var(--surface);
    border-radius: 8px;
    padding: 16px;
}
.card .facts {
    font-family: "JetBrains Mono", monospace;
    font-size: 12.5px;
    line-height: 1.75;
    overflow-x: auto;
}
.card h3 { font-family: "JetBrains Mono", monospace; font-size: 14px; margin-bottom: 8px; }
.muted { color: #9399b2; }
h1, h2 { font-family: "JetBrains Mono", monospace; font-weight: 600; }
h2 { font-size: 16px; margin-bottom: 10px; color: var(--sky); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    border: 1px solid var(--surface);
    color: var(--peach);
    padding: 3px 8px;
    border-radius: 4px;
}

.skill-group h3 {
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
    color: var(--mauve);
    margin: 22px 0 4px;
    font-weight: 500;
}
.skill-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.skill {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 6px 10px;
    min-width: 0;
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    line-height: 1.3;
    border: 1px solid var(--surface);
    background: #181825;
    color: var(--text);
    border-radius: 6px;
}
.skill:hover { border-color: var(--overlay); }
.skill-ico {
    width: 26px;
    height: 26px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: #11111b;
    overflow: hidden;
}
.skill-ico.light { background: #cdd6f4; }
.skill-ico img { width: 18px; height: 18px; object-fit: contain; display: block; }
.skill-ico.ph { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; }

.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 10px;
}
.cert {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    background: #181825;
    border: 1px solid var(--surface);
    border-radius: 8px;
}
.cert:hover { border-color: var(--overlay); }
.cert-head { display: flex; align-items: center; gap: 10px; }
.cert-ico {
    width: 36px;
    height: 36px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #11111b;
}
.cert-ico svg { width: 20px; height: 20px; }
.cert-ico.sf { color: var(--green); }
.cert-ico.ud { color: var(--mauve); }
.cert-issuer { font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 500; }
.cert-date { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--muted); }
.cert-name { font-size: 14px; line-height: 1.4; flex: 1; }
.cert a { font-family: "JetBrains Mono", monospace; font-size: 12px; }

.job {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px;
    border-left: 2px solid var(--overlay);
    padding: 4px 0 16px 16px;
}
.job time { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--green); }

.term {
    background: #11111b;
    border: 1px solid var(--surface);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 13px;
}
.term .prompt { color: var(--green); }
.socials { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.socials a {
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    color: var(--text);
    border: 1px solid var(--surface);
    padding: 6px 10px;
    border-radius: 4px;
}

.statusbar {
    background: #89b4fa;
    color: #1e1e2e;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 600;
}
.statusbar span { opacity: 0.9; }

/* desktop: mobile-only elements hidden */
.menu-btn { display: none; }
.brand { display: none; }
.backdrop { display: none; }

@media (max-width: 860px) {
    .workspace { grid-template-columns: 1fr; }
    .ide { position: relative; grid-template-rows: 54px minmax(0, 1fr) 26px; }

    /* header */
    .titlebar {
        gap: 10px;
        padding: 0 12px;
        background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
        border-bottom: 1px solid var(--surface);
    }
    .dots, .titlebar .file { display: none; }

    .menu-btn {
        display: inline-grid;
        place-items: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 8px;
        background: var(--surface);
        border-color: var(--overlay);
        color: var(--sky);
    }

    .brand { display: flex; align-items: center; min-width: 0; }
    .brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
    .brand-name { font-size: 13px; font-weight: 700; color: var(--text); }
    .brand-role .caret { width: 5px; height: 10px; vertical-align: -1px; }
    .brand-role {
        min-height: 12px;
        font-size: 10px;
        color: var(--green);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .lang-switch svg { display: none; }
    .lang-switch button { padding: 5px 9px; }

    /* sidebar */
    .explorer { display: none; }
    .explorer.open {
        display: block;
        position: absolute;
        top: 54px;
        left: 0;
        z-index: 8;
        width: min(260px, 86vw);
        height: calc(100% - 80px);
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5);
    }
    .backdrop.show {
        display: block;
        position: absolute;
        top: 54px;
        left: 0;
        right: 0;
        bottom: 26px;
        z-index: 7;
        background: rgba(17, 17, 27, 0.6);
    }

    /* content */
    .grid, .job, .grid[style] { grid-template-columns: 1fr !important; }
    .skill-list { grid-template-columns: repeat(2, 1fr); }
    .span-3, .span-2 { grid-column: auto; }
    .pane { width: min(920px, calc(100% - 24px)); }
}

/* intro: desk + computer scene */
#intro {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #0b0b13;
    overflow: hidden;
    transition: opacity 0.6s ease, visibility 0.6s;
}
#intro.hide { opacity: 0; visibility: hidden; pointer-events: none; }
#intro svg {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    will-change: transform;
    transition: transform 1.3s cubic-bezier(0.7, 0, 0.3, 1);
    animation: introFade 0.8s ease both;
}
#intro .cl {
    transform-box: fill-box;
    transform-origin: left center;
    transform: scaleX(0);
    animation: typeLine 0.5s ease forwards;
}
@keyframes introFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes typeLine { to { transform: scaleX(1); } }
.intro-skip {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 101;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--surface);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
}
.intro-skip:hover { color: var(--text); border-color: var(--overlay); }

/* intro: gentle version when the device has "reduce motion" on */
#intro.reduce svg { transition: none; }
#intro.reduce .cl { animation: none; transform: scaleX(1); }