@font-face {
  font-family: 'Berkeley Mono';
  src: url('../fonts/BerkeleyMono-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('../fonts/BerkeleyMono-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('../fonts/BerkeleyMono-Oblique.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --font-mono: 'Berkeley Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --line-height: 1.7;
  --lh: calc(1em * var(--line-height));
  --half-lh: calc(var(--lh) / 2);
  
  --bg: #111111;
  --fg: #d4d4d4;
  --fg-muted: #808080;
  --accent: #6cb6ff;
  --accent-green: #4ec94e;
  --border: #404040;
}

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

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

body {
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: var(--line-height);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 400;
  background: var(--bg);
  color: var(--fg);
  margin: 0;
  padding: var(--lh) 4ch;
  max-width: 120ch;
  margin-inline: auto;
}

/* Two column layout */
.layout {
  display: grid;
  grid-template-columns: 1fr 30ch;
  gap: 6ch;
}

.content {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: var(--lh);
  align-self: start;
}

@media (max-width: 80ch) {
  .layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: none;
  }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  margin: 0;
}

.post-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 var(--half-lh) 0;
}

.title-arrow {
  color: var(--accent-green);
  margin-right: 1ch;
}

h2 {
  font-size: 1rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.3em;
  padding: var(--half-lh) 0 calc(var(--half-lh) / 2) 0;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  padding: var(--half-lh) 0;
}

p {
  margin: 0;
  padding: var(--half-lh) 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Lists */
ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-left: 3ch;
}

ul li, ol li {
  padding: calc(var(--half-lh) / 2) 0;
}

ul.asterisk li::before {
  content: '* ';
  color: var(--fg);
}

ul.dot li::before {
  content: '• ';
  color: var(--fg);
}

ol {
  padding-left: 4ch;
  list-style: decimal;
}

/* Blockquote */
blockquote {
  margin: var(--half-lh) 0;
  padding: var(--half-lh) 2ch;
  border-left: 2px solid var(--accent-green);
  color: var(--fg);
}

blockquote p {
  padding: 0;
}

/* Code */
pre, code {
  font-family: var(--font-mono);
  font-size: 1rem;
}

code {
  color: var(--accent);
}

pre {
  margin: var(--half-lh) 0;
  padding: var(--half-lh) 2ch;
  overflow-x: auto;
  border: 1px solid var(--border);
}

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

pre.shiki {
  padding: var(--half-lh) 2ch;
  border: 1px solid var(--border);
}

pre.shiki code {
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: var(--line-height);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--half-lh) 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--half-lh) 0;
}

th, td {
  text-align: left;
  padding: calc(var(--half-lh) / 2) 2ch;
  border: 1px solid var(--border);
}

th {
  font-weight: 700;
}

/* Header spacer (maintains position without visible header) */
.header-spacer {
  height: var(--lh);
}

/* Table of contents */
.toc-header {
  padding: 0 0 var(--half-lh) 0;
  margin: 0;
}

.toc-title {
  color: var(--accent);
  font-weight: 400;
}

.toc-header .sep {
  color: var(--fg-muted);
  margin: 0 1ch;
}

.toc-header a {
  color: var(--fg-muted);
}

.toc-header a:hover {
  color: var(--accent);
}

.toc ul {
  padding: 0;
}

.toc li {
  padding: calc(var(--half-lh) / 2) 0;
}

.toc a {
  color: var(--fg);
}

.toc a:hover {
  color: var(--accent);
}

/* Post list (home page) */
.post-list {
  padding: 0;
  list-style: none;
}

.post-list li {
  padding: var(--half-lh) 0;
}

.post-list li::before {
  content: none !important;
}

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

.post-list .post-date {
  color: var(--fg-muted);
  margin-left: 2ch;
}

/* Post footer */
.post-footer {
  margin-top: var(--lh);
  padding-top: var(--half-lh);
  border-top: 1px dotted var(--border);
  color: var(--fg-muted);
}

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

.post-footer a:hover {
  color: var(--accent);
}

.post-footer .sep {
  margin: 0 1ch;
}

/* Site footer (home page) */
.site-footer {
  margin-top: var(--lh);
  padding-top: var(--half-lh);
  border-top: 1px dotted var(--border);
  color: var(--fg-muted);
}
