table {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

pre.output {
  border: none;
  background: none;
  border-radius: none;
}

div.pandas {
  overflow: auto;
  font-size: small;
}

/* Model badges on PR references - ONLY within blog post articles */
article.blog-post a[title]::after {
  content: " " attr(title);
  background: #e8e8e8;
  color: #333;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.65em;
  font-weight: 600;
  margin-left: 4px;
  white-space: nowrap;
}

/* Blue badges (Copilot) */
article.blog-post a[data-badge-color="blue"]::after {
  background: #bfe7ff;
  color: #003d7a;
}

/* Green badges (OpenCode, Pi) */
article.blog-post a[data-badge-color="green"]::after {
  background: #b6f6d9;
  color: #0d3f2d;
}

[data-theme="dark"] article.blog-post a[title]::after {
  background: #3a3a3a;
  color: #e0e0e0;
}

[data-theme="dark"] article.blog-post a[data-badge-color="blue"]::after {
  background: #1e4d7b;
  color: #a8d8f5;
}

[data-theme="dark"] article.blog-post a[data-badge-color="green"]::after {
  background: #1d4d3d;
  color: #7dd3b0;
}

/* Homepage _index.md */
.content-section {
  --hs-heading-color: #6b7280;
  --hs-heading-line: #e5e7eb;
  padding: 1rem 1rem 1rem;
}

[data-theme="dark"] .content-section {
  --hs-heading-color: #9ca3af;
  --hs-heading-line: #374151;
}

.content-section h4 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--hs-heading-color);
  margin: 0.6em 0 0.3em;
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.content-section h4::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hs-heading-line);
}

.content-section h4:first-child {
  margin-top: 0;
}

.content-section p {
  line-height: 2.2;
  font-size: 0.88rem;
  margin: 0 0 0.6em;
  padding-left: 0.6em;
}

.content-section p:last-child {
  margin-bottom: 0;
}

.content-section a {
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    filter 0.15s ease;
}

.content-section a:hover {
  filter: brightness(0.85);
}

/* Section 1: Favorite posts and series — slate */
.content-section h4:nth-of-type(1) + p a {
  background: #475569;
  color: #f1f5f9;
}
/* Section 2: My classes and books — teal */
.content-section h4:nth-of-type(2) + p a {
  background: #0f766e;
  color: #f0fdfa;
}
/* Section 3: My workshops — amber */
.content-section h4:nth-of-type(3) + p a {
  background: #b45309;
  color: #fffbeb;
}
/* Section 4: Python libraries — indigo */
.content-section h4:nth-of-type(4) + p a {
  background: #4338ca;
  color: #eef2ff;
}
/* Section 5: Other projects — rose */
.content-section h4:nth-of-type(5) + p a {
  background: #be123c;
  color: #fff1f2;
}
/* Section 6: My sites — emerald */
.content-section h4:nth-of-type(6) + p a {
  background: #047857;
  color: #ecfdf5;
}

[data-theme="dark"] .content-section h4:nth-of-type(1) + p a {
  background: #94a3b8;
  color: #1e293b;
}
[data-theme="dark"] .content-section h4:nth-of-type(2) + p a {
  background: #5eead4;
  color: #134e4a;
}
[data-theme="dark"] .content-section h4:nth-of-type(3) + p a {
  background: #fcd34d;
  color: #78350f;
}
[data-theme="dark"] .content-section h4:nth-of-type(4) + p a {
  background: #a5b4fc;
  color: #312e81;
}
[data-theme="dark"] .content-section h4:nth-of-type(5) + p a {
  background: #fda4af;
  color: #881337;
}
[data-theme="dark"] .content-section h4:nth-of-type(6) + p a {
  background: #6ee7b7;
  color: #064e3b;
}

/* Series nav blocks (in-post C++ / Python series) */
.series-nav {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 1em 1.5em;
  margin: 1.5em 0;
  text-align: center;
  line-height: 1.8;
}

.series-nav a,
.series-nav strong {
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background 0.15s ease,
    filter 0.15s ease;
}

.series-nav a {
  background: #475569;
  color: #f1f5f9;
}

.series-nav a:hover {
  filter: brightness(0.85);
}

.series-nav strong {
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

[data-theme="dark"] .series-nav a {
  background: #94a3b8;
  color: #1e293b;
}

[data-theme="dark"] .series-nav strong {
  background: rgba(255, 255, 255, 0.12);
}

/* Project table */
.project-table-wrapper {
  --pt-bg: #fff;
  --pt-border: #e5e7eb;
  --pt-row-hover: #f9fafb;
  --pt-row-alt: #f8f9fb;
  --pt-th-bg: #f3f4f6;
  --pt-th-text: #374151;
  --pt-text: #1f2937;
  --pt-text-muted: #6b7280;
  --pt-tip-bg: #1f2937;
  --pt-tip-text: #f9fafb;
  --pt-badge-blue-bg: #dbeafe;
  --pt-badge-blue-text: #1e40af;
  --pt-badge-green-bg: #d1fae5;
  --pt-badge-green-text: #065f46;
  --pt-badge-yellow-bg: #fef3c7;
  --pt-badge-yellow-text: #92400e;
  --pt-badge-red-bg: #fee2e2;
  --pt-badge-red-text: #991b1b;
  --pt-badge-gray-bg: #f3f4f6;
  --pt-badge-gray-text: #4b5563;

  max-width: 100vw;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5em;
}
table.project-table {
  margin-bottom: 0;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--pt-text);
  font-size: 0.88em;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  overflow: hidden;
}
table.project-table td,
table.project-table th {
  border: none !important;
  padding: 6px 10px;
  white-space: nowrap;
  border-bottom: 1px solid var(--pt-border);
}
table.project-table thead th {
  border-bottom: 2px solid var(--pt-border);
}
table.project-table tbody tr:last-child td {
  border-bottom: none;
}
table.project-table tbody tr:nth-child(even) {
  background: var(--pt-row-alt);
}
table.project-table tbody tr:hover {
  background: var(--pt-row-hover);
}
table.project-table th {
  font-weight: 600;
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pt-th-text);
  text-align: left;
  position: sticky;
  background: var(--pt-th-bg);
  z-index: 1;
}
table.project-table thead th {
  top: 0;
}
table.project-table tfoot th {
  bottom: 0;
}
table.project-table tbody tr.noncore {
  opacity: 0.55;
}
.badge {
  font-size: 0.82em;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-block;
  line-height: 1.4;
}
.badge-blue {
  background: var(--pt-badge-blue-bg);
  color: var(--pt-badge-blue-text);
}
.badge-green {
  background: var(--pt-badge-green-bg);
  color: var(--pt-badge-green-text);
}
.badge-red {
  background: var(--pt-badge-red-bg);
  color: var(--pt-badge-red-text);
}
.badge-yellow {
  background: var(--pt-badge-yellow-bg);
  color: var(--pt-badge-yellow-text);
}
.badge-gray {
  background: var(--pt-badge-gray-bg);
  color: var(--pt-badge-gray-text);
}
a .badge,
.project-table .badge a {
  color: inherit;
  text-decoration: none;
}
a:hover .badge,
.project-table .badge a:hover {
  filter: brightness(0.92);
}
table.project-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}
table.project-table th[data-sort]:hover {
  color: var(--pt-text);
}
table.project-table th.sort-asc::after {
  content: " \25B2";
  font-size: 0.7em;
}
table.project-table th.sort-desc::after {
  content: " \25BC";
  font-size: 0.7em;
}
table.project-table td.dl-cell {
  text-align: right;
  font-family: var(--default-mono-font, ui-monospace, monospace);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.has-tip {
  position: relative;
}
.tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--pt-tip-bg);
  color: var(--pt-tip-text);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.82em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s 50ms;
  z-index: 10;
  user-select: all;
  cursor: text;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--pt-tip-bg);
}
.has-tip:hover > .tip,
.tip:hover {
  opacity: 1;
  pointer-events: auto;
}
.hooks-badge {
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
}
.hooks-popup {
  position: fixed;
  z-index: 1000;
  max-width: 280px;
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82em;
  background: #1f2937;
  color: #f9fafb;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.hooks-popup[hidden] {
  display: none;
}
.hooks-popup-title {
  font-weight: 600;
  margin-bottom: 6px;
}
.hooks-popup a {
  color: inherit;
  text-decoration: underline;
}
.hooks-group-head {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.hooks-group-head:first-of-type {
  margin-top: 0;
}
.hooks-rev {
  font-family: var(--default-mono-font, ui-monospace, monospace);
  font-size: 0.85em;
  opacity: 0.7;
}
.hooks-popup ul {
  margin: 2px 0 0;
  padding: 0 0 0 14px;
  list-style: none;
  font-family: var(--default-mono-font, ui-monospace, monospace);
}
.hooks-popup li {
  white-space: nowrap;
}
[data-theme="dark"] .hooks-popup {
  background: #e0e0ee;
  color: #16162b;
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .hooks-popup {
    background: #e0e0ee;
    color: #16162b;
  }
}
table.project-table td:first-child,
table.project-table th:first-child {
  padding-left: 12px;
}
table.project-table td:last-child,
table.project-table th:last-child {
  padding-right: 12px;
}

[data-theme="dark"] .project-table-wrapper {
  --pt-bg: #1a1a2e;
  --pt-border: #2d2d44;
  --pt-row-hover: #22223a;
  --pt-row-alt: #1e1e34;
  --pt-th-bg: #16162b;
  --pt-th-text: #a0a0b8;
  --pt-text: #e0e0ee;
  --pt-text-muted: #707088;
  --pt-tip-bg: #e0e0ee;
  --pt-tip-text: #16162b;
  --pt-badge-blue-bg: #1e3a5f;
  --pt-badge-blue-text: #93c5fd;
  --pt-badge-green-bg: #14432a;
  --pt-badge-green-text: #6ee7b7;
  --pt-badge-yellow-bg: #4a3518;
  --pt-badge-yellow-text: #fcd34d;
  --pt-badge-red-bg: #5c1a1a;
  --pt-badge-red-text: #fca5a5;
  --pt-badge-gray-bg: #2d2d44;
  --pt-badge-gray-text: #a0a0b8;
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .project-table-wrapper {
    --pt-bg: #1a1a2e;
    --pt-border: #2d2d44;
    --pt-row-hover: #22223a;
    --pt-row-alt: #1e1e34;
    --pt-th-bg: #16162b;
    --pt-th-text: #a0a0b8;
    --pt-text: #e0e0ee;
    --pt-text-muted: #707088;
    --pt-tip-bg: #e0e0ee;
    --pt-tip-text: #16162b;
    --pt-badge-blue-bg: #1e3a5f;
    --pt-badge-blue-text: #93c5fd;
    --pt-badge-green-bg: #14432a;
    --pt-badge-green-text: #6ee7b7;
    --pt-badge-yellow-bg: #4a3518;
    --pt-badge-yellow-text: #fcd34d;
    --pt-badge-red-bg: #5c1a1a;
    --pt-badge-red-text: #fca5a5;
    --pt-badge-gray-bg: #2d2d44;
    --pt-badge-gray-text: #a0a0b8;
  }
}
