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

* {
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fafafa;
  --text: #333;
  --heading: #111;
  --link: #2563eb;
  --link-hover: #2563eb;
  --code-bg: #f1f5f9;
  --border: #e2e8f0;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --tag-bg: #eff6ff;
  --tag-text: #2563eb;
  --blockquote-border: #2563eb;
  --blockquote-text: #475569;
  --table-header-bg: #f8fafc;
  --table-border: #e2e8f0;
  --profile-link: #64748b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --text: #cbd5e1;
    --heading: #f1f5f9;
    --link: #60a5fa;
    --link-hover: #60a5fa;
    --code-bg: #1e293b;
    --border: #334155;
    --muted: #94a3b8;
    --muted-light: #64748b;
    --tag-bg: #1e3a5f;
    --tag-text: #60a5fa;
    --blockquote-border: #60a5fa;
    --blockquote-text: #94a3b8;
    --table-header-bg: #1e293b;
    --table-border: #334155;
    --profile-link: #94a3b8;
  }
}

html {
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  font-family: "Maitree", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Prompt", sans-serif;
  line-height: 1.3;
  color: var(--heading);
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

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

a:hover {
  text-decoration: underline;
}

code {
  font-family: "Source Code Pro", monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  overflow-x: auto;
}

img {
  max-width: 100%;
  height: auto;
}

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

/* Profile section */
.profile {
  text-align: center;
  margin-bottom: 3rem;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 1rem;
}

.profile-name {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.profile-desc {
  color: var(--muted);
  margin-bottom: 1rem;
}

.profile-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-links a {
  color: var(--profile-link);
  font-size: 0.9rem;
}

.profile-links a:hover {
  color: var(--link);
}

/* Post list */
.post-list {
  list-style: none;
}

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

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

.post-title {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.post-title a {
  color: var(--heading);
}

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

.post-date {
  font-size: 0.85rem;
  color: var(--muted-light);
}

.post-desc {
  font-size: 0.9rem;
  color: var(--text);
  margin-top: 0.35rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.post-tag {
  font-size: 0.75rem;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 0.1em 0.5em;
  border-radius: 4px;
}

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

.post-header h1 {
  margin-bottom: 0.25rem;
}

.post-meta {
  color: var(--muted-light);
  font-size: 0.9rem;
}

.post-content {
  line-height: 1.8;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.35rem;
}

.post-content blockquote {
  border-left: 4px solid var(--blockquote-border);
  padding-left: 1rem;
  margin: 1.25rem 0;
  color: var(--blockquote-text);
  font-style: italic;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
}

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

.post-content th {
  background: var(--table-header-bg);
  font-weight: 700;
}

/* 404 page */
.not-found {
  text-align: center;
  padding: 4rem 0;
}

.not-found h1 {
  font-size: 4rem;
  color: var(--link);
  margin-bottom: 0.5rem;
}

.not-found p {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

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

/* Back link */
.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 3rem 0 1rem;
  font-size: 0.85rem;
  color: var(--muted-light);
}