/* Import fonts */
@import url("./fonts.css");

:root {
  /* Custom Cursors */
  --cursor-default: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="%23FFF" stroke="%23000" stroke-width="1.5" d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87a.5.5 0 0 0 .35-.85L6.35 2.85a.5.5 0 0 0-.85.35Z"></path></svg>') 5 5, auto;
  --cursor-pointer: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="%23FFF" stroke="%23000" stroke-width="1.5" stroke-linejoin="round" d="M10 11V8.99c0-.88.59-1.64 1.44-1.86h.05A1.99 1.99 0 0 1 14 9.05V12v-2c0-.88.6-1.65 1.46-1.87h.05A1.98 1.98 0 0 1 18 10.06V13v-1.94a2 2 0 0 1 1.51-1.94h0A2 2 0 0 1 22 11.06V14c0 .6-.08 1.27-.21 1.97a7.96 7.96 0 0 1-7.55 6.48 54.98 54.98 0 0 1-4.48 0 7.96 7.96 0 0 1-7.55-6.48C2.08 15.27 2 14.59 2 14v-1.49c0-1.11.9-2.01 2.01-2.01h0a2 2 0 0 1 2.01 2.03l-.01.97v-10c0-1.1.9-2 2-2h0a2 2 0 0 1 2 2V11Z"></path></svg>') 12 0, pointer;
  --cursor-heart: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="%23FFF" stroke="%23000" stroke-width="1.5" stroke-linejoin="round" d="M12 8S9.75 5 7 5a4.5 4.5 0 0 0-4.5 4.5C2.5 14.5 12 20 12 20s9.5-5.5 9.5-10.5A4.5 4.5 0 0 0 17 5c-2.75 0-5 3-5 3Z"></path></svg>') 12 12, pointer;
  --cursor-thumb-up: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="%23FFF" stroke="%23000" stroke-width="1.5" d="M9.61 4.45C7.68 11.71 8 9.28 8 18.5c0 .83.67 1.5 1.5 1.5h8.3c.7 0 1.31-.49 1.46-1.17l1.33-6A1.5 1.5 0 0 0 19.13 11h-5.21a1.5 1.5 0 0 1-1.46-1.86l.93-3.71a1.95 1.95 0 0 0-3.78-.98ZM6.5 20h-2A1.5 1.5 0 0 1 3 18.5v-6c0-.83.67-1.5 1.5-1.5h2c.83 0 1.5.67 1.5 1.5v6c0 .83-.67 1.5-1.5 1.5Z"></path></svg>') 12 6, pointer;

  /* Typography */
  --font-body: "Noto Sans", sans-serif;
  --font-heading: "Recursive", sans-serif;
  --font-mono: "Rec Mono Duotone", "Recursive", monospace;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif;

  /* Type scale - compact and efficient */
  --font-size-base: 16px;
  --font-size-sm: 0.875rem; /* 14px */
  --font-size-md: 1rem; /* 16px */
  --font-size-lg: 1.0625rem; /* 17px */
  --font-size-xl: 1.25rem; /* 20px */
  --font-size-2xl: 1.5rem; /* 24px */
  --font-size-3xl: 2rem; /* 32px */
  --font-size-4xl: 2.5rem; /* 40px */

  /* Reading text size */
  --font-size-reading: 1.0625rem; /* 17px - efficient reading size */

  /* Line heights */
  --line-height-tight: 1.1;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;

  /* Spacing scale - efficient 4px base unit */
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem; /* 8px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem; /* 16px */
  --space-5: 1.25rem; /* 20px */
  --space-6: 1.5rem; /* 24px */
  --space-8: 2rem; /* 32px */
  --space-10: 2.5rem; /* 40px */
  --space-12: 3rem; /* 48px */

  /* Layout */
  --container-max: 90vw;
  --border-radius: 4px;

  /* Light theme colors - clean white */
  --color-bg: #ffffff;
  --color-bg-alt: #f8f8f8;
  --color-text: #1a1a1a;
  --color-text-muted: #666666;
  --color-border: #e0e0e0;
  --color-accent: #0066cc;
  --color-accent-hover: #0052a3;
  --color-code-bg: #f0f0f0;
  --color-code-border: #eeeeee;
  --color-selection: rgba(0, 102, 204, 0.15);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark theme colors - warm and soft for comfortable reading */
    --color-bg: #1a1612;
    --color-bg-alt: #252118;
    --color-text: #c9c5c0;
    --color-text-muted: #8a857f;
    --color-border: #3a342e;
    --color-accent: #8da3b9;
    --color-accent-hover: #a4b9cc;
    --color-code-bg: #252118;
    --color-code-border: #252118;
    --color-selection: rgba(141, 163, 185, 0.25);
  }
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

/* Base */
html {
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-variation-settings:
    "MONO" 0,
    "CASL" 0,
    "wght" 400,
    "slnt" 0;
  font-optical-sizing: auto;
  font-kerning: normal;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  cursor: var(--cursor-default);
}

::selection {
  background-color: var(--color-selection);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  text-wrap: balance;
  font-optical-sizing: auto;
}

h1 {
  font-size: var(--font-size-4xl);
  font-weight: 800;
}
h2 {
  font-size: var(--font-size-3xl);
}
h3 {
  font-size: var(--font-size-2xl);
}
h4 {
  font-size: var(--font-size-xl);
}
h5 {
  font-size: var(--font-size-lg);
}
h6 {
  font-size: var(--font-size-md);
}

p,
ul,
ol,
pre,
table,
blockquote {
  margin-bottom: var(--space-4);
}

p {
  text-wrap: pretty;
  hyphenate-limit-chars: 6 3 2;
  text-spacing: trim-start allow-end;
  word-break: auto-phrase;
}

/* Add spacing when paragraph follows a code block */
pre + p,
pre + ul,
pre + ol,
pre + blockquote {
  margin-top: var(--space-6);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    border-color 0.2s,
    color 0.2s;
  font-feature-settings: "case", "lnum", "pnum", "ss01";
  cursor: var(--cursor-pointer);
}

a:hover {
  color: var(--color-accent-hover);
  border-bottom-color: currentColor;
}

ul,
ol {
  padding-left: var(--space-6);
}

li {
  margin-bottom: var(--space-2);
}

blockquote {
  padding-left: var(--space-6);
  border-left: 3px solid var(--color-accent);
  color: var(--color-text-muted);
  font-style: italic;
  position: relative;
  margin-left: 0;
  margin-right: 0;
}

blockquote::before {
  content: '"';
  position: absolute;
  left: -0.5em;
  top: -0.2em;
  font-size: 3em;
  color: var(--color-accent);
  opacity: 0.3;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.125em 0.25em;
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-variation-settings:
    "MONO" 1,
    "CASL" 0,
    "wght" 400,
    "slnt" 0;
}

pre {
  overflow-x: auto;
  overflow-y: hidden;
  padding: var(--space-3) 0;
  padding-top: var(--space-6);
  margin: 0;
  background-color: transparent;
  border: none;
  border-radius: var(--border-radius);
  font-family: var(--font-mono);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  position: relative;
  font-variation-settings:
    "MONO" 1,
    "CASL" 0,
    "wght" 400,
    "slnt" 0;
}

pre code {
  padding: 0;
  background: none;
  border: none;
  font-family: inherit;
  font-variation-settings: inherit;
}

/* Shiki-specific styling */
.shiki {
  background-color: transparent !important;
  padding: var(--space-4);
  margin: 0;
}

.shiki code {
  display: block;
  width: 100%;
  background: transparent !important;
  padding: 0 !important;
}

/* Shiki dual theme support - THIS IS THE KEY */
/* Light mode */
@media (prefers-color-scheme: light) {
  .shiki,
  .shiki span {
    color: var(--shiki-light) !important;
    background-color: var(--shiki-light-bg, transparent) !important;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .shiki,
  .shiki span {
    color: var(--shiki-dark) !important;
    background-color: var(--shiki-dark-bg, transparent) !important;
  }
}

/* Multi-language code block tabs */
.code-block-tabs {
  margin: var(--space-4) 0;
  background-color: transparent;
  border: none;
  border-radius: var(--border-radius);
}

.code-tabs-container {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  padding: 0;
}

.code-tab {
  background: none;
  border: none;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  cursor: var(--cursor-pointer);
  text-transform: lowercase;
  letter-spacing: 0.05em;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
  border-bottom: 2px solid transparent;
  position: relative;
  top: 1px;
}

.code-tab:hover {
  color: var(--color-text);
  background-color: var(--color-bg);
}

.code-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.code-block-tabs .code-content {
  display: none;
  margin: 0;
  border: none;
  border-radius: 0;
}

.code-block-tabs .code-content.active {
  display: block;
}

.code-block-tabs .code-content code {
  display: block;
}

/* Apply Shiki styling to tabbed code blocks */
.code-block-tabs .shiki,
.code-block-tabs .shiki span {
  background-color: transparent !important;
}

/* Light mode for tabbed code blocks */
@media (prefers-color-scheme: light) {
  .code-block-tabs .shiki,
  .code-block-tabs .shiki span {
    color: var(--shiki-light) !important;
  }
}

/* Dark mode for tabbed code blocks */
@media (prefers-color-scheme: dark) {
  .code-block-tabs .shiki,
  .code-block-tabs .shiki span {
    color: var(--shiki-dark) !important;
  }
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--space-8) auto;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-10) 0;
}

/* Layout */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* Header */
.site-header {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-6);
  background-color: var(--color-bg);
}

@media (prefers-color-scheme: dark) {
  .site-header {
  }
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: nowrap;
  position: relative;
}

/* Mobile menu toggle button - hidden on desktop */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: var(--cursor-pointer);
  z-index: 1000;
}

.hamburger {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-text);
  position: relative;
  transition: background-color 0.3s ease;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background-color: var(--color-text);
  transition: transform 0.3s ease;
}

.hamburger::before {
  top: -8px;
}

.hamburger::after {
  top: 8px;
}

/* Hamburger animation when menu is open */
.mobile-menu-toggle[aria-expanded="true"] .hamburger {
  background-color: transparent;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg) translate(6px, -6px);
}

.nav-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  border: none;
  font-family: var(--font-serif);
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.nav-title:hover {
  color: var(--color-accent);
  border: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  flex-shrink: 1;
  min-width: 0;
  flex-wrap: nowrap;
}

.nav-links::-webkit-scrollbar {
  height: 4px;
}

.nav-links::-webkit-scrollbar-track {
  background: transparent;
}

.nav-links::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.nav-links::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.nav-links a {
  color: var(--color-text-muted);
  border: none;
  font-weight: 500;
  font-size: var(--font-size-md);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--border-radius);
  transition: color 0.2s ease;
  position: relative;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-3);
  right: var(--space-3);
  height: 2px;
  background-color: var(--color-accent);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

.nav-links a[aria-current="page"] {
  color: var(--color-accent);
  font-weight: 600;
}

.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Main content */
.main {
  min-height: calc(100vh - 200px);
  margin-bottom: var(--space-12);
}

/* Posts list */
.posts-list {
  list-style: none;
  padding: 0;
}

.post-item {
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--color-border);
}

.post-item:first-child {
  padding-top: 0;
}

.post-item:last-child {
  border-bottom: none;
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-6);
  margin-bottom: var(--space-3);
}

.post-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Use serif font for post titles */
.post-title,
.article-title {
  font-family: var(--font-serif);
}

.post-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin: 0;
  line-height: var(--line-height-tight);
  text-wrap: balance;
  flex: 1;
}

.post-title a {
  color: var(--color-text);
  border: none;
}

.post-title a:hover {
  color: var(--color-accent);
  border: none;
}

.post-excerpt {
  color: var(--color-text-muted);
  text-wrap: pretty;
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  margin: 0;
}

/* Compact post list for home page */
.post-item-compact {
  padding: var(--space-1) 0;
  border: none;
}

.post-item-compact .post-header {
  gap: var(--space-4);
}

.post-item-compact .post-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
}

/* Featured post section */
.featured-post {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-6);
  align-items: flex-start;
}

.featured-image {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: var(--border-radius);
  flex-shrink: 0;
  margin: 0;
}

.featured-content {
  flex: 1;
}

.featured-badge {
  display: inline-block;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.featured-post .post-title {
  font-size: var(--font-size-4xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.featured-post .post-excerpt {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  margin-top: var(--space-4);
}

.featured-post .post-meta {
  margin-top: var(--space-3);
}

/* Responsive featured post */
@media (max-width: 640px) {
  .featured-post {
    flex-direction: column;
  }

  .featured-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
}

/* Dev log posts styling */
.post-type-devlog .post-title a {
  color: var(--color-accent);
}

.post-type-devlog .post-title a:hover {
  color: var(--color-accent-hover);
}

.post-type-devlog .post-meta::before {
  content: "◉ ";
  color: var(--color-accent);
  font-weight: bold;
}

/* Dev log page specific */
.devlog-page h1 {
  font-family: var(--font-serif);
  text-align: center;
}

.devlog-intro {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: var(--space-12);
}

.no-posts {
  text-align: center;
  color: var(--color-text-muted);
  margin-top: var(--space-12);
}

/* Projects styles */
.projects-page h1,
.project-page h1 {
  font-family: var(--font-serif);
  text-align: center;
}

.projects-intro {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: var(--space-12);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-12);
}

.project-card {
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  transition: border-color 0.2s ease;
}

.project-card:hover {
  border-color: var(--color-accent);
}

.project-title {
  font-size: var(--font-size-lg);
  margin: 0 0 var(--space-2) 0;
}

.project-title a {
  color: var(--color-text);
}

.project-description {
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.project-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.no-projects {
  text-align: center;
  color: var(--color-text-muted);
  margin-top: var(--space-12);
}

/* Project page styles */
.project-page .project-description {
  text-align: center;
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-8);
}

.project-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-12);
  font-size: var(--font-size-sm);
}

.project-nav a {
  color: var(--color-text-muted);
}

.project-nav a:hover {
  color: var(--color-text);
}

/* Project link in post metadata */
.post-project a {
  color: var(--color-accent);
  font-weight: 500;
}

.post-project a:hover {
  color: var(--color-accent-hover);
}

/* Dev log page project navigation */
.project-nav-links {
  text-align: center;
  margin-bottom: var(--space-12);
}

.project-nav-links a {
  color: var(--color-accent);
}

.project-nav-links a:hover {
  color: var(--color-accent-hover);
}

/* Project sections in dev log */
.project-section {
  margin-bottom: var(--space-16);
}

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

.project-section-title {
  font-family: var(--font-serif);
  font-size: var(--font-size-2xl);
  color: var(--color-accent);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-border);
}

.project-section .post-title {
  font-size: var(--font-size-lg);
}

/* Posts page title styling */
.posts-page h1 {
  font-family: var(--font-serif);
  text-align: center;
}

.view-all {
  text-align: center;
  margin-top: var(--space-12);
}

/* Tags page */
.tags-index h1,
.tag-page h1 {
  margin-bottom: var(--space-8);
}

.tags-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.tags-list li {
  margin: 0;
}

.tags-list a {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
}

.tags-list a:hover {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

.tag-count {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-left: var(--space-1);
}

/* Article */
.article-header {
  position: sticky;
  top: 0;
  margin-bottom: var(--space-8);
  padding: var(--space-3) var(--space-6);
  background-color: var(--color-bg);
  z-index: 10;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  min-height: 3rem;
  gap: var(--space-4);
}

.article-header-content {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.article-header .article-title {
  margin: 0;
  line-height: 1.2;
}

.article-title {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
  text-wrap: balance;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  line-height: var(--line-height-tight);
  letter-spacing: -0.025em;
}

.article-meta {
  display: flex;
  gap: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  justify-content: center;
  align-items: center;
  overflow: hidden;
  flex-wrap: wrap;
}

.like-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  cursor: var(--cursor-heart);
  padding: 0;
  transition: all 0.2s ease;
  position: relative;
}

.like-button:hover {
  color: var(--color-accent);
  transform: scale(1.05);
}

.like-button .heart-icon {
  transition: all 0.2s ease;
}

.like-button.liked {
  color: #e63946;
}

.like-button.liked .heart-icon path {
  fill: #e63946;
  stroke: #e63946;
}

.like-button.liked:hover {
  color: #d62828;
}

.like-button.animating {
  animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.2);
  }
  50% {
    transform: scale(0.95);
  }
  75% {
    transform: scale(1.1);
  }
}

.scroll-to-top-link {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.2s ease;
  cursor: var(--cursor-pointer);
  opacity: 0;
  visibility: hidden;
}

.scroll-to-top-link.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top-link:hover {
  color: var(--color-accent);
}

.article-content > *:first-child {
  margin-top: 0;
}

/* Unified Post Styling */
.article-content {
  font-family: var(--font-body);
  font-size: var(--font-size-reading);
  line-height: var(--line-height-relaxed);
  hanging-punctuation: first last;
  font-variation-settings:
    "MONO" 0,
    "CASL" 0,
    "wght" 400,
    "slnt" 0;
  text-rendering: optimizeLegibility;
  font-feature-settings:
    "kern" 1,
    "liga" 1,
    "calt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  font-family: var(--font-serif);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  font-weight: normal;
}

.article-content h1 {
  color: #355e3b;
}

@media (prefers-color-scheme: dark) {
  .article-content h1 {
    color: #7ba05b;
  }
}

/* Emphasis styling */
.article-content em {
  font-variation-settings:
    "MONO" 0,
    "CASL" 0,
    "wght" 450,
    "slnt" -8;
}

.article-content strong {
  font-variation-settings:
    "MONO" 0,
    "CASL" 0,
    "wght" 700,
    "slnt" 0;
}

/* Warning Component */
.warning-box {
  margin: var(--space-xl) 0;
  padding: var(--space-lg);
  position: relative;
}

.warning-header {
  margin-bottom: var(--space-md);
  font-weight: 600;
  text-align: center;
}

.warning-title {
  font-size: var(--font-size-lg);
  letter-spacing: -0.02em;
  font-family: var(--font-serif);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.warning-content {
  font-size: var(--font-size-sm);
  line-height: var(--line-height);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

/* Warning color variants */
.warning-warning .warning-title {
  color: #dc2626;
  text-decoration-color: #dc2626;
}

.warning-warning .warning-content {
  color: #b91c1c;
  text-decoration-color: #dc2626;
}

@media (prefers-color-scheme: dark) {
  .warning-warning .warning-title {
    color: #ef4444;
    text-decoration-color: #ef4444;
  }

  .warning-warning .warning-content {
    color: #dc2626;
    text-decoration-color: #ef4444;
  }
}

.warning-danger .warning-title {
  color: #ef4444;
  text-decoration-color: #ef4444;
}

.warning-danger .warning-content {
  text-decoration-color: #ef4444;
}

@media (prefers-color-scheme: dark) {
  .warning-danger .warning-title {
    color: #f87171;
    text-decoration-color: #f87171;
  }

  .warning-danger .warning-content {
    text-decoration-color: #f87171;
  }
}

/* Post Tags */
.post-tags {
  margin-top: var(--space-4);
  color: var(--color-text-muted);
}

.post-tag {
  color: var(--color-accent);
  text-decoration: underline;
}

.post-tag:hover {
  color: var(--color-accent-hover);
}

/* Related Posts */
.related-posts {
  margin-top: var(--space-4);
  margin-bottom: var(--space-6);
}

.related-posts h3 {
  margin-top: 0;
  margin-bottom: var(--space-4);
}

.related-posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-posts-list li {
  margin-bottom: var(--space-3);
}

.related-posts-list a {
  color: var(--color-accent);
  text-decoration: underline;
}

.related-posts-list a:hover {
  color: var(--color-accent-hover);
}

/* Footer */
.site-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-12) 0 var(--space-8);
  border-top: 2px solid var(--color-border);
  margin-top: var(--space-12);
  background-color: var(--color-bg);
}

.footer-left {
  order: 1;
}

.footer-center {
  order: 2;
  text-align: center;
}

.footer-right {
  order: 3;
  text-align: center;
}

.site-footer a {
  color: var(--color-text-muted);
  text-decoration: underline;
  cursor: var(--cursor-pointer);
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--color-accent);
}

/* Social Icons */
.social-icons {
  display: flex;
  gap: var(--space-6);
  align-items: center;
  justify-content: center;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
  cursor: var(--cursor-pointer);
}

.social-icon:hover {
  color: var(--color-text);
  transform: translateY(-2px);
}

/* Desktop footer layout */
@media (min-width: 768px) {
  .site-footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-10) 0;
  }

  .footer-left {
    order: 1;
  }

  .footer-center {
    order: 2;
  }

  .footer-right {
    order: 3;
    text-align: right;
  }

  .social-icons {
    justify-content: flex-start;
  }
}

/* MDX Components */
.mdx-image-figure {
  margin: var(--space-xl) 0;
}

/* Code Block Component */
.code-block {
  margin: var(--space-xl) 0;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.code-header {
  background-color: var(--color-bg-alt);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

.code-title {
  color: var(--color-text);
  font-weight: 600;
}

.code-filename {
  color: var(--color-text-muted);
  font-style: italic;
}

.code-content {
  position: relative;
}

.code-block pre {
  margin: 0;
  border: none;
  border-radius: 0;
}

.code-block code {
  display: block;
  padding: var(--space-lg);
  background: transparent;
  border: none;
  font-size: 0.9em;
  line-height: 1.5;
}

.mdx-image {
  cursor: zoom-in;
  transition: opacity 0.2s;
}

.mdx-image:hover {
  opacity: 0.9;
}

.mdx-image-figure figcaption {
  margin-top: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
}

/* AI Badge Inline */
.ai-badge-inline {
  display: inline;
  color: var(--color-accent);
  text-decoration: none;
}

.ai-badge-inline svg {
  display: inline-block;
  width: 15px;
  height: 15px;
  vertical-align: middle;
  opacity: 0.6;
  margin-right: 0.25rem;
}

/* Image Dialog */
.image-dialog {
  padding: 0;
  border: none;
  background: transparent;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  overflow: visible;
}

.image-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
}

.image-dialog .zoomed-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  cursor: default;
}

.dialog-close {
  position: absolute;
  top: var(--space-xl);
  right: var(--space-xl);
  padding: var(--space-sm);
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--font-size-sm);
  font-family: var(--font-mono);
  font-weight: 400;
  cursor: var(--cursor-pointer);
  transition:
    color 0.2s,
    transform 0.2s;
  text-transform: lowercase;
  letter-spacing: 0.1em;
  outline: none;
}

.dialog-close:hover {
  color: rgba(255, 255, 255, 1);
  transform: scale(1.05);
}

.dialog-close:focus {
  outline: none;
}

.dialog-close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* Header anchors */
.header-anchor {
  color: inherit;
  text-decoration: none;
  border: none;
  font-family: inherit;
}

.header-anchor:hover {
  color: inherit;
  border: none;
}

.header-anchor::before {
  content: "#";
  position: absolute;
  left: -1.5em;
  opacity: 0;
  transition: opacity 0.2s;
  color: var(--color-text-muted);
}

h1:hover .header-anchor::before,
h2:hover .header-anchor::before,
h3:hover .header-anchor::before,
h4:hover .header-anchor::before,
h5:hover .header-anchor::before,
h6:hover .header-anchor::before {
  opacity: 1;
}

/* TOC styling */
.table-of-contents {
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
}

.table-of-contents ol {
  margin: 0;
  padding-left: var(--space-lg);
}

.table-of-contents li {
  margin-bottom: var(--space-xs);
}

/* Utilities */
.text-muted {
  color: var(--color-text-muted);
}

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

/* Responsive */
@media (max-width: 1024px) {
  :root {
    --container-max: 90vw;
  }
}

/* Tablet navigation adjustments */
@media (max-width: 900px) {
  .nav-links {
    gap: var(--space-4);
  }

  .nav-links a {
    font-size: var(--font-size-sm);
    padding: var(--space-2);
  }
}

@media (max-width: 640px) {
  :root {
    --container-max: 95vw;
  }

  .site-header {
    padding: var(--space-4) 0;
  }

  .nav {
    gap: var(--space-4);
  }

  .nav-title {
    font-size: var(--font-size-lg);
  }

  /* Show mobile menu toggle on mobile */
  .mobile-menu-toggle {
    display: block;
  }

  /* Mobile nav links - vertical dropdown menu */
  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--color-bg);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: calc(var(--space-8) + var(--space-12)) var(--space-6) var(--space-8);
    margin: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    border-bottom: 1px solid var(--color-border);
    z-index: 999;
  }

  /* Show menu when toggle is active */
  .mobile-menu-toggle[aria-expanded="true"] ~ .nav-links {
    max-height: 100vh;
    opacity: 1;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  /* Hide scroll to top button on mobile */
  .scroll-to-top-link {
    display: none !important;
  }

  .nav-links a {
    font-size: var(--font-size-md);
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    width: 100%;
  }

  .nav-links a::after {
    display: none;
  }

  .dialog-close {
    top: var(--space-sm);
    right: var(--space-sm);
  }

  .post-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .post-meta {
    order: -1;
  }

  .post-title {
    font-size: var(--font-size-xl);
  }

  .featured-post .post-title {
    font-size: var(--font-size-3xl);
  }

  .article-header {
    flex-direction: column;
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }

  .article-title {
    font-size: clamp(1.5rem, 4vw, 1.75rem);
  }

  .scroll-to-top-link {
    align-self: flex-end;
  }

  /* Mobile footer improvements */
  .site-footer {
    padding: var(--space-8) 0;
    text-align: center;
  }

  .footer-center {
    font-size: var(--font-size-sm);
  }

  .footer-right {
    font-size: var(--font-size-sm);
  }
}

/* Social embed component */
.social-embed {
  margin: var(--space-8) 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.social-embed-mastodon iframe {
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-alt);
  max-width: 100%;
}

.social-embed-bluesky {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.social-embed-bluesky .bluesky-embed {
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-4);
  background: var(--color-bg-alt);
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--font-size-md);
}

.social-embed-bluesky .bluesky-embed a {
  color: var(--color-accent);
  text-decoration: none;
}

.social-embed-bluesky .bluesky-embed a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.social-embed-error {
  padding: var(--space-4);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  margin: var(--space-4) 0;
}

/* Mobile styles for social embeds */
@media (max-width: 640px) {
  .social-embed-mastodon iframe {
    width: 100%;
    height: auto;
    min-height: 400px;
  }

  .social-embed-bluesky {
    max-width: 100%;
  }
}

/* Mastodon Archive Styles */
.mastodon-page {
  max-width: 800px;
  margin: 0 auto;
}

.mastodon-page h1 {
  font-family: var(--font-serif);
  font-weight: 700;
}

.mastodon-intro {
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
  font-size: var(--font-size-reading);
}

.mastodon-intro a {
  color: var(--color-accent);
  text-decoration: none;
}

.mastodon-intro a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.mastodon-list {
  padding: 0;
  max-width: 800px;
  margin: 0 auto;
}

.mastodon-day-group {
  margin-bottom: var(--space-6);
}

.mastodon-day-header {
  display: block;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
}

.mastodon-content {
  background: transparent;
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.mastodon-body {
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  color: var(--color-text);
}

.mastodon-body p {
  margin-bottom: var(--space-2);
}

.mastodon-body p:last-child {
  margin-bottom: 0;
}

/* Handle Mastodon-specific HTML elements */
.mastodon-body a {
  color: var(--color-accent);
  text-decoration: none;
}

.mastodon-body a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.mastodon-body .mention,
.mastodon-body .hashtag {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.mastodon-body .mention:hover,
.mastodon-body .hashtag:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.mastodon-body .ellipsis::after {
  content: "…";
}

.mastodon-body .invisible {
  display: none;
}

.mastodon-media {
  margin: var(--space-2) 0 0 0;
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.mastodon-media img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.mastodon-footer {
  margin-top: var(--space-2);
}

.mastodon-footer a {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  text-decoration: none;
  font-family: var(--font-mono);
}

.mastodon-footer a:hover {
  color: var(--color-accent);
}

/* Mastodon posts on homepage */
.post-type-mastodon {
  border-left: 3px solid var(--color-accent);
  padding-left: var(--space-4);
}

.post-type-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  background: var(--color-accent);
  color: var(--color-bg);
  font-size: var(--font-size-sm);
  border-radius: var(--border-radius);
  font-weight: 500;
  font-family: var(--font-mono);
}

.mastodon-preview {
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  color: var(--color-text-muted);
  margin: var(--space-2) 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mastodon-preview p {
  margin: 0;
  display: inline;
}

.mastodon-preview a {
  color: var(--color-accent);
  text-decoration: none;
}

.post-link {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  margin-top: var(--space-2);
  display: inline-block;
}

.post-link:hover {
  color: var(--color-accent);
}

/* Mobile styles for Mastodon archive */
@media (max-width: 640px) {
  .mastodon-media {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .mastodon-media img {
    height: 150px;
  }

  .mastodon-content {
    padding: var(--space-2);
  }

  .mastodon-day-header {
    font-size: var(--font-size-md);
  }
}

/* Mastodon Live Feed - Homepage */
.mastodon-feed-section {
  margin: var(--space-10) 0;
  padding: var(--space-6) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.mastodon-feed-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.mastodon-feed-header-bar h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin: 0;
  font-family: var(--font-serif);
}

.mastodon-feed-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-family: var(--font-mono);
}

.mastodon-feed-link:hover {
  color: var(--color-accent);
}

.mastodon-feed-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.mastodon-feed-scroll::-webkit-scrollbar {
  height: 8px;
}

.mastodon-feed-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.mastodon-feed-scroll::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.mastodon-feed-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.mastodon-feed-container {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-2) 0;
}

.mastodon-feed-card {
  flex: 0 0 auto;
  width: 350px;
  max-width: 80vw;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-alt);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scroll-snap-align: start;
}

.mastodon-feed-header time {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.mastodon-feed-content {
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  overflow: hidden;
}

.mastodon-feed-content p {
  margin-bottom: var(--space-2);
}

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

.mastodon-feed-content a {
  color: var(--color-accent);
  text-decoration: none;
}

.mastodon-feed-content a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.mastodon-feed-media {
  margin: var(--space-2) 0;
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.mastodon-feed-media img {
  width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  object-fit: cover;
  max-height: 300px;
}

.mastodon-feed-footer {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.mastodon-feed-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-family: var(--font-mono);
}

.mastodon-feed-footer a:hover {
  color: var(--color-accent);
}

/* Loading state */
.mastodon-feed-loading {
  display: flex;
  gap: var(--space-4);
}

.mastodon-feed-skeleton {
  flex: 0 0 auto;
  width: 350px;
  height: 300px;
  background: linear-gradient(
    90deg,
    var(--color-bg-alt) 0%,
    var(--color-border) 50%,
    var(--color-bg-alt) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Error state */
.mastodon-feed-error {
  padding: var(--space-8);
  text-align: center;
  color: var(--color-text-muted);
}

.mastodon-feed-error a {
  color: var(--color-accent);
  text-decoration: none;
}

.mastodon-feed-error a:hover {
  text-decoration: underline;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .mastodon-feed-section {
    margin: var(--space-8) 0;
    padding: var(--space-4) 0;
  }

  .mastodon-feed-header-bar h2 {
    font-size: var(--font-size-xl);
  }

  .mastodon-feed-card {
    width: 300px;
    max-width: 85vw;
  }

  .mastodon-feed-container {
    gap: var(--space-3);
  }
}

.github-repo-link,
.youtube-video-link {
  display: inline;
  white-space: nowrap;
}

.github-repo-link svg,
.youtube-video-link svg {
  display: inline-block;
  width: 15px;
  height: 15px;
  color: var(--color-text-muted);
  vertical-align: middle;
  margin-right: 0.25rem;
}

.github-repo-link a,
.youtube-video-link a {
  color: var(--color-accent);
  text-decoration: underline;
  border: none;
}

.github-repo-link a:hover,
.youtube-video-link a:hover {
  color: var(--color-accent-hover);
  border: none;
}

/* GitHub Repository Popup */
.github-repo-link {
  position: relative;
  display: inline;
}

/* Define anchor on the link */
.github-link-anchor {
  anchor-name: --github-link;
}

.github-popup {
  display: block;
  position: absolute;
  position-anchor: --github-link;

  /* Default: centered above the link */
  bottom: anchor(top);
  left: anchor(center);
  translate: -50% 0;
  margin-bottom: var(--space-3);

  /* Automatic fallback positioning when popup doesn't fit */
  position-try-options:
    --below-center,
    --above-left,
    --above-right,
    --below-left,
    --below-right;

  /* Visual styling */
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0;
  min-width: 280px;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  overflow: hidden;

  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  visibility: hidden;

  /* Smooth transition */
  transition: opacity 200ms ease, visibility 200ms ease;
  z-index: 100;
}

/* Position try fallbacks */
@position-try --below-center {
  top: anchor(bottom);
  bottom: auto;
  left: anchor(center);
  translate: -50% 0;
  margin-top: var(--space-3);
  margin-bottom: 0;
}

@position-try --above-left {
  bottom: anchor(top);
  left: anchor(left);
  translate: 0 0;
  margin-bottom: var(--space-3);
}

@position-try --above-right {
  bottom: anchor(top);
  right: anchor(right);
  left: auto;
  translate: 0 0;
  margin-bottom: var(--space-3);
}

@position-try --below-left {
  top: anchor(bottom);
  bottom: auto;
  left: anchor(left);
  translate: 0 0;
  margin-top: var(--space-3);
}

@position-try --below-right {
  top: anchor(bottom);
  bottom: auto;
  right: anchor(right);
  left: auto;
  translate: 0 0;
  margin-top: var(--space-3);
}

/* Show popup on hover */
.github-repo-link:hover .github-popup,
.github-link-anchor:focus + .github-popup {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* Popup content layout */
.github-popup-content {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

.github-popup-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
  border-bottom: 1px solid var(--color-border);
}

.github-popup-avatar {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}

.github-popup-title {
  flex: 1;
  min-width: 0;
}

.github-popup-repo-name {
  color: var(--color-text);
  font-weight: 600;
  font-size: var(--font-size-base);
  margin-bottom: var(--space-1);
  word-break: break-word;
}

.github-popup-description {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.github-popup-stats {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-bg-alt);
}

.github-popup-stat {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.github-popup-stat svg {
  width: 14px;
  height: 14px;
  color: var(--color-accent);
  flex-shrink: 0;
}

/* Loading and error states */
.github-popup-loading,
.github-popup-error {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-style: italic;
  padding: var(--space-2);
}

.github-popup-error {
  color: #ef4444;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .github-popup {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .github-popup {
    transition: none;
  }
}
