/* gleb.app home: terminal-style bento, set in JetBrains Mono. Two themes:
   dark   : IntelliJ Dark editor colours + vyshyvanka red / white / black
   ubuntu : Ubuntu terminal palette (aubergine, orange, warm grey, ANSI colours) */

@font-face { font-family: 'RoadUA'; src: url('../fonts/RoadUA-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url('../fonts/JetBrainsMono-latin-400.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap; src: url('../fonts/JetBrainsMono-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url('../fonts/JetBrainsMono-cyrillic-400.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap; src: url('../fonts/JetBrainsMono-cyrillic-700.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }

:root {
    /* IntelliJ Dark (new UI) editor colours */
    --bg: #1e1f22;
    --panel: #2b2d30;
    --panel2: #393b40;
    --line: #43454a;
    --ink: #6f737a;          /* tile borders */
    --fg: #bcbec4;           /* default text */
    --dim: #868a91;          /* secondary text / comments */
    --key: #56a8f5;          /* functions, labels, links */
    --str: #6aab73;          /* strings */
    --kw: #cf8e6d;           /* keywords */
    --ok: #5fb865;           /* success */
    --acc: #d6001c;          /* accent surface: vyshyvanka red */
    --acc-ink: #fff;
    --acc-text: #ff5468;     /* accent as text on dark */
    --hi: #dfe1e5;           /* light surface: the white of the embroidery */
    --hi-ink: #1e1f22;
    --prompt-user: #6aab73;
    --prompt-path: #56a8f5;
    --st-a: #f0253f;         /* stitch: red */
    --st-w: #dfe1e5;         /* stitch: white */
    --st-d: #4e5157;         /* stitch: black thread */

    --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, 'DejaVu Sans Mono', Menlo, monospace;
    --head: 'RoadUA', var(--mono);
}

/* Ubuntu terminal: aubergine background, orange, warm grey, ANSI palette */
:root[data-theme="ubuntu"] {
    --bg: #2c001e;           /* dark aubergine */
    --panel: #300a24;        /* aubergine */
    --panel2: #3d1233;
    --line: #5e2750;         /* light aubergine */
    --ink: #aea79f;          /* warm grey */
    --fg: #eeeeec;
    --dim: #aea79f;
    --key: #729fcf;          /* ANSI blue */
    --str: #8ae234;          /* ANSI bright green */
    --kw: #fcaf3e;           /* ANSI bright orange */
    --ok: #8ae234;
    --acc: #e95420;          /* Ubuntu orange */
    --acc-ink: #fff;
    --acc-text: #ff7a4d;
    --hi: #eeeeec;
    --hi-ink: #2c001e;
    --prompt-user: #8ae234;
    --prompt-path: #729fcf;
    --st-a: #e95420;         /* stitch: orange */
    --st-w: #eeeeec;         /* stitch: white */
    --st-d: #5e2750;         /* stitch: aubergine */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    background-image: radial-gradient(color-mix(in srgb, var(--fg) 8%, transparent) 1px, transparent 1px);
    background-size: 22px 22px;
    color: var(--fg);
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.55;
    overflow-x: hidden;
    transition: background-color .3s, color .3s;
}

a { color: var(--key); }
code, kbd { font-family: inherit; color: var(--str); }
kbd { border: 1px solid var(--ink); border-radius: 4px; padding: 0 5px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--hi); color: var(--hi-ink); padding: 8px 12px; z-index: 10; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px dashed var(--acc-text); outline-offset: 3px; }

/* ---------- vyshyvanka ---------- */
.stitch { font-family: var(--mono); font-variant-ligatures: none; white-space: pre; overflow: hidden; line-height: 1; font-size: 12px; letter-spacing: .38em; font-weight: 700; user-select: none; }
.stitch i { font-style: normal; }
.stitch .a { color: var(--st-a); }
.stitch .w { color: var(--st-w); }
.stitch .d { color: var(--st-d); }
.band { padding: 6px 0; margin: 0 0 30px; border-bottom: 2px solid var(--line); background: color-mix(in srgb, var(--bg) 75%, #000); }
#band-bottom { margin: 40px 0 0; border-bottom: 0; border-top: 2px solid var(--line); }
.pat { margin-top: 10px; font-size: 13px; }

/* ---------- bento grid ---------- */
.grid {
    display: grid; gap: 26px; max-width: 1180px; margin: 0 auto;
    padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
        "term  term  term  stat"
        "term  term  term  resume"
        "range range stats stats"
        "exp   exp   p1    p2"
        "exp   exp   p3    edu"
        "play  play  play  play"
        "lawn  lawn  lawn  lawn"
        "contact contact pat pat";
    grid-template-rows: auto auto auto 1fr 1fr auto auto auto;   /* the two 1fr rows keep the 4 project/education tiles equal */
}
.term-tile { grid-area: term; }
.status-tile { grid-area: stat; }
.resume-tile { grid-area: resume; }
.range-tile { grid-area: range; }
.stats-tile { grid-area: stats; }
.exp-tile { grid-area: exp; }
.p1 { grid-area: p1; } .p2 { grid-area: p2; } .p3 { grid-area: p3; }
.edu-tile { grid-area: edu; }
.contact-tile { grid-area: contact; }
.pat-tile { grid-area: pat; }
.play-tile { grid-area: play; }
.lawn-tile { grid-area: lawn; }

@media (max-width: 1000px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas: "term term" "stat resume" "range range" "stats stats" "exp exp" "p1 p2" "p3 edu" "play play" "lawn lawn" "contact contact" "pat pat";
        grid-template-rows: repeat(5, auto) 1fr 1fr auto auto auto auto;
    }
}
@media (max-width: 620px) {
    .grid {
        gap: 22px;
        padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "term" "resume" "stats" "range" "exp" "p1" "p2" "p3" "edu" "play" "lawn" "contact" "stat" "pat";
        grid-template-rows: none;
    }
    .band { margin-bottom: 22px; }
}

.tile {
    --sh: var(--acc);
    position: relative; min-width: 0;
    background: var(--panel);
    border: 2px solid var(--ink);
    border-radius: 6px;
    box-shadow: 6px 6px 0 var(--sh);
    padding: 18px 20px;
    transition: transform .15s ease, box-shadow .15s ease, background-color .3s;
}
.tile.alt { --sh: var(--hi); }
@media (hover: hover) { .tile:hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--sh); } }
.tile:active { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--sh); }
.term-tile:hover, .term-tile:active { transform: none; box-shadow: 6px 6px 0 var(--sh); }

.label { margin: 0 0 12px; color: var(--dim); font-size: 12px; }
.d { color: var(--kw); }
.cm { color: var(--dim); }
.tile h2 { font-family: var(--head); font-weight: 700; margin: 0 0 8px; font-size: 22px; line-height: 1.15; }
.lede { margin: 0 0 14px; color: var(--fg); font-size: 13.5px; }

/* ---------- terminal ---------- */
.term-tile { --sh: var(--hi); padding: 0; display: flex; flex-direction: column; height: 620px; overflow: hidden; background: var(--bg); }
@media (max-width: 1000px) { .term-tile { height: 560px; } }
@media (max-width: 620px) { .term-tile { height: min(78svh, 600px); min-height: 460px; } }

.titlebar { display: flex; align-items: flex-end; gap: 6px; background: var(--panel2); border-bottom: 2px solid var(--ink); padding: 2px 6px 0 8px; font-size: 12px; flex: none; position: relative; }
.titlebar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: linear-gradient(90deg, var(--acc) 50%, var(--hi) 50%); }
.tab { background: var(--bg); padding: 7px 14px; border-radius: 6px 6px 0 0; border: 1px solid var(--line); border-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62%; margin-bottom: -1px; position: relative; z-index: 1; }
.tab-icon { color: var(--prompt-user); margin-right: 6px; }
.tab-plus { padding: 6px 8px; color: var(--dim); }
.spacer { flex: 1; }
.theme-btn { font: inherit; font-size: 11px; color: var(--fg); background: transparent; border: 1px solid var(--ink); border-radius: 4px; padding: 2px 8px; margin: 0 8px 6px; cursor: pointer; }
.theme-btn:hover { background: var(--line); }
.wc { width: 34px; text-align: center; padding: 6px 0; color: var(--dim); }
.wc.close:hover { background: #c42b1c; color: #fff; }
@media (max-width: 620px) { .wc, .tab-plus { display: none; } .titlebar { padding-right: 0; } }

.term-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.out { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 18px 4px; font-size: 13.5px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; overscroll-behavior: contain; }
.out .ln { white-space: pre-wrap; word-break: break-word; min-height: 1.55em; }
.out .cmdline { margin-top: 10px; }
.out pre { margin: 0; font: inherit; }
.out .banner { color: var(--acc-text); font-weight: 700; line-height: 1.15; margin: 4px 0 6px; font-size: clamp(11px, 3.2vw, 15px); }
.out .sub { color: var(--dim); }
.out h3 { margin: 6px 0 2px; font: inherit; color: var(--key); }
.out .k { color: var(--key); }
.out .s { color: var(--str); }
.out .e { color: var(--acc-text); }
.out .o { color: var(--ok); }
.out .y { color: var(--acc-text); }
.out .b { font-weight: 700; color: var(--hi); }
.out .m { color: var(--dim); }
.out .cols { display: grid; grid-template-columns: max-content 1fr; column-gap: 18px; }
.out .cols > span:nth-child(odd) { color: var(--key); }
.out .li { padding-left: 2ch; text-indent: -2ch; }
.out .nf { display: flex; flex-wrap: wrap; gap: 4px 22px; align-items: center; margin: 6px 0; }
.out .sw { letter-spacing: 0; }
.out .gap { margin-top: 8px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 18px; flex: none; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; font: inherit; font-size: 12.5px; color: var(--fg); background: var(--panel); border: 1px solid var(--ink); border-radius: 999px; padding: 6px 13px; cursor: pointer; min-height: 34px; transition: background .12s, color .12s, transform .1s; }
.chips button:hover { background: var(--hi); color: var(--hi-ink); border-color: var(--hi); }
.chips button:active { transform: scale(.94); }

.prompt-row { display: flex; align-items: center; gap: 8px; padding: 6px 18px 14px; flex: none; }
.prompt { white-space: nowrap; font-weight: 700; user-select: none; }
.prompt .u, .prompt .h, .out .pr .u, .out .pr .h { color: var(--prompt-user); }
.prompt .p, .out .pr .p { color: var(--prompt-path); }
.prompt .at, .prompt .c, .prompt .d, .out .pr .at, .out .pr .c, .out .pr .d { color: var(--fg); }
#cmd { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--fg); font: inherit; font-size: 16px; caret-color: var(--acc-text); caret-shape: block; padding: 6px 0; }
#cmd::placeholder { color: var(--dim); opacity: .7; }
@media (min-width: 621px) { #cmd { font-size: 13.5px; } }
@media (max-width: 480px) { .prompt .at, .prompt .h, .prompt .c { display: none; } }
.prompt-row:focus-within { background: color-mix(in srgb, var(--fg) 4%, transparent); }

/* ---------- status ---------- */
.state { margin: 0 0 8px; font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--dim); display: inline-block; }
.dot.on { background: var(--ok); animation: pulse 2s infinite; }
.dot.off { background: var(--acc-text); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 70%, transparent); } 70%, 100% { box-shadow: 0 0 0 10px transparent; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 16px; margin: 0; }
.kv dt { color: var(--key); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.bar { color: var(--ok); letter-spacing: 0; }
.fine { margin: 12px 0 0; font-size: 11.5px; color: var(--dim); }

/* ---------- resume tile: white, black text ---------- */
.resume-tile { background: #fff; color: #000; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; border-color: #000; --sh: var(--acc); min-height: 150px; }
.resume-tile .open { font-size: 12px; font-weight: 700; }
.resume-tile .big { font-family: var(--head); font-weight: 700; font-size: clamp(30px, 4vw, 40px); line-height: 1; display: flex; justify-content: space-between; align-items: center; }
.resume-tile .big b { transition: transform .2s; }
.resume-tile:hover .big b, .resume-tile:focus-visible .big b { transform: translateX(8px); }
.resume-tile:focus-visible { outline-color: #000; }

/* ---------- range (the stack, relays to React) ---------- */
.range-tile .lede b { color: var(--acc-text); font-weight: 700; }
.layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.layer { display: block; padding: 6px 10px 7px; border-left: 4px solid var(--c, var(--acc)); background: color-mix(in srgb, var(--fg) 4%, transparent); border-radius: 0 4px 4px 0; transition: background .15s, transform .15s, opacity .3s; }
.layer:hover { background: color-mix(in srgb, var(--fg) 10%, transparent); transform: translateX(4px); }
/* two lines, always: the name, then the tools on a single line */
.layer b, .layer span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer b { color: var(--hi); font-weight: 700; font-size: 13px; }
.layer span { font-size: 12px; color: var(--fg); }
.layer:nth-child(even) { --c: var(--hi); }

/* ---------- stats ---------- */
.stats-tile { display: flex; flex-direction: column; }
.stats { flex: 1; grid-auto-rows: 1fr; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; margin: 0; }
.stats div { border-top: 2px solid var(--line); padding-top: 8px; }
.stats dt { font-family: var(--head); font-weight: 700; font-size: clamp(26px, 3.2vw, 34px); line-height: 1; color: var(--hi); margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.stats dd { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.35; }
@media (max-width: 620px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- experience ---------- */
.role + .role { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.role h2 { margin-bottom: 2px; }
.role .where { margin: 0 0 8px; font-size: 12.5px; color: var(--dim); }
.role .where b { color: var(--acc-text); font-weight: 400; }
.role ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.role li { position: relative; padding-left: 18px; font-size: 13px; }
.role li::before { content: '›'; position: absolute; left: 2px; color: var(--acc-text); font-weight: 700; }
.role li b { color: var(--hi); font-weight: 700; }

/* ---------- projects ---------- */
.proj { display: flex; flex-direction: column; }
.proj .tags { margin-top: auto; }
.proj .badge { align-self: flex-start; display: inline-block; margin: 0 0 10px; font-size: 11.5px; font-weight: 700; color: var(--acc-ink); background: var(--acc); padding: 1px 8px; border-radius: 3px; }
.proj .desc { margin: 0 0 14px; color: color-mix(in srgb, var(--fg) 88%, transparent); font-size: 13px; }
.tags { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 11.5px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 8px; }

/* ---------- education ---------- */
.edu-tile ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 13px; }
.edu-tile li b { display: block; color: var(--hi); }
.edu-tile li span { color: var(--dim); font-size: 12px; }

/* ---------- contact ---------- */
.contact-tile { background: var(--hi); color: var(--hi-ink); border-color: var(--hi); --sh: var(--acc); }
.contact-tile .label { color: color-mix(in srgb, var(--hi-ink) 60%, transparent); }
.contact-tile .label .d { color: var(--hi-ink); }
.contact-tile ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.contact-tile a { display: block; color: inherit; text-decoration: none; padding: 7px 0; min-height: 44px; transition: transform .15s; transform-origin: left; }
.contact-tile a:hover, .contact-tile a:focus-visible { transform: translateX(6px); }
.contact-tile li span { display: block; font-family: var(--head); font-weight: 700; font-size: 19px; line-height: 1.1; }
.contact-tile li em { display: block; font-style: normal; font-size: 12.5px; opacity: .75; overflow-wrap: anywhere; }
.contact-tile a:focus-visible { outline-color: var(--hi-ink); }

/* ---------- footer ---------- */
footer { text-align: center; color: var(--dim); font-size: 12px; padding: 18px 20px calc(30px + env(safe-area-inset-bottom)); }
footer p { margin: 2px 0; }
.flag { display: inline-block; width: 18px; height: 12px; vertical-align: -1px; background: linear-gradient(#0057b7 50%, #ffd500 50%); border-radius: 2px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- fit (tailor the page to a role) ---------- */
.fitbar { max-width: 1180px; margin: -8px auto 18px; padding: 0 20px; display: flex; justify-content: center; align-items: center; gap: 12px; font-size: 12.5px; }
.fitbar[hidden] { display: none; }
.fitbar b { color: var(--acc-text); }
.fitbar button { font: inherit; font-size: 12px; color: var(--fg); background: transparent; border: 1px solid var(--ink); border-radius: 999px; padding: 3px 12px; cursor: pointer; }
.fitbar button:hover { background: var(--hi); color: var(--hi-ink); }
.layer.hit { --c: var(--acc-text); background: color-mix(in srgb, var(--acc) 16%, transparent); }
.layer.miss, .role li.miss { opacity: .42; }
.role li { transition: opacity .3s; }
.role li.hit b { color: var(--acc-text); }
.proj { transition: transform .15s ease, box-shadow .15s ease, background-color .3s, opacity .3s; }
.proj.miss { opacity: .62; }
.out .lnk { font: inherit; color: var(--key); background: none; border: 0; border-bottom: 1px dashed var(--key); padding: 0; cursor: pointer; }
.out .lnk:hover { color: var(--acc-text); border-color: var(--acc-text); }

/* ---------- game tile ---------- */
.play-tile, .lawn-tile { padding-bottom: 12px; }
#bugs { display: block; width: 100%; height: 300px; border: 1px solid var(--line); border-radius: 4px; background: color-mix(in srgb, var(--bg) 60%, var(--panel)); touch-action: pan-y; cursor: grab; }
#bugs:active { cursor: grabbing; }
@media (max-width: 620px) { #bugs { height: 270px; } }
.hud { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; font-size: 12.5px; flex-wrap: wrap; }
.hud button { font: inherit; font-size: 12px; color: var(--fg); background: transparent; border: 1px solid var(--ink); border-radius: 999px; padding: 4px 14px; cursor: pointer; min-height: 32px; }
.hud button.primary { background: var(--acc); color: var(--acc-ink); border-color: var(--hi); font-weight: 700; }
.hud button:hover { background: var(--hi); color: var(--hi-ink); }
.hud .on { color: var(--acc-text); }
.hud .w { color: var(--ok); font-weight: 700; }
.play-tile .fine { margin: 8px 0 0; }
#lawn { display: block; width: 100%; border: 1px solid var(--line); border-radius: 4px; background: color-mix(in srgb, var(--bg) 60%, var(--panel)); touch-action: manipulation; cursor: pointer; user-select: none; -webkit-user-select: none; }

/* ---------- easter eggs ---------- */
.rain { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; transition: opacity .8s; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 51; background: var(--hi); color: var(--hi-ink); border: 2px solid var(--acc); box-shadow: 4px 4px 0 var(--acc); padding: 8px 14px; border-radius: 6px; font-size: 13px; max-width: calc(100vw - 32px); text-align: center; }

/* ---------- Purdue Old Gold education tile ---------- */
.edu-tile { background: #cfb991; color: #000; border-color: #000; --sh: #8e6f3e; }
.edu-tile .label { color: rgba(0, 0, 0, .6); }
.edu-tile .label .d { color: #000; }
.edu-tile li b { color: #000; }
.edu-tile li span { color: #2e2a22; }

/* ---------- neofetch logos ---------- */
.out .pg { color: #cfb991; font-weight: 700; line-height: 1.1; font-size: clamp(9.5px, 2.9vw, 13.5px); }
.out .pg i { font-style: normal; }
.out .pgo { color: #cfb991; }
.out .pgf { color: var(--dim); font-weight: 400; }
.out .pgroup { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.out .nf pre { white-space: pre-wrap; }
