:root {
  --background: #111111;
  --foreground: #c9c9c9;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --neutral-700: #333333;
  --neutral-900: #171717;
  --accent: #cbe05a;
  --page-max: 1160px;
  --content-max: 700px;
}

@media (prefers-color-scheme: light) {
  :root {
    --background: #ffffff;
    --foreground: #171717;
    --neutral-700: #e5e5e5;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-size: 1.05rem;
  background: var(--background);
  color: var(--foreground);
  font-family: "Source Serif 4", Georgia, serif;
  line-height: 1.5;
}

code, pre {
  font-family: "JetBrains Mono", monospace;
}

h1, h2, h3, li, strong, a {
  color: var(--gray-300);
}

a {
  text-decoration: none;
  color: inherit;
}

.wrap {
  max-width: var(--page-max);
  margin: 2rem 1rem 0;
  padding: 0 0.5rem;
}

@media (min-width: 1024px) {
  .wrap {
    margin: 2.5rem auto 0;
    padding: 0 2rem;
  }
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content-slot {
  flex: 1 1 auto;
  padding-bottom: 4rem;
}

/* Nav */
.nav-aside {
  margin-bottom: 2.5rem;
}

.nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--neutral-700);
}

.logo-link {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent);
}

.nav-right {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.nav-link {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  transition: color 0.15s ease;
}

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

/* Posts list */
.posts-page {
  margin-top: 0;
  max-width: var(--content-max);
}

.year-header {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 2.5rem 0 1rem;
}

.year-header:first-child {
  margin-top: 0;
}

.post-item {
  border-bottom: 1px solid var(--neutral-700);
  padding: 1.5rem 0;
}

.post-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.post-link {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.post-title {
  display: block;
  min-width: 0;
  font-family: "Instrument Sans", sans-serif;
  font-weight: 500;
  font-size: 1.3rem;
  color: var(--foreground);
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
  transition: color 0.15s ease;
}

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

.post-desc {
  display: block;
  min-width: 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.05rem;
  color: var(--gray-400);
  margin-bottom: 0.75rem;
}

.post-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-meta .dot {
  color: var(--neutral-700);
}

/* Post page */
.post-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--neutral-700);
}

.topbar-link {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  transition: color 0.15s ease;
}

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

.topbar-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--content-max)) 200px;
  gap: 4rem;
  align-items: start;
}

@media (max-width: 900px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

.post-article {
  max-width: var(--content-max);
}

.post-kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.post-category {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
}

.post-article-date {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: var(--gray-500);
}

.post-article-title {
  font-family: "Instrument Sans", sans-serif;
  font-weight: 500;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  color: var(--foreground);
  margin: 0 0 1.25rem;
}

.post-article-desc {
  font-family: "Source Serif 4", serif;
  font-size: 1.2rem;
  color: var(--gray-400);
  line-height: 1.5;
  margin: 0 0 2.5rem;
}

.post-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--content-max);
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--neutral-700);
}

.post-footer-author {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: var(--gray-500);
}

/* Table of contents */
.toc {
  position: sticky;
  top: 2.5rem;
}

.toc-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toc-link {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--gray-500);
  transition: color 0.15s ease;
}

.toc-link:hover {
  color: var(--gray-300);
}

.toc-link.is-active {
  color: var(--accent);
}

.toc-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: inherit;
  opacity: 0.7;
}

/* Prose */
.prose {
  color: var(--gray-300);
  font-size: 1.05rem;
  line-height: 1.75;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--foreground);
  font-family: "Instrument Sans", sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 2.25rem;
  margin-bottom: 1rem;
}

.prose h2 { font-size: 1.4rem; }
.prose h3 { font-size: 1.2rem; }
.prose h4 { font-size: 1.05rem; }

.prose p {
  margin: 1.25rem 0;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
}

.prose a:hover {
  opacity: 0.8;
}

.prose strong {
  color: var(--foreground);
  font-weight: 700;
}

.prose ul, .prose ol {
  margin: 1.25rem 0;
  padding-left: 1.5rem;
}

.prose li {
  margin: 0.5rem 0;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin: 1.75rem 0;
  color: var(--gray-400);
  font-family: "Source Serif 4", serif;
  font-style: italic;
  font-size: 1.1rem;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

.prose code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

.prose pre {
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose pre code {
  background: none;
  padding: 0;
}

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

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  font-size: 0.75rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--gray-400);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

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

/* 404 */
.not-found {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 1rem;
}

.not-found-title {
  font-family: "Instrument Sans", sans-serif;
  font-size: 2.25rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 1rem;
}

.not-found-text {
  color: var(--gray-500);
  margin-bottom: 1.5rem;
  max-width: 28rem;
}

.not-found-link {
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  transition: color 0.15s ease;
}

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

.paw {
  display: inline-block;
  font-size: 1.5rem;
  transition: transform 0.15s ease;
}

.paw-left {
  transform: rotate(-15deg);
}

.paw-right {
  transform: rotate(10deg);
}

.not-found-link:hover .paw-left {
  transform: rotate(-15deg) scale(1.1);
}

.not-found-link:hover .paw-right {
  transform: rotate(10deg) scale(1.1);
}
