
:root {
  --bg: #050505;
  --surface: #090909;
  --fg: #d0d0d0;
  --hi: #f5f5f5;
  --mute: #929292;
  --line: #292929;
  --line-hover: #555;
}

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.75 'IBM Plex Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #555;
  color: #fff;
}

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

a {
  color: #e5e5e5;
  text-underline-offset: 4px;
  transition: color .2s ease;
}

a:hover {
  color: #fff;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--hi);
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

h1, h2, h3, p, li, dd, dt {
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(64px, 11vw, 124px);
  font-weight: 700;
  line-height: .98;
  letter-spacing: -.055em;
}

h2 {
  margin-bottom: 26px;
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.035em;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}

p {
  max-width: 72ch;
}

.mute, .org, .meta, .status {
  color: var(--mute);
}

/* Navigation */

nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, .94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 14px;
}

nav b {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: auto;
  color: var(--hi);
  font: 600 21px 'Space Grotesk', sans-serif;
}

nav a {
  color: #aaa;
  text-decoration: none;
}

nav a:hover {
  color: #fff;
}

/* Main content and section dividers */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px 72px;
}

main > section {
  margin-top: 72px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

/* Remove decorative squares and pseudo-element markers */

section::before,
section::after,
h1::before,
h1::after,
h2::before,
h2::after,
h3::before,
h3::after,
p::before,
p::after {
  content: none !important;
  display: none !important;
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
  align-items: center;
  gap: 42px;
  min-height: 84vh;
  padding: 48px 0;
}

.hero > div {
  min-width: 0;
}

.hero h1 {
  margin-bottom: 16px;
  color: var(--hi);
  animation: title-arrive .65s ease-out both;
}

@keyframes title-arrive {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.role {
  margin-bottom: 20px;
  color: #aaa;
  font: 14px/1.7 'IBM Plex Mono', monospace;
}

.hero p {
  color: #c4c4c4;
}

.status {
  margin-top: 18px;
  font-size: 14px;
}

/* Social links and buttons */

.soc {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 25px;
}

.soc a, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid #393939;
  background: #101010;
  color: #eee;
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}

.soc a:first-child {
  border-color: #eee;
  background: #eee;
  color: #080808;
}

.soc a:hover, .btn:hover {
  transform: translateY(-2px);
  border-color: #fff;
  background: #fff;
  color: #000;
}

.btn.o {
  border-color: var(--line);
  color: var(--mute);
}

/* ASCII logo animation */

.logo {
  display: block;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 3 / 2;
  justify-self: center;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, .08));
  transition: filter .3s ease;
}

.logo:hover {
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, .16));
}

/* About and facts */

.about p {
  line-height: 1.85;
}

.about p + p {
  margin-top: 14px;
}

.facts {
  margin-top: 30px;
  border-top: 1px solid var(--line);
}

.facts div {
  display: grid;
  grid-template-columns: 154px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #222;
}

.facts dt {
  color: var(--mute);
  font: 13px/1.8 'IBM Plex Mono', monospace;
}

.facts dd {
  color: #dedede;
}

/* Projects */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color .25s ease, transform .25s ease, background .25s ease;
}

.card:hover, .card:focus-within {
  border-color: var(--line-hover);
  background: #0c0c0c;
}

.card.go {
  cursor: pointer;
}

.card.go:hover {
  transform: translateY(-3px);
}

.card .th {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  padding: 22px;
  border-bottom: 1px solid #252525;
  background: radial-gradient(ellipse at center, #111, #080808 72%);
}

.card .th img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
  transition: transform .35s ease, filter .35s ease;
}

.card:hover .th img {
  transform: scale(1.025);
  filter: grayscale(.65) contrast(1.08);
}

.ph {
  color: #888;
  font: 9px/1.15 'IBM Plex Mono', monospace;
  transition: color .25s;
}

.card:hover .ph {
  color: #c8c8c8;
}

.card > h3 {
  padding: 17px 18px 19px;
  color: var(--hi);
}

/* Project details overlay */

.ov {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 22px;
  border-top: 1px solid #383838;
  background: rgba(5, 5, 5, .98);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
}

.card:hover .ov,
.card:focus-within .ov,
.card:focus .ov {
  opacity: 1;
  transform: none;
}

.ov p {
  margin-bottom: 12px;
  color: #c8c8c8;
  font-size: 14px;
  line-height: 1.7;
}

.ov a {
  display: inline-block;
  margin-top: 8px;
  color: #fff;
}

.tags span, .chip {
  display: inline-block;
  margin: 0 6px 8px 0;
  padding: 3px 9px;
  border: 1px solid #333;
  border-radius: 2px;
  background: #090909;
  color: #c5c5c5;
  font: 12px/1.6 'IBM Plex Mono', monospace;
  transition: border-color .2s, color .2s;
}

.chip:hover, .tags span:hover {
  border-color: #666;
  color: #fff;
}

/* Services — table-like grid with clear separation lines */

#services .two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

#services .two > div {
  min-width: 0;
  margin: 0;
  padding: 24px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background .2s ease;
}

#services .two > div:hover {
  background: #0b0b0b;
}

#services .two h3 {
  margin-bottom: 8px;
  color: var(--hi);
}

#services .two p {
  color: #aaa;
  font-size: 14px;
  line-height: 1.8;
}

/* Skills */

.sk {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 22px;
  padding: 19px 0;
  border-top: 1px solid var(--line);
}

.sk h3 {
  color: #ddd;
}

/* Experience, education and courses */

.tl {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 32px;
  padding: 25px 0;
  border-top: 1px solid var(--line);
}

.tl ul {
  margin: 12px 0 0 18px;
  padding: 0;
}

.tl li {
  margin-bottom: 6px;
  padding-left: 2px;
  color: #bdbdbd;
}

.meta {
  color: var(--mute);
  font: 13px/1.8 'IBM Plex Mono', monospace;
}

.org {
  margin-top: 3px;
  color: #aaa;
}

/* Contact */

.contact p {
  margin-bottom: 16px;
}

.contact > p a {
  text-underline-offset: 5px;
}

/* Blog */

.post {
  max-width: 72ch;
}

.post h1 {
  margin-bottom: 18px;
  font-size: clamp(38px, 6vw, 60px);
  line-height: 1.08;
}

.post h2, .post h3 {
  margin-top: 28px;
}

.post p, .post ul {
  margin: 16px 0;
}

.post ul {
  padding-left: 22px;
}

.post img {
  max-width: 100%;
  height: auto;
  filter: grayscale(1);
}

.post pre {
  overflow: auto;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: #090909;
  color: #ddd;
  font: 13px/1.7 'IBM Plex Mono', monospace;
}

.post code {
  padding: 1px 4px;
  background: #151515;
  color: #eee;
  font-family: 'IBM Plex Mono', monospace;
}

/* Background canvas */

#bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .65;
  filter: blur(1.4px);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 30%, #000 90%);
  mask-image: radial-gradient(ellipse at center, transparent 30%, #000 90%);
}

/* Footer */

footer {
  max-width: 1100px;
  margin: auto;
  padding: 32px;
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 13px;
}

.kp {
  margin-top: 18px;
  overflow: hidden;
  color: #303030;
  font: 11px/1.5 'IBM Plex Mono', monospace;
  white-space: pre;
}

/* Admin — existing selectors retained */

.adm {
  max-width: 860px;
  margin: auto;
  padding: 30px 24px;
}

.adm input, .adm textarea, .adm select {
  width: 100%;
  margin: 4px 0 12px;
  padding: 9px;
  border: 1px solid #333;
  background: #080808;
  color: #eee;
  font: inherit;
}

.adm label {
  display: block;
  color: var(--mute);
  font-size: 13px;
}

.adm fieldset {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.bad {
  padding: 6px 10px;
  background: #400;
  color: #fff;
}

#msg {
  min-height: 30px;
  margin: 10px 0;
}

/* Responsive */

@media (max-width: 760px) {
  nav {
    gap: 14px;
    padding: 13px 18px;
  }

  nav b {
    width: 100%;
  }

  main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 22px;
    padding: 38px 0;
  }

  .logo {
    order: -1;
    max-width: 380px;
  }

  .sk, .tl {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  #services .two > div {
    padding: 18px;
  }

  .facts div {
    grid-template-columns: 115px minmax(0, 1fr);
    gap: 12px;
  }

  main > section {
    margin-top: 54px;
    padding-top: 24px;
  }
}

@media (max-width: 520px) {
  .grid, #services .two {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(52px, 16vw, 78px);
  }

  h2 {
    font-size: 28px;
  }

  .facts div {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  .soc {
    gap: 8px;
  }

  .soc a {
    padding: 8px 12px;
  }

  footer {
    padding: 24px 20px;
  }
}

/* Touchscreens: show project descriptions without hover */

@media (hover: none) {
  .ov {
    position: static;
    padding: 0 18px 18px;
    border-top: 0;
    background: transparent;
    opacity: 1;
    transform: none;
  }
}

/* Accessibility */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .card:hover, .soc a:hover, .btn:hover {
    transform: none;

    
  }
}

/* Align navbar branding with the hero's left edge */
nav {
  position: sticky;
  top: 0;
  justify-content: flex-start;
  padding-left: max(32px, calc((100% - 1100px) / 2 + 32px));
}

/* Keep the icon and Ivan together on the left */
nav b {
  position: static;
  transform: none;
  margin: 0;
  white-space: nowrap;
}

/* Push navigation links to the right */
nav a:first-of-type {
  margin-left: auto;
}

nav a + a {
  margin-left: 0;
}

@media (max-width: 760px) {
  nav {
    padding: 13px 20px;
  }

  nav b {
    width: 100%;
    margin-bottom: 2px;
  }

  nav a:first-of-type {
    margin-left: 0;
  }
}
