:root {
  --brand: #03a9f4;
  --brand-hover: #0286c2;
  --text: #404040;
  --heading: #111;
  --muted: #6b7280;
  --bg: #ffffff;
  --surface: #ffffff;
  --border: #e5e7eb;
  --code-bg: #f4f5f7;
  --max: 720px;
  --header-max: 960px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --text: #e8eaed;
  --heading: #f4f5f7;
  --muted: #9aa0a6;
  --bg: #1a1d23;
  --surface: #242830;
  --border: #3d4450;
  --code-bg: #2c313c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Open Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover { color: var(--brand-hover); }

.header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner,
.footer-inner,
.main {
  width: min(var(--header-max), calc(100% - 2.5rem));
  margin: 0 auto;
}

.main {
  width: min(var(--max), calc(100% - 2.5rem));
  flex: 1;
  padding: 2.5rem 0 4rem;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--heading);
  font-family: "Maven Pro", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
}

.brand:hover { color: var(--brand); }

.brand img {
  display: block;
  width: 32px;
  height: 32px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
}

.nav a {
  color: var(--text);
  font-size: 0.95rem;
}

.nav a:hover { color: var(--brand); }

.hero {
  margin-bottom: 2.5rem;
}

.hero h1,
.post-header h1 {
  font-family: Roboto, Helvetica, Arial, sans-serif;
  font-weight: 500;
  color: var(--heading);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

.hero h1 { font-size: 2rem; }
.post-header h1 { font-size: 2.1rem; }

.tagline,
.meta,
.copyright,
.empty,
.excerpt {
  color: var(--muted);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.post-teaser time,
.meta time {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-teaser h2 {
  font-family: Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.45rem;
  font-weight: 500;
  margin: 0.35rem 0 0.4rem;
}

.post-teaser h2 a { color: var(--heading); }
.post-teaser h2 a:hover { color: var(--brand); }

.excerpt { margin: 0; }

.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.post-header { margin-bottom: 1.75rem; }
.meta { margin: 0; }

.content h2,
.content h3 {
  font-family: Roboto, Helvetica, Arial, sans-serif;
  color: var(--heading);
  margin: 2rem 0 0.75rem;
}

.content p { margin: 0 0 1rem; }

.content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border: 1px solid var(--border);
  background: #fff;
}

.content figure {
  margin: 1.5rem 0;
}

.content figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 0.4rem;
}

.content figure img {
  margin-bottom: 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0 1.5rem;
  font-size: 0.95rem;
}

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

.content iframe {
  max-width: 100%;
  display: block;
  margin: 1.5rem auto;
}

.kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.kg-gallery-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.kg-gallery-image {
  flex: 1;
  min-width: 0;
}

.kg-gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
}

.kg-callout-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  border: 1px solid var(--border);
  background: var(--code-bg);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin: 1.25rem 0;
}

.kg-callout-emoji { font-size: 1.2rem; line-height: 1.3; }
.kg-embed-card iframe { width: 100%; min-height: 315px; }

.feature-image {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 0 1.75rem;
  border: 1px solid var(--border);
  background: #fff;
}

.content pre,
.content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border-radius: 4px;
}

.content code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

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

.content blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 1rem;
  border-left: 3px solid var(--brand);
  color: var(--muted);
}

.content ul, .content ol { padding-left: 1.3rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2rem 0 0;
}

.tags a {
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  color: var(--text);
}

.tags a:hover { border-color: var(--brand); color: var(--brand); }

.comments {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 2rem;
  background: var(--surface);
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.footer h3 {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.footer-links a {
  display: block;
  color: var(--text);
  margin: 0.25rem 0;
  font-size: 0.95rem;
}

.footer-links a:hover { color: var(--brand); }

.copyright {
  margin: 2rem 0 0;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; padding: 0.75rem 0; }
  .footer-links { grid-template-columns: 1fr; }
  .hero h1, .post-header h1 { font-size: 1.7rem; }
}
