/* ── Design tokens ── */
:root {
  --ink: #050507;
  --ink-2: #0c0d12;
  --ink-3: #151720;
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.15);
  --text: #f0f1f5;
  --muted: #9ba3b5;
  --accent: #56d0e0;
  --accent-dim: rgba(86, 208, 224, 0.1);
  --green: #4ade80;
  --blue: #60a5fa;
}

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

body {
  background: var(--ink);
  color: var(--text);
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Helvetica,
    Arial,
    sans-serif;
  font-weight: 400;
  line-height: 1.7;
}

/* ── Two-column layout (article pages) ── */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  border-right: 1px solid var(--border);
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-home {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.05em;
  padding: 0 12px;
  transition: color 0.2s;
}
.sidebar-home:hover {
  color: var(--text);
}

.sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar li a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  text-decoration: none;
  border-left: 2px solid transparent;
}

.sidebar li a:hover {
  background: rgba(255, 255, 255, 0.04);
  border: none !important;
}
.sidebar li.active a {
  border-left: 5px solid;
  border-left-color: var(--accent);
}

.sidebar-date {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  color: var(--accent);
}
.sidebar-title {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
}

/* ── Main column ── */
main {
  padding: 82px 72px 72px 42px;
}

/* ── Article header ── */
.article-header {
  margin-bottom: 48px;
}

.eyebrow {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.article-header h1 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 12px;
}

.article-header time {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.header-sep {
  color: var(--muted);
  margin: 0 6px;
}
.header-md-link {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.header-md-link:hover {
  color: var(--accent);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.tag {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 10px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}

.article-figure {
  margin: 32px 0 0;
  padding: 0;
}
.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.article-figure figcaption {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 10px;
  letter-spacing: 0.02em;
}

/* ── Article body (markdown output) ── */
.article-body {
  font-size: 16px;
  line-height: 1.85;
  color: var(--muted);
}

.article-body h2 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 26px;
  color: var(--text);
  letter-spacing: -0.5px;
  margin: 48px 0 16px;
}

.article-body h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
}

.article-body p {
  margin-bottom: 20px;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(232, 197, 106, 0.4);
}
.article-body a:hover {
  text-decoration-color: var(--accent);
}

.article-body ul,
.article-body ol {
  padding-left: 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-body img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin: 32px 0;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  background: var(--accent-dim);
  border-radius: 0 8px 8px 0;
  margin: 24px 0;
  font-style: italic;
}

/* Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.5;
}

.article-body thead {
  border-bottom: 2px solid var(--border-bright);
}

.article-body th {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: left;
  padding: 10px 16px;
}

.article-body td {
  padding: 10px 16px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

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

.article-body tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.article-body td strong,
.article-body th strong {
  color: var(--text);
  font-weight: 600;
}

/* Shiki code blocks */
.article-body pre {
  border-radius: 10px;
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.7;
}

.article-body code:not(pre code) {
  font-family: "DM Mono", monospace;
  font-size: 12.5px;
  background: var(--ink-3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border);
}

/* ── Article footer ── */
.article-footer {
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.article-footer a {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.article-footer a:hover {
  color: var(--text);
}

/* ── Reading time pill in header ── */
.reading-time {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

/* ── Article pager (prev/next at bottom) ── */
.article-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 32px;
}
.article-pager .pager-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  transition:
    border-color 0.2s,
    background 0.2s,
    transform 0.2s;
  min-height: 80px;
}
.article-pager .pager-link:hover {
  border-color: var(--text);
  background: rgba(255, 255, 255, 0.02);
  transform: translateY(-1px);
}
.article-pager .pager-next {
  text-align: right;
  align-items: flex-end;
}
.article-pager .pager-label {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.article-pager .pager-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-pager .pager-empty {
  /* Reserves the grid cell when only one neighbor exists */
  visibility: hidden;
}
@media (max-width: 640px) {
  .article-pager {
    grid-template-columns: 1fr;
  }
  .article-pager .pager-empty {
    display: none;
  }
  .article-pager .pager-next {
    text-align: left;
    align-items: flex-start;
  }
}

/* ── List page ── */
.list-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 80px 48px;
}
.list-header {
  margin-bottom: 56px;
}

.list-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 40px;
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "DM Mono", monospace;
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}

.list-header h1 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 48px;
  color: var(--text);
  letter-spacing: -1.5px;
  margin-bottom: 12px;
}

.list-header p {
  font-size: 16px;
  color: var(--muted);
  font-weight: 300;
}

.article-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.article-card {
  display: flex;
  gap: 24px;
  padding: 28px 32px;
  background: var(--ink-2);
  text-decoration: none;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.article-card:last-child {
  border-bottom: none;
}
.article-card:hover {
  background: var(--ink-3);
}

.card-image {
  flex-shrink: 0;
  width: 100px;
  height: 70px;
  border-radius: 8px;
  overflow: hidden;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-body h2 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
  letter-spacing: -0.3px;
}
.card-summary {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.card-body time {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

pre {
  padding: 10px;
}
code {
  color: cyan;
  font-family: monospace;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
    position: static;
    height: auto;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: none;
    padding: 16px;
  }

  main {
    order: 1;
  }

  .sidebar ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .sidebar li a {
    flex-direction: row;
    gap: 6px;
    align-items: center;
    padding: 6px 10px;
    background: var(--ink-3);
    border-radius: 6px;
    border-left: none;
  }

  .sidebar li.active a {
    background: var(--accent-dim);
    border-right-color: var(--accent);
  }
  .sidebar-date {
    display: none;
  }

  main {
    padding: 32px 20px;
  }
  .list-layout {
    padding: 40px 20px;
  }
  .article-card {
    flex-direction: column;
  }
  .card-image {
    width: 100%;
    height: 160px;
  }
}
