/* Dzmitry Krivolap — portfolio. One column, one typeface (Newsreader). */

:root {
  color-scheme: light dark;

  --bg: #fcfcfb;
  --text: #1c1e22;
  --muted: #6c717b;
  --rule: #dfe1e5;
  --accent: #2e45d6;
  --accent-ink: #ffffff;
  --shadow: 0 6px 24px rgb(20 22 28 / 0.14);
  --photo-filter: none;

  --font: "Newsreader", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417;
    --text: #e6e7ea;
    --muted: #9298a3;
    --rule: #34373e;
    --accent: #9eaaff;
    --accent-ink: #131417;
    --shadow: 0 6px 24px rgb(0 0 0 / 0.45);
    --photo-filter: brightness(0.92);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-optical-sizing: auto;
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
  text-rendering: optimizeLegibility;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}

.brand { font-weight: 600; text-decoration: none; }

.site-header ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }
.site-header nav a[aria-current="page"] { color: var(--text); text-decoration: underline; }

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: clamp(2.75rem, 8vw, 5rem) 1.25rem 3rem;
}

h2,
#contact { scroll-margin-top: 1.5rem; }

p { margin: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

section + section { margin-top: clamp(3rem, 7vw, 4.25rem); }

h1,
h2,
h3 { margin: 0; font-size: inherit; line-height: inherit; }

h2 {
  margin-bottom: 1.25rem;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
}

/* ---------- Intro ---------- */

.avatar {
  width: 8rem;
  height: 8rem;
  margin-bottom: 1.75rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--rule);
  filter: var(--photo-filter);
}

h1 { font-size: 1.375rem; font-weight: 600; line-height: 1.3; }

.role { color: var(--muted); margin-bottom: 1.25rem; }

.bio { max-width: 36rem; }
.bio p + p { margin-top: 0.75rem; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

/* ---------- Product and lab lists ---------- */

.list {
  display: grid;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list h3 { font-weight: 600; }
.list .meta { color: var(--muted); font-size: 0.9375rem; }
.note { color: var(--muted); font-weight: 400; font-style: italic; }

/* ---------- Blog ---------- */

.blog-title {
  font-size: clamp(2.25rem, 7vw, 3.75rem);
  line-height: 1.05;
  margin-bottom: 0.75rem;
  overflow-wrap: anywhere;
}

.blog-intro { max-width: 30rem; }
.blog-meta { color: var(--muted); font-size: 0.9375rem; }
.blog-back { display: inline-block; margin-bottom: 1.5rem; }

.blog-posts {
  margin-top: clamp(2.75rem, 6vw, 3.5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.blog-posts h2 { margin-bottom: 0.75rem; }

.blog-topics { margin-top: 1.25rem; }
.blog-topics:not([hidden]) + .blog-posts { margin-top: 1.75rem; }

.post-tags {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}

.post-tags:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}

.post-tags a {
  display: inline-block;
  padding: 0.125rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  text-decoration: none;
}

.post-tags a:hover { border-color: currentColor; color: var(--accent); }
.post-tags a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.post-body { margin-top: 2rem; overflow-wrap: anywhere; }
.post-body > * + * { margin-top: 1rem; }
.post-body h2,
.post-body h3 { margin-bottom: 0; color: var(--text); font-weight: 600; font-style: normal; }
.post-body h2 { margin-top: 2rem; font-size: 1.25rem; }
.post-body img { display: block; max-width: 100%; height: auto; }
.post-body table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
.post-body caption { padding-bottom: 0.5rem; color: var(--muted); text-align: left; }
.post-body th,
.post-body td { padding: 0.375rem 0.5rem; border-bottom: 1px solid var(--rule); text-align: left; }
.post-body pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--rule);
  font-size: 0.875rem;
}

.article-navigation,
.related-posts {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.article-navigation:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.article-navigation a { overflow-wrap: anywhere; text-decoration: none; }
.article-navigation span { display: block; color: var(--muted); font-size: 0.9375rem; }
.article-navigation strong {
  font-weight: 600;
  text-decoration: underline var(--rule);
  text-underline-offset: 0.2em;
}
.article-navigation a:hover strong { text-decoration-color: currentColor; }
.article-next { grid-column: 2; text-align: right; }

.related-posts h2 { margin-bottom: 0.4rem; }
.related-posts ul { margin: 0; padding: 0; list-style: none; }
.related-posts li + li { margin-top: 0.35rem; }

/* ---------- Label / value rows (experience, skills, education, contact) ---------- */

.rows {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.6rem 1.5rem;
  margin: 0;
}
.rows dt { color: var(--muted); font-variant-numeric: tabular-nums lining-nums; }
.rows dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Footer ---------- */

footer {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.25rem 6rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------- Floating contact button ---------- */

.cta {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.cta:hover { background: var(--accent); color: var(--accent-ink); }
.cta:focus-visible { outline-offset: 4px; border-radius: 999px; }

.cta.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
}

@media (prefers-reduced-motion: no-preference) {
  .cta { transition: opacity 180ms ease, transform 180ms ease, visibility 180ms; }
}

/* ---------- 404 ---------- */

.notfound h1 { margin-bottom: 0.5rem; }
.notfound p + p { margin-top: 1.25rem; }

/* ---------- Small screens ---------- */

@media (max-width: 32rem) {
  .avatar { width: 7rem; height: 7rem; }
  .cta { right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); padding: 0.6rem 1.1rem; font-size: 1rem; }
  .rows { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rows dt { font-size: 0.9375rem; }
  .rows dd + dt { margin-top: 0.75rem; }
  .article-navigation:not([hidden]) { grid-template-columns: minmax(0, 1fr); gap: 0.85rem; }
  .article-next { grid-column: auto; text-align: left; }
}
