/* Screen reader only class for accessible h1 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Typography improvements - narrower reading column with better line height */
.post .main-content-wrap {
  max-width: 72ch;
  margin: 0 auto;
  line-height: 1.7;
  font-size: 18px;
}

/* Better spacing for headings inside post content */
.post-content h2,
.post-content h3 {
  margin-top: 2.2rem;
  margin-bottom: 1rem;
}

/* Improved code block readability and horizontal scrolling */
pre {
  overflow-x: auto;
  padding: 1rem 1.25rem;
}

pre code {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Slightly increase clickable area for links */
a {
  padding: 0.1rem 0.05rem;
}

/* Make focus states clearly visible */
a:focus,
button:focus {
  outline: 2px solid #2684ff;
  outline-offset: 2px;
}

/* Skip link - visible only when focused */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: #000;
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
}

.skip-link:focus {
  left: 0.5rem;
}

/* Chroma syntax highlighting tweaks */
.chroma {
  background-color: #1e1e1e;
  color: #f8f8f2;
  padding: 1rem 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
}

.chroma .ln {
  color: #888;
}

.chroma .k,   /* keywords */
.chroma .kc,
.chroma .kd,
.chroma .kn,
.chroma .kr {
  color: #ff79c6;
}

.chroma .s,   /* strings */
.chroma .s1,
.chroma .s2 {
  color: #f1fa8c;
}

.chroma .n,   /* names */
.chroma .na,
.chroma .nb,
.chroma .nf {
  color: #50fa7b;
}

.chroma .c {  /* comments */
  color: #6272a4;
}

/* Dark mode styles - automatically activates when OS prefers dark mode */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #111;
    color: #f2f2f2;
  }

  .post,
  .main-content-wrap {
    background-color: #111;
    color: #f2f2f2;
  }

  a {
    color: #8ab4f8;
  }

  pre,
  code,
  .chroma {
    background-color: #1e1e1e;
    color: #f8f8f2;
  }

  /* Adjust header for dark mode */
  .header {
    background-color: #111;
  }

  /* Keep sidebar transparent to show cover image */
  .sidebar .sidebar-container {
    background-color: rgba(17, 17, 17, 0.8);
  }

  /* Enhanced focus states for dark mode - better contrast */
  a:focus,
  button:focus {
    outline: 2px solid #8ab4f8;
    outline-offset: 2px;
  }
}
