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

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #000000;
  --fg: #f5f5f4;
  --muted: #a8a29e;
  --dim: #8f8880;
  --faint: #131110;
  --accent: #dc2626;
  --link: #ef4444;
  --border: rgba(255,255,255,0.05);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  font-size: clamp(1rem, calc(0.9375rem + 0.4vw), 1.625rem);
}

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  padding: 2rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

@media (min-width: 768px) {
  body { padding: 3rem 1.5rem; }
}

/* --- Skip to content (a11y) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 999;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0 0 0.375rem 0.375rem;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 0;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Scrollbar --- */
html { scrollbar-color: #3e3a36 var(--bg); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #3e3a36; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }
::-webkit-scrollbar-corner { background: var(--bg); }

/* --- Focus styles (a11y) --- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* --- Wrap --- */
.wrap { max-width: 480px; width: 100%; margin: 0 auto; }

/* Wider content area for posts */
.post-page .wrap { max-width: 640px; }

@media (min-width: 768px) {
  .wrap { max-width: 540px; }
  .post-page .wrap { max-width: 680px; }
}

/* --- Header --- */
.top { margin-bottom: 1.25rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ascii {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(3.9px, 0.85vw, 6px);
  line-height: 1;
  color: var(--fg);
  white-space: pre;
  user-select: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin-inline: auto;
  max-width: 100%;
  overflow-x: clip;
  margin-bottom: 0.5rem;
  opacity: 0;
  transform: translateY(10px);
  animation: asciiIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

@keyframes asciiIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ascii-accent { color: var(--accent); }

.sub {
  margin-top: 0.375rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

.sub b { color: var(--dim); font-weight: 600; }

.links {
  margin-top: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  min-height: 2rem;
  transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pill:hover { border-color: var(--accent); color: var(--muted); }
.pill svg { width: 12px; height: 12px; flex-shrink: 0; }

/* --- Section headers --- */
.sec-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  margin-top: 2rem;
}

.sec-head h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--accent);
  white-space: nowrap;
}

.sec-head .path {
  color: var(--dim);
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (min-width: 768px) {
  .sec-head h2 { font-size: 0.5625rem; }
}

.sec-head .note {
  color: var(--dim);
  font-size: 0.625rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.sec-head .note a { color: var(--dim); }
.sec-head .note a:hover { color: var(--fg); }

.sec-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Logs / Blog list --- */
.log {
  display: block;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--fg);
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.log:last-child { border-bottom: none; }
.log:hover { color: var(--accent); }

.log-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

@media (max-width: 400px) {
  .log-row {
    flex-direction: column;
    gap: 0.15rem;
  }
  .log-meta { gap: 0.375rem; }
}

.log-title {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
}

.log-date {
  font-size: 0.625rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.log-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.log-read {
  font-size: 0.625rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  white-space: nowrap;
}

.log-arrow {
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.log:hover .log-arrow {
  opacity: 1;
  transform: translateX(0);
}

.log-excerpt {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.log-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.log-tag {
  font-size: 0.625rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  background: var(--faint);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.log-tag:hover { color: var(--accent); }

.log-more {
  display: block;
  padding: 0.75rem 0;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  text-decoration: none;
  border-bottom: none;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.log-more:hover { color: var(--accent); }

.log-year {
  display: block;
  padding: 0.75rem 0 0.25rem;
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  letter-spacing: 0.05em;
}

/* --- Blog search --- */
.search-wrap {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.search-label {
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  color: var(--accent);
  white-space: nowrap;
}

.search-input {
  flex: 1;
  min-width: 8rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.4rem 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  color: var(--fg);
  min-height: 2rem;
  outline: none;
  transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-input::placeholder { color: var(--dim); }

.search-input:focus { border-color: var(--accent); }

.search-tags {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-tags:hover { color: var(--accent); }

.search-status {
  width: 100%;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
}

.log-card {
  border-bottom: 1px solid var(--border);
  max-height: 12rem;
  overflow: hidden;
  opacity: 1;
  transform: none;
  transition:
    max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    border-bottom-width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.log-card.is-hidden {
  max-height: 0;
  opacity: 0;
  transform: translateY(-0.25rem);
  border-bottom-width: 0;
  pointer-events: none;
}

.log-card .log {
  border-bottom: none;
  padding-bottom: 0.125rem;
}

.log-card:last-of-type { border-bottom: none; }

.log-card[hidden],
.log-year[hidden] { display: none; }

/* --- Tags cloud --- */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.5rem 0;
}

.tag-pill { gap: 0.4rem; }

.tag-count {
  font-size: 0.625rem;
  color: var(--dim);
  background: var(--faint);
  border-radius: 999px;
  padding: 0 0.35rem;
  line-height: 1.2;
}

/* --- Stack --- */
.stack-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.8;
}

.marquee {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: marquee 14s linear infinite;
}

.marquee-rev .marquee-track {
  animation-direction: reverse;
  animation-duration: 11s;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-1 * var(--marquee-w, 50%))); }
}

.stack-items {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.125rem;
  padding-right: 0.125rem;
  flex-shrink: 0;
  color: var(--muted);
}

.stack-items[aria-hidden] {
  user-select: none;
}

.stack-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem;
  min-width: 3.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--faint);
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s;
  cursor: default;
}

.stack-item:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.si {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
  display: block;
}

.stack-label {
  font-size: 0.6875rem;
  line-height: 1;
  white-space: nowrap;
}

.si-fallback {
  font-size: 1.25rem;
  line-height: 1.5rem;
  color: var(--dim);
}

/* --- Uses --- */
.uses-list {
  list-style: none;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.7;
}

.uses-list li + li { margin-top: 0.375rem; }
.uses-list strong { color: var(--fg); font-weight: 500; }

.uses-list .note {
  color: var(--dim);
  font-size: 0.6875rem;
  padding: 0 0.25rem;
}

.uses-list a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--dim);
  text-underline-offset: 2px;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1), text-decoration-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.uses-list a:hover { color: var(--fg); text-decoration-color: var(--muted); }

/* --- Certifications --- */
.certs-grid {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cert-badge {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.cert-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  font-size: 0.75rem;
}

.cert-name {
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
}

.cert-name:hover { color: var(--accent); }

.cert-name-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.cert-date {
  color: var(--dim);
  font-size: 0.625rem;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.cert-desc {
  color: var(--muted);
  font-size: 0.6875rem;
}

.cert-badge-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  border-radius: 8px;
}

.cert-badge-btn:hover .cert-badge,
.cert-badge-btn:focus-visible .cert-badge {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Lightbox --- */
.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.lightbox-img {
  max-width: 100%;
  max-height: 90dvh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.lightbox-close:hover { color: var(--accent); }

/* --- Quote --- */
.quote {
  border-left: 2px solid var(--accent);
  padding-left: 0.625rem;
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--dim);
  font-style: italic;
  line-height: 1.6;
}

.quote-link {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--dim);
  text-underline-offset: 2px;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1), text-decoration-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.quote-link:hover {
  color: var(--fg);
  text-decoration-color: var(--muted);
}

/* --- Back link (shared) --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  text-decoration: none;
  min-height: 2rem;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.back-link:hover { color: var(--accent); }

/* --- Footer --- */
.foot {
  margin-top: 2rem;
}

.foot-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-top: 0.625rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.625rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
}

.post-page .foot-inner { max-width: 640px; }

@media (min-width: 768px) {
  .foot-inner { max-width: 540px; }
  .post-page .foot-inner { max-width: 680px; }
}

.foot-right {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* ===========================
   POST / BLOG STYLES
   =========================== */

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  text-decoration: none;
  min-height: 2rem;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-back:hover { color: var(--accent); }

.post-back-bottom {
  margin-top: 3rem;
  margin-bottom: 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
}

.post-header { margin-bottom: 2rem; }

.post-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.post-meta {
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-sep { color: var(--border); }

.post-excerpt {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.6;
  font-style: italic;
}

.post-cover {
  margin-bottom: 2rem;
  border-radius: 0.5rem;
  overflow: hidden;
}

.post-cover img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0.5rem;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-cover:hover img {
  transform: scale(1.02);
}

/* --- Post prose --- */
.post-body {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.8;
}

@media (min-width: 768px) {
  .post-body { font-size: 1rem; }
}

.post-body h1 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--fg);
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.post-body h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--fg);
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.post-body h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg);
  margin: 1.5rem 0 0.5rem;
}

.post-body p { margin-bottom: 1rem; }

.post-body a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: rgba(220,38,38,0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

.post-body a:hover { text-decoration-color: var(--link); }

.post-body strong { color: var(--fg); font-weight: 500; }

.post-body em { color: var(--muted); }

.post-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 0.75rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--dim);
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-body blockquote:hover {
  color: var(--muted);
  border-left-color: var(--fg);
}

.post-body ul, .post-body ol {
  margin: 0.75rem 0;
  padding-left: 1.25rem;
}

.post-body li {
  margin-bottom: 0.375rem;
  color: var(--muted);
}

.post-body li::marker { color: var(--dim); }

.post-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125em;
  background: var(--faint);
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  color: var(--fg);
}

.post-body pre {
  background: var(--faint);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  transition: border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-body pre:hover {
  border-color: rgba(255,255,255,0.1);
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.7;
}

@media (min-width: 768px) {
  .post-body pre code { font-size: 0.75rem; }
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.25rem 0;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* --- Guestbook --- */
.guestbook {
  margin-top: 1.5rem;
}

/* --- Now page --- */
.now-body {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.8;
}

.now-body p { margin-bottom: 1rem; }
.now-body strong { color: var(--fg); font-weight: 500; }

.now-updated {
  margin-top: 2rem;
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
}

/* --- Comments --- */
.comments {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.guestbook .comments {
  margin-top: 1.5rem;
}

/* ===========================
   SYNTAX HIGHLIGHTING (Prism)
   =========================== */

pre[class*="language-"],
code[class*="language-"] {
  color: #d6d3d1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.7;
  direction: ltr;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  tab-size: 2;
  hyphens: none;
}

@media (min-width: 768px) {
  pre[class*="language-"],
  code[class*="language-"] {
  font-size: 0.875rem;
  }
}

pre[class*="language-"] {
  background: #141210;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-wrap {
  position: relative;
}

.code-wrap pre {
  margin: 0;
}

.code-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.3rem 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  color: var(--dim);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.25rem;
  cursor: pointer;
  opacity: 0;
  min-height: 1.75rem;
  min-width: 1.75rem;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.code-wrap:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}

.code-copy:hover {
  color: var(--fg);
}

.code-copy.copied {
  color: #4ade80;
}

pre[class*="language-"]::selection,
code[class*="language-"]::selection,
pre[class*="language-"]::selection,
code[class*="language-"]::selection {
  background: rgba(220,38,38,0.15);
}

/* Tokens — VS Code–inspired with red accent */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: #98928d; font-style: italic; }

.token.punctuation { color: #9c968f; }

.token.namespace { opacity: 0.7; }

.token.property,
.token.tag,
.token.boolean,
.token.constant,
.token.symbol { color: #e879f9; }

.token.number,
.token.deleted { color: #fb923c; }

.token.selector,
.token.attr-name { color: #facc15; }

.token.string,
.token.char,
.token.inserted { color: #4ade80; }

.token.builtin { color: #22d3ee; }

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string { color: #a8a29e; }

.token.atrule,
.token.attr-value,
.token.keyword { color: #ef4444; }

.token.function { color: #60a5fa; }

.token.class-name { color: #facc15; }

.token.regex,
.token.important { color: #fb923c; }

.token.variable { color: #f5f5f4; }

.token.important,
.token.bold { font-weight: bold; }

.token.italic { font-style: italic; }

.token.entity { cursor: help; }

/* ===========================
   READING PROGRESS BAR
   =========================== */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--dim);
  z-index: 999;
  opacity: 0.4;
  transition: width 0.1s linear;
}

/* ===========================
   POST TAGS
   =========================== */

.post-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.post-tag {
  font-size: 0.625rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  text-decoration: none;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  min-height: 1.5rem;
  min-width: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-tag:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ===========================
   RELATED POSTS
   =========================== */

.related {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.related .sec-head {
  margin-top: 0;
}

/* ===========================
   404 PAGE
   =========================== */

.nf {
  min-height: 80dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.nf-code {
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--accent);
  line-height: 1;
}

.nf-text {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.nf-home {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  min-height: 2rem;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nf-home:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.nf-sub {
  margin-top: 1rem;
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--dim);
  animation: blink 1.2s step-end infinite;
}

/* ===========================
   REVEAL ANIMATIONS
   =========================== */

.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: revealIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-play-state: paused;
}

@keyframes revealIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   ACCESSIBILITY & MOTION
   =========================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .log-arrow { opacity: 1; transform: none; }
  .reveal { opacity: 1; transform: none; animation: none; }
  .ascii { opacity: 1; transform: none; animation: none; }
  .marquee { mask-image: none; -webkit-mask-image: none; }
}

@media (prefers-contrast: more) {
  :root {
    --border: rgba(255,255,255,0.15);
    --dim: #b9b3ad;
  }
}

/* ===========================
   PRINT
   =========================== */

@media print {
  body { background: #fff; color: #000; padding: 0; }
  .skip-link, .log-arrow, .code-copy, .pill, .nf-sub, .comments { display: none; }
  a { color: #000; text-decoration: underline; }
  .post-body a::after { content: " (" attr(href) ")"; font-size: 0.75em; color: #666; }
}
