/* CSS Variables */

:root {
  /* Base colors */
  --bg-color: #fff;
  --text-color: #333;
  --heading-color: #333;
  --meta-color: #595959;
  --border-color: #eaeaea;
  --border-color-rgb: 234, 234, 234;
  --text-color-rgb: 51, 51, 51;
  --code-bg: #f5f7fa;
  --code-border: #e2e8f0;
  --code-color: #2a3646;
  --blockquote-border: #a00;
  --highlight-bg: #fffde7;
  --focus-color: #8a4b00;

  /* Typography scale */
  --text-small: 0.75rem;
  --text-base: 1rem;
  --text-large: 1.25rem;
  --text-xlarge: 1.5rem;
  --text-2xlarge: 2rem;
  --text-3xlarge: 2.5rem;
  --text-4xlarge: 3rem;
  --text-code: 0.85rem;
  --text-code-block: 0.9rem;

  /* Essential colors only */
  --yellow-50: #fffde7;
  --yellow-100: #fff9c4;
  --yellow-200: #fff59d;
  --yellow-500: #ffeb3b;
  --yellow-500-rgb: 255, 235, 59;
  --yellow-600: #fdd835;
  --yellow-900: #f57f17;

  --blue-light: #e3f2fd;
  --blue-dark: #1565c0;
  --green-light: #e8f5e9;
  --green-dark: #2e7d32;
  --red-light: #ffebee;
  --red-dark: #b71c1c;

  --gray-100: #f5f5f5;
  --gray-700: #616161;
  --gray-900: #212121;

  /* Spacing system */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
  --space-2xl: 2rem;
  --space-3xl: 3rem;
  --space-4xl: 4rem;

  /* Border radius scale */
  --radius-xs: 2px;
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 50%;

  /* Animation durations */
  --duration-fast: 0.2s;
  --duration-normal: 0.3s;

  /* Breakpoints */
  --breakpoint-mobile: 768px;
  --breakpoint-desktop: 1200px;
  --breakpoint-toc-sidebar: 1400px;
  --breakpoint-desktop-lg: 1400px;
  --breakpoint-desktop-xl: 1600px;

  /* Fonts */
  --font-family:
    "Inter", -apple-system, blinkmacsystemfont, "Segoe UI", roboto,
    "Helvetica Neue", arial, sans-serif;
  --font-mono:
    "SF Mono", consolas, monaco, "Andale Mono", "Ubuntu Mono", monospace;

  /* Component colors */
  --link-bg: var(--yellow-50);
  --link-color: var(--gray-900);
  --link-hover-bg: var(--yellow-100);
  --link-underline: 1px solid rgba(245, 127, 23, 0.55);

  --header-bg: #f8f5f0;
  --header-accent: var(--yellow-500);
  --nav-link-bg: rgba(var(--yellow-500-rgb), 0.15);
  --nav-link-hover-bg: var(--yellow-200);

  --info-bg: var(--blue-light);
  --info-color: var(--blue-dark);
  --success-bg: var(--green-light);
  --success-color: var(--green-dark);
  --warning-bg: var(--yellow-100);
  --warning-color: var(--yellow-900);
  --danger-bg: var(--red-light);
  --danger-color: var(--red-dark);

  --input-background: var(--bg-color);
  --text-muted: var(--meta-color);
  --text-2xl: var(--text-2xlarge);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --heading-color: #f5f5f5;
    --meta-color: #a0a0a0;
    --border-color: #333;
    --border-color-rgb: 51, 51, 51;
    --text-color-rgb: 224, 224, 224;
    --code-bg: #1a1d21;
    --code-border: #2c313a;
    --code-color: #e2e6ed;
    --blockquote-border: #cc0000;
    --highlight-bg: #333;
    --focus-color: var(--yellow-500);
    --gray-100: #2d2d2d;

    --link-bg: rgba(255, 235, 59, 0.1);
    --link-color: var(--yellow-100);
    --link-hover-bg: rgba(255, 235, 59, 0.2);
    --link-underline: 1px solid rgba(var(--yellow-500-rgb), 0.5);

    --header-bg: #1e1e1e;
    --header-accent: var(--yellow-600);
    --nav-link-bg: #2d2d2d;
    --nav-link-hover-bg: rgba(var(--yellow-500-rgb), 0.15);

    --info-bg: rgba(33, 150, 243, 0.1);
    --info-color: #90caf9;

    --success-bg: rgba(76, 175, 80, 0.1);
    --success-color: #a5d6a7;

    --warning-bg: rgba(var(--yellow-500-rgb), 0.1);
    --warning-color: #fff59d;

    --danger-bg: rgba(244, 67, 54, 0.1);
    --danger-color: #ef9a9a;

    --input-background: #1e1e1e;
    --text-muted: var(--meta-color);
    --text-2xl: var(--text-2xlarge);
  }
}

/* Base styles */

/* Font loaded via HTML head */

/* Base elements */
html {
  overflow: hidden scroll;
  background-color: var(--bg-color);
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-weight: 400;
  color: var(--text-color);
  line-height: 1.6;
  font-size: var(--text-large);
  background-color: var(--bg-color);
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  width: 100%;
}

html,
button,
input,
select,
textarea {
  color: var(--text-color);
}

/* Selection styles */
::-moz-selection,
::selection {
  background: var(--highlight-bg);
  text-shadow: none;
}

/* Focus indicators */
*:focus-visible {
  outline: 3px solid var(--focus-color);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* Remove outlines when focus-visible is supported */
@supports selector(:focus-visible) {
  *:focus:not(:focus-visible) {
    outline: none;
  }
}

/* Basic elements */
hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 1rem 0;
  padding: 0;
}

img {
  margin: 10px auto;
  max-width: 100%;
  height: auto;
  display: block;
}

a img {
  border: none;
}

figure {
  margin: 0;
  text-align: center;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

textarea {
  resize: vertical;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Typography */

/* Content headings */
.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  line-height: 1.2;
  color: var(--heading-color);
  margin-top: 1.2em;
  margin-bottom: 0.5em;
}

/* Specific heading sizes */
.markdown h1 {
  font-size: var(--text-2xlarge);
  font-weight: 500;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-color);
}

.markdown h2 {
  font-size: calc(var(--text-2xlarge) * 0.9);
  font-weight: 500;
  letter-spacing: -0.25px;
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--border-color);
  margin-top: 1.2em;
}

.markdown h3 {
  font-size: var(--text-xlarge);
  font-weight: 400;
  letter-spacing: -0.1px;
  margin-top: 0.9em;
}

.markdown h4 {
  font-size: var(--text-large);
  font-weight: 400;
  margin-top: 0.8em;
  margin-bottom: 0.4em;
}

.markdown h5,
.markdown h6 {
  font-size: var(--text-base);
  font-weight: 400;
  margin-top: 0.7em;
  margin-bottom: 0.3em;
}

/* Heading spacing adjustments */
.markdown h1 + p,
.markdown h2 + p,
.markdown h3 + p,
.markdown h4 + p,
.markdown h5 + p,
.markdown h6 + p {
  margin-top: 0.3em;
}

.markdown > h1:first-child {
  margin-top: 0.3em;
}

.markdown > h2:first-child,
.markdown > h3:first-child {
  margin-top: 0.4em;
}

/* Header anchors */
.header-link-icon {
  visibility: hidden;
  color: var(--meta-color);
  opacity: 0.7;
  margin-left: 0.25em;
  padding: 0;
  background-color: transparent;
  border-bottom: 0;
}

.header-link-icon:hover,
.header-link-icon:focus,
.header-link-icon:focus-visible {
  padding-bottom: 0;
  background-color: transparent;
  border-bottom: 0;
  visibility: visible;
}

h1:hover .header-link-icon,
h2:hover .header-link-icon,
h3:hover .header-link-icon,
h4:hover .header-link-icon,
h5:hover .header-link-icon,
h6:hover .header-link-icon {
  visibility: visible;
}

.header-link-icon svg {
  vertical-align: middle;
}

/* Paragraphs */
.markdown p {
  margin-bottom: 0.8em;
}

/* Links */
a {
  background-color: transparent;
  color: var(--link-color);
  padding: 0;
  border-radius: 0;
  transition:
    color var(--duration-fast) ease,
    background-color var(--duration-fast) ease,
    border-color var(--duration-fast) ease;
  border-bottom: var(--link-underline);
  text-decoration: none;
  word-break: break-word;
}

a:hover {
  background-color: var(--link-hover-bg);
  border-bottom: 1px solid var(--yellow-600);
  padding-bottom: 0;
  text-decoration: none;
}

a:focus {
  background-color: var(--link-hover-bg);
  border-bottom: 1px solid var(--yellow-600);
}

/* Link exceptions */
.site-title a,
.site-title a:hover {
  border-bottom: none;
  text-decoration: none;
}

/* Lists */
ul {
  padding-left: 15px;
  list-style: disc inside;
}

ul.flat {
  margin: 0;
  padding: 0;
}

ul.flat li {
  display: inline-block;
  list-style: none;
  margin-left: 0;
}

/* Blockquotes */
blockquote {
  margin-left: 1rem;
  font-style: italic;
  font-size: var(--text-large);
  font-family: Georgia, serif;
  border-left: 3px solid var(--blockquote-border);
  padding-left: 20px;
  line-height: 1.5;
  color: var(--text-color);
  opacity: 0.9;
}

blockquote cite {
  font-size: var(--text-small);
  opacity: 0.8;
}

blockquote em {
  font-weight: 600;
}

/* Details/Summary elements */
details > summary {
  list-style: none;
  cursor: pointer;
  padding: 1px 0;
  border-radius: 0;
  background-color: transparent;
  color: var(--link-color);
  display: inline-block;
  transition: background-color var(--duration-fast) ease;
}

details > summary:hover {
  background-color: var(--link-hover-bg);
  border-bottom: 1px solid var(--yellow-600);
  padding-bottom: 1px;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "\25B6\00a0";
  color: var(--link-color);
  font-size: 0.8em;
}

details[open] > summary::before {
  content: "\25BC\00a0";
  font-size: 0.8em;
}

details > summary code {
  background-color: transparent;
  color: inherit;
  font-family: var(--font-mono);
  font-size: inherit;
  padding: 0;
  border-radius: 0;
  vertical-align: baseline;
}

details > summary a {
  background-color: transparent;
  color: inherit;
  padding: 0;
  border-bottom: none;
}

details > summary a:hover {
  background-color: transparent;
  text-decoration: underline;
}

/* Code styling */
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: var(--text-code);
  background-color: var(--code-bg);
  color: var(--code-color);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--code-border);
  white-space: nowrap;
}

/* Code blocks */
.highlight {
  margin: 1.5rem 0;
  overflow: auto;
  border-radius: var(--radius-sm);
  background-color: var(--code-bg);
  box-shadow: none;
  border: 1px solid var(--code-border);
  position: relative;
  max-width: 100%;
}

.highlight pre {
  margin: 0;
  padding: 1.25rem;
  background-color: transparent !important;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-code-block);
  line-height: 1.5;
  tab-size: 4;
}

.highlight pre code {
  display: block;
}

/* Chroma tokens: matched palettes for light and dark presentation. */
.chroma {
  color: #24292f;
  background-color: transparent !important;
}

.chroma .c,
.chroma .ch,
.chroma .cm,
.chroma .c1,
.chroma .cs,
.chroma .cp,
.chroma .cpf {
  color: #57606a;
  font-style: italic;
}

.chroma .k,
.chroma .kc,
.chroma .kd,
.chroma .kn,
.chroma .kp,
.chroma .kr,
.chroma .kt,
.chroma .o,
.chroma .ow {
  color: #cf222e;
}

.chroma .s,
.chroma .sa,
.chroma .sb,
.chroma .sc,
.chroma .dl,
.chroma .sd,
.chroma .s1,
.chroma .s2,
.chroma .se,
.chroma .sh,
.chroma .si,
.chroma .sr,
.chroma .ss,
.chroma .sx {
  color: #0a3069;
}

.chroma .na,
.chroma .nc,
.chroma .nf,
.chroma .nx {
  color: #8250df;
}

.chroma .m,
.chroma .mb,
.chroma .mf,
.chroma .mh,
.chroma .mi,
.chroma .mo,
.chroma .il {
  color: #0550ae;
}

.chroma .gd {
  color: #82071e;
  background-color: #ffebe9;
}

.chroma .gi {
  color: #116329;
  background-color: #dafbe1;
}

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

  .chroma .c,
  .chroma .ch,
  .chroma .cm,
  .chroma .c1,
  .chroma .cs,
  .chroma .cp,
  .chroma .cpf {
    color: #a5afba;
  }

  .chroma .k,
  .chroma .kc,
  .chroma .kd,
  .chroma .kn,
  .chroma .kp,
  .chroma .kr,
  .chroma .kt,
  .chroma .o,
  .chroma .ow {
    color: #ff7b72;
  }

  .chroma .s,
  .chroma .sa,
  .chroma .sb,
  .chroma .sc,
  .chroma .dl,
  .chroma .sd,
  .chroma .s1,
  .chroma .s2,
  .chroma .se,
  .chroma .sh,
  .chroma .si,
  .chroma .sr,
  .chroma .ss,
  .chroma .sx {
    color: #a5d6ff;
  }

  .chroma .na,
  .chroma .nc,
  .chroma .nf,
  .chroma .nx {
    color: #d2a8ff;
  }

  .chroma .m,
  .chroma .mb,
  .chroma .mf,
  .chroma .mh,
  .chroma .mi,
  .chroma .mo,
  .chroma .il {
    color: #79c0ff;
  }

  .chroma .gd {
    color: #ffdcd7;
    background-color: #67060c;
  }

  .chroma .gi {
    color: #aff5b4;
    background-color: #033a16;
  }
}

.highlight:not([class*="language-"]) pre code > span {
  display: block;
  position: relative;
  line-height: 1.6;
}

a code {
  border-bottom: none;
}

/* Code block scrollbars */
.highlight::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.highlight::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}

.highlight::-webkit-scrollbar-track {
  background: transparent;
}

@media (prefers-color-scheme: dark) {
  .highlight::-webkit-scrollbar-thumb {
    background: var(--gray-700);
  }
}

li code {
  word-break: break-word;
  white-space: normal;
}

@media (max-width: 767px) {
  :not(pre) > code {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

/* Keyboard shortcuts */
kbd {
  display: inline-block;
  padding: 0.2em 0.4em;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: var(--radius-sm);
  border: 1px solid var(--code-border);
  box-shadow: 0 1px 0 var(--code-border);
  background-color: var(--bg-color);
  color: var(--code-color);
  margin: 0 0.1em;
}

kbd.combo kbd {
  margin: 0 0.1em;
  box-shadow: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--code-border);
}

kbd.combo .combo-plus {
  margin: 0 0.2em;
  color: var(--meta-color);
}

/* Tables */
table th {
  background-color: var(--code-bg);
}

table th,
table td {
  padding: 10px 20px;
  border: 1px solid var(--border-color);
}

@media (max-width: 767px) {
  table {
    font-size: var(--text-base);
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }
}

/* Components */

/* Layout containers */
.wrapper,
.container {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  width: 100%;
}

.container {
  margin-top: 30px;
}

/* Site header */
.header {
  margin-bottom: 30px;
  padding: 30px 25px 25px;
  background-color: var(--header-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: none;
  width: 100%;
  max-width: 100%;
  left: 0;
  right: 0;
  overflow: visible;
  position: relative;
}

.header h1,
.header .site-title,
.header .site-tagline {
  margin: 0;
  padding: 0;
  font-weight: inherit;
  border: none;
  background: none;
}

.header .site-title {
  font-size: var(--text-2xlarge);
  line-height: 1.3em;
}

.header .site-tagline {
  font-size: var(--text-large);
  margin-top: 5px;
}

.site-title a {
  color: var(--heading-color);
  font-size: var(--text-4xlarge);
  text-decoration: none !important;
  background-color: transparent;
  padding: 0;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.site-title a:hover {
  color: var(--yellow-600);
  border-bottom: none;
}

.header .site-description {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 30px;
}

.header .site-description .site-tagline {
  flex: 1;
}

.header .site-description nav {
  margin: 0;
  padding: 0 10px;
  border: none;
  min-width: 50px;
  margin-left: 0;
}

.header .site-description nav ul svg {
  max-height: 15px;
  margin: 0;
}

.header .site-description nav ul.flat li {
  margin: 0 4px;
}

.header .social a {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

/* Header navigation */
.header nav {
  margin-top: 15px;
  border-top: 1px solid var(--border-color);
  overflow: visible;
  position: relative;
}

.header nav ul,
.header nav li {
  margin: 0;
}

.header nav ul.flat {
  padding: 0;
  overflow: visible;
  position: relative;
}

.header nav:not(.social) ul.flat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.header nav ul.flat li {
  display: inline-block;
  list-style: none;
  margin-left: 0;
  margin-right: 0;
  margin-top: 12px;
  text-transform: capitalize;
}

.header nav ul.flat li a {
  background-color: transparent;
  border-radius: 0;
  padding: 6px 8px;
  border-bottom: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.header nav ul.flat li a:hover {
  background-color: transparent;
  border-bottom: none;
  padding-bottom: 6px;
  color: var(--link-color);
}

.header nav ul.flat li a[aria-current="page"] {
  background-color: transparent;
  box-shadow: inset 0 -3px 0 var(--focus-color);
}

/* Footer */
.footer {
  text-align: center;
  font-size: var(--text-small);
  color: var(--meta-color);
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
  margin-top: 40px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.copyright {
  font-size: var(--text-small);
  color: var(--text-color);
  font-weight: 500;
  padding: 5px 0;
}

.footer a {
  background-color: transparent;
  color: var(--text-color);
  padding: 0;
  opacity: 0.8;
  transition: opacity var(--duration-fast) ease;
  border-bottom: none;
}

.footer a:hover {
  opacity: 1;
  border-bottom: 1px dotted var(--text-color);
  background-color: transparent;
  padding-bottom: 0;
}

.footer-links {
  margin-top: 5px;
}

@media (min-width: 768px) {
  .footer-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .footer-links {
    margin-top: 0;
  }
}

/* Post styling */
.post .post-header {
  margin-bottom: 2rem;
}

.post .post-header .title {
  margin: 0;
  font-size: var(--text-3xlarge);
  line-height: 1.1;
  font-weight: 600;
  color: var(--heading-color);
}

.post .post-header .meta {
  display: block;
  margin-top: 0.5rem;
  font-size: var(--text-base);
  color: var(--text-color);
  font-weight: 500;
}

.post .draft-label {
  color: var(--warning-color);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
  background-color: var(--warning-bg);
}

.post ul li {
  margin-bottom: 10px;
}

.post ul li p {
  display: inline;
}

/* Recent posts */
.recent-posts .posts .post {
  margin-bottom: 30px;
}

.recent-posts .posts .post .meta,
.list .posts .post .meta {
  font-size: var(--text-base);
  color: var(--text-color);
  font-weight: 500;
  margin-bottom: 4px;
}

.recent-posts .posts .post .description {
  margin-top: 8px;
  line-height: 1.5;
}

/* Section headers */
.section-header {
  font-size: var(--text-base);
  font-weight: 600;
  text-transform: none;
  color: var(--text-color);
  margin-bottom: 20px;
  letter-spacing: 0;
}

/* Pagination */
.pagination {
  margin: 0;
  padding: 0;
  text-align: left;
  display: flex;
  justify-content: space-between;
}

.pagination li {
  list-style: none;
  display: inline-block;
  margin: 0;
  padding: 0;
}

.pagination .page-prev {
  margin-right: 20px;
  padding-right: 20px;
}

.pagination .page-item.page-prev {
  text-align: left;
}

.pagination .page-item.page-next {
  text-align: right;
}

/* Layout & utilities */

/* Utility classes */
.align-center {
  text-align: center;
}

.align-left {
  text-align: left;
}

.align-right {
  text-align: right;
}

.page-title {
  margin: 0;
}

.smaller {
  font-size: var(--text-small);
}

/* Search */
.search-widget {
  position: relative;
  margin-left: auto !important;
  text-transform: none !important;
}

input.search-input {
  box-sizing: border-box;
}

.search-input {
  width: 140px;
  padding: 6px 12px;
  font-size: 16px; /* Prevents zoom on iOS */
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--input-background);
  color: var(--text-color);
  font-family: var(--font-family);
  transition:
    width 0.2s ease,
    border-color 0.2s ease;
  -webkit-appearance: none; /* Remove iOS styling */
  min-height: 44px;
}

.search-input:focus {
  border-color: var(--link-color);
  width: 180px;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  margin-top: 0;
  background: var(--header-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-height: 300px;
  overflow: hidden auto;
  z-index: 1000;
  min-width: 280px;
  max-width: min(400px, calc(100vw - 40px));
}

.search-dropdown.hidden {
  display: none;
}

.search-result {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-color);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.1s ease;
  text-transform: none;
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover,
.search-result.selected {
  background-color: var(--gray-100);
}

@media (prefers-color-scheme: dark) {
  .search-result:hover,
  .search-result.selected {
    background-color: #2d2d2d;
  }

  .search-dropdown {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background: var(--header-bg);
  }

  .search-result-title mark {
    background-color: rgba(var(--yellow-500-rgb), 0.3);
  }
}

.search-result-title {
  font-weight: 500;
  margin-bottom: 3px;
  font-size: var(--text-base);
  line-height: 1.3;
}

.search-result-title mark {
  background-color: var(--yellow-200);
  color: var(--text-color);
  padding: 0 2px;
  border-radius: 2px;
}

.search-result-meta {
  font-size: var(--text-small);
  color: var(--text-muted);
  font-weight: 400;
}

.search-result-context {
  margin-top: 4px;
  font-size: var(--text-small);
  color: var(--text-muted);
  line-height: 1.4;
}

.search-no-results {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-small);
}

.search-more {
  padding: 10px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-small);
  border-top: 1px solid var(--border-color);
}

/* Responsive images */
img[src$="#responsive"] {
  width: 50%;
  height: auto;
}

/* Responsive */

/* Mobile styles */
@media (max-width: 767px) {
  body {
    padding: 10px;
    font-size: var(--text-large);
    max-width: 100vw;
  }

  .wrapper,
  .container {
    padding: 0 5px;
  }

  .header {
    padding: 20px 15px;
    margin-left: -10px;
    margin-right: -10px;
    border-radius: 0;
  }

  .header .site-description {
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
  }

  .header .site-description nav {
    padding-right: 0;
    padding-left: 0;
  }

  .header .site-description nav ul.flat li {
    margin-right: 2px;
    margin-left: 2px;
  }

  .site-title a {
    font-size: var(--text-2xlarge);
  }

  .post-header .title {
    font-size: var(--text-2xlarge);
  }

  .post-header {
    margin-bottom: 1.5rem;
  }

  .markdown h1 {
    font-size: var(--text-xlarge);
    margin-top: 1.5em;
  }

  .header nav:not(.social) ul.flat li {
    margin-right: 0;
  }

  .header nav:not(.social) ul.flat {
    gap: 8px 6px;
  }

  .header nav:not(.social) ul.flat li a {
    padding: 8px;
    font-size: var(--text-base);
  }

  .search-widget {
    flex: 1 0 100%;
    margin-left: 0 !important;
    margin-top: 4px !important;
  }

  .search-input {
    width: 100%;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 6px 10px;
  }

  .search-input:focus {
    width: 100%;
  }

  .search-dropdown {
    right: 0;
    left: 0;
    min-width: 0;
    max-width: 100%;
  }
}

/* Table of Contents */
.post-with-sidebar {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.toc-sticky {
  margin-bottom: 20px;
  border-radius: 0;
  background-color: transparent;
  border: 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  border-left: 3px solid var(--yellow-500);
  font-size: var(--text-base);
  scroll-margin-top: 20px;
  box-shadow: none;
}

.toc-sticky details {
  padding: 8px 12px;
}

.toc-sticky details summary {
  cursor: pointer;
  padding: 8px 4px;
  color: var(--text-color);
  font-weight: 600;
  user-select: none;
  display: flex;
  align-items: center;
  border-radius: 0;
  position: relative;
  min-height: 44px;
}

.toc-sticky details summary:hover {
  background-color: var(--link-bg);
  color: var(--link-color);
}

.toc-sticky details summary::before {
  content: none;
}

.toc-sticky details summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.1em;
  color: var(--meta-color);
}

.toc-sticky details[open] summary::after {
  content: "−";
}

.toc-sticky details[open] summary {
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  background-color: transparent;
}

.toc-sticky h2 {
  display: none;
}

.toc-sticky details > :not(summary) {
  animation: none;
}

.toc-sticky ul {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.toc-sticky li {
  margin: 6px 0;
  line-height: 1.4;
}

.toc-sticky ul ul {
  padding-left: 15px;
}

.toc-sticky a {
  background: transparent;
  padding: 0;
  color: var(--text-color);
  opacity: 0.9;
  display: inline-block;
  border-bottom: 1px solid transparent;
}

.toc-sticky a:hover {
  opacity: 1;
  border-bottom: 1px solid var(--yellow-600);
  color: var(--link-color);
}

/* Keep unusually long in-flow TOCs useful without pushing the post off-screen. */
@media (max-width: 1399px) {
  .toc-sticky details[open] > nav {
    max-height: min(55vh, 30rem);
    max-height: min(55svh, 30rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-gutter: stable;
  }
}

/* Desktop TOC positioning */
@media (min-width: 1400px) {
  .post-with-sidebar {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    --toc-top-position: 0px;
  }

  .toc-sticky {
    position: sticky;
    top: 20px;
    float: right;
    margin-right: calc(-220px - 30px);
    width: 220px;
    background: transparent;
    padding: 0 0 0 15px;
    border: none;
    border-left: 3px solid var(--yellow-500);
    border-radius: 0;
    box-shadow: none;
    margin-top: 0;
    margin-bottom: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    z-index: 90;
    opacity: 1;
    transition: none;
  }

  .toc-sticky:hover {
    opacity: 1;
  }

  .toc-sticky details {
    padding: 0;
    display: block;
  }

  .toc-sticky details summary {
    display: none;
  }

  .toc-sticky details[open] {
    border-bottom: none;
    padding-bottom: 0;
  }

  .toc-sticky details > :not(summary) {
    animation: none;
  }

  .toc-sticky h2 {
    display: block;
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--meta-color);
    font-weight: 600;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
  }
}

@media (min-width: 1600px) {
  .toc-sticky {
    margin-right: calc(-220px - 50px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toc-sticky,
  .toc-sticky details summary,
  .toc-sticky details summary::after,
  .toc-sticky details > :not(summary) {
    animation: none;
    transition: none;
  }
}

/* Hugo places the language on the nested code element. */
.highlight:has(code[data-lang])::after {
  position: absolute;
  top: 4px;
  right: 0;
  color: var(--meta-color);
  font-size: 0.7rem;
  font-family: var(--font-family);
  padding: 0.3rem 0.6rem;
  background: var(--code-bg);
  border-bottom-left-radius: var(--radius-sm);
  opacity: 0.8;
  text-transform: uppercase;
}

.highlight:has(code[data-lang="bash"])::after,
.highlight:has(code[data-lang="sh"])::after {
  content: "shell";
}

.highlight:has(code[data-lang="fish"])::after {
  content: "fish";
}

.highlight:has(code[data-lang="vim"])::after {
  content: "vim";
}

.highlight:has(code[data-lang="text"])::after {
  content: "output";
}

.highlight:has(code[data-lang="bash"]) pre code::before,
.highlight:has(code[data-lang="sh"]) pre code::before,
.highlight:has(code[data-lang="fish"]) pre code::before {
  content: "$ ";
  color: var(--meta-color);
  opacity: 0.8;
  user-select: none;
}

.highlight:has(code[data-lang="text"]) pre {
  font-family: var(--font-mono);
  color: var(--meta-color);
  font-size: var(--text-code);
}

/* Print styles */
@media print {
  /* Hide navigation and UI elements */
  .header nav,
  .footer,
  .toc-sticky,
  .search-widget {
    display: none !important;
  }

  /* Basic print setup */
  body {
    font-size: 12pt;
    line-height: 1.6;
    color: #000;
    background: #fff;
    max-width: 100%;
  }

  /* Clean up header */
  .header {
    margin-bottom: 30px;
    background: none;
    box-shadow: none;
  }

  /* Links */
  a {
    color: #000;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
  }

  /* Code blocks */
  .highlight {
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

  .highlight pre {
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  /* Images */
  img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  /* Prevent awkward page breaks */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    page-break-after: avoid;
  }
}
