:root {
  --bg: #0d0d0f;
  --bg-alt: #101013;
  --edge: #232327;
  --text: #e9e9ea;
  /* 7.49:1 on --bg � passes WCAG AAA for the small .stack / .lead body copy. */
  --muted: #a0a0a8;
  --link: #6ea8fe;
  --thumb-bg: #08080a;
  --btn-bg: #e9e9ea;
  --btn-fg: #0d0d0f;
  --btn-bg-hover: #ffffff;
  color-scheme: dark;
}

/* Light theme. Measured with the WCAG relative-luminance formula:
   --muted is 6.18:1 on --bg and 6.61:1 on --bg-alt, --link 6.60:1, --text 16.86:1.
   All comfortably clear WCAG AA (4.5:1) for body copy. */
:root[data-theme="light"] {
  --bg: #f7f7f9;
  --bg-alt: #ffffff;
  --edge: #dcdce2;
  --text: #16161a;
  --muted: #5c5c66;
  --link: #1450c4;
  --thumb-bg: #eceef2;
  --btn-bg: #16161a;
  --btn-fg: #ffffff;
  --btn-bg-hover: #000000;
  color-scheme: light;
}

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

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

body {
  font: 400 16px/1.65 Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

html, body { max-width: 100%; overflow-x: hidden; }

a, button { color: inherit; text-decoration: none; touch-action: manipulation; -webkit-tap-highlight-color: rgba(110, 168, 254, .15); }

a:hover { color: var(--link); }

/* Keyboard users must be able to see where they are. The delete button in
   particular is opacity:0 until hover, so focus has to reveal it too. */
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav { border-bottom: 1px solid var(--edge); }

.bar {
  display: flex;
  align-items: baseline;
  gap: 28px;
  height: 60px;
}

.logo { font-weight: 600; letter-spacing: -.01em; }

.menu { display: flex; gap: 20px; margin-right: auto; color: var(--muted); font-size: .95rem; }
.menu a:hover { color: var(--link); }

.lang {
  font-family: "JetBrains Mono", monospace;
  font-size: .8rem;
  color: var(--muted);
  border: 1px solid var(--edge);
  padding: 2px 8px;
}
.lang:hover { color: var(--link); border-color: var(--link); }

.theme {
  background: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.filters button {
  font: inherit;
  font-size: .82rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--edge);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.filters button:hover { color: var(--link); border-color: var(--link); }
.filters button[aria-pressed="true"] {
  color: var(--link);
  border-color: var(--link);
}

/* Sits with the filter chips but is not one of them, so it is styled apart
   even though it shares the row. */
.restore {
  font-size: .82rem;
  color: var(--muted);
  background: none;
  border: 1px dashed var(--edge);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  margin-left: auto;
}
.restore:hover { color: var(--link); border-color: var(--link); }
.restore[hidden] { display: none; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding-top: 12px;
  padding-bottom: 14px;
  font-size: .85rem;
  color: var(--muted);
}

.links .cv { color: var(--link); }

.hero { padding: 72px 0 64px; }

.intro {
  display: flex;
  gap: 48px;
  align-items: flex-start;
  justify-content: space-between;
}

.intro-text { max-width: 46ch; }

h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.15;
}

.role { color: var(--muted); margin-top: 12px; }

.lead { color: var(--muted); margin-top: 20px; }

.acts { display: flex; gap: 18px; align-items: center; margin-top: 28px; font-size: .95rem; }
.acts a { color: var(--muted); }
.acts a:hover { color: var(--link); }

.button {
  background: var(--btn-bg);
  color: var(--btn-fg) !important;
  padding: 8px 18px;
  font-weight: 500;
  border-radius: 4px;
}
.button:hover { background: var(--btn-bg-hover); color: var(--btn-fg); }

.face {
  width: 168px;
  height: 168px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--edge);
  background: var(--bg-alt);
}

.block { padding: 52px 0; border-top: 1px solid var(--edge); }
.block.alt { background: var(--bg-alt); }

h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 26px;
}

.skills div {
  display: flex;
  gap: 24px;
  padding: 9px 0;
  border-bottom: 1px solid var(--edge);
}
.skills div:last-child { border-bottom: 0; }

.skills dt { flex: 0 0 130px; color: var(--muted); font-size: .92rem; }
.skills dd { font-size: .95rem; }

/* The list draws its own bottom rule instead of `.work:last-child`: filtering
   and hiding can remove the last card, which would otherwise leave the list
   visually unterminated. */
.works { border-bottom: 1px solid var(--edge); }

.work {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  padding: 26px 34px 26px 0;
  border-top: 1px solid var(--edge);
  /* Anchors the absolutely positioned delete control in its corner. */
  position: relative;
}
.work:hover h3 { color: var(--link); }

/* The engine card carries a second link (the demo video), so it cannot be an
   anchor wrapping the whole row. The title becomes the link instead, stretched
   over the row by a pseudo-element, which keeps the row clickable and leaves the
   video as a separate link sitting on top of it. */
.work-link { color: inherit; }
.work-link::after { content: ""; position: absolute; inset: 0; }
.work-link:focus-visible::after {
  outline: 2px solid var(--link);
  outline-offset: -3px;
}

.work-video {
  position: relative;
  z-index: 2;
  display: inline-block;
  margin-top: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: .74rem;
  color: var(--link);
  border-bottom: 1px solid var(--link);
  padding-bottom: 1px;
}
.work-video:hover { opacity: .7; }

/* Tag filter hides non-matching cards. The delete control uses an inline
   display:none, which outranks this class, so a card hidden by the user stays
   hidden no matter which filter is active. */
.work.filtered { display: none; }

.thumb {
  flex: 0 0 188px;
  border: 1px solid var(--edge);
  border-radius: 4px;
  overflow: hidden;
  background: var(--thumb-bg);
}
.thumb img { display: block; width: 100%; height: auto; }

.work-text { flex: 1 1 auto; min-width: 0; }

.work h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
.work h3 span { font-weight: 400; color: var(--muted); }

.stack {
  font-family: "JetBrains Mono", monospace;
  font-size: .74rem;
  color: var(--muted);
  margin: 6px 0 10px;
}

.work p { font-size: .93rem; color: var(--muted); }

.del {
  position: absolute;
  right: 0;
  top: 6px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  font-size: .8rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s;
}
.work:hover .del, .del:focus-visible { opacity: 1; }
.del:hover { color: #ff6b81; border-color: #ff6b81; }

.fine { color: var(--muted); font-size: .85rem; }

.foot { border-top: 1px solid var(--edge); padding: 26px 0; color: var(--muted); font-size: .85rem; }

@media (hover: none), (pointer: coarse) {
  .del { opacity: 1; width: 32px; height: 32px; }
  .work { padding-right: 40px; }
}

@media (max-width: 700px) {
  .wrap { padding: 0 20px; }
  .bar { height: 54px; }
  .links { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 16px; }
  .links::-webkit-scrollbar { display: none; }
  .links a { flex: 0 0 auto; white-space: nowrap; }

  .hero { padding: 44px 0 40px; }
  .intro { flex-direction: column-reverse; gap: 28px; }
  .intro-text { max-width: none; }
  .face { width: 120px; height: 120px; }

  .work { flex-direction: column; gap: 16px; padding: 22px 34px 22px 0; }
  .thumb { flex: 0 0 auto; width: 100%; max-width: 320px; }
  .skills div { flex-direction: column; gap: 2px; }
  .skills dt { flex: 0 0 auto; font-size: .85rem; }
  .block { padding: 40px 0; }
}

@media (max-width: 380px) {
  .wrap { padding: 0 16px; }
  .bar { gap: 18px; }
  .menu { gap: 14px; font-size: .88rem; }
  .face { width: 100px; height: 100px; }
  .button { width: 100%; text-align: center; }
  .acts { flex-direction: column; align-items: stretch; gap: 12px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
