:root {
  --paper: #1A1A1A;
  --ink: #EEEDE6;
  --ink-soft: #C6C4B9;
  --dim: #8A897F;
  --line: #2E2E2E;
  --accent: #8CFFFA;
  --accent-bright: #8CFFFA;
  --accent-soft: #20302F;
  --card: #212121;

  --display: "Space Grotesk", "Inter", -apple-system, sans-serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --max: 640px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

html.theme-light {
  color-scheme: light;
  --paper: #FAF9F4;
  --ink: #201F1B;
  --ink-soft: #403F38;
  --dim: #76756C;
  --line: #E4E2D8;
  --accent: #0B8A86;
  --accent-bright: #0B7B78;
  --accent-soft: #DFF1EF;
  --card: #EEECE4;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

code {
  font-family: var(--mono);
  font-size: 0.87em;
  background: var(--accent-soft);
  padding: 2px 5px;
  border-radius: 3px;
}

.topnav {
  padding: 28px 0;
}

.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle .theme-sun { display: none; }

html.theme-light .theme-toggle .theme-sun {
  display: block;
}

html.theme-light .theme-toggle .theme-moon {
  display: none;
}

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--dim);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--accent);
  z-index: 60;
  transition: width 0.08s linear;
}

.navlinks {
  display: flex;
  gap: 28px;
  font-family: var(--mono);
  font-size: 13.5px;
}

.navlinks a {
  color: var(--dim);
  position: relative;
  padding-bottom: 3px;
  transition: color 0.15s ease;
}

.navlinks a:hover { color: var(--ink); }

.navlinks a.is-active { color: var(--accent); }

.navlinks a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.about {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0 140px;
}

.about-hero {
  padding: 24px 0 44px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

.about-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.about-name {
  font-family: var(--display);
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}

.about-role {
  margin: 14px 0 0;
  color: var(--dim);
  font-size: 17px;
}

.about-bio { font-size: 17.5px; }

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
}

.badge {
  display: block;
  width: 88px;
  height: 31px;
  line-height: 0;
  flex-shrink: 0;
}

.badge img {
  display: block;
  width: 88px;
  height: 31px;
  border-radius: 2px;
}

.writes { width: 100%; padding: 40px 0 100px; }

.writes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.writes-head h1 {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.writes-sub {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--dim);
  margin: 0;
}

.post-list { list-style: none; margin: 0; padding: 0; width: 100%; }

.post-item { border-bottom: 1px solid var(--line); width: 100%; }

.post-item-link {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 24px;
  padding: 26px 0;
  align-items: baseline;
  border-radius: 6px;
  width: 100%;
  transition: background 0.15s ease;
}

.post-item-link:hover {
  background: var(--card);
}

.post-item-link:hover .post-item-title { color: var(--accent); }

.post-item-date {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--dim);
  white-space: nowrap;
  padding-top: 4px;
}

.post-item-title {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.35;
  transition: color 0.15s ease;
}

.ext { font-size: 13px; color: var(--dim); font-family: var(--sans); }

.post-item-excerpt {
  margin: 0;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.55;
}

.proj-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
}

.proj-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.writes-stats {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 18px 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--dim);
}

.empty {
  padding: 40px 0;
  color: var(--dim);
  font-size: 15px;
}

.notfound {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 0 140px;
}

.notfound-code {
  font-family: var(--display);
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent-bright);
}

.notfound-title {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 14px 0 8px;
  color: var(--ink);
}

.notfound-text {
  color: var(--dim);
  font-size: 15.5px;
  margin: 0 0 28px;
}

.notfound-back {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--accent);
}
.notfound-back:hover { color: var(--accent-bright); }

.notfound-suggestion {
  max-width: 340px;
  margin: 4px 0 28px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--dim);
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 6px;
}

.notfound-suggestion-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.notfound-suggestion-link:hover { text-decoration-color: var(--accent); }

.post { max-width: 1120px; padding: 32px 0 100px; }

.back {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--dim);
  display: inline-block;
  margin-bottom: 28px;
}
.back:hover { color: var(--accent); }

.post-title {
  font-family: var(--display);
  font-size: 38px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--dim);
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.read-size {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.read-size button {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.read-size button:hover { color: var(--accent); }

.read-size button.is-pressed {
  color: var(--accent);
  border-color: var(--line);
}

body.read-l .prose { font-size: 19px; line-height: 1.7; }
body.read-xl .prose { font-size: 20.5px; line-height: 1.75; }

.post-cover {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 32px;
  display: block;
}

.prose { font-size: 17.5px; color: var(--ink-soft); }
.prose > * + * { margin-top: 1.3em; }

.prose h1, .prose h2, .prose h3 {
  font-family: var(--display);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 1.9em;
  line-height: 1.35;
}
.prose h2 { font-size: 24px; }
.prose h3 { font-size: 19.5px; }
.prose p { margin-top: 1.3em; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.prose a:hover { text-decoration-color: var(--accent); }

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.5em; }

.prose blockquote {
  margin: 1.3em 0;
  padding-left: 18px;
  border-left: 2px solid var(--accent);
  color: var(--dim);
  font-style: italic;
}

.code-block {
  position: relative;
  margin-top: 1.3em;
}

.prose pre {
  background: var(--ink);
  color: var(--paper);
  padding: 18px 20px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}
.code-block pre { margin-top: 0; }
.prose pre code { background: none; padding: 0; color: inherit; }

.code-lang {
  position: absolute;
  top: 9px;
  left: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--paper);
  opacity: 0.5;
  user-select: none;
  pointer-events: none;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.code-block:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.copy-btn:hover {
  background: var(--accent-bright);
  color: var(--ink);
}

.copy-btn.is-copied {
  opacity: 1;
  background: var(--accent-bright);
  color: var(--ink);
}

.prose img { max-width: 100%; border-radius: 6px; margin-top: 1.3em; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.5em 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.3em;
  font-size: 15.5px;
}
.prose th, .prose td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.prose th {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--dim);
  font-weight: 500;
}

.dot { color: var(--line); }

.share {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.share-label {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--dim);
  margin-right: 2px;
}

.share-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.share-copy .share-copy-check { display: none; }

.share-copy.is-copied .share-copy-check {
  display: block;
  color: var(--accent);
}

.share-copy.is-copied .share-copy-icon {
  display: none;
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  align-items: center;
}

.post-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.35;
  min-width: 0;
}

.post-nav-next {
  justify-content: flex-end;
  text-align: right;
}

.post-nav-arrow {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--dim);
  transition: color 0.15s ease;
}

.post-nav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--display);
  font-size: 15px;
  color: var(--ink);
  transition: color 0.15s ease;
}

.post-nav-item:hover .post-nav-arrow,
.post-nav-item:hover .post-nav-text {
  color: var(--accent);
}

.post-nav-item.post-nav-disabled {
  visibility: hidden;
}

/* responsive */

@media (max-width: 480px) {
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .about-name { font-size: 42px; }
  .post-title { font-size: 30px; }
  .writes-head h1 { font-size: 26px; }
  .post-item-link { grid-template-columns: 1fr; gap: 6px; }
  .post-item-date { padding-top: 0; order: -1; }
  .post-item-link:hover { margin: 0 -12px; padding: 26px 12px; }
}

@media (max-width: 640px) {
  .navlinks { gap: 20px; font-size: 12.5px; }
  .theme-toggle { margin-left: 18px; width: 32px; height: 32px; }
  .to-top { right: 16px; bottom: 16px; width: 40px; height: 40px; }
}
