:root {
  --text: #111;
  --bg: #ffffff;
  --accent: #666;
  --link: #666;
  --subtle: #ddd;
  --font-body: "Palatino", "Palatino Linotype", "Book Antiqua", serif;
  --font-mono: "Inconsolata", "Courier New", Courier, monospace;
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
}

h1 {
  font-size: 36px;
  margin: 35px 0 15px;
}

h2 {
  font-size: 26px;
  margin: 30px 0 15px;
  border-bottom: 1px solid var(--subtle);
  padding-bottom: 5px;
}

h3 {
  font-size: 20px;
  margin: 25px 0 10px;
}

p {
  font-size: 16px;
  margin-bottom: 1.2rem;
  color: #222;
}

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

a:hover { text-decoration: underline; }

pre, code {
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.3;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 10px 0 15px;
}

header {
  text-align: left;
  margin-bottom: 40px;
}

header h1,
header p {
  margin-left: 0;
}

.header-icons {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-start;
  margin-top: 0.4rem;
}

.header-icons a {
  color: var(--text);
  transition: color 0.2s ease;
}

.header-icons a:hover { color: var(--link); }

.header-icons svg {
  width: 20px;
  height: 20px;
}

nav {
  margin: 12px 0 30px;
}

nav a {
  margin-right: 15px;
  color: #555;
}

nav a:hover { text-decoration: underline; }

.section { margin-bottom: 4rem; }

.blog-date {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

footer {
  margin-top: 5rem;
  border-top: 1px solid var(--subtle);
  padding-top: 1.6rem;
  text-align: center;
  color: var(--accent);
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  body { padding: 1.25rem; }
  h1 { font-size: 28px; }
}

#homeBlogGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.7rem;
  margin-top: 2rem;
}

#homeBlogGrid .blog-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.07);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#homeBlogGrid .blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

#homeBlogGrid img {
  height: 140px;
  object-fit: cover;
  width: 100%;
}

#homeBlogGrid .blog-content {
  padding: 1rem;
}

#homeBlogGrid .blog-content h3 {
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

#homeBlogGrid .blog-content p {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 0.4rem;
}

#homeBlogGrid .blog-meta {
  font-size: 0.82rem;
  color: #777;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  transition: color 0.2s ease;
}

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

.contact-links svg {
  width: 20px;
  height: 20px;
}

img, video, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

figure { margin: 1.25rem 0; text-align: center; }
figure img { width: 100%; border-radius: 6px; }
figcaption { font-size: 0.9rem; color: var(--accent); margin-top: 0.5rem; }

@media (max-width: 640px) {
  .content { padding: 0 1rem; }
  figcaption { font-size: 0.88rem; line-height: 1.35; }
}

mjx-container[jax="SVG"] {
  font-size: 1em !important;
  display: inline-block !important;
  line-height: 0 !important;
  vertical-align: -0.18em !important;
  margin: 0 0.06em;
}

mjx-container[display="true"] {
  display: block !important;
  text-align: center;
  margin: 1.25rem auto;
  line-height: 1 !important;
}

mjx-container svg {
  display: inline !important;
  max-width: none !important;
  height: auto !important;
  overflow: visible;
}

mjx-container .mjx-script {
  font-size: 0.8em;
}

p > mjx-container:first-child { margin-left: 0.15em; }
p > mjx-container:last-child { margin-right: 0.15em; }
