/* karha.ru — shared tokens, fonts and the main page. Project pages add their own CSS. */

@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url(fonts/golos-text-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url(fonts/golos-text-latin-400-normal.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: "Golos Text"; font-weight: 600; font-display: swap; src: url(fonts/golos-text-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-display: swap; src: url(fonts/golos-text-latin-600-normal.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: "Unbounded"; font-weight: 600; font-display: swap; src: url(fonts/unbounded-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-weight: 600; font-display: swap; src: url(fonts/unbounded-latin-600-normal.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/jetbrains-mono-cyrillic-400-normal.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: 400; font-display: swap; src: url(fonts/jetbrains-mono-latin-400-normal.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; }

:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #152030;
  --muted: #5a6779;
  --line: #dde3ea;
  --accent: #2c63d1;
  --night: #121a2b;
  --night-ink: #e8edf6;
  --night-muted: #9aa8bf;
  --night-line: #2f3d5e;
  --morning: #e3a23b;
  --bad: #d4483b;
  --good: #1f9b6c;
  --font-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --font-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1522; --surface: #172033; --ink: #e6ebf3; --muted: #9aa6b8; --line: #263248;
    --accent: #6f9cf2; --night: #0a0f1a; --night-ink: #e8edf6; --night-muted: #8e9cb4; --night-line: #26324c;
    --morning: #f0b555; --bad: #f07466; --good: #47c393;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.55; }
img { max-width: 100%; }
a { color: var(--accent); }
h1, h2 { font-family: var(--font-display); font-weight: 600; text-wrap: balance; margin: 0; }
h3 { margin: 0; text-wrap: balance; }
p, ul, dl { margin: 0; }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: 6px; z-index: 10; }

/* Top bar shared by all pages */
.topbar { background: var(--night); color: var(--night-ink); border-bottom: 1px solid var(--night-line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.topbar a { color: var(--night-ink); text-decoration: none; }
.brand { font-family: var(--font-display); font-size: 14px; letter-spacing: 0.04em; }
.topnav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; }
.topnav a { color: var(--night-muted); }
.topnav a:hover, .topnav a:focus-visible, .topnav a[aria-current] { color: var(--morning); outline: none; }

/* Hero */
.hero { background: var(--night); color: var(--night-ink); }
.hero .wrap { padding-block: 56px 64px; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--night-muted); }
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.1; margin-top: 14px; }
.hero h1 span { color: var(--morning); }
.hero .lead { margin-top: 18px; font-size: 18px; color: var(--night-muted); max-width: 40em; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; color: var(--night-muted); font-size: 15px; list-style: none; padding: 0; }
.facts b { color: var(--night-ink); font-weight: 600; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px; border: 1px solid var(--night-line); color: var(--night-ink); }
.btn.primary { background: var(--morning); border-color: var(--morning); color: #1b1407; }
.btn:hover, .btn:focus-visible { border-color: var(--morning); outline: none; }
.btn.primary:hover, .btn.primary:focus-visible { filter: brightness(1.06); }

.cv-links { margin-top: 16px; color: var(--night-muted); font-size: 15px; }
.cv-links a { color: var(--night-ink); }
.cv-links a:hover, .cv-links a:focus-visible { color: var(--morning); outline: none; }

/* Metrics */
.metrics { list-style: none; padding: 0; margin-top: 40px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--night-line); border: 1px solid var(--night-line); border-radius: 10px; overflow: hidden; }
.metrics li { background: var(--night); padding: 18px 18px 16px; display: grid; gap: 4px; align-content: start; }
.metrics .num { font-family: var(--font-display); font-size: clamp(22px, 3vw, 30px); color: var(--night-ink); font-variant-numeric: tabular-nums; }
.metrics .what { color: var(--night-muted); font-size: 14px; }

/* Sections */
section { scroll-margin-top: 16px; }
section > .wrap { padding-block: 64px 0; }
h2 { font-size: clamp(22px, 2.6vw, 30px); }
.section-lead { color: var(--muted); margin-top: 10px; max-width: 44em; font-size: 17px; }
.prose { margin-top: 18px; display: grid; gap: 12px; max-width: 46em; }
.about-sub { margin-top: 28px; font-size: 18px; }
.about-list { margin-top: 12px; max-width: 46em; }

/* Project cards */
.cards { margin-top: 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: grid; grid-template-rows: auto 1fr; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.card:hover, .card:focus-visible { border-color: var(--accent); box-shadow: 0 10px 30px rgba(21,32,48,0.10); outline: none; }
.card-media { background: var(--night); padding: 24px; height: 220px; display: grid; place-items: center; overflow: hidden; }
.card-media img { display: block; width: auto; max-width: min(100%, 380px); height: auto; max-height: 172px; border-radius: 6px; box-shadow: 0 14px 30px rgba(0,0,0,0.4); }
.card-code { margin: 0; width: 100%; max-width: 380px; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; color: var(--night-ink); white-space: pre; overflow: hidden; }
.card-body { padding: 20px 22px 22px; display: grid; gap: 10px; align-content: start; }
.card-tag { font-family: var(--font-mono); font-size: 12px; color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; }
.card h3 { font-size: 20px; font-weight: 600; }
.card p { color: var(--muted); font-size: 15px; }
.card .more { color: var(--accent); font-weight: 600; font-size: 15px; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { font-size: 13px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

/* Experience */
.job { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: grid; gap: 18px; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; align-items: baseline; }
.job-head h3 { font-size: 19px; font-weight: 600; }
.job-when { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.job h4 { margin: 6px 0 0; font-size: 16px; font-weight: 600; }
.bullets { list-style: none; padding: 0; display: grid; gap: 10px; }
.bullets li { padding-left: 20px; position: relative; }
.bullets li::before { content: ""; position: absolute; left: 0; top: 0.68em; width: 8px; height: 2px; background: var(--accent); }
.bullets b { font-weight: 600; }

/* Skills */
.skills { margin-top: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 36px; }
.skills div { display: grid; grid-template-columns: 8.5em 1fr; gap: 12px; padding-block: 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.skills dt { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.skills dd { margin: 0; min-width: 0; }

.plain-list { margin-top: 18px; padding-left: 20px; display: grid; gap: 8px; }

/* Footer */
footer .wrap { padding-block: 56px 48px; border-top: 1px solid var(--line); margin-top: 72px; display: grid; gap: 18px; }
.contact-list { display: flex; flex-wrap: wrap; gap: 12px 40px; }
.contact-list dt { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.contact-list dd { margin: 2px 0 0; font-size: 17px; }
.contact-list a { text-decoration: none; }
.contact-list a:hover, .contact-list a:focus-visible { text-decoration: underline; }
.fineprint { color: var(--muted); font-size: 13px; }

@media (max-width: 820px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skills { grid-template-columns: 1fr; }
  section > .wrap { padding-block: 48px 0; }
  .hero .wrap { padding-block: 40px 48px; }
}
@media (max-width: 460px) {
  .skills div { grid-template-columns: 1fr; gap: 2px; }
  .topnav { display: none; }
  .job { padding: 18px; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* Resume role cards on the main page (#cv) */
.roles { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.roles a { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; text-decoration: none; color: var(--ink); height: 100%; transition: border-color .15s; }
.roles a:hover, .roles a:focus-visible { border-color: var(--accent); outline: none; }
.roles .k { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.roles h3 { font-size: 19px; font-weight: 600; }
.roles p { color: var(--muted); font-size: 15px; }
