/* Base typography overrides for Tailwind Preflight reset.
   Scoped to `.content` to avoid surprising global side effects. */

.content :where(a) {
  color: #2563eb; /* blue-600 */
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

.content :where(a:hover) {
  color: #1d4ed8; /* blue-700 */
  text-decoration-thickness: 2px;
}

.content :where(a:visited) {
  color: #7c3aed; /* violet-600 */
}

.content :where(a:focus-visible) {
  outline: 2px solid rgba(37, 99, 235, 0.45); /* blue-600 @ 45% */
  outline-offset: 2px;
  border-radius: 2px;
}

@media (prefers-color-scheme: dark) {
  .content :where(a) {
    color: #60a5fa; /* blue-400 */
  }

  .content :where(a:hover) {
    color: #93c5fd; /* blue-300 */
  }

  .content :where(a:visited) {
    color: #c4b5fd; /* violet-300 */
  }

  .content :where(a:focus-visible) {
    outline: 2px solid rgba(96, 165, 250, 0.5); /* blue-400 @ 50% */
  }
}

/* External link icon */
.content .link-external .external-link-icon {
  display: inline-block;
  margin-left: 0.15em;
  opacity: 0.65;
  text-decoration: none;
  font-size: 0.85em;
  vertical-align: baseline;
}

.content .link-external:hover .external-link-icon {
  opacity: 1;
}

/* SVG icon inherits link color */
.content .link-external .external-link-icon svg {
  fill: currentColor;
  vertical-align: -0.1em;
}

.content :where(h1, h2, h3, h4, h5, h6) {
  font-weight: 700;
  line-height: 1.2;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

/* Section heading self-links (hover to reveal) */
.content :where(h2, h3, h4, h5, h6) {
  scroll-margin-top: 1.25rem;
}

.content :where(.heading-anchor) {
  margin-left: 0.5rem;
  font-weight: 600;
  font-size: 0.9em;
  text-decoration: none;
  opacity: 0;
  transition: opacity 120ms ease-in-out;
}

.content :where(h2:hover .heading-anchor, h3:hover .heading-anchor, h4:hover .heading-anchor, h5:hover .heading-anchor, h6:hover .heading-anchor) {
  opacity: 0.65;
}

.content :where(h2:focus-within .heading-anchor, h3:focus-within .heading-anchor, h4:focus-within .heading-anchor, h5:focus-within .heading-anchor, h6:focus-within .heading-anchor) {
  opacity: 1;
}

.content :where(.heading-anchor:hover) {
  opacity: 1;
  text-decoration: none;
}

/* Page title in the layout header (outside `.content`) */
article > header h1 {
  font-weight: 900;
  font-size: 2.5rem;
  line-height: 1.1;
  margin: 0;
}

.content :where(h2) {
  font-size: 1.875rem;
}

.content :where(h3) {
  font-size: 1.5rem;
}

.content :where(h4) {
  font-size: 1.25rem;
}

.content :where(h5) {
  font-size: 1.125rem;
}

.content :where(h6) {
  font-size: 1rem;
  font-weight: 600;
}

.content :where(h1, h2, h3, h4, h5, h6):first-child {
  margin-top: 0;
}

.content :where(ul, ol) {
  padding-left: 1.5rem;
  margin: 1rem 0;
  list-style-position: outside;
}

.content :where(ul) {
  list-style-type: disc;
}

.content :where(ol) {
  list-style-type: decimal;
}

.content :where(li) {
  margin: 0.25rem 0;
}

.content :where(li > ul, li > ol) {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Code */

.content :where(code) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.95em;
}

/* Ensure code blocks always use a "technical" monospace font (even with Prism/Rouge themes). */
.content :where(pre),
.content :where(pre code),
pre[class*="language-"],
code[class*="language-"],
.highlighter-rouge pre,
.highlight pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace !important;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  font-weight: 100;
}

/* Inline code (but not code inside code blocks) */
.content :where(code):not(pre code) {
  background: rgba(17, 24, 39, 0.06); /* gray-900 @ 6% */
  padding: 0.15em 0.35em;
  border-radius: 0.35rem;
}

.content :where(pre) {
  background: #f6f8fa; /* GitHub light-ish */
  color: #24292f;
  border: 1px solid #d0d7de;
  border-radius: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1.25rem 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.content :where(pre code) {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  display: block;
  white-space: pre;
}

/* Prevent Prism themes from overriding our block background. */
pre[class*="language-"],
code[class*="language-"] {
  background: transparent !important;
}

/* Jekyll/Rouge wrapper */
.content :where(.highlight) {
  margin: 1.25rem 0;
}

.content :where(.highlight pre) {
  margin: 0;
}

/* Fallback for cases where `.content` isn't present, and to beat any resets. */
.highlighter-rouge pre,
.highlight pre {
  background: #f6f8fa !important; /* GitHub light-ish */
  color: #24292f !important;
  border: 1px solid #d0d7de !important;
  border-radius: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1.25rem 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.highlighter-rouge pre code,
.highlight pre code {
  background: transparent !important;
  color: inherit;
  padding: 0;
  white-space: pre;
}

/* Rouge token colors (light mode) */
.content :where(.highlight) .c,
.content :where(.highlight) .c1,
.content :where(.highlight) .cm,
.content :where(.highlight) .cp {
  color: #6e7781; /* gray */
}

.content :where(.highlight) .k,
.content :where(.highlight) .kd,
.content :where(.highlight) .kn,
.content :where(.highlight) .kp,
.content :where(.highlight) .kr,
.content :where(.highlight) .kt {
  color: #cf222e; /* red */
  font-weight: 600;
}

.content :where(.highlight) .s,
.content :where(.highlight) .s1,
.content :where(.highlight) .s2,
.content :where(.highlight) .se,
.content :where(.highlight) .sh,
.content :where(.highlight) .si,
.content :where(.highlight) .sx {
  color: #0a3069; /* deep blue */
}

.content :where(.highlight) .na,
.content :where(.highlight) .nb,
.content :where(.highlight) .nc,
.content :where(.highlight) .nf,
.content :where(.highlight) .nn,
.content :where(.highlight) .no,
.content :where(.highlight) .nt,
.content :where(.highlight) .nv,
.content :where(.highlight) .n {
  color: #8250df; /* purple */
}

.content :where(.highlight) .m,
.content :where(.highlight) .mi,
.content :where(.highlight) .mf,
.content :where(.highlight) .mh,
.content :where(.highlight) .il,
.content :where(.highlight) .mo {
  color: #0550ae; /* blue */
}

.content :where(.highlight) .p,
.content :where(.highlight) .o {
  color: #24292f; /* foreground */
}

.content :where(.highlight) .err {
  color: #cf222e;
  background: rgba(207, 34, 46, 0.12);
  border-radius: 0.25rem;
  padding: 0 0.15em;
}

/* Same token colors, unscoped (Rouge emits these inside `.highlight`). */
.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cp {
  color: #6e7781 !important;
}

.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt {
  color: #cf222e !important;
  font-weight: 600;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sx {
  color: #0a3069 !important;
}

.highlight .na,
.highlight .nb,
.highlight .nc,
.highlight .nf,
.highlight .nn,
.highlight .no,
.highlight .nt,
.highlight .nv,
.highlight .n {
  color: #8250df !important;
}

.highlight .m,
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .il,
.highlight .mo {
  color: #0550ae !important;
}

.highlight .p,
.highlight .o {
  color: #24292f !important;
}

.highlight .err {
  color: #cf222e !important;
  background: rgba(207, 34, 46, 0.12) !important;
  border-radius: 0.25rem;
  padding: 0 0.15em;
}

@media (prefers-color-scheme: dark) {
  .content :where(code):not(pre code) {
    background: rgba(255, 255, 255, 0.08);
  }

  .content :where(pre) {
    background: #0d1117;
    color: #c9d1d9;
    border-color: #30363d;
  }

  .highlighter-rouge pre,
  .highlight pre {
    background: #0d1117 !important;
    color: #c9d1d9 !important;
    border-color: #30363d !important;
  }

  /* Rouge token colors (dark mode) */
  .content :where(.highlight) .c,
  .content :where(.highlight) .c1,
  .content :where(.highlight) .cm,
  .content :where(.highlight) .cp,
  .highlight .c,
  .highlight .c1,
  .highlight .cm,
  .highlight .cp {
    color: #8b949e !important;
  }

  .content :where(.highlight) .k,
  .content :where(.highlight) .kd,
  .content :where(.highlight) .kn,
  .content :where(.highlight) .kp,
  .content :where(.highlight) .kr,
  .content :where(.highlight) .kt,
  .highlight .k,
  .highlight .kd,
  .highlight .kn,
  .highlight .kp,
  .highlight .kr,
  .highlight .kt {
    color: #ff7b72 !important;
  }

  .content :where(.highlight) .s,
  .content :where(.highlight) .s1,
  .content :where(.highlight) .s2,
  .content :where(.highlight) .se,
  .content :where(.highlight) .sh,
  .content :where(.highlight) .si,
  .content :where(.highlight) .sx,
  .highlight .s,
  .highlight .s1,
  .highlight .s2,
  .highlight .se,
  .highlight .sh,
  .highlight .si,
  .highlight .sx {
    color: #a5d6ff !important;
  }

  .content :where(.highlight) .na,
  .content :where(.highlight) .nb,
  .content :where(.highlight) .nc,
  .content :where(.highlight) .nf,
  .content :where(.highlight) .nn,
  .content :where(.highlight) .no,
  .content :where(.highlight) .nt,
  .content :where(.highlight) .nv,
  .content :where(.highlight) .n,
  .highlight .na,
  .highlight .nb,
  .highlight .nc,
  .highlight .nf,
  .highlight .nn,
  .highlight .no,
  .highlight .nt,
  .highlight .nv,
  .highlight .n {
    color: #d2a8ff !important;
  }

  .content :where(.highlight) .m,
  .content :where(.highlight) .mi,
  .content :where(.highlight) .mf,
  .content :where(.highlight) .mh,
  .content :where(.highlight) .il,
  .content :where(.highlight) .mo,
  .highlight .m,
  .highlight .mi,
  .highlight .mf,
  .highlight .mh,
  .highlight .il,
  .highlight .mo {
    color: #79c0ff !important;
  }

  .content :where(.highlight) .p,
  .content :where(.highlight) .o,
  .highlight .p,
  .highlight .o {
    color: #c9d1d9 !important;
  }

  .content :where(.highlight) .err,
  .highlight .err {
    color: #f85149 !important;
    background: rgba(248, 81, 73, 0.15) !important;
  }
}

a.link-internal {
  background-color: #033776;
  color: #fff;
  padding: 0.1em 0.5em 0.4em 0.5em;
  border-radius: 9999px;
  text-decoration: none;
}

a.link-internal:hover {
  background-color: #0057a3;
  color: #fff;
}

a.link-musical {
  text-decoration: none;
}