:root {
  --bg: #131416;
  --bg-soft: #1c1d20;
  --fg: #e6e3de;
  --fg-muted: #8a8680;
  --fg-dim: #54514c;
  --rule: #26272b;
  --link: #e8e4df;

  --accent: #89dceb;
  --accent-warm: #f5b95c;

  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: ui-serif, "Iowan Old Style", Charter, "Source Serif 4", "Apple Garamond", Cambria, Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.15s ease;
}
a:hover { border-color: var(--fg); }

/* hero */
.hero {
  margin-bottom: 5rem;
}

.logo {
  font-family: var(--mono);
  font-size: clamp(1.5rem, 5.25vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
  border: none;
  color: var(--fg);
  white-space: nowrap;
}

.logo .ch,
.logo .dot-out {
  display: inline-grid;
  transition:
    grid-template-columns 1ms steps(1, jump-end),
    opacity 1ms steps(1, jump-end);
}

.logo .ch > span,
.logo .dot-out > span {
  overflow: hidden;
  white-space: pre;
}

.logo .ch {
  grid-template-columns: 0fr;
  opacity: 0;
}

.logo .dot-out {
  grid-template-columns: 1fr;
  opacity: 1;
}

.logo .domain:hover .ch {
  grid-template-columns: 1fr;
  opacity: 1;
  transition-delay: var(--d);
}

.logo .domain:hover .dot-out {
  grid-template-columns: 0fr;
  opacity: 0;
  transition-delay: var(--dot-d, 0.36s);
}

.logo .caret {
  position: relative;
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: baseline;
}

.logo .caret::before {
  content: "";
  position: absolute;
  left: -0.04em;
  bottom: 0;
  width: 0.08em;
  height: 0.85em;
  background: currentColor;
  opacity: 0;
}

.logo .domain:hover .caret::before {
  animation:
    caret-on 1ms linear var(--d-prev) forwards,
    caret-off 1ms linear var(--d) forwards;
}

@keyframes caret-on { to { opacity: 1; } }
@keyframes caret-off { to { opacity: 0; } }

.hero nav {
  margin-top: 1.75rem;
  display: flex;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.hero nav a {
  color: var(--fg-muted);
  border-bottom-color: transparent;
}
.hero nav a:hover {
  color: var(--fg);
  border-bottom-color: var(--fg-muted);
}

/* posts list */
.posts h2 {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: var(--fg-muted);
  font-weight: 500;
  font-style: italic;
  margin: 0 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.posts ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.posts li {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
}

.posts li:last-child { border-bottom: none; }

.posts li a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border: none;
}

.posts .post-title {
  color: var(--fg);
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.posts li a:hover .post-title {
  border-bottom-color: var(--fg-muted);
}

.posts time {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
  flex-shrink: 0;
  white-space: nowrap;
}

.posts .summary {
  margin: 0.4rem 0 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.posts .empty {
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: 0.9rem;
}

/* post page */
.post-header {
  margin-bottom: 4rem;
}

.logo-small {
  font-size: 1.15rem;
  border: none;
}

article h1 {
  font-family: var(--display);
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}

article > time {
  display: block;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
  margin-bottom: 2.5rem;
}

article h2 {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
}

article h3 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

article > p, article ul, article ol {
  margin: 0 0 1.2rem;
}

article a {
  color: var(--accent);
  border-bottom-color: var(--rule);
}
article a:hover { border-color: var(--accent); }

article code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

article pre {
  background: var(--bg-soft);
  padding: 1rem 1.2rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
  border-left: 2px solid var(--rule);
}

article pre.shiki {
  background: var(--bg-soft) !important;
}

.code-block {
  position: relative;
  margin: 0 0 1.2rem;
}

.code-block pre {
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.25rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  color: var(--fg-muted);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

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

.copy-btn:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

.copy-btn.copied {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
}

@media (hover: none) {
  .copy-btn { opacity: 1; }
}

article pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  font-family: var(--mono);
}

article blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid var(--accent-warm);
  color: var(--fg-muted);
  font-style: italic;
}

article hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

article img {
  max-width: 100%;
  border-radius: 4px;
}

article ul, article ol { padding-left: 1.4rem; }
article li { margin-bottom: 0.4rem; }

article table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}

article thead th {
  font-family: var(--display);
  font-weight: 600;
  text-align: left;
  padding: 0.6rem 0.9rem;
  color: var(--fg);
  border-bottom: 1px solid var(--fg-dim);
}

article tbody td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  color: var(--fg);
  vertical-align: top;
}

article tbody tr:last-child td { border-bottom: none; }

article tbody tr:hover td { background: var(--bg-soft); }

article th[align="right"], article td[align="right"] { text-align: right; }
article th[align="center"], article td[align="center"] { text-align: center; }

.post-footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.9rem;
}

.post-footer a {
  color: var(--fg-muted);
  border: none;
}
.post-footer a:hover { color: var(--fg); }

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