:root {
  --bg: #f6f7f9;
  --surface: #fff;
  --ink: #14171c;
  --muted: #5b6370;
  --line: #e2e5ea;
  --accent: #2f4bff;
  --accent-ink: #fff;
  --soft: #e9edff;
  --code-bg: #14171c;
  --code-ink: #d7dbe3;
  --shadow:
    0 1px 2px rgba(20, 23, 28, 0.05), 0 12px 32px -12px rgba(20, 23, 28, 0.14);
  --pad: clamp(16px, 5vw, 80px);
  --head: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
::-webkit-scrollbar {
  display: none;
}

[data-theme="dark"] {
  --bg: #0d1016;
  --surface: #151a22;
  --ink: #eceff4;
  --muted: #98a2b3;
  --line: #262d38;
  --accent: #8aa2ff;
  --accent-ink: #0d1016;
  --soft: #1b2340;
  --code-bg: #0a0d12;
  --code-ink: #cfd5e0;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  overflow-x: clip;
}
body {
  overflow-x: clip;
  min-width: 320px;
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  transition:
    background 0.3s,
    color 0.3s;
}
a {
  color: inherit;
  text-decoration: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
ul,
ol {
  list-style: none;
}

/* nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo {
  font: 800 22px var(--head);
}
.logo span {
  color: var(--accent);
}
#menu {
  display: flex;
  gap: 4px;
}
#menu a {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: 0.2s;
}
#menu a:hover {
  color: var(--ink);
}
#menu a.active {
  background: var(--soft);
  color: var(--accent);
}
.nav-actions {
  display: flex;
  gap: 8px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s;
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.i-moon {
  display: none;
}
[data-theme="dark"] .i-moon {
  display: block;
}
[data-theme="dark"] .i-sun {
  display: none;
}
.burger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
}
.burger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition:
    transform 0.25s,
    opacity 0.2s;
}
.burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* layout */
.hero,
.sec,
.footer {
  width: 100%;
  margin: 0;
  padding-inline: var(--pad);
}
.sec {
  padding-top: 84px;
  padding-bottom: 20px;
}
.sec > *,
.hero > * {
  min-width: 0;
}
h2 {
  font: 800 clamp(28px, 4vw, 40px)/1.1 var(--head);
  letter-spacing: -0.02em;
  margin-bottom: 32px;
}
h3 {
  font: 700 18px var(--head);
  margin-bottom: 14px;
}
.lead {
  color: var(--muted);
  font-size: clamp(16px, 1.4vw, 20px);
  max-width: 60ch;
}

/* hero */
.hero {
  min-height: calc(100vh - 66px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
  padding-top: 48px;
  padding-bottom: 48px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    420px circle at var(--mx, 70%) var(--my, 30%),
    var(--soft),
    transparent 70%
  );
  z-index: -1;
  transition: background 0.1s;
}
.hello {
  color: var(--accent);
  font-weight: 600;
}
h1 {
  font: 800 clamp(40px, 7.5vw, 112px)/0.98 var(--head);
  letter-spacing: -0.04em;
  margin: 8px 0 16px;
}
.role {
  font: 600 clamp(18px, 2.4vw, 24px) var(--head);
  margin-bottom: 16px;
}
.sep {
  color: var(--accent);
}
.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition:
    transform 0.2s,
    border-color 0.2s;
}
.btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.code-card {
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--line);
}
.code-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid #ffffff14;
}
.code-bar i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ffffff26;
}
.code-bar b {
  margin-left: 10px;
  font: 400 12px var(--mono);
  color: #8b93a3;
}
#code {
  font: 400 clamp(12px, 1.1vw, 15px)/1.75 var(--mono);
  padding: 20px;
  min-height: 290px;
  white-space: pre-wrap;
  overflow: hidden;
}
#code .k {
  color: #c792ea;
}
#code .t {
  color: #82aaff;
}
#code .s {
  color: #c3e88d;
}
#code .c {
  color: #697386;
}
#code::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* about */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: start;
}
.prose p {
  color: var(--muted);
  font-size: clamp(16px, 1.3vw, 19px);
  margin-bottom: 16px;
  max-width: 70ch;
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stats li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.stats li:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.stats strong {
  display: block;
  font: 800 34px var(--head);
  color: var(--accent);
}
.stats span {
  font-size: 14px;
  color: var(--muted);
}

/* skills */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 16px;
}
.skill-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  transition: 0.2s;
  cursor: default;
}
.chip:hover {
  background: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-2px);
}

/* projects */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.filters button {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: 500 14px var(--body);
  cursor: pointer;
  transition: 0.2s;
}
.filters button.on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  transition:
    transform 0.25s,
    box-shadow 0.25s,
    border-color 0.25s;
  transform-style: preserve-3d;
}
.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.card.hide {
  display: none;
}
.card h3 {
  margin-bottom: 8px;
}
.card p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 16px;
  flex: 1;
}
.card .chips {
  margin-bottom: 18px;
}
.card .chip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.card .btn {
  align-self: flex-start;
  padding: 8px 16px;
  font-size: 14px;
}

/* timeline */
.timeline {
  border-left: 2px solid var(--line);
  margin-left: 6px;
}
.timeline li {
  position: relative;
  padding: 0 0 32px 28px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline time {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}
.timeline h3 {
  margin: 2px 0 2px;
}
.timeline .org {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 8px;
}
.timeline ul {
  list-style: disc;
  padding-left: 18px;
  color: var(--muted);
  font-size: 15px;
}
.timeline p.note {
  color: var(--muted);
  font-size: 15px;
}

/* certs */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.plain li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.plain strong {
  display: block;
  font-weight: 600;
}
.plain span {
  color: var(--muted);
  font-size: 14px;
}

/* contact */
.contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 14px;
  margin-top: 28px;
}
.contacts a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: 0.2s;
}
.contacts a:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.contacts .ic {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}
.contacts small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.contacts b {
  font-weight: 600;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.contacts a > span:last-child {
  min-width: 0;
}
.footer {
  padding: 64px 0 32px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* reveal (only the content cards, set by JS) */
.rv {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.5s,
    transform 0.5s;
}
.rv.in {
  opacity: 1;
  transform: none;
}

/* large screens */
@media (min-width: 1500px) {
  .cards {
    grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  }
  .skills {
    grid-template-columns: repeat(3, 1fr);
  }
  .card {
    padding: 30px;
  }
}
/* tablets */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 56px;
  }
  .code-card {
    max-width: 560px;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
  #menu a {
    padding: 6px 9px;
    font-size: 13px;
  }
}
@media (max-width: 860px) {
  .burger {
    display: flex;
  }
  #menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    padding: 12px var(--pad) 20px;
    border-bottom: 1px solid var(--line);
    display: none;
  }
  #menu.open {
    display: flex;
  }
  #menu a {
    padding: 12px 14px;
    font-size: 16px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .sec {
    padding-top: 64px;
  }
}
/* phones */
@media (max-width: 600px) {
  .hero {
    padding-top: 32px;
    padding-bottom: 32px;
  }
  .cta .btn {
    flex: 1 1 100%;
    justify-content: center;
  }
  .code-card {
    max-width: 100%;
  }
  #code {
    padding: 14px;
    min-height: 250px;
  }
  .skill-group,
  .card {
    padding: 20px;
  }
  .timeline li {
    padding-left: 22px;
  }
  .stats strong {
    font-size: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .rv {
    opacity: 1;
    transform: none;
  }
}
