/* Layout: app shell with a navigation rail (top bar on phones) and a column of white cards. */
:root {
  --bg: #F7F7FA;
  --surface: #FFFFFF;
  --surface-2: #F5F4F9;
  --chip: #F2F1F6;
  --line: #E4E2EE;
  --text: #19191C;
  --text-2: #4A4A55;
  --muted: #5E5E6B;
  --faint: #6E6E7A;
  --primary: #7F52FF;
  --primary-text: #5B2FE0;
  --container: #EEE8FF;
  --on-container: #3B1F9E;
  --kotlin: linear-gradient(135deg, #E44857 0%, #C711E1 50%, #7F52FF 100%);
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.55; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

.mono { font-family: var(--mono); }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.rail { flex: 0 0 88px; position: sticky; top: 0; height: 100vh; padding: 20px 0; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.rail-logo { width: 52px; height: 52px; border-radius: 16px; background: var(--kotlin); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 17px; margin-bottom: 20px; text-decoration: none; }
.rail-item { text-decoration: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; min-width: 56px; }
.rail-pill { width: 56px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background .15s ease; }
.rail-item:hover .rail-pill { background: #ECEAF3; }
.rail-item.active .rail-pill { background: var(--container); color: var(--on-container); }
.rail svg { width: 22px; height: 22px; }

.content { flex: 1 1 0; min-width: 0; padding: 24px max(16px, 3vw) 120px 8px; }
.stack { max-width: 1180px; display: flex; flex-direction: column; gap: 16px; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .rail { position: sticky; top: 0; z-index: 6; height: auto; flex: 0 0 auto; flex-direction: row; justify-content: space-around; padding: 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .rail-logo { display: none; }
  .content { padding: 16px 16px 112px; }
}

/* Cards & shared bits */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 28px; }
.section-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.pill-green { background: #E8F6EC; color: #1E6B34; }
.pill-green .dot { width: 8px; height: 8px; border-radius: 50%; background: #2E9E4F; }
.pill-grey { background: var(--chip); color: var(--text-2); }
.pill-purple { background: var(--container); color: var(--on-container); }
.tag { font-family: var(--mono); font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--chip); color: var(--text-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 32px; padding: 0 12px; border-radius: 8px; background: var(--chip); display: inline-flex; align-items: center; font-size: 14px; font-weight: 500; }
.code-hint { font-family: var(--mono); font-size: 13px; color: #8A8A96; }

.btn { text-decoration: none; height: 54px; padding: 0 22px; border-radius: 14px; font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; gap: 10px; transition: transform .15s ease, box-shadow .15s ease; cursor: pointer; border: 0; font-family: inherit; }
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--primary); color: #fff; font-weight: 700; box-shadow: 0 6px 18px rgba(127, 82, 255, .30); }
.btn-outline { border: 1.5px solid #D6D3E3; color: var(--text); background: transparent; }
.btn-text { color: var(--primary-text); padding: 0 12px; }
.btn-dark { background: var(--text); color: #fff; height: 46px; font-size: 15px; border-radius: 12px; }
.btn-light-outline { border: 1.5px solid #D6D3E3; color: var(--text); height: 46px; font-size: 15px; border-radius: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 12px; }

.fab { position: fixed; right: max(24px, env(safe-area-inset-right, 0px)); bottom: max(24px, env(safe-area-inset-bottom, 0px)); z-index: 10; text-decoration: none; height: 56px; padding: 0 20px 0 16px; border-radius: 16px; background: var(--primary); color: #fff; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 10px; box-shadow: 0 10px 28px rgba(127, 82, 255, .38); transition: transform .15s ease; }
.fab:hover { transform: translateY(-1px); }
.fab svg { width: 22px; height: 22px; }

/* Hero */
.hero { padding: clamp(24px, 4vw, 48px); display: flex; flex-wrap: wrap; gap: 36px; align-items: center; }
.hero-text { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.hero-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.hero h1 { margin: 0; font-weight: 800; font-size: clamp(42px, 5.6vw, 76px); line-height: 1; letter-spacing: -0.035em; }
.hero .role { font-size: clamp(19px, 2vw, 24px); font-weight: 600; color: var(--primary-text); }
.hero p { margin: 0; max-width: 52ch; font-size: 17px; color: var(--text-2); }
.hero-photo { flex: 1 1 260px; max-width: 300px; aspect-ratio: 1 / 1; border-radius: 40px; overflow: hidden; background: #151513; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px; display: flex; flex-direction: column; gap: 4px; }
.stat b { font-weight: 800; font-size: 44px; line-height: 1; letter-spacing: -0.03em; }
.stat span { font-size: 15px; color: var(--muted); }

/* Expertise */
.expertise { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.exp { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.exp-code { align-self: flex-start; height: 32px; padding: 0 10px; border-radius: 10px; background: var(--container); color: var(--on-container); display: inline-flex; align-items: center; font-family: var(--mono); font-weight: 700; font-size: 13px; }
.exp h3 { margin: 0; font-size: 18px; font-weight: 700; }
.exp p { margin: 0; font-size: 14.5px; color: var(--text-2); }
.exp .tech { margin-top: auto; padding-top: 4px; font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* Featured */
.featured-head { padding: 12px 8px 0; }
.featured-head a { font-size: 14px; color: var(--primary-text); font-weight: 600; text-decoration: none; }
.feat { padding: clamp(22px, 3vw, 32px); display: flex; flex-wrap: wrap; gap: 24px 32px; align-items: center; }
.feat-text { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.feat-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.feat-meta .pill { height: 26px; font-size: 13px; padding: 0 10px; }
.feat h3 { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
.feat p { margin: 0; font-size: 15.5px; color: var(--text-2); }
.tiles { flex: 1 1 420px; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { border-radius: 16px; background: var(--surface-2); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-height: 84px; }
.tile .k { font-family: var(--mono); font-size: 12px; color: var(--primary-text); font-weight: 700; }
.tile .v { font-size: 14.5px; font-weight: 500; line-height: 1.35; }

/* Experience */
.exp-list { padding: 28px 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.exp-list .section-head { padding: 0 16px 10px; }
.job { border-radius: 16px; padding: 12px 16px; display: flex; align-items: center; gap: 16px; transition: background .15s ease; }
.job:hover { background: #F7F6FB; }
.job-ini { flex: 0 0 46px; height: 46px; border-radius: 12px; background: var(--chip); color: var(--muted); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.job-ini.hl { background: var(--container); color: var(--on-container); }
.job-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.job-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.job-top b { font-size: 16.5px; }
.job-top span { font-size: 14px; color: var(--muted); }
.parallel { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #FFF3E0; color: #8A4B00; }
.job-note { font-size: 14.5px; color: var(--text-2); }
.api { flex: 0 0 auto; font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); }
details.more summary { list-style: none; cursor: pointer; align-self: center; margin: 6px auto 0; width: max-content; height: 44px; padding: 0 18px; border-radius: 12px; background: var(--chip); color: var(--on-container); font-weight: 600; font-size: 15px; display: flex; align-items: center; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary .closed, details.more:not([open]) summary .open { display: none; }
details.more[open] summary { order: 2; margin-top: 10px; }
details.more { display: flex; flex-direction: column; }
@media (max-width: 520px) { .api { display: none; } .job { padding: 12px 8px; } }

/* Pet project teasers */
.teasers { display: flex; flex-wrap: wrap; gap: 16px; }
.teaser { flex: 1 1 360px; min-width: 0; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 24px; display: flex; gap: 18px; align-items: center; transition: transform .15s ease, box-shadow .15s ease; }
.teaser:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(60, 40, 140, .10); }
.app-icon { flex: 0 0 68px; height: 68px; border-radius: 20px; display: grid; place-items: center; font-weight: 800; font-size: 32px; }
.app-icon.matemo { background: #3D8BEB; color: #fff; }
.app-icon.fero { background: #1F201B; color: #D9B84A; }
.teaser .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.teaser small { font-size: 13px; color: #6E6E7A; font-weight: 500; }
.teaser b { font-size: 22px; font-weight: 800; }
.teaser span span { font-size: 15px; color: var(--muted); }

/* Skills */
.skills { display: flex; flex-direction: column; gap: 16px; }
.skill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.skill-row .label { flex: 0 0 130px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #6E6E7A; }

/* Contact */
.contact { display: flex; flex-wrap: wrap; gap: 16px; }
.contact-main { flex: 999 1 480px; min-width: 0; border-radius: 28px; background: var(--text); color: #fff; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.contact-main .code-hint { color: #B69CFF; }
.contact-main h2 { margin: 0; font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.contact-item { text-decoration: none; color: #fff; min-height: 46px; padding: 0 16px; border-radius: 12px; background: #2B2B31; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; border: 0; font-family: inherit; cursor: pointer; }
.contact-item svg { width: 18px; height: 18px; flex: none; }
.contact-item:hover { background: #3A3A42; color: #fff; }
.contact-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #6E6E7A; }
.kv b { font-weight: 700; }
.kv .lvl { font-weight: 400; color: var(--muted); }
.copied { font-size: 13px; color: #B9F0C6; min-height: 1em; }

/* Pet projects page */
.page-head { padding: 16px 8px 8px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head h1 { margin: 0; font-weight: 800; font-size: clamp(36px, 4.6vw, 60px); line-height: 1; letter-spacing: -0.035em; }
.listing { padding: clamp(20px, 3.5vw, 36px); display: flex; flex-direction: column; gap: 24px; }
.listing-head { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.listing-head .app-icon { flex-basis: 92px; height: 92px; border-radius: 26px; font-size: 42px; }
.listing-title { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.listing-title h2 { margin: 0; font-size: 32px; line-height: 1; font-weight: 800; letter-spacing: -0.02em; }
.listing-title .tagline { font-size: 17px; color: var(--text-2); }
.listing-title .meta { font-size: 14px; color: #6E6E7A; }
.store-btn { height: 50px; padding: 0 18px 0 14px; gap: 10px; }
.store-btn-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.store-btn-text small { font-size: 10.5px; font-weight: 500; opacity: .8; }
.store-btn-text b { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.shots { overflow-x: auto; margin: 0 -8px; padding: 0 8px 4px; }
.shots-row { display: flex; gap: 14px; width: max-content; }
.shot-img { width: 196px; height: auto; border-radius: 24px; border: 6px solid var(--text); }
.shot { width: 196px; height: 412px; border-radius: 28px; border: 6px solid var(--text); display: grid; place-items: center; font-family: var(--mono); font-size: 12px; text-align: center; padding: 12px; }
.matemo .shot, .matemo .feature { background: #EAF2FD; }
.fero .shot, .fero .feature { background: #FAF4E0; }
.matemo .accent { color: #1D5BB0; }
.fero .accent { color: #7D5F00; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.feature { border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.feature b { font-size: 15.5px; }
.feature span { font-size: 14px; color: var(--text-2); }
.toml { border-radius: 18px; background: #1E1F22; color: #DFE1E5; overflow: hidden; }
.toml-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #2E3035; font-family: var(--mono); font-size: 12.5px; color: #9DA0A8; }
.toml-dots { display: flex; gap: 6px; }
.toml-dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.toml-body { padding: 4px 16px 12px; }
.toml-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid #2B2D31; }
.toml-row:last-child { border-bottom: 0; }
.toml-key { flex: 0 0 150px; font-family: var(--mono); font-size: 13px; color: #B69CFF; }
.toml-libs { flex: 1 1 400px; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.lib { min-height: 28px; padding: 2px 10px; border-radius: 6px; background: #2B2D31; display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12.5px; }
.lib em { font-style: normal; color: #8FCB98; }
.walkthrough { border-radius: 28px; background: var(--text); color: #fff; padding: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.walkthrough b { font-size: 22px; font-weight: 800; }
.walkthrough p { margin: 4px 0 0; font-size: 15px; color: #B9BAC4; }
.btn-white { background: #fff; color: var(--text); height: 46px; font-size: 15px; border-radius: 12px; }

/* ---------- Easter eggs ---------- */
.toast { position: fixed; left: 50%; bottom: max(96px, calc(env(safe-area-inset-bottom, 0px) + 96px)); z-index: 30; transform: translate(-50%, 12px); max-width: calc(100vw - 32px); width: max-content; padding: 10px 18px; border-radius: 22px; background: #303034; color: #fff; font-size: 14px; font-weight: 500; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* "Show layout bounds" from Android developer options. */
.dev-bounds body * { outline: 1px solid rgba(255, 64, 129, .7) !important; outline-offset: -1px; }
.dev-bounds .toast, .dev-bounds .dev-chip { outline: 0 !important; }
.dev-chip { position: fixed; left: 50%; top: 12px; z-index: 30; transform: translateX(-50%); max-width: calc(100vw - 32px); height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: #FF4081; color: #fff; font: 600 13px var(--sans); cursor: pointer; box-shadow: 0 4px 16px rgba(255, 64, 129, .35); }
@media (max-width: 760px) { .dev-chip { top: auto; bottom: max(96px, calc(env(safe-area-inset-bottom, 0px) + 96px)); } }

/* Recomposition counter. */
button.recompose { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
button.recompose:hover { color: var(--primary-text); }
.recompose-count { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--on-container); background: var(--container); padding: 2px 8px; border-radius: 6px; }
.recompose-count.pop { animation: pop .3s ease; }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* Dessert codename on the API badges. */
.api.has-dessert { position: relative; cursor: help; }
.api.has-dessert::after { content: attr(data-dessert); position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 5; white-space: nowrap; padding: 6px 10px; border-radius: 8px; background: var(--text); color: #fff; font: 500 12.5px var(--sans); opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
.api.has-dessert:hover::after, .api.has-dessert:focus-visible::after { opacity: 1; transform: none; }
.api.has-dessert:hover { color: var(--on-container); border-color: #CFC4F5; }

[data-devtap] { -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: reduce) { .recompose-count.pop { animation: none; } }
