@import url('https://fonts.googleapis.com/css2?family=Inter:wght@600;800;900&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap');

:root {
  --nav-bg: #14161b;
  --text: #16181d;
  --text-muted: #6b7280;
  --border: #e8e8e8;
  --link: #16181d;
  --max-width: 700px;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Source Serif 4', Georgia, serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: #ffffff;
  line-height: 1.6;
}

a { color: inherit; }

/* ---------- Header ---------- */

.site-header {
  background: var(--nav-bg);
  color: #fff;
}

.nav-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.92rem;
  color: #fff;
  text-decoration: none;
  opacity: 0.92;
}

.nav-links a:hover { opacity: 0.5; }

.search-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
}

/* ---------- Hero (homepage only) ---------- */

.hero {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px 56px;
  text-align: center;
}

.hero-title {
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: 2.6rem;
  letter-spacing: 0.02em;
  color: #fff;
  margin: 0 0 16px;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  margin: 0;
}

/* ---------- Layout ---------- */

.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.site-main-wide {
  max-width: 1100px;
  padding: 40px 24px 80px;
}

/* ---------- Post grid (homepage) ---------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 32px;
}

.grid-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.grid-card-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 16px;
}

.grid-card-title {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 0 0 8px;
}

.grid-card-excerpt {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: #3d4b8c;
  line-height: 1.5;
  margin: 0;
}

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

@media (max-width: 600px) {
  .post-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.9rem; }
}

/* ---------- Post header ---------- */

.eyebrow {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

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

.post-title {
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: 2.5rem;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}

.post-card-title {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 8px;
}

.post-subtitle,
.post-card-subtitle {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: #3d3d3d;
  margin: 0 0 14px;
}

.post-meta {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 40px;
}

/* ---------- Featured image ---------- */

.post-featured-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 40px;
}

/* ---------- Post body ---------- */

.post-body {
  font-size: 1.08rem;
}

.post-body p {
  margin: 0 0 1.3em;
}

.post-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-body h2 {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.5rem;
  margin: 2em 0 0.6em;
}

.post-body h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 1.8em 0 0.5em;
}

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 4px;
}

.post-body ol,
.post-body ul {
  padding-left: 1.4em;
  margin: 0 0 1.3em;
}

.post-body li {
  margin-bottom: 0.4em;
}

.post-body blockquote {
  margin: 1.5em 0;
  padding-left: 1.2em;
  border-left: 3px solid var(--border);
  color: #4a4a4a;
}

.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f3f3f3;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

.post-body pre {
  background: #1a1a1a;
  color: #eee;
  padding: 1em;
  border-radius: 6px;
  overflow-x: auto;
}

.post-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.8em 0;
  font-family: var(--font-ui);
  font-size: 0.92rem;
}

.post-body th {
  background: #eef3f8;
  text-align: left;
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid #dde5ee;
  white-space: nowrap;
}

.post-body td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.post-body th:not(:first-child),
.post-body td:not(:first-child) {
  text-align: center;
}

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

/* Markdown admonition */
.post-body .admonition {
  margin: 1.5em 0;
  padding: 16px 20px;
  border-radius: 6px;
}

.post-body .admonition-title {
  font-family: var(--font-ui);
  font-weight: 700;
  margin: 0 0 6px;
}

.post-body .admonition.note,
.post-body .admonition.hint,
.post-body .admonition.tip {
  border-left-color: #2563eb;
  background: #eff6ff;
}
.post-body .admonition.note .admonition-title,
.post-body .admonition.hint .admonition-title,
.post-body .admonition.tip .admonition-title {
  color: #1e40af;
}

.post-body .admonition.important {
  border-left-color: #7c3aed;
  background: #f5f3ff;
}
.post-body .admonition.important .admonition-title {
  color: #5b21b6;
}

.post-body .admonition.danger,
.post-body .admonition.error {
  border-left-color: #dc2626;
  background: #fef2f2;
}
.post-body .admonition.danger .admonition-title,
.post-body .admonition.error .admonition-title {
  color: #991b1b;
}

.post-body .admonition.attention,
.post-body .admonition.caution {
  border-left-color: #d97706;
  background: #fff8ec;
}
.post-body .admonition.attention .admonition-title,
.post-body .admonition.caution .admonition-title {
  color: #92400e;
}

.post-body .admonition p:last-child {
  margin-bottom: 0;
}

/* ---------- Tags ---------- */

.post-tags {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-pill {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  background: #f2f2f2;
  color: var(--text);
  padding: 5px 12px;
  border-radius: 20px;
}

/* ---------- Post list (index) ---------- */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.post-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

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

.post-card .post-meta {
  margin-bottom: 0;
}

.pager {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-weight: 600;
  margin-top: 40px;
}

.pager a { text-decoration: none; }

/* ---------- Footer ---------- */

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 60px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .nav-wrap {
    flex-wrap: wrap;
    gap: 14px 16px;
  }
  .nav-links {
    gap: 16px;
    font-size: 0.85rem;
    order: 3;
    width: 100%;
  }
  .post-title { font-size: 1.9rem; }
  .site-main { padding: 40px 20px 60px; }
}
