@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Monospace everywhere */
body, body * { font-family: var(--mono) !important; }
body { font-size: 15px; line-height: 1.75; }

/* Code blocks */
pre {
  position: relative;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}
:not(pre) > code {
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: rgba(128, 128, 128, 0.18);
  font-size: 0.9em;
}

/* Copy button (added by copy-code.js) */
.copy-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid rgba(128, 128, 128, 0.5);
  border-radius: 4px;
  background: transparent;
  color: inherit;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s;
}
pre:hover .copy-btn, .copy-btn:focus { opacity: 1; }

/* Tables, quotes, images */
table { border-collapse: collapse; width: 100%; }
th, td { padding: 0.4rem 0.7rem; border: 1px solid rgba(128, 128, 128, 0.35); }
blockquote { margin-left: 0; padding-left: 1rem; border-left: 3px solid rgba(128, 128, 128, 0.6); }
img { max-width: 100%; height: auto; }

/* Table of contents */
.toc {
  margin: 1.5rem 0;
  padding: 0.5rem 1rem;
  border: 1px dashed rgba(128, 128, 128, 0.5);
  border-radius: 6px;
  font-size: 0.9rem;
}
.toc ul { margin: 0.3rem 0; padding-left: 1.2rem; }

img.circle {
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* ---------- Motion system ---------- */
:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}
html { scroll-behavior: smooth; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Home: sections enter in sequence */
.home > * {
  animation: rise 700ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}
.home > *:nth-child(1) { --i: 0; }
.home > *:nth-child(2) { --i: 1; }
.home > *:nth-child(3) { --i: 2; }
.home > .home-recent { animation: none; }

/* Recent posts enter one by one */
.post-list li {
  animation: rise 600ms var(--ease-out) both;
  animation-delay: calc(320ms + var(--i, 0) * 70ms);
}
.post-list li:nth-child(1) { --i: 0; }
.post-list li:nth-child(2) { --i: 1; }
.post-list li:nth-child(3) { --i: 2; }
.post-list li:nth-child(4) { --i: 3; }
.post-list li:nth-child(5) { --i: 4; }

/* Other pages (posts, about): simple fade-up */
main:not(.home) { animation: rise 500ms var(--ease-out) both; }

/* Post list rows: gentle response on hover */
.post-list li { transition: transform 250ms var(--ease-out); }
.post-list li:hover { transform: translateX(4px); }
.post-list li time { transition: opacity 250ms ease; }
.post-list li:hover time { opacity: 1; }
.post-title {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 300ms var(--ease-out);
}
.post-list li:hover .post-title,
.post-title:focus-visible { background-size: 100% 1px; }

/* Portrait: soft scale with a faint ring */
img.circle {
  transition: transform 400ms var(--ease-out), box-shadow 400ms var(--ease-out);
}
img.circle:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 6px rgba(128, 128, 128, 0.18);
}

/* Social icons: small lift */
main a:has(svg) {
  display: inline-block;
  transition: transform 200ms var(--ease-out), opacity 200ms ease;
}
main a:has(svg):hover { transform: translateY(-3px); opacity: 0.8; }

/* Keyboard focus, for accessibility */
a:focus-visible, button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 3px;
}

/* Scroll reveal (classes added by motion.js) */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Reading progress bar on posts */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: currentColor;
  opacity: 0.55;
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 1000;
  pointer-events: none;
}

/* Cross-fade between pages (supported browsers only) */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 250ms; }

/* Honor "reduce motion" system setting */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}