:root {
  --bg: #f5f2ee;
  --fg: #3a2f2a;
  --muted: #8b7b73;
  --accent: #6b4e3d;
  --surface: #fffaf8;
  --border: #dcd3cc;
  --code-bg: #3a2f2a;
  --code-fg: #e8e0d8;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2a1f1a;
    --fg: #e8e0d8;
    --muted: #a8968c;
    --accent: #c9b3a3;
    --surface: #3a2f2a;
    --border: #4a3f3a;
    --code-bg: #1a0f0a;
    --code-fg: #d7cfc5;
  }
}

[data-theme="dark"] {
  --bg: #2a1f1a;
  --fg: #e8e0d8;
  --muted: #a8968c;
  --accent: #c9b3a3;
  --surface: #3a2f2a;
  --border: #4a3f3a;
  --code-bg: #1a0f0a;
  --code-fg: #d7cfc5;
}

[data-theme="light"] {
  --bg: #f5f2ee;
  --fg: #3a2f2a;
  --muted: #8b7b73;
  --accent: #6b4e3d;
  --surface: #fffaf8;
  --border: #dcd3cc;
  --code-bg: #3a2f2a;
  --code-fg: #e8e0d8;
}

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

body {
  font-family: "Courier New", Courier, monospace;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  transition: background 0.3s ease, color 0.3s ease;
}

.site-shell {
  width: min(900px, 100%);
  border: 1px solid var(--border);
  padding: 2.5rem;
  background: var(--surface);
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.06);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.brand {
  font-size: 1.8rem;
  letter-spacing: 0.15rem;
}

.nav {
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
}

.nav a {
  text-decoration: none;
  color: var(--accent);
  position: relative;
}

.nav a::after {
  content: "";
  position: absolute;
  bottom: -0.2rem;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 150ms ease;
}

.nav a:hover::after,
.nav a.active::after {
  transform: scaleX(1);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: background 0.2s ease, color 0.2s ease;
}

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

.content {
  display: grid;
  gap: 2.5rem;
}

.section {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.section h2 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
}

.post {
  margin-bottom: 2rem;
}

.post time {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.post h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.post-content {
  font-size: 0.95rem;
  line-height: 1.7;
}

.post-content pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
  margin: 1.2rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

.post-content code {
  background: var(--border);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.9rem;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.6rem;
  text-align: left;
}

.post-content blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--muted);
}

.post-content hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 2rem 0;
}

.post-content .checkbox {
  font-family: inherit;
  margin-right: 0.5rem;
  color: var(--muted);
}

.post-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.post-content a:hover {
  border-bottom-color: var(--accent);
}

.site-footer {
  margin-top: 3rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}

@media (max-width: 600px) {
  body {
    padding: 1.5rem;
  }
  .site-shell {
    padding: 1.5rem;
  }
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .brand {
    font-size: 1.4rem;
  }
}
