:root {
  --bg: #ffffff;
  --bg-secondary: #f6f8fa;
  --text: #1f2328;
  --text-secondary: #636c76;
  --border: #d1d9e0;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --code-bg: #f6f8fa;
  --code-border: #d1d9e0;
  --max-width: 800px;
  --header-bg: #1b1f24;
  --header-text: #f0f3f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-secondary: #161b22;
    --text: #e6edf3;
    --text-secondary: #8b949e;
    --border: #30363d;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --code-bg: #161b22;
    --code-border: #30363d;
    --header-bg: #010409;
    --header-text: #f0f3f6;
  }
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Header */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 2rem 0;
  border-bottom: 3px solid var(--accent);
}

.site-header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
}

.site-nav a {
  color: var(--header-text);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.8;
}

.site-nav a:hover {
  opacity: 1;
  color: var(--accent);
}

.site-description-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.site-social {
  display: flex;
  gap: 0.6rem;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  color: var(--header-text);
  opacity: 0.6;
}

.nav-icon:hover {
  opacity: 1;
  color: var(--accent);
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--header-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-title:hover {
  color: var(--accent);
}

.site-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Main */
main {
  flex: 1;
  padding: 2.5rem 0;
}

/* Home page */
.home > p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-top: 0.5rem;
}

.post-summary {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

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

.post-summary h2 {
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.3rem;
}

.post-summary h2 a {
  color: var(--text);
  text-decoration: none;
}

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

.post-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.5rem;
  line-height: 1.5;
}

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

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

.tag {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

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

.post-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.post-content {
  font-size: 1rem;
  line-height: 1.7;
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

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

.post-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

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

.post-content a {
  color: var(--accent);
  text-decoration: none;
}

.post-content a:hover {
  text-decoration: underline;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0 auto;
  display: block;
}

.post-content figure {
  margin: 1.5rem 0;
  text-align: center;
}

.post-content figure img {
  margin: 0 auto;
}

.post-content figcaption {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

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

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

.post-content li > ul,
.post-content li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 4px 4px 0;
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Code */
.post-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 3px;
  padding: 0.15em 0.35em;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  line-height: 1.45;
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
}

/* Syntax highlighting (Rouge) — light mode */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #6a737d; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr { color: #d73a49; }
.highlight .kt { color: #005cc5; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc,
.highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx,
.highlight .sr, .highlight .ss { color: #032f62; }
.highlight .nf, .highlight .nx { color: #6f42c1; }
.highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .mb,
.highlight .il { color: #005cc5; }
.highlight .cp, .highlight .cpf { color: #d73a49; }
.highlight .o, .highlight .ow { color: #d73a49; }
.highlight .nc, .highlight .nn { color: #6f42c1; }
.highlight .na { color: #005cc5; }
.highlight .nb { color: #005cc5; }
.highlight .ni { color: #24292e; }
.highlight .err { color: #cb2431; }
.highlight .gd { color: #cb2431; background-color: #ffeef0; }
.highlight .gi { color: #22863a; background-color: #f0fff4; }

@media (prefers-color-scheme: dark) {
  .highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #8b949e; }
  .highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr { color: #ff7b72; }
  .highlight .kt { color: #79c0ff; }
  .highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc,
  .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx,
  .highlight .sr, .highlight .ss { color: #a5d6ff; }
  .highlight .nf, .highlight .nx { color: #d2a8ff; }
  .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .mb,
  .highlight .il { color: #79c0ff; }
  .highlight .cp, .highlight .cpf { color: #ff7b72; }
  .highlight .o, .highlight .ow { color: #ff7b72; }
  .highlight .nc, .highlight .nn { color: #d2a8ff; }
  .highlight .na { color: #79c0ff; }
  .highlight .nb { color: #79c0ff; }
  .highlight .ni { color: #e6edf3; }
  .highlight .err { color: #f85149; }
  .highlight .gd { color: #f85149; background-color: #3c1618; }
  .highlight .gi { color: #3fb950; background-color: #0d2117; }
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

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

.post-content th {
  background: var(--bg-secondary);
  font-weight: 600;
}

.post-content tr:nth-child(even) {
  background: var(--bg-secondary);
}

/* Foreword */
.foreword {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.foreword p {
  margin-bottom: 0;
}

/* Video */
.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 1.5rem 0;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Footer */
.site-footer {
  background: var(--header-bg);
  color: var(--text-secondary);
  padding: 1.5rem 0;
  font-size: 0.85rem;
  margin-top: auto;
}

.footer-links {
  margin-top: 0.5rem;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  margin-right: 1rem;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Presentations */
.presentations h1 {
  margin-bottom: 2rem;
}

.presentation {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.presentation:last-child {
  border-bottom: none;
}

.presentation h2 {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
}

.presentation-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.presentation-meta a {
  color: var(--text-secondary);
}

.presentation-venue {
  font-weight: 600;
  color: var(--text);
}

.presentation-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.presentation-links a {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
}

.presentation-links a:hover {
  opacity: 0.85;
}

/* Responsive */
@media (max-width: 600px) {
  .post-title {
    font-size: 1.5rem;
  }

  .post-content h2 {
    font-size: 1.3rem;
  }

  .site-header {
    padding: 1.5rem 0;
  }
}
