:root {
  --accent: #0a58ca;
  --bg: #ffffff;
  --text: #111111;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: var(--bg);
  color: var(--text);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid #eee;
  position: relative;
}

/* Hamburger menu button - hidden by default */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  background: var(--text);
  border-radius: 3px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.site-right { display:flex; align-items:center; gap:1.25rem; }

.theme-toggle {
  width: 48px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #e6e6e6;
  position: relative;
  cursor: pointer;
  display: inline-block;
}
.theme-toggle:focus { box-shadow: 0 0 0 3px rgba(10,88,202,0.14); outline: none; }
.theme-toggle .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  transition: transform 220ms cubic-bezier(.2,.9,.3,1), background 220ms;
}
/* when dark, move knob to right and change track color */
/* make the switch track dark in dark mode (instead of blue) */
html.dark .theme-toggle { background: #424242; }
html.dark .theme-toggle .knob { transform: translateX(20px); background: #fafafa; }

.site-title a {
  text-decoration: none;
  font-weight: 700;
  color: var(--accent);
  font-size: 1.1rem;
}

.site-nav a {
  margin-left: 1rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.95rem;
  transition: color 180ms ease;
}

.site-nav a.active {
  color: var(--accent);
  font-weight: 600;
}

/* Bio section with profile picture (used on about page) */
.bio-section {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 3rem;
}

.profile-pic-static {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 40%;
  flex-shrink: 0;
  border: 3px solid var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  opacity: 1;
  background: transparent;
}

.bio-text h1 {
  margin-top: 0;
}

.site-main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* smooth theme transitions */
html { transition: background-color 220ms ease, color 220ms ease; }

.site-footer {
  padding: 2rem 1rem;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

/* Post styles */
.post-title { margin: 0 0 0.5rem 0; font-weight: 700; letter-spacing: -0.5px; text-decoration: none; color: inherit; }
.post-title a { color: inherit; text-decoration: none; }
.post-title a:hover { text-decoration: underline; }
.post-meta { color: #777; font-size: 0.9rem; margin-bottom: 1rem; }
.post-tags { display:flex; flex-wrap:wrap; gap:0.35rem; margin: -0.25rem 0 0.75rem; }
.tag-badge { display:inline-block; padding:0.15rem 0.55rem; border-radius:999px; background:#f0f4ff; color:#0a2a5a; font-size:0.8rem; font-weight:600; border:1px solid #d5e2ff; text-decoration:none; transition:background 180ms ease, border-color 180ms ease; }
.tag-badge:hover { background:#e3ecff; border-color:#c3d7ff; }
html.dark .tag-badge { background: rgba(107,176,255,0.16); color:#dbe9ff; border-color: rgba(219,233,255,0.35); }
html.dark .tag-badge:hover { background: rgba(107,176,255,0.26); border-color: rgba(219,233,255,0.55); }

.tag-index { display:flex; flex-direction:column; gap:1.5rem; }
.tag-list { display:flex; flex-wrap:wrap; gap:0.5rem; }
.tag-count { font-weight:500; color:#4a5a78; }
html.dark .tag-count { color:#b8c8e8; }
.tag-section { padding:1.25rem 1rem; border:1px solid #e5e5e5; border-radius:10px; background:#fafafa; }
.tag-section + .tag-section { margin-top:0.5rem; }
.tag-section h2 { margin:0 0 0.75rem 0; font-size:1.1rem; display:flex; align-items:center; gap:0.4rem; }
.tag-posts { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:0.35rem; }
.tag-posts a { color: inherit; text-decoration:none; font-weight:600; }
.tag-posts a:hover { text-decoration:underline; }
.tag-posts .post-meta { color:#777; font-size:0.9rem; margin-left:0.35rem; }
html.dark .tag-section { background:#2a2a2a; border-color:#3a3a3a; }
html.dark .tag-posts .post-meta { color:#b0b0b0; }
/* Post hero image */
.post-hero-image {
  margin: 1.5rem 0 2rem 0;
}
.post-hero-image img {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
/* Blog index: snippets and read-more button */
.blog-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.post-item {
  padding: 1.5rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: all 220ms ease;
  position: relative;
  cursor: pointer;
}
.post-item:hover {
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
  border-color: #bbb;
}
.post-item .post-title { font-size: 1.15rem; margin-bottom: 0.25rem; }
.post-item .post-title a::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
.post-item .tag-badge, .post-item .read-more {
  position: relative;
  z-index: 2;
}
.post-excerpt { color: #666; margin: 0.5rem 0 0.75rem; }

/* Post thumbnail styling */
.post-thumbnail {
  width: 150px;
  min-width: 150px;
  height: 150px;
  overflow: hidden;
  border-radius: 6px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  order: 2;
}
.post-thumbnail a {
  width: 100%;
  height: 100%;
  display: block;
}
.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.post-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  order: 1;
}

.read-more {
  display: inline-block;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  background: transparent;
  border: 1px solid #ddd;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: auto;
  align-self: flex-start;
}
.read-more:hover { background: rgba(0,0,0,0.04); }

/* Dark mode adjustments for cards and read-more */
html.dark .post-item { background: #2a2a2a; border-color: #3a3a3a; }
html.dark .post-item:hover { border-color: #555; box-shadow: 0 8px 16px rgba(0,0,0,0.3); }
html.dark .post-excerpt { color: #cfcfcf; }
html.dark .post-thumbnail { background: #333; }
html.dark .read-more { border-color: rgba(255,255,255,0.15); }
html.dark .read-more:hover { background: rgba(255,255,255,0.06); }

/* Pagination */
.pagination { display:flex; gap:0.5rem; justify-content:center; align-items:center; margin-top:2rem; }
.pagination .page, .pagination a { padding:0.35rem 0.6rem; border-radius:4px; text-decoration:none; color:inherit; border:1px solid #eee; }
.pagination .current { background:#f0f0f0; font-weight:600; }
.pagination .prev, .pagination .next { font-weight:600; }

html.dark .pagination .page, html.dark .pagination a { border-color: #3a3a3a; }
html.dark .pagination .current { background:#2a2a2a; }
html.dark .pagination .page.disabled { background: #3a3a3a !important; color: #888 !important; }



/* Image styling inside posts */
.post-content img, .post-content svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
  margin-left: 0;
  border-radius: 6px;
}

figure {
  display: inline-block;
  margin: 0;
  max-width: 100%;
}

figure img {
  margin: 0px;
}

figcaption {
  background: #f5f5f5;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  margin-top: -0.5rem;
  border-radius: 0 0 6px 6px;
}

/* Center captions for side-by-side images */
.side-by-side {
  display: flex;
  justify-content: center;
  gap: 2%;
  flex-wrap: wrap;
}

.side-by-side img {
  max-width: 49%;
  height: auto;
}

html.dark figcaption {
  background: #2a2a2a;
  color: #aaa;
}

/* Code block styling */
pre {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  position: relative;
}

/* Code copy button */
.code-block-wrapper {
  position: relative;
}

.copy-code-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: #e0e0e0;
  color: #333333;
  border: 1px solid #cccccc;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 10;
}

.code-block-wrapper:hover .copy-code-button,
.copy-code-button:focus {
  opacity: 1;
}

.copy-code-button:hover {
  background: #d0d0d0;
  border-color: #b0b0b0;
}

.copy-code-button:active {
  transform: scale(0.95);
}

.copy-code-button.copied {
  background: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

html.dark .copy-code-button {
  background: #3a3a3a;
  color: #e0e0e0;
  border-color: #4a4a4a;
}

html.dark .copy-code-button:hover {
  background: #4a4a4a;
  border-color: #5a5a5a;
}

html.dark .copy-code-button.copied {
  background: #1e4620;
  color: #b8e6b8;
  border-color: #2d5a2f;
}

code {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0 0.4rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85em;
  line-height: 1.2;
  vertical-align: baseline;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

html.dark pre {
  background: #2a2a2a;
  border-color: #3a3a3a;
}

html.dark code {
  background: #2a2a2a;
  border-color: #3a3a3a;
}

/* Syntax highlighting with Rouge */
.highlight { color: #333; }
.highlight .c, .highlight .c1, .highlight .cm { color: #008000; font-style: italic; } /* Comments */
.highlight .k, .highlight .kd, .highlight .kn { color: #0000ff; font-weight: bold; } /* Keywords */
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb { color: #a31515; } /* Strings */
.highlight .nv, .highlight .no, .highlight .vi { color: #001080; } /* Variables */
.highlight .nb, .highlight .nc, .highlight .nf { color: #795e26; } /* Functions/cmdlets */
.highlight .m, .highlight .mi, .highlight .mf { color: #098658; } /* Numbers */
.highlight .o { color: #000000; } /* Operators */

/* Dark mode syntax highlighting */
html.dark .highlight { color: #d4d4d4; }
html.dark .highlight .c, html.dark .highlight .c1, html.dark .highlight .cm { color: #6a9955; }
html.dark .highlight .k, html.dark .highlight .kd, html.dark .highlight .kn { color: #569cd6; }
html.dark .highlight .s, html.dark .highlight .s1, html.dark .highlight .s2, html.dark .highlight .sb { color: #ce9178; }
html.dark .highlight .nv, html.dark .highlight .no, html.dark .highlight .vi { color: #9cdcfe; }
html.dark .highlight .nb, html.dark .highlight .nc, html.dark .highlight .nf { color: #dcdcaa; }
html.dark .highlight .m, html.dark .highlight .mi, html.dark .highlight .mf { color: #b5cea8; }
html.dark .highlight .o { color: #d4d4d4; }

/* Post content links */
.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(10, 88, 202, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 180ms ease;
}

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

html.dark .post-content a {
  text-decoration-color: rgba(107, 176, 255, 0.3);
}

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

/* Dark mode variables */
html.dark {
  --bg: #1f1f1f;
  --text: #e6e6e6;
  --accent: #6bb0ff;
}

html.dark .site-header {
  border-bottom-color: #333;
}

body { background: var(--bg); color: var(--text); }

/* Mobile responsive styles */
@media (max-width: 768px) {
  .site-header {
    flex-wrap: wrap;
    padding: 1rem;
  }

  /* Show hamburger menu */
  .hamburger {
    display: flex;
    order: 2;
  }

  .site-title {
    order: 1;
  }

  .site-right {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg);
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem 2rem 2rem;
    gap: 2rem;
    box-shadow: -4px 0 12px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
  }

  .site-right.active {
    right: 0;
  }

  .site-nav {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }

  .site-nav a {
    margin: 0;
    padding: 1rem 0;
    width: 100%;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-size: 1.15rem;
    font-weight: 700;
    display: block;
  }

  html.dark .site-nav a {
    border-bottom-color: rgba(255,255,255,0.1);
  }

  .theme-toggle {
    margin-top: 1rem;
  }

  /* Bio section - stack vertically on mobile */
  .bio-section {
    flex-direction: column;
    text-align: left;
  }

  .profile-pic-static {
    display: none;
  }

  .site-main {
    margin: 1rem auto;
    padding: 0 1rem;
  }

  /* Blog post items - stack vertically on mobile */
  .post-item {
    flex-direction: column;
    padding: 1rem;
  }

  .post-thumbnail {
    width: 100%;
    min-width: 100%;
    height: 200px;
    order: 1;
  }

  .post-content-wrapper {
    order: 2;
  }

  .post-title {
    font-size: 1.25rem;
  }

  /* Pagination adjustments */
  .pagination {
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .pagination .page, .pagination a {
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 0.75rem;
  }

  .site-title a {
    font-size: 1rem;
  }

  .site-nav a {
    font-size: 0.9rem;
  }

  .post-item {
    padding: 0.75rem;
  }

  .post-title {
    font-size: 1.1rem;
  }

  .post-meta, .post-excerpt {
    font-size: 0.85rem;
  }

  /* Bio section - smaller profile picture */
  .bio-section {
    gap: 1rem;
  }

  .profile-pic-static {
    width: 100px;
    height: 100px;
  }
}

