:root {
  color-scheme: light dark;
  --page-bg: #f6f8fa;
  --header-bg: #0d1117;
  --header-text: #f0f6fc;
  --accent: #2f81f7;
  --footer-text: #656d76;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #0d1117;
    --footer-text: #8b949e;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', Helvetica,
    Arial, sans-serif;
  background: var(--page-bg);
  color: #1f2328;
}

.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid #30363d;
}

.site-header__inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.site-header__brand {
  font-weight: 700;
  font-size: 1.05rem;
}

.site-header__subtitle {
  opacity: 0.85;
  font-size: 0.95rem;
}

.site-header__link {
  margin-left: auto;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.site-header__link:hover {
  text-decoration: underline;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.markdown-body {
  background: #ffffff;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  padding: 32px 40px;
  box-shadow: 0 1px 2px rgba(27, 31, 36, 0.06);
}

@media (prefers-color-scheme: dark) {
  body {
    color: #e6edf3;
  }

  .markdown-body {
    background: #161b22;
    border-color: #30363d;
    color-scheme: dark;
  }
}

.markdown-body img.zoomable-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #d0d7de;
  cursor: zoom-in;
  transition: box-shadow 0.15s ease;
}

.markdown-body img.zoomable-image:hover {
  box-shadow: 0 4px 16px rgba(27, 31, 36, 0.15);
}

body.lightbox-open {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 4, 9, 0.82);
  backdrop-filter: blur(4px);
}

.image-lightbox__panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.image-lightbox__figure {
  margin: 0;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.image-lightbox__figure img {
  max-width: 96vw;
  max-height: calc(92vh - 48px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.image-lightbox__caption {
  margin: 0;
  color: #f0f6fc;
  font-size: 0.9rem;
  text-align: center;
  max-width: 96vw;
}

.image-lightbox__close {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #21262d;
  color: #f0f6fc;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0,  0, 0.3);
}

.image-lightbox__close:hover {
  background: #30363d;
}

.markdown-body table {
  display: block;
  overflow-x: auto;
}

.markdown-body blockquote {
  border-left-color: var(--accent);
}

.site-footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px 32px;
  text-align: center;
  color: var(--footer-text);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--accent);
}
