/* Post header spans full width above TOC/content */
.post-header { max-width: var(--content-max-width, 800px); margin: 0 auto 0.5rem auto; }
.post-header .tldr { margin-top: 0.5rem; }
@media screen and (min-width: 60em) {
  .page .post-header { position: relative; }
  .page .post-container { clear: both; }
}
/* CSS Custom Properties */
:root {
  /* Light theme colors */
  --color-primary: #dc143c;
  --color-primary-hover: #b91c3c;
  --color-border: #663399;
  --color-callout: #1e90ff;
  --color-text: #232333;
  --color-text-muted: #737373;
  --color-text-meta: #999999;
  --color-background: #fdfaf5;
  --color-background-code: #f8f8f8;
  --color-background-pre: #ececec;
  --color-background-toc: #ececec;
  --color-background-draft: #f9f2f4;
  --color-header-bg: #232333;
  --color-header-link: #f5f5f5;
  --color-header-link-hover: #ffffff;
  
  /* Dark theme colors */
  --color-primary-dark: #50fa7b;
  --color-primary-hover-dark: #3dd458;
  --color-border-dark: #0066ff;
  --color-text-dark: #ffffff;
  --color-text-muted-dark: #dddddd;
  --color-background-dark: #2021248e;
  --color-background-code-dark: #3a3a3a67;
  --color-background-pre-dark: #2728221a;
  --color-background-toc-dark: #272822;
  --color-background-draft-dark: #0066ff;
  --color-header-bg-dark: #111318;
  --color-header-link-dark: #e0e0e0;
  --color-header-link-hover-dark: #ffffff;
  
  /* Spacing and sizing */
  --content-max-width: 800px;
  --content-padding: 1ch;
  --border-radius: 5px;
  --font-size-base: 16px;
  --line-height-base: 1.6;
  --line-height-content: 1.5;

  /* Font families */
  --font-sans: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-sans-fallback: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-family-base: var(--font-sans, var(--font-sans-fallback));

  /* Scrollbar colors */
  --color-scrollbar-thumb: #232333be;
  --color-scrollbar-thumb-hover: #73737397;
}
/* Reset and base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color: var(--color-text, #232333);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base, 15px);
  line-height: var(--line-height-base, 1.6);
  scroll-behavior: smooth;
  height: 100%;

  /* Prevent layout shift when scrollbars appear (Windows classic scrollbars). */
  scrollbar-gutter: stable;

  /* Firefox scrollbar sizing/colors. */
  scrollbar-width: thin;
  scrollbar-color: var(--color-scrollbar-thumb) transparent;
}

@supports not (scrollbar-gutter: stable) {
  /* Fallback: always reserve scrollbar space so content doesn't jump. */
  html { overflow-y: scroll; }
}

/* WebKit/Blink scrollbar sizing/colors (Chrome/Edge/Safari). */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background-color: var(--color-scrollbar-thumb);
  border-radius: var(--border-radius, 5px);
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-scrollbar-thumb-hover);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  /* Use min-height 100vh to force full screen height */
  min-height: 100vh;
  
  display: flex;
  flex-direction: column;
  
  /* Move your margin to padding to avoid calc() complexity/errors */
  margin: 0;
  padding: 8px; 
  
  background-color: var(--color-background, #f8f8f8);
  font-family: var(--font-family-base);
}

body.section {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 16px);
}

* {
  -webkit-tap-highlight-color: transparent;
}

/* Selection styles */
::selection {
  background: var(--color-primary, #dc143c);
  color: #ffffff;
}

::-moz-selection {
  background: var(--color-primary, #dc143c);
  color: #ffffff;
}

/* Typography */
p {
  font-family: inherit;
  line-height: 1.7;
  color: #2a2a2a;
  /* Fallback for older browsers */
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

@supports (margin-block: 0.5em) {
  p {
    margin-top: unset;
    margin-bottom: unset;
    margin-block: 0.5em;
  }
}

hr {
  border: 0;
  /* Fallback for older browsers */
  border-top: 3px dotted var(--color-border, #663399);
  margin-top: 1em;
  margin-bottom: 1em;
}

@supports (border-block-start: 3px dotted var(--color-border, #663399)) {
  hr {
    border-top: unset;
    margin-top: unset;
    margin-bottom: unset;
    border-block-start: 3px dotted var(--color-border, #663399);
    margin-block: 1em;
  }
}

blockquote {
  /* Fallback for older browsers */
  border-left: 3px solid var(--color-border, #663399);
  padding-left: 1em;
  color: var(--color-text-muted, #737373);
  margin: 0;
  font-style: italic;
}

@supports (border-inline-start: 3px solid var(--color-border, #663399)) {
  blockquote {
    border-left: unset;
    padding-left: unset;
    border-inline-start: 3px solid var(--color-border, #663399);
    padding-inline-start: 1em;
  }
}

/* Links - subtle style */
a {
  color: var(--color-primary, #dc143c);
  text-decoration: none;
  position: relative;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}

/* Post content links: reduce saturation/attention while keeping site accent color intact */
.post-content a {
  color: var(--color-primary, #dc143c);
}

.post-content a:hover,
.post-content a:focus {
  border-bottom-color: var(--color-primary-hover, #b91c3c);
  color: var(--color-primary-hover, #b91c3c);
}

@supports (color: color-mix(in srgb, red 50%, white)) {
  .post-content a {
    color: color-mix(in srgb, var(--color-primary, #dc143c) 55%, var(--color-text, #232333));
  }

  .post-content a:hover,
  .post-content a:focus {
    color: color-mix(in srgb, var(--color-primary-hover, #b91c3c) 65%, var(--color-text, #232333));
    border-bottom-color: color-mix(in srgb, var(--color-primary-hover, #b91c3c) 65%, var(--color-text, #232333));
  }
}

a:hover,
a:focus {
  border-bottom-color: var(--color-primary-hover, #b91c3c);
  color: var(--color-primary-hover, #b91c3c);
  background: none;
  outline: none;
}

/* Lists
   Limit bullet removal to navigation/listing contexts; preserve normal lists in content */
/* Listing / navigation style (no bullets) */
.post-group-list,
.site-nav ul,
.toc ul {
  list-style: none;
  padding-left: 0;
  padding-inline-start: 0;
  margin: 0;
}
.post-group-list li,
.site-nav ul li,
.toc ul li { text-indent: 0; }
.post-group-list > li::before,
.site-nav ul > li::before,
.toc ul > li::before { content: ''; }

/* Restore default styling for content lists */
.post-content ul,
.content ul,
article ul {
  list-style: disc;
  padding-left: 1.25em; /* fallback */
  padding-inline-start: 1.25em;
  margin: 0 0 1em; /* keep bottom spacing */
}
/* Nested lists retain appropriate indent */
.post-content ul ul,
.content ul ul,
article ul ul { list-style: circle; }

/* Ordered lists styling (ensure numbering & spacing restored) */
.post-content ol,
.content ol,
article ol {
  list-style: decimal;
  padding-left: 1.5em;
  padding-inline-start: 1.5em;
  margin: 0 0 1em;
}
.post-content ol ol,
.content ol ol,
article ol ol { list-style: lower-alpha; }

/* List item spacing inside main content */
.post-content ul li,
.post-content ol li,
.content ul li,
.content ol li,
article ul li,
article ol li { margin: 0.3em 0; }

/* Ensure list text in article body uses same serif font as paragraphs */
.post-content .body ul,
.post-content .body ol,
.post-content .body li,
article .body ul,
article .body ol,
article .body li {
  font-family: inherit;
  line-height: 1.7; /* match paragraph line-height */
}

/* Images */
img {
  border: 3px solid var(--color-background-pre, #ececec);
  /* Fallback for older browsers */
  max-width: 100%;
  height: auto;
  /* Modern logical properties */
  max-inline-size: 100%;
  block-size: auto;
  border-radius: var(--border-radius, 5px);
}

figure {
  display: inline-block;
  margin: 0;
  /* Fallback for older browsers */
  max-width: 100%;
  /* Modern logical properties */
  max-inline-size: 100%;
}

figure img {
  /* Fallback for older browsers */
  max-height: 500px;
  /* Modern logical properties */
  max-block-size: 500px;
}

@media screen and (min-width: 37.5em) {
  figure {
    /* Fallback for older browsers */
    padding-left: 2.5rem;
    padding-right: 2.5rem;
    /* Modern logical properties */
    padding-inline: 2.5rem;
  }
}

figure h4 {
  font-size: 1rem;
  margin: 0;
  /* Fallback for older browsers */
  margin-bottom: 1em;
  /* Modern logical properties */
  margin-block-end: 1em;
}

figure h4::before {
  content: '↳ ';
  color: var(--color-primary, #dc143c);
}

/* Code blocks */
code,
pre {
  font-family: inherit;
}

code {
  background-color: var(--color-background-code, #f1f1f1);
  padding: 0.1em 0.2em;
  border-radius: 3px;
  font-size: 0.9em;
}

pre {
  background-color: var(--color-background-pre, #ececec);
  line-height: 1.4;
  overflow-x: auto;
  padding: 1em;
  border-radius: var(--border-radius, 5px);
  border: 1px solid var(--color-border, #663399);
}

.highlight pre ::selection {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

pre code {
  background-color: transparent;
  color: inherit;
  font-size: 100%;
  padding: 0;
}

/* Layout containers */
.content {
  /* Fallback for older browsers */
  margin-bottom: 4em;
  margin-left: auto;
  margin-right: auto;
  max-width: var(--content-max-width, 800px);
  min-height: calc(100vh - 16px - 13em); /* full viewport height minus body margin and footer space */
  padding-left: var(--content-padding, 1ch);
  padding-right: var(--content-padding, 1ch);
  /* Modern logical properties */
  margin-block-end: 4em;
  margin-inline: auto;
  max-inline-size: var(--content-max-width, 800px);
  padding-inline: var(--content-padding, 1ch);
  word-wrap: break-word;
  overflow-wrap: break-word;

  flex: 1;
}

/* Header */
/* Site Header */
.site-header {
  width: 100%;
  background: transparent;
  color: inherit;
  margin: 0 0 1.5rem 0;
  padding: 0.5rem 1rem;
  box-shadow: none;
}

.site-header-inner {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-header .main a {
  color: inherit;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .5px;
  border-bottom: none;
}

.site-header .main a:hover,
.site-header .main a:focus {
  color: var(--color-primary-hover, #b91c3c);
  border-bottom: none;
}

.site-nav a {
  color: inherit;
  font-weight: 500;
  font-size: .95rem;
  border-bottom: 2px solid transparent;
  padding: .25rem .4rem;
  border-radius: 0;
  transition: color .2s ease, border-color .2s ease;
  background: none;
}

.site-nav a:hover,
.site-nav a:focus {
  border-bottom-color: var(--color-primary, #dc143c);
  color: var(--color-primary-hover, #b91c3c);
  background: none;
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--color-primary, #dc143c);
  background: none;
  color: var(--color-primary, #dc143c);
}

@media (prefers-color-scheme: dark) {
  .site-header { background: transparent; color: var(--color-text-dark, #ffffff); }
  .site-header .main a,
  .site-nav a { color: var(--color-text-dark, #ffffff); }
  .site-nav a:hover,
  .site-nav a:focus { color: var(--color-primary-dark, #50fa7b); }
  .site-nav a[aria-current="page"] { color: var(--color-primary-dark, #50fa7b); }

  :root {
    --color-scrollbar-thumb: var(--color-background-pre-dark, #27282242);
    --color-scrollbar-thumb-hover: var(--color-background-code-dark, #3a3a3a47);
  }
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-size: 1.2rem; /* base fallback; overridden below per level */
  /* Fallback for older browsers */
  margin-top: 2em;
  margin-bottom: 0.5em;
  /* Modern logical properties */
  margin-block-start: 2em;
  margin-block-end: 0.5em;
  line-height: 1.2;
}

/* Hierarchical heading sizes */
h1:not(.title) { font-size: 1.7rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1.05rem; }
h6 { font-size: 0.95rem; }

/* Global h1 spacing override (replaces previous article-specific margin tweaks) */
h1 {
  margin-top: 0.6em;
  margin-bottom: 0.25em;
  margin-block-start: 0.6em;
  margin-block-end: 0.25em;
}

/* Removed decorative hashes from headings for cleaner look */

/* Larger main post title */
article h1.title {
  font-size: 2rem;
  line-height: 1.3;
  letter-spacing: .5px;
}

.meta {
  color: var(--color-text-meta, #999999);
  letter-spacing: -0.5px;
  font-size: 0.9em;
}

/* Post layout */
.post-container {
  /* Flexbox fallback for older browsers */
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
}

@supports (display: grid) {
  .post-container {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media screen and (min-width: 60em) {
  .post-container {
    /* Flexbox fallback */
    flex-wrap: nowrap;
  }
  
  @supports (display: grid) {
    .post-container {
      grid-template-columns: auto 1fr; /* default when no specific page type class applied */
    }
  }
}

.post-content {
  /* Flexbox fallback */
  flex: 1;
  min-width: 0;
  /* Modern properties */
  min-inline-size: 0;
  overflow-wrap: break-word;
}

.toc {
  color: var(--color-text, #232333);
  flex: 0 0 auto;
  overflow-y: auto;
  padding: 0;
  background: none;
  border: none;
}

@media screen and (min-width: 60em) {
  .toc {
    position: sticky;
    /* Fallback for older browsers */
    top: 1.25rem;
    /* Modern logical properties */
    inset-block-start: 1.25rem;
  }
}

@media screen and (max-width: 59.99em) {
  .toc {
    /* Fallback for older browsers */
    margin-bottom: 1.5rem;
    /* Modern logical properties */
    margin-block-end: 1.5rem;
    order: -1;
  }
}

/* Wider layout for single content pages with TOC: body has class 'single' */
@media screen and (min-width: 60em) {
  /* Keep centered content; position TOC absolutely to the left without shifting content */
  .page .content { max-width: var(--content-max-width, 800px); }
  /* Subtle right shift to counter left visual weight from TOC */
  .page .post-content { position: relative; max-width: var(--content-max-width, 800px); transform: translateX(20px); }
  /* Match header/title/meta with content shift for visual balance */
  .page .post-header { padding-left: 16px; }
  .page .post-header .title, .page .post-header .meta { padding-left: 3px; }
  /* Shift listing (section) content slightly to balance overall page weight */
  .section .content { position: relative; left: 20px; }
  .page .toc {
    position: absolute;
    text-align: right;

    width: max-content; 
    max-width: 12rem;
    top: 1em; /* align TOC start with body content top */
    left: calc(-16rem - 0.5rem); /* TOC width + smaller gap */
    /* reduce the right padding of the TOC */
    /* width:16rem; */
    right: 100%; 
    margin-right: 2rem; /* The gap between TOC and content */
    left: auto; /* Reset the left property */
  }
  .page .toc ul { list-style: none; padding: 0; margin: 0; }
  .page .toc li { margin: .25rem 0; }
  .page .toc a { font-size: .85rem; color: var(--color-text-muted, #737373); border-bottom: 1px solid transparent; }
  .page .toc a:hover, .page .toc a:focus { color: var(--color-text, #232333); border-bottom-color: var(--color-primary, #dc143c); }
}


/* Author/meta styling */
.meta .post-author {
  font-weight: 600;
  color: var(--color-text, #232333);
}

/* Footer */
footer {
  text-align: center;
  font-size: 0.9em;
  color: var(--color-text-muted, #737373);
  padding: 1rem 0;
  margin-top: auto;
}

.soc {
  display: flex;
  align-items: center;
  /* Fallback for older browsers */
  border-bottom: none;
  /* Modern logical properties */
  border-block-end: none;
  transition: color 0.2s ease;
}

.soc:hover,
.soc:focus {
  color: var(--color-primary, #dc143c);
  outline: 2px solid var(--color-primary, #dc143c);
  outline-offset: 2px;
}

.border {
  margin-inline: 0.5rem;
  border: 1px solid var(--color-border, #663399);
}

/* Common elements */
.title h1 {
  /* Fallback for older browsers */
  margin-bottom: 0;
  /* Modern logical properties */
  margin-block-end: 0;
}

time {
  color: var(--color-text-muted, #737373);
  font-size: 0.9em;
}

/* Posts */
article .title {
  /* Fallback for older browsers */
  margin-bottom: 1em;
  /* Modern logical properties */
  margin-block-end: 1em;
}


/* Callouts */
.callout {
  background-color: var(--color-callout, #1e90ff);
  color: #ffffff;
  padding: 1em;
  border-radius: var(--border-radius, 5px);
  /* Fallback for older browsers */
  margin-top: 1em;
  margin-bottom: 1em;
  /* Modern logical properties */
  margin-block: 1em;
}

.callout p {
  font-family: inherit;
  margin: 0;
}

.callout a {
  /* Fallback for older browsers */
  border-bottom: 3px solid #ffffff;
  /* Modern logical properties */
  border-block-end: 3px solid #ffffff;
  color: inherit;
}

.callout a:hover,
.callout a:focus {
  background-color: #ffffff;
  color: var(--color-callout, #1e90ff);
}

/* Callout variants */
.callout-alert {
  color: #721c24;
  background-color: #f8d7da;
  border: 3px solid #f5c2c7;
}

.callout-tip {
  color: #055160;
  background-color: #d1ecf1;
  border: 3px solid #b8daff;
}

.callout-warning {
  color: #664d03;
  background-color: #fff3cd;
  border: 3px solid #ffecb5;
}

.callout-custom {
  /* Custom styles will be applied inline */
  color: inherit;
}

/* Site and content elements */
.site-description {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
}

.tags li::before {
  content: "🏷 ";
  margin-inline-start: 2rem;
}

.tags a {
  /* Fallback for older browsers */
  border-bottom: 3px solid var(--color-primary, #dc143c);
  /* Modern logical properties */
  border-block-end: 3px solid var(--color-primary, #dc143c);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.tags a:hover,
.tags a:focus {
  color: #ffffff;
  background-color: var(--color-primary-hover, #b91c3c);
}

/* Icons and media */
svg {
  /* Fallback for older browsers */
  max-height: 1rem;
  max-width: 1rem;
  /* Modern logical properties */
  max-block-size: 1rem;
  max-inline-size: 1rem;
}

.feather {
  /* Fallback for older browsers */
  width: 1.5rem;
  height: 1.5rem;
  /* Modern logical properties */
  inline-size: 1.5rem;
  block-size: 1.5rem;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: inline-block;
  vertical-align: middle;
}

/* Draft label */
.draft-label {
  color: var(--color-border, #663399);
  text-decoration: none;
  padding: 0.125rem 0.25rem;
  border-radius: 4px;
  /* Fallback for older browsers */
  margin-left: 0.375rem;
  /* Modern logical properties */
  margin-inline-start: 0.375rem;
  background-color: var(--color-background-draft, #f9f2f4);
  font-size: 0.8em;
  font-weight: bold;
}
/* Code highlighting */
.highlight {
  position: relative;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--border-radius, 5px);
  overflow: hidden;
}
/* Code language badges */
.highlight pre code[class*="language-"] {
  -webkit-overflow-scrolling: touch;
}

.highlight pre code[class*="language-"]::before {
  background: #000000;
  border-radius: 0 0 0.25rem 0.25rem;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.025rem;
  padding: 0.1rem 0.5rem;
  position: absolute;
  /* Fallback for older browsers */
  right: 1rem;
  top: 0;
  /* Modern logical properties */
  inset-inline-end: 1rem;
  inset-block-start: 0;
  text-align: right;
  text-transform: uppercase;
}

/* Language-specific badges */
.highlight pre code[class*="language-js"]::before,
.highlight pre code[class="language-javascript"]::before {
  content: "js";
  background: #f7df1e;
  color: #000000;
}

.highlight pre code[class*="language-ts"]::before {
  content: "ts";
  background: #3178c6;
  color: #ffffff;
}

.highlight pre code[class*="language-py"]::before,
.highlight pre code[class*="language-python"]::before {
  content: "python";
  background: #3776ab;
  color: #ffffff;
}

.highlight pre code[class*="language-go"]::before {
  content: "go";
  background: #00add8;
  color: #ffffff;
}

.highlight pre code[class*="language-css"]::before {
  content: "css";
  background: #1572b6;
  color: #ffffff;
}

.highlight pre code[class*="language-html"]::before {
  content: "html";
  background: #e34f26;
  color: #ffffff;
}

.highlight pre code[class*="language-json"]::before {
  content: "json";
  background: #000000;
  color: #ffffff;
}

.highlight pre code[class*="language-yml"]::before,
.highlight pre code[class*="language-yaml"]::before {
  content: "yaml";
  background: #cc1018;
  color: #ffffff;
}

.highlight pre code[class*="language-shell"]::before,
.highlight pre code[class*="language-bash"]::before,
.highlight pre code[class*="language-sh"]::before {
  content: "shell";
  background: #4eaa25;
  color: #ffffff;
}

.highlight pre code[class*="language-md"]::before,
.highlight pre code[class*="language-markdown"]::before {
  content: "markdown";
  background: #083fa1;
  color: #ffffff;
}

/* Tables */
table {
  border-spacing: 0;
  border-collapse: collapse;
  /* Fallback for older browsers */
  width: 100%;
  margin-top: 1rem;
  margin-bottom: 1rem;
  /* Modern logical properties */
  inline-size: 100%;
  margin-block: 1rem;
  border-radius: var(--border-radius, 5px);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

table th {
  padding: 0.75rem;
  border: 1px solid var(--color-border, #663399);
  font-weight: bold;
  background-color: var(--color-background-pre, #ececec);
  text-align: start;
}

table td {
  padding: 0.75rem;
  border: 1px solid var(--color-border, #663399);
}

table tr:nth-child(even) {
  background-color: var(--color-background-code, #f1f1f1);
}

/* Navigation and theme toggle */
nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-toggle {
  /* Reset button styles */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  background: none;
  margin: 0;
  font: inherit;
  cursor: pointer;

  /* Custom styling */
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text, #232333);
}

.nav-toggle:hover,
.nav-toggle:focus {
  background-color: var(--color-primary, #dc143c);
  color: #ffffff;
  outline: 2px solid var(--color-primary, #dc143c);
  outline-offset: 2px;
}

.nav-toggle:focus {
  outline-style: solid;
}

.nav-toggle:active {
  transform: scale(0.95);
}

/* Media queries for responsive design */
@media (max-width: 37.4em) {
  .content {
    /* Fallback for older browsers */
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    /* Modern logical properties */
    padding-inline: 0.5rem;
  }
  
  .site-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .site-description {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Post group blocks (for grouped section listing) */
.post-group {
  /* Removed box styling for a flatter section list */
  border: none;
  background: none;
  border-radius: 0;
  padding: 0;
  margin: 1.5rem 0;
}
.post-group h2 {
  margin: 0 0 .75rem 0;
}
.post-group-list { list-style: none; margin: 0; padding: 0; }
.post-group-list li { margin: .3rem 0; }
.post-group-list li a { font-weight: 500; border-bottom: 1px solid transparent; }
.post-group-list li a:hover { border-bottom-color: var(--color-primary, #dc143c); }

/* Override spacing: reduce gap below title and first body element top margin */
article .title { margin-bottom: 0.5em; margin-block-end: 0.5em; }
.post-content .body > :first-child { margin-top: 0.3em !important; }


/* Paper / Project cards (academic block layout) */
.paper-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem 1.1rem;
  margin: 1.25rem 0;
  border: 1px solid var(--color-background-pre, #ececec);
  border-left: 3px solid var(--color-primary, #dc143c);
  border-radius: 0;
  background: transparent;
}

@media screen and (min-width: 37.5em) {
  .paper-card--has-image {
    grid-template-columns: 140px 1fr;
    align-items: start;
  }
}

.paper-card__media img {
  width: 100%;
  height: auto;
  border-radius: 0;
  border: 1px solid var(--color-background-pre, #ececec);
  display: block;
}

.paper-card__body { min-width: 0; }

.paper-card__title {
  margin: 0 0 .25rem 0;
  font-size: 1.02rem;
  line-height: 1.35;
  font-weight: 600;
}

.paper-card__title a {
  color: inherit;
  border-bottom: none;
}
.paper-card__title a:hover,
.paper-card__title a:focus {
  color: var(--color-primary-hover, #b91c3c);
  border-bottom: none;
}

.paper-card__authors {
  font-size: .88rem;
  color: var(--color-text-muted, #737373);
  margin-bottom: .15rem;
  line-height: 1.4;
}

.paper-card__venue {
  font-size: .82rem;
  color: var(--color-text-meta, #999999);
  font-style: italic;
  margin-bottom: .35rem;
}

.paper-card__desc {
  font-size: .92rem;
  line-height: 1.55;
}

.paper-card__desc p { margin-block: .25em; }
.paper-card__desc ul {
  margin: .25em 0;
  padding-inline-start: 1.1em;
}
.paper-card__desc li { margin: .15em 0; }

/* --- KaTeX Overrides --- */

/* KaTeX depends on content-box sizing for all its internal metric calculations.
   The global `* { box-sizing: border-box }` reset above breaks those
   measurements (e.g. the \sqrt overline bar becomes shorter than its content).
   Revert to content-box for everything inside a KaTeX span. */
.katex,
.katex * {
  box-sizing: content-box;
}

/* The global `svg { max-width: 1rem; max-height: 1rem }` rule below is meant
   for UI icons, but it also clamps KaTeX's radical SVGs (used by \sqrt{}).
   KaTeX sets `width: 100%` on its SVGs, but max-width/max-height still win
   as constraints, so the overline bar gets truncated to 1rem and never covers
   the full content. Remove those limits for all .katex SVGs. */
.katex svg {
  max-width: none;
  max-height: none;
  max-inline-size: none;
  max-block-size: none;
}

/* Fix display-mode equations (centered blocks) */
.katex-display {
  margin: 1em 0;
  overflow-x: auto; /* Adds scrollbar for long equations on mobile */
  overflow-y: hidden;
}