/* ============================================
   PERSONAL WEBSITE - STYLE.CSS
   Minimalistic, edgy design with grey-orange palette
   ============================================ */

/* ============================================
   CSS VARIABLES & DESIGN TOKENS
   ============================================ */
:root {
  /* Light theme colors */
  --bg-primary: #d2cdc6;
  --bg-secondary: #c7c2bb;
  --bg-tertiary: #aea69b;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #888888;
  --accent: #d7801d;
  --accent-hover: #b45309;
  --accent-bg: #d7801d;
  --border: #a6a4a0;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-2xl: 8rem;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1.1rem;
  --font-size-lg: 1.375rem;
  --font-size-xl: 1.65rem;
  --font-size-2xl: 2.2rem;
  --font-size-3xl: 3.3rem;
  --font-size-4xl: 4.4rem;

  /* Layout */
  --max-width: 1200px;
  --header-height: 60px;
  --sidebar-width: 250px;
  --content-padding: 2rem;
}

/* Dark theme (default) */
[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #252525;
  --bg-tertiary: #333333;
  --text-primary: #f5f5f5;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --accent: #d76513;
  --accent-hover: #fb923c;
  --accent-bg: var(--accent);
  --border: #404040;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Thin scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background-color 0.3s ease;
}

.header__container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__logo {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.header__logo:hover {
  color: var(--accent);
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header__nav-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.header__nav-link {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.2s ease;
  padding: var(--space-sm) var(--space-md);
  display: block;
}

.header__nav-link:hover,
.header__nav-link.active {
  color: var(--text-primary);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Mobile menu */
.header__burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.header__burger span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  transition: transform 0.3s ease;
}

@media (max-width: 768px) {
  .header__burger {
    display: flex;
  }

  .header__nav-links {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-md);
    border-bottom: 1px solid var(--border);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .header__nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .header__burger {
    order: 2;
  }

  .theme-toggle {
    order: 1;
  }
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) 0;
}

.landing-footer {
  margin-top: 0;
}

.footer__container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer__copyright {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.footer__links {
  display: flex;
  gap: var(--space-md);
}

.footer__link {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.footer__link:hover {
  color: var(--text-primary);
}

.footer__link svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
.main {
  flex: 1;
  /* margin-top: var(--header-height); */
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

/* ============================================
   LANDING PAGE - TWO-STATE SCROLL
   ============================================ */
.landing-wrapper {
  height: 100vh;
  overflow-y: auto;
}

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  position: relative;
  transition: min-height 0.4s ease-out;
  padding-top: var(--space-2xl);
}

.hero.scrolled {
  min-height: 50vh;
}

.hero__content {
  max-width: 600px;
}

.hero__name {
  font-size: var(--font-size-4xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.hero__title {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.hero__info {
  margin-bottom: var(--space-lg);
}

.hero__info-row {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.hero__info-label {
  color: var(--text-muted);
}

.hero__info-value {
  color: var(--accent);
}

.hero__socials {
  display: flex;
  gap: var(--space-md);
}

.hero__social-link {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.hero__social-link:hover {
  color: var(--accent);
}

.hero__social-link svg {
  width: 24px;
  height: 24px;
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: var(--space-2xl);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--accent);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.3s ease;
  animation: bounce 2s infinite;
  padding: var(--space-md);
}

.scroll-indicator.hidden {
  opacity: 0;
  pointer-events: none;
}

.scroll-indicator svg {
  width: 24px;
  height: 24px;
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  40% {
    transform: translateX(-50%) translateY(-10px);
  }

  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/* Bio Section */
.bio {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg);
}

.bio__title {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.bio__content {
  max-width: 650px;
}

.bio__content p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.8;
}

.bio__content a {
  color: var(--accent);
}

@media (max-width: 768px) {
  .hero {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
  }

  .hero__name {
    font-size: var(--font-size-2xl);
  }

  .hero__title {
    font-size: var(--font-size-base);
  }
}

/* ============================================
   CV PAGE
   ============================================ */

.cv__header {
  margin-bottom: var(--space-lg);
}

/* Common page title base class */
.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: var(--space-lg) 0;
  letter-spacing: -0.02em;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
}

/* .page-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, var(--accent), transparent);
  opacity: 0.5;
} */

.cv__section {
  margin-bottom: var(--space-md);
}

.cv__section-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-lg);
  margin-top: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--accent);
}

.cv__entry {
  display: grid;
  grid-template-columns: 12em 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.cv__entry:last-child {
  border-bottom: none;
}

.cv__entry-meta {
  font-size: var(--font-size-sm);
}

.cv__entry-location {
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.cv__entry-date {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.cv__entry-content {
  flex: 1;
}

.cv__entry-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.cv__entry-subtitle {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.cv__entry-description {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.cv__entry-list {
  list-style: disc;
  padding-left: var(--space-lg);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.cv__entry-list li {
  margin-bottom: var(--space-xs);
}

/* Row-based entries with subentries */
.cv__entry--with-rows {
  display: block;
  padding-bottom: var(--space-md);
}

.cv__entry-row {
  display: grid;
  grid-template-columns: 12em 1fr;
  gap: var(--space-lg);
}

.cv__entry-row-meta {
  font-size: var(--font-size-sm);
  text-align: left;
}

.cv__entry-row-content {
  flex: 1;
}

/* Subtitle rows */
.cv__entry-row--sub {
  margin-top: var(--space-sm);
}

.cv__subentry-title {
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

@media (max-width: 768px) {
  .cv__entry {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .cv__entry-row {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }

  .cv__entry-row-meta {
    text-align: left;
  }
}

/* ============================================
   WORKS PAGE - RIGHT SIDEBAR LAYOUT
   ============================================ */
.works {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  grid-template-areas:
    "header header"
    "topbar sidebar"
    "main sidebar";
  gap: var(--space-lg) var(--space-xl);
}

.works__header {
  grid-area: header;
  margin-bottom: 0;
}

.works__topbar {
  grid-area: topbar;
  align-self: start;
}

.works__sidebar {
  grid-area: sidebar;
  position: sticky;
  top: calc(var(--header-height) + var(--space-xl));
  height: fit-content;
}

.works__main {
  grid-area: main;
  min-width: 0;
}

/* Top bar: search + view toggle */
.works__topbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.works__search {
  flex: 1;
}

.works__search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background-color: var(--bg-secondary);
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
}

.works__search-input::placeholder {
  color: var(--text-muted);
}

.works__search-input:focus {
  outline: none;
  background-color: var(--bg-tertiary);
}

/* Filters in sidebar */
.works__filter-group {
  margin-bottom: var(--space-lg);
}

.works__filter-label {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  display: block;
}

.works__filter-pills {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.works__filter-pill {
  padding: var(--space-xs) var(--space-md);
  background-color: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.works__filter-pill:hover {
  color: var(--text-primary);
}

.works__filter-pill.active {
  background-color: var(--accent-bg);
  color: var(--bg-primary);
}

.works__filter-pill-count {
  margin-left: var(--space-xs);
  opacity: 0.6;
}

/* Tag filter pills */
.works__filter-container .works__filter-pill {
  letter-spacing: 0.25em;
}

/* Tag filter pills - puzzle layout */
.works__tags-container {
  flex-direction: row !important;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.works__tags-container::after {
  content: '';
  flex: 999 999 0;
  height: 0;
}

.works__tags-container .works__filter-pill {
  padding: var(--space-sm) var(--space-sm);
  /* border: 1px solid var(--border); */
  background-color: var(--bg-secondary);
  text-align: center;
  flex: 1 1 auto;
  min-width: fit-content;
}

.works__tags-container .works__filter-pill.active {
  background-color: var(--accent-bg);
  border: none;
  /* border-color: var(--accent); */
}

/* View toggle */
.works__view-toggle {
  display: flex;
  gap: var(--space-sm);
}

.works__view-btn {
  padding: var(--space-sm);
  background-color: var(--bg-secondary);
  /* border: 1px solid var(--border); */
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.works__view-btn:hover {
  color: var(--text-primary);
}

.works__view-btn.active {
  background-color: var(--accent-bg);
  /* border-color: var(--accent); */
  color: var(--bg-primary);
}

.works__view-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.works__count {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

@media (max-width: 900px) {
  .works {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "topbar"
      "sidebar"
      "main";
  }

  .works__sidebar {
    position: static;
  }

  .works__filter-pills {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* Works Grid */
.works__grid {
  display: grid;
  gap: var(--space-md);
}

.works__grid.gallery {
  grid-template-columns: repeat(3, 1fr);
}

.works__grid.list {
  grid-template-columns: 1fr;
}

@media (max-width: 1024px) {
  .works__grid.gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .works__grid.gallery {
    grid-template-columns: 1fr;
  }
}

/* Work Card */
.work-card {
  background-color: var(--bg-secondary);
  transition: background-color 0.2s ease;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

/* .work-card:hover {
  background-color: var(--bg-tertiary);
} */

.work-card__thumbnail {
  aspect-ratio: 16/9;
  overflow: hidden;
  background-color: var(--bg-tertiary);
}

.work-card__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-card__content {
  padding: var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.work-card__title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  line-height: 1.3;
  transition: color 0.2s ease;
}

.work-card:hover .work-card__title {
  color: var(--accent);
}

.work-card__subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.work-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.work-card__type {
  text-transform: uppercase;
  color: var(--accent);
}

/* List view card */
.works__grid.list .work-card {
  flex-direction: row;
}

.works__grid.list .work-card__thumbnail {
  width: 120px;
  min-width: 120px;
  aspect-ratio: 1;
}

.works__grid.list .work-card__content {
  padding: var(--space-md) var(--space-lg);
}

@media (max-width: 640px) {
  .works__grid.list .work-card {
    flex-direction: row;
  }

  .works__grid.list .work-card__thumbnail {
    display: none;
  }

  .works__grid.list .work-card__subtitle {
    display: none;
  }
}

/* ============================================
   ARTICLE PAGE
   ============================================ */
.article {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: var(--space-2xl);
  padding-top: var(--space-xl);
}

.article__main {
  max-width: 800px;
  min-width: 0;
  width: 100%;
}

.article__header {
  margin-bottom: var(--space-xl);
}

.article__type {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.article__title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.article__meta {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.article__meta span {
  margin-right: var(--space-md);
}

.article__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.article__tag {
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

/* Article content */
.article__content {
  line-height: 1.8;
  overflow-wrap: break-word;
  word-wrap: break-word;
  min-width: 0;
  overflow-x: hidden;
}

/* Tables need horizontal scroll wrapper */
.article__content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  margin-bottom: var(--space-md);
  border-collapse: collapse;
}

/* Table cell styling */
.article__content th,
.article__content td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  color: var(--text-secondary);
}

/* Table header styling - bold with thin bottom border */
.article__content th {
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

/* Reset tr.header class that Pandoc generates (conflicts with page header) */
.article__content tr.header {
  /* Override any page header styles that might leak here */
  position: static;
  background: transparent;
  height: auto;
  z-index: auto;
}

.article__content h2 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.article__content h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.article__content p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

.article__content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article__content strong {
  color: var(--accent);
  font-weight: 600;
}

.article__content ul,
.article__content ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
  color: var(--text-secondary);
}

.article__content li {
  margin-bottom: var(--space-sm);
}

/* Inline code only - don't override Prism code blocks */
.article__content code:not([class*="language-"]) {
  background-color: var(--bg-secondary);
  padding: 0.2em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Pre blocks without Prism classes */
.article__content pre:not([class*="language-"]) {
  background-color: var(--bg-secondary);
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
  border: 1px solid var(--border);
  max-width: 100%;
}

.article__content pre code {
  background: none;
  padding: 0;
}

.article__content img {
  margin: var(--space-lg) 0;
  border: 1px solid var(--border);
}

.article__content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* TOC Sidebar */
.article__toc {
  position: sticky;
  top: calc(var(--header-height) + var(--space-xl));
  max-height: calc(100vh - var(--header-height) - var(--space-2xl));
  overflow-y: auto;
}

.article__toc-title {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.article__toc-list {
  list-style: none;
}

.article__toc-item {
  margin-bottom: var(--space-sm);
}

.article__toc-link {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  padding-left: var(--space-sm);
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}

.article__toc-link:hover {
  color: var(--text-primary);
}

.article__toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.article__toc-link.level-3 {
  padding-left: var(--space-lg);
  font-size: var(--font-size-xs);
}

@media (max-width: 1024px) {
  .article {
    grid-template-columns: 1fr;
  }

  .article__toc {
    display: none;
  }

  .article__toc.toc-overlay-open {
    display: block;
    position: fixed;
    bottom: var(--space-lg);
    right: calc(var(--space-lg) + 56px);
    top: auto;
    left: auto;
    width: 260px;
    max-height: 50vh;
    overflow-y: auto;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    z-index: 999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.2s ease-out;
  }
}

/* TOC Floating Action Button */
.toc-fab {
  display: none;
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--accent-bg);
  color: var(--bg-primary);
  border: none;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.toc-fab:hover {
  transform: scale(1.1);
  background-color: var(--accent-hover);
}

.toc-fab svg {
  width: 24px;
  height: 24px;
}

.toc-fab.active {
  background-color: var(--text-muted);
}

@media (max-width: 1024px) {
  .toc-fab {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================================
   UTILITIES
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* ============================================
   SYNTAX HIGHLIGHTING (Prism.js)
   ============================================ */

/* Override Prism theme to match site colors */
pre[class*="language-"],
code[class*="language-"] {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  tab-size: 4;
}

/* Commented out - these overrides were for Prism Tomorrow theme
   Duotone Dark theme has its own colors that work better */
/*
[data-theme="dark"] pre[class*="language-"] {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

[data-theme="light"] pre[class*="language-"] {
  background-color: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

[data-theme="light"] code[class*="language-"] {
  color: #383a42;
}

[data-theme="light"] .token.comment,
[data-theme="light"] .token.prolog,
[data-theme="light"] .token.doctype,
[data-theme="light"] .token.cdata {
  color: #a0a1a7;
}

[data-theme="light"] .token.punctuation {
  color: #383a42;
}

[data-theme="light"] .token.property,
[data-theme="light"] .token.tag,
[data-theme="light"] .token.boolean,
[data-theme="light"] .token.number,
[data-theme="light"] .token.constant,
[data-theme="light"] .token.symbol {
  color: #986801;
}

[data-theme="light"] .token.selector,
[data-theme="light"] .token.attr-name,
[data-theme="light"] .token.string,
[data-theme="light"] .token.char,
[data-theme="light"] .token.builtin {
  color: #50a14f;
}

[data-theme="light"] .token.operator,
[data-theme="light"] .token.entity,
[data-theme="light"] .token.url,
[data-theme="light"] .language-css .token.string,
[data-theme="light"] .style .token.string,
[data-theme="light"] .token.variable {
  color: #0184bc;
}

[data-theme="light"] .token.atrule,
[data-theme="light"] .token.attr-value,
[data-theme="light"] .token.keyword {
  color: #a626a4;
}

[data-theme="light"] .token.function,
[data-theme="light"] .token.class-name {
  color: #4078f2;
}

[data-theme="light"] .token.regex,
[data-theme="light"] .token.important {
  color: #e45649;
}
*/

/* Line numbers - non-selectable */
.line-numbers .line-numbers-rows {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  pointer-events: none;
  border-right: 1px solid var(--border);
  padding-right: var(--space-sm);
}

.line-numbers-rows>span::before {
  color: var(--text-muted);
}

/* Code block container */
.article__content pre[class*="language-"] {
  position: relative;
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  padding-left: 3.5em;
  overflow-x: auto;
  max-width: 100%;
}

/* Copy button styling */
div.code-toolbar>.toolbar {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  opacity: 0;
  transition: opacity 0.2s ease;
}

div.code-toolbar:hover>.toolbar {
  opacity: 1;
}

div.code-toolbar>.toolbar>.toolbar-item>button,
div.code-toolbar>.toolbar>.toolbar-item>span {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5em !important;
  font-size: var(--font-size-xs);
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.2s ease;
}

div.code-toolbar>.toolbar>.toolbar-item>button:hover {
  background: var(--accent-bg);
  color: var(--bg-primary);
  border-color: var(--accent);
}

div.code-toolbar>.toolbar>.toolbar-item>button:focus {
  outline: none;
}

/* Line numbers */
pre.numberSource code>span>a:first-child::before {
  content: attr(data-line-number);
  color: var(--text-muted);
  text-align: right;
  padding-right: var(--space-md);
  min-width: 2.5em;
  display: inline-block;
  border-right: 1px solid var(--border);
  margin-right: var(--space-md);
}