:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: #0a0a0a;
  --text: #ffffff;
  --muted: #bfbfbf;
  --link: #e6e6e6;
  --link-strong: #ffffff;
  --dot: #222222;
  --nav-bg: rgba(0, 0, 0, 0.92);
  --nav-border: rgba(255, 255, 255, 0.15);
  --border: rgba(255,255,255,0.12);
}

/* Ensure rubber-banding/overscroll areas render as black */
html { background-color: #000; }

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(ellipse at 20% 30%, #0a0a0a 0%, #000000 50%, #000000 100%);
  background-size: 200% 200%;
  animation: subtleShift 20s ease-in-out infinite;
  color: var(--text);
  line-height: 1.65;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@keyframes subtleShift {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; background-position: 0% 0%; }
}

/* Hide scrollbars while keeping content scrollable */
html, body { 
  -ms-overflow-style: none; /* IE 10+ */
  scrollbar-width: none;    /* Firefox */
}
body::-webkit-scrollbar {
  width: 0;
  height: 0;               /* Chrome/Safari/Edge */
}

.logo {
  position: fixed;
  left: 16px;
  top: 12px;
  color: var(--muted);
  text-decoration: none;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  font-weight: 700;
  letter-spacing: 0.01em;
  opacity: 0.7;
  font-size: 20px;
  transition: transform .2s ease, opacity .2s ease;
  will-change: transform, opacity;
  z-index: 20;
}

.logo:hover { opacity: 1; }

.logo.is-hidden {
  transform: translateY(-140%);
  opacity: 0;
  pointer-events: none;
}

.site-header {
  position: fixed;
  top: 12px;
  right: 16px;
}

a { text-decoration: bold;}
.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  backdrop-filter: blur(3px);
}
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 16px;
  letter-spacing: 0.01em;
  font-weight: 600;
  opacity: 0.7;
  transition: color 0.2s ease, opacity 0.2s ease;
}
.nav a:hover,
.nav a:focus-visible {
  color: var(--link-strong);
  opacity: 1;
  text-decoration: bold;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 96px 24px 60px;
  min-height: 100vh;
}

.title {
  font-size: 36px;
  line-height: 1.2;
  margin: 24px 0 16px;
}

.lead { color: var(--muted); margin-bottom: 24px; }

.content p { margin: 12px 0; color: #dddddd; }

.content .about-line {
  margin: 18px 0;
}
.accent-strong {
  font-weight: 700;
  letter-spacing: 0.05em;
}
.accent-italic {
  font-style: italic;
  color: var(--link-strong);
}
.accent-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.links ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: 10px 14px;
  padding: 0; margin: 28px 0 0;
}
.links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
}
.links .icon {
  width: 18px;
  height: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.links a:hover { color: var(--link-strong); }

.site-footer {
  position: relative;
  max-width: 720px;
  margin: 52px auto 28px;
  padding: 16px 24px 28px;
  color: var(--muted);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  border-top: 1px solid var(--nav-border);
  transform: translateX(-50%);
}
.site-footer .footer-inner {
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.site-footer .footer-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}
.site-footer .footer-name {
  color: var(--link-strong);
  font-weight: 600;
}
.site-footer .footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 0;
  margin: 0;
  font-size: 0.95rem;
}
.site-footer .footer-links a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer .footer-links a:hover { color: var(--link-strong); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

@media (max-width: 640px) {
  .container { padding-top: 84px; }
}

/* Keep animation visible but gentle overall */

/* Projects */
.projects { margin-top: 56px; }
.projects-title {
  font-size: 28px;
  margin: 12px 0 10px;
}
.projects { scroll-margin-top: 96px; }
.projects-grid {
  display: grid;
  grid-template-columns: 1fr; /* single card per row */
  gap: 20px;
  margin-top: 12px;
  justify-items: center; /* center narrower cards */
}
.project-card {
  background: var(--panel);
  border: 1px solid var(--nav-border);
  border-radius: 12px;
  padding: 20px 20px 18px;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0; /* remove enforced min-height to avoid bottom gap */
  text-decoration: none;
  color: var(--text);
  max-width: 640px; /* decrease card width while keeping 1 per row */
}
.project-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.22); box-shadow: 0 6px 18px rgba(0,0,0,0.35); background: #0c0c0c; }
.project-card:focus-visible { outline: 2px solid rgba(255,255,255,0.4); outline-offset: 2px; }
.project-name {
  margin: 0 0 6px;
  font-size: 20px;
}
.project-desc {
  margin: 0 0 10px;
  color: #dddddd;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1em * 1.5 * 2); /* keep some consistency when fewer lines */
}
.project-links { margin: 0; }
.project-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 6px;
  min-height: 28px; /* slightly tighter tag row */
}
.project-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--nav-border);
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
}
.project-pill-more { opacity: 0.8; }
.project-date {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.project-footer {
  margin-top: 8px; /* reduce large gap between tags and link */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px; /* tighter spacing above footer */
  border-top: 1px solid rgba(255,255,255,0.08);
  color: var(--link);
  font-size: 14px;
}
.project-card:hover .project-footer { color: var(--link-strong); }
.project-footer .icon-gh { opacity: .9; vertical-align: middle; }
.project-footer .footer-left { display: inline-flex; align-items: center; gap: 8px; }
.project-empty { color: var(--muted); margin: 8px 0; }

/* Blog-specific styles */
.blog-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10,12,16,0.7);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.blog-nav {
  max-width: 820px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  gap: 16px;
}
.blog-nav a {
  color: var(--link);
  text-decoration: none;
}
.blog-nav a:hover { color: var(--link-strong); }

.blog-container {
  max-width: 820px;
  margin: 96px auto 96px auto;
  padding: 0 20px 120px;
}

.page-title {
  font-size: 34px;
  margin: 20px 0 8px;
}

.post-list { display: grid; gap: 18px; }
.post-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.post-item:last-child { border-bottom: 0; }
.post-title { margin: 0 0 4px; font-size: 22px; }
.post-summary { color: #dddddd; margin: 6px 0 0; }
.post-meta { color: var(--muted); font-size: 14px; }

.post-header { position: relative; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 26px; }
.post h1.post-title { font-size: 36px; margin: 8px 0 6px; }
.post-content { margin-top: 4px; font-size: 18px; }
.post-content h2 { margin-top: 28px; }
.post-content h3 { margin-top: 22px; }
.post-content p { color: #dddddd; }

.post-tags { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.post-tags .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
}

/* Inline code */
code {
  background: rgba(255,255,255,0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

/* Code blocks */
.code-wrap {
  position: relative;
  margin: 1.5em 0;
  border-radius: 10px;
  background: #050505;
  border: 1px solid rgba(255,255,255,0.14);
  overflow: hidden;
  counter-reset: line;
}

/* Header bar with language and copy button */
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 8px 12px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.code-lang {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.code-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

.code-copy:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.95);
}

.code-copy .icon-copy,
.code-copy .icon-check {
  pointer-events: none;
}

.code-copy .icon-check {
  display: none;
  color: #4ade80;
}

.code-copy.copied .icon-copy {
  display: none;
}

.code-copy.copied .icon-check {
  display: block;
}

/* Code container with line numbers */

.code-wrap pre {
  margin: 0;
  padding: 0;
  background: transparent;
  overflow-x: auto;
}

.code-wrap pre code {
  display: block;
  background: transparent;
  padding: 14px 14px 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1;
  tab-size: 2;
}

.code-line {
  display: flex;
  align-items: baseline;
  gap: 0;
  min-height: 1em;
}

.code-line::before {
  counter-increment: line;
  content: counter(line);
  flex: none;
  width: calc(var(--digit-width) * 0.56ch + 8px);
  margin-right: 16px;
  text-align: right;
  color: rgba(255,255,255,0.45);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1;
  user-select: none;
}

.code-line-text {
  flex: 1;
  min-width: 0;
}

blockquote {
  margin: 1rem 0; padding: 0.6rem 1rem; border-left: 3px solid #666666;
  background: rgba(255, 255, 255, 0.06);
}

.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem auto; /* center within reading width */
  transform: none;
  border-radius: 8px;
}
.post-content figure { margin: 1rem 0; text-align: center; }
.post-content figcaption { color: var(--muted); font-size: 14px; margin-top: 6px; }

.post-content table {
  width: 100%; border-collapse: collapse; overflow: hidden; border-radius: 8px;
}
.post-content th, .post-content td { border: 1px solid var(--border); padding: 8px 10px; }
.post-content thead { background: rgba(255,255,255,0.06); }

.anchor-link {
  text-decoration: none;
  color: var(--muted);
  margin-left: 6px;
  opacity: 0.0;
  transition: opacity .15s ease;
}
.post-content h1:hover .anchor-link,
.post-content h2:hover .anchor-link,
.post-content h3:hover .anchor-link,
.post-content h4:hover .anchor-link,
.post-content h5:hover .anchor-link,
.post-content h6:hover .anchor-link { opacity: .8; }

.post-content mjx-container[jax="SVG"] svg { fill: currentColor; }
.post-content mjx-container { line-height: 1.2; }
.post-content mjx-container[display="true"] { display: block; margin: 0.75rem 0; overflow-x: auto; }

.hljs, pre code.hljs { color: #e6e6e6; background: transparent; }
.hljs-comment, .hljs-quote { color: #7f8c98; font-style: italic; }
.hljs-keyword, .hljs-doctag, .hljs-formula { color: #c792ea; }
.hljs-type, .hljs-built_in, .hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: #82aaff; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string { color: #c3e88d; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #f78c6c; }
.hljs-title, .hljs-section, .hljs-name, .hljs-title.class_, .hljs-class .hljs-title { color: #82aaff; }
.hljs-subst, .hljs-meta, .hljs-link, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-selector-tag { color: #89ddff; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
.hljs-code { color: #e6e6e6; }

.minimap__container {
  position: fixed;
  top: 24px;
  right: 24px;
  left: auto;
  width: auto;
  z-index: 100;
  user-select: none;
  overflow: hidden;
  opacity: .8;
  transition: opacity .2s ease, transform .2s ease;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.35));
}
.minimap__container:hover { opacity: 1; }
.minimap__size {
  position: relative;
  width: 100%;
  height: auto;
  z-index: 5;
  border-radius: 6px;
  overflow: hidden;
}
.minimap__viewer {
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  z-index: 10;
  border: 1px solid #ffffff22;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset;
  will-change: transform;
  cursor: grab;
  touch-action: none;
}
.minimap__viewer.dragging { cursor: grabbing; }
.minimap__content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  transform-origin: 0 0;
  border: none;
  pointer-events: none;
  border-radius: 6px;
  background: #0b0b0b;
  will-change: transform;
}

@media (max-width: 1024px) {
  .minimap__container { display: none; }
}
