:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --border: #e5e7eb;
  --code-bg-inline: #f3f4f6;
  --code-bg-block: #0d1117;
  --max-width: 720px;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --border: #30363d;
  --code-bg-inline: #161b22;
  --code-bg-block: #161b22;
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg: #0d1117;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --border: #30363d;
    --code-bg-inline: #161b22;
    --code-bg-block: #161b22;
  }
}

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

html {
  scrollbar-gutter: stable;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  transition: background-color 0.2s, color 0.2s;
  scrollbar-gutter: stable;
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.9rem;
  transition: color 0.15s;
}

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

.theme-switcher {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  background: var(--border);
  border-radius: 6px;
  padding: 0.2rem;
  margin-left: auto;
}

.theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  color: var(--text-muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
  line-height: 0;
}

.theme-btn:hover {
  color: var(--text);
}

.theme-btn.active {
  background: var(--bg);
  color: var(--text);
}

/* ── Main ── */
.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* ── Hero ── */
.hero {
  border-bottom: 1px solid var(--border);
  padding: 3rem 1.5rem;
}

.hero-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

.hero-photo-wrap {
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 30%;
  transform: scale(1.5);
  transform-origin: 40% 30%;
  display: block;
}

.hero-text h1 {
  font-size: 2.75rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  line-height: 1.15;
}

.hero-subtitle {
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.6rem;
}

.hero-bio {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Post list ── */
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.post-list {
  list-style: none;
}

.post-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

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

.post-item a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.post-item a:hover {
  color: var(--accent);
}

.post-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  margin-left: 1rem;
  flex-shrink: 0;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Post ── */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.6rem;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-tags {
  display: flex;
  gap: 0.4rem;
}

.tag {
  background: var(--code-bg-inline);
  padding: 0.15em 0.5em;
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Post content ── */
.post-content {
  line-height: 1.8;
  font-size: 0.975rem;
  text-align: justify;
}

.post-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: 4.5rem;
}

.post-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

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

.page-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.page-toc {
  display: none;
}

@media (min-width: 1248px) {
  .page-layout {
    display: grid;
    grid-template-columns: 12rem var(--max-width);
    gap: 3rem;
    max-width: none;
    margin: 0;
    padding: 3rem 1.5rem 3rem calc(50vw - 360px - 12rem - 3rem);
    align-items: start;
  }

  .page-toc {
    display: block;
    position: sticky;
    top: 5rem;
  }
}

.toc-heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem !important;
}

#toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#toc-list li {
  margin-bottom: 0.35rem;
}

#toc-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.15s;
}

#toc-list a:hover,
#toc-list a.active {
  color: var(--accent);
}

#toc-list a.active {
  font-weight: 500;
}


.cert-section {
  margin-bottom: 1.5rem;
}

.cert-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem !important;
}

.cert-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  margin: 1.5rem 0;
}

.cert-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.cert-badge img {
  width: 5rem;
  height: 5rem;
  object-fit: contain;
}

.cert-badge--featured img {
  width: 7rem;
  height: 7rem;
}

.cert-badge span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.cert-badge[data-tooltip] {
  position: relative;
}

.cert-badge[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-size: 0.75rem;
  white-space: nowrap;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.cert-badge[data-tooltip]:hover::after {
  opacity: 1;
}

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

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

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content code {
  background: var(--code-bg-inline);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.875em;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.post-content pre {
  background: var(--code-bg-block);
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: #c9d1d9;
}

/* ── GitHub Dark syntax theme ── */
.post-content .hljs-keyword,
.post-content .hljs-type,
.post-content .hljs-template-variable,
.post-content .hljs-variable.language_ { color: #ff7b72; }
.post-content .hljs-title,
.post-content .hljs-title.class_,
.post-content .hljs-title.class_.inherited__,
.post-content .hljs-title.function_ { color: #d2a8ff; }
.post-content .hljs-attr,
.post-content .hljs-attribute,
.post-content .hljs-number,
.post-content .hljs-operator,
.post-content .hljs-literal,
.post-content .hljs-selector-attr,
.post-content .hljs-selector-class,
.post-content .hljs-selector-id { color: #79c0ff; }
.post-content .hljs-string,
.post-content .hljs-regexp,
.post-content .hljs-meta .hljs-string { color: #a5d6ff; }
.post-content .hljs-built_in,
.post-content .hljs-symbol { color: #ffa657; }
.post-content .hljs-comment,
.post-content .hljs-code,
.post-content .hljs-formula { color: #8b949e; }
.post-content .hljs-tag,
.post-content .hljs-name,
.post-content .hljs-selector-tag { color: #7ee787; }
.post-content .hljs-meta,
.post-content .hljs-variable { color: #79c0ff; }
.post-content .hljs-section { color: #1f6feb; font-weight: bold; }
.post-content .hljs-bullet { color: #f2cc60; }
.post-content .hljs-addition { color: #aff5b4; background: #033a16; }
.post-content .hljs-deletion { color: #ffdcd7; background: #67060c; }

.post-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

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

/* ── Page (About) ── */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
}

/* ── Post footer ── */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--text);
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Responsive ── */
@media (max-width: 600px) {
.post-item {
    flex-direction: column;
    gap: 0.25rem;
  }

  .post-date {
    margin-left: 0;
  }

  .post-header h1 {
    font-size: 1.4rem;
  }
}
