/* Import Custom Fonts */
@import url('https://fonts.googleapis.com/css2?family=Aclonica&family=Merriweather:wght@300;400;700&family=Fira+Code&display=swap');

:root,
:root.dark-mode,
html,
html.dark-mode {
  /* Override PreTeXt theme colors - cyan/purple instead of blue/red */
  --primary-color: #14b5ff !important;
  --secondary-color: #7952f5 !important;
  --primary-color-dark: #0a95eb !important;
  --primary-color-light: #00e8ff !important;
  --secondary-color-dark: #5e17eb !important;
  --secondary-color-light: #9b7dff !important;
  --primary-color-gray-5: rgba(20, 181, 255, 0.15) !important;
  
  /* TOC active item overrides - these are the actual variables PreTeXt uses */
  --tocitem-active-background: rgba(20, 181, 255, 0.2) !important;
  --tocitem-active-text-color: #00e8ff !important;
  --tocitem-active-border-color: rgba(20, 181, 255, 0.4) !important;
  --tocitem-active-backgrounde: rgba(20, 181, 255, 0.15) !important;
  
  /* TOC specific overrides */
  --toc-item-active-background: linear-gradient(135deg, rgba(20, 181, 255, 0.2), rgba(121, 82, 245, 0.15)) !important;
  --toc-active-background: linear-gradient(135deg, rgba(20, 181, 255, 0.2), rgba(121, 82, 245, 0.15)) !important;
  --toc-active-border-color: rgba(20, 181, 255, 0.4) !important;
  
  /* Colors - Matching original design */
  --color-bg: #0d1117;
  --color-surface: #161b22;
  --color-primary: #14b5ff;
  --color-secondary: #7952f5;
  --color-text: whitesmoke;
  --color-muted: #8b949e;
  --color-link: #7652f5;
  --color-link-hover: #5e17eb;
  --color-math: #00f5db;
  --color-warning: #ffa657;

  /* Gradients */
  --gradient-light-to-dark-blue: linear-gradient(to right bottom, #00e8ff, #14b5ff, #3a98ff, #0070eb);
  --gradient-cyan-to-blue: linear-gradient(130deg, #00ffee, #0a95eb);
  --gradient-blue-to-purple: linear-gradient(to right bottom, #00e8ff, #14b5ff, #5280ff, #7952f5);

  /* Typography */
  --font-heading: 'Aclonica', sans-serif;
  --font-body: 'Merriweather', Georgia, serif;
  --font-mono: 'Fira Code', monospace;
}

/* Global Background & Body Styling */
body.pretext {
  background-image: url('wisp.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  font-family: var(--font-body) !important;
  color: var(--color-text) !important;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Ensure page wrapper takes full height */
.ptx-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.ptx-page .ptx-main {
  flex: 1;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.5);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00ffee, #14b5ff);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #00ffff, #00e8ff);
}

/* Header & Masthead */
.ptx-masthead {
  background: rgba(0, 0, 0, 0.6) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ptx-masthead .title-container {
  text-align: left !important;
  justify-content: flex-start !important;
}

.ptx-masthead .title-container h1 {
  font-family: var(--font-heading) !important;
  font-size: 1.8rem !important;
  background: var(--gradient-cyan-to-blue);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ptx-masthead .title-container h1 a {
  background: var(--gradient-cyan-to-blue);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ptx-masthead .byline {
  color: var(--color-muted) !important;
}

.ptx-masthead .logo-link img {
  height: 50px;
  margin-right: 1rem;
  filter: drop-shadow(0 0 8px rgba(0, 232, 255, 0.4));
}

/* Add logo before title */
.ptx-masthead .title-container::before {
  content: '';
  display: inline-block;
  width: 50px;
  height: 50px;
  background-image: url('logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  margin-right: 1rem;
  vertical-align: middle;
  filter: drop-shadow(0 0 8px rgba(0, 232, 255, 0.4));
}

/* Sidebar & TOC */
.ptx-page {
  display: grid !important;
  grid-template-columns: 350px 1fr !important;
  grid-template-areas: "sidebar main" !important;
}

.ptx-sidebar {
  grid-area: sidebar !important;
  width: 350px !important;
  min-width: 350px !important;
  max-width: 350px !important;
  background: rgba(13, 17, 23, 0.4) !important;
  border-right: 1px solid rgba(20, 181, 255, 0.2);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3), inset -1px 0 0 rgba(255, 255, 255, 0.1);
  overflow-y: auto !important;
  height: 100vh !important;
  position: sticky !important;
  top: 0 !important;
}

.ptx-main {
  grid-area: main !important;
}

.ptx-sidebar .ptx-toc {
  font-family: var(--font-heading);
  padding: 1rem !important;
}

/* Remove all default TOC list styling */
.ptx-toc ul,
.ptx-toc ul.structural,
.ptx-toc ul li {
  list-style: none !important;
  list-style-type: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Reset text transforms from PreTeXt defaults */
.ptx-toc,
.ptx-toc *,
.ptx-toc .toc-title-box,
.ptx-toc .codenumber,
.ptx-toc .title {
  text-transform: none !important;
  font-variant: normal !important;
  letter-spacing: normal !important;
}

/* TOC Chapter headers (Prototypes, Tutorials, etc.) */
.ptx-toc ul.structural > li > .codenumber,
.ptx-toc ul.structural > li > .title {
  background: var(--gradient-cyan-to-blue);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: bold;
}

/* TOC links and items */
.ptx-toc a {
  color: var(--color-text) !important;
  transition: all 0.2s ease;
  text-decoration: none !important;
}

.ptx-toc ul.structural li,
.ptx-toc .toc-item {
  background: rgba(30, 35, 45, 0.9) !important;
  border: 1px solid rgba(60, 65, 75, 0.6) !important;
  border-radius: 12px !important;
  margin-bottom: 6px !important;
  padding: 0.5rem 0.75rem !important;
  transition: all 0.3s ease;
}

.ptx-toc ul.structural li:hover,
.ptx-toc .toc-item:hover {
  background: rgba(40, 50, 60, 0.95) !important;
  border-color: rgba(20, 181, 255, 0.4) !important;
}

/* FORCE override PreTeXt's toc-title-box backgrounds - ultra high specificity */
.ptx-sidebar .ptx-toc .toc-item .toc-title-box,
.ptx-sidebar .ptx-toc .toc-item.active .toc-title-box,
.ptx-sidebar .ptx-toc .toc-item.contains-active .toc-title-box,
.ptx-toc .toc-item .toc-title-box,
.ptx-toc .toc-item.active .toc-title-box,
.ptx-toc .toc-item.contains-active .toc-title-box,
nav.ptx-toc .toc-item .toc-title-box,
nav.ptx-toc .toc-item.active .toc-title-box,
nav.ptx-toc .toc-item.contains-active .toc-title-box,
.toc-title-box {
  background: transparent !important;
  background-color: transparent !important;
  border-color: transparent !important;
  border-radius: inherit !important;
}

/* SPECIAL: Override for toc-frontmatter which uses different color palette */
/* ALL folder styling - consistent very dark background (frontmatter, chapters, backmatter) */
/* ULTRA HIGH SPECIFICITY to override PreTeXt defaults */
body.pretext nav#ptx-toc.ptx-toc li.toc-item.toc-frontmatter,
body.pretext nav#ptx-toc.ptx-toc li.toc-item.toc-frontmatter.contains-active,
body.pretext nav#ptx-toc.ptx-toc li.toc-item.toc-frontmatter.active,
body.pretext nav#ptx-toc.ptx-toc li.toc-item.toc-backmatter,
body.pretext nav#ptx-toc.ptx-toc li.toc-item.toc-backmatter.contains-active,
body.pretext nav#ptx-toc.ptx-toc li.toc-item.toc-backmatter.active,
body.pretext nav#ptx-toc.ptx-toc li.toc-item.toc-chapter,
body.pretext nav#ptx-toc.ptx-toc li.toc-item.toc-chapter.contains-active,
body.pretext nav#ptx-toc.ptx-toc li.toc-item.toc-chapter.active,
body.pretext .ptx-toc li.toc-frontmatter,
body.pretext .ptx-toc li.toc-frontmatter.contains-active,
body.pretext .ptx-toc li.toc-backmatter,
body.pretext .ptx-toc li.toc-backmatter.contains-active,
body.pretext .ptx-toc li.toc-chapter,
body.pretext .ptx-toc li.toc-chapter.contains-active,
li.toc-item.toc-frontmatter,
li.toc-item.toc-frontmatter.contains-active,
li.toc-item.toc-frontmatter.active,
.ptx-toc li.toc-frontmatter,
.ptx-toc li.toc-frontmatter.contains-active,
.ptx-toc li.toc-frontmatter.active,
nav.ptx-toc li.toc-frontmatter.contains-active,
#ptx-sidebar .ptx-toc li.toc-frontmatter.contains-active,
li.toc-item.toc-backmatter,
li.toc-item.toc-backmatter.contains-active,
li.toc-item.toc-backmatter.active,
.ptx-toc li.toc-backmatter,
.ptx-toc li.toc-backmatter.contains-active,
.ptx-toc li.toc-backmatter.active,
nav.ptx-toc li.toc-backmatter.contains-active,
#ptx-sidebar .ptx-toc li.toc-backmatter.contains-active,
li.toc-item.toc-chapter,
li.toc-item.toc-chapter.contains-active,
li.toc-item.toc-chapter.active,
.ptx-toc li.toc-chapter,
.ptx-toc li.toc-chapter.contains-active,
.ptx-toc li.toc-chapter.active,
nav.ptx-toc li.toc-chapter.contains-active,
#ptx-sidebar .ptx-toc li.toc-chapter.contains-active,
nav#ptx-toc .toc-chapter,
nav#ptx-toc .toc-chapter.contains-active,
nav#ptx-toc .toc-chapter.active {
  background: rgba(10, 8, 20, 0.98) !important;
  background-color: rgba(10, 8, 20, 0.98) !important;
  border: 1px solid rgba(80, 60, 140, 0.5) !important;
  border-radius: 12px !important;
}


/* Force the title-box to be transparent */
.ptx-toc li.toc-frontmatter.contains-active > .toc-title-box,
.ptx-toc li.toc-frontmatter.active > .toc-title-box,
.ptx-toc li.toc-backmatter.contains-active > .toc-title-box,
.ptx-toc li.toc-backmatter.active > .toc-title-box,
li.toc-frontmatter.contains-active > .toc-title-box,
li.toc-backmatter.contains-active > .toc-title-box {
  background: transparent !important;
  border-radius: 12px !important;
}

/* Note: .contains-active parent items (Front Matter, chapter headings) have 
   PreTeXt-default red styling that's extremely resistant to CSS overrides.
   The active leaf items (actual notes/sections) correctly show cyan gradient. */

/* Active/selected folder (contains-active) - very dark background for contrast with purple-blue text */
body.pretext .ptx-toc ul.structural li.contains-active,
body.pretext .ptx-toc li.contains-active,
body.pretext .ptx-toc .toc-item.contains-active,
.ptx-toc ul.structural li.contains-active,
.ptx-toc li.contains-active,
.ptx-toc .toc-item.contains-active,
.ptx-sidebar .ptx-toc .toc-item.contains-active,
nav.ptx-toc .toc-item.contains-active,
.ptx-toc .toc-frontmatter.contains-active,
.ptx-toc .toc-chapter.contains-active,
.ptx-toc .toc-backmatter.contains-active,
.ptx-toc li.toc-frontmatter.contains-active,
.ptx-toc li.toc-chapter.contains-active,
.ptx-toc li.toc-backmatter.contains-active,
nav#ptx-toc.ptx-toc .toc-item.toc-frontmatter.contains-active,
nav#ptx-toc.ptx-toc.depth2 ul.structural .toc-item.contains-active,
nav#ptx-toc.ptx-toc.depth2 ul.structural ul.structural .toc-item.contains-active,
#ptx-sidebar .ptx-toc .toc-item.contains-active {
  background: rgba(10, 8, 20, 0.98) !important;
  background-color: rgba(10, 8, 20, 0.98) !important;
  border: 1px solid rgba(80, 60, 140, 0.5) !important;
  border-radius: 12px !important;
}

/* Active leaf item (article/note selection) - same very dark styling */
body.pretext .ptx-toc ul.structural li.active,
body.pretext .ptx-toc li.active,
body.pretext .ptx-toc .toc-item.active,
.ptx-toc ul.structural li.active,
.ptx-toc li.active,
.ptx-toc .toc-item.active,
.ptx-sidebar .ptx-toc .toc-item.active,
nav.ptx-toc .toc-item.active,
.ptx-toc .toc-frontmatter.active,
.ptx-toc .toc-chapter.active,
.ptx-toc .toc-backmatter.active,
nav#ptx-toc.ptx-toc .toc-item.active:not(:has(.toc-item.active)),
#ptx-sidebar .ptx-toc .toc-item.active {
  background: rgba(10, 8, 20, 0.98) !important;
  background-color: rgba(10, 8, 20, 0.98) !important;
  border: 1px solid rgba(80, 60, 140, 0.5) !important;
  border-radius: 12px !important;
}

/* Root-level active sections - same very dark styling */
.ptx-toc ul.structural > li.active,
.ptx-toc ul.structural > li.contains-active,
.ptx-toc > ul > li.active,
.ptx-toc > ul > li.contains-active {
  background: rgba(10, 8, 20, 0.98) !important;
  background-color: rgba(10, 8, 20, 0.98) !important;
  border: 1px solid rgba(80, 60, 140, 0.5) !important;
  border-radius: 12px !important;
}

/* Nested items inside expanded folders - slightly lighter dark */
body.pretext .ptx-toc .toc-item.active .toc-item,
body.pretext .ptx-toc .toc-item.contains-active .toc-item,
.ptx-toc .toc-item.active .toc-item,
.ptx-toc .toc-item.contains-active .toc-item {
  background: rgba(15, 12, 28, 0.96) !important;
  background-color: rgba(15, 12, 28, 0.96) !important;
  border-radius: 12px !important;
}

/* The actual selected article/leaf item - distinct subtle purple highlight */
body.pretext .ptx-toc .toc-item.active .toc-item.active,
body.pretext .ptx-toc .toc-item.contains-active .toc-item.active,
.ptx-toc .toc-item.active .toc-item.active,
.ptx-toc .toc-item.contains-active .toc-item.active,
.ptx-toc .toc-item.active:not(:has(.toc-item)),
nav.ptx-toc .toc-item.active:not(:has(.toc-item)) {
  background: rgba(40, 30, 70, 0.6) !important;
  background-color: rgba(40, 30, 70, 0.6) !important;
  border: 1px solid rgba(120, 90, 180, 0.5) !important;
  border-radius: 12px !important;
}

/* Remove square containers from nested active lists */
.ptx-toc .toc-item.active > ul,
.ptx-toc .toc-item.contains-active > ul,
.ptx-toc .toc-item ul.active,
.ptx-toc ul.structural.active {
  background: transparent !important;
  background-color: transparent !important;
  border-radius: inherit !important;
  border: none !important;
  padding-left: 1rem !important;
}

.ptx-toc ul.structural li.active a,
.ptx-toc li.active a,
.ptx-toc li.active .codenumber,
.ptx-toc li.active .title,
.ptx-toc .toc-item.active a,
.ptx-toc .toc-item.active .codenumber,
.ptx-toc .toc-item.active .title {
  background: var(--gradient-cyan-to-blue);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: bold;
}

/* Folder titles when expanded - blue to purple gradient for contrast against blue background */
.ptx-toc .toc-item.contains-active > .toc-title-box a,
.ptx-toc .toc-item.contains-active > .toc-title-box .title,
.ptx-toc .toc-item.contains-active > .toc-title-box .codenumber,
.ptx-toc .toc-chapter.contains-active > .toc-title-box a,
.ptx-toc .toc-chapter.contains-active > .toc-title-box .title,
.ptx-toc .toc-chapter.contains-active > .toc-title-box .codenumber,
.ptx-toc .toc-frontmatter.contains-active > .toc-title-box a,
.ptx-toc .toc-frontmatter.contains-active > .toc-title-box .title,
.ptx-toc .toc-frontmatter.contains-active > .toc-title-box .codenumber,
.ptx-toc .toc-backmatter.contains-active > .toc-title-box a,
.ptx-toc .toc-backmatter.contains-active > .toc-title-box .title,
.ptx-toc .toc-backmatter.contains-active > .toc-title-box .codenumber {
  background: linear-gradient(130deg, #60a5fa, #a78bfa, #c084fc) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  font-weight: bold !important;
}

/* Folder expand/collapse arrow when expanded - matching gradient */
.ptx-toc .toc-item.contains-active > .toc-title-box .toc-chevron,
.ptx-toc .toc-item.contains-active > .toc-title-box .expand-collapse,
.ptx-toc .toc-item.contains-active > .toc-title-box button,
.ptx-toc .toc-chapter.contains-active > .toc-title-box .toc-chevron,
.ptx-toc .toc-frontmatter.contains-active > .toc-title-box .toc-chevron,
.ptx-toc .toc-backmatter.contains-active > .toc-title-box .toc-chevron {
  color: #a78bfa !important;
}

.ptx-toc .toc-item.contains-active > .toc-title-box .material-symbols-outlined,
.ptx-toc .toc-chapter.contains-active > .toc-title-box .material-symbols-outlined,
.ptx-toc .toc-frontmatter.contains-active > .toc-title-box .material-symbols-outlined,
.ptx-toc .toc-backmatter.contains-active > .toc-title-box .material-symbols-outlined {
  background: linear-gradient(130deg, #60a5fa, #a78bfa, #c084fc) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

/* Main Content Area */
.ptx-page > .ptx-main {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 2rem;
  min-height: 100vh;
}

.ptx-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Headings */
.ptx-content h1, .ptx-content h2, .ptx-content h3, .ptx-content h4, .ptx-content h5, .ptx-content h6 {
  font-family: var(--font-heading) !important;
}

.ptx-content h1.heading {
  font-size: 2.5rem !important;
  background: linear-gradient(130deg, #3b82f6, #8b5cf6, #d946ef) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  display: inline-block;
  margin-bottom: 1.5rem;
}

/* Section numbers and h2 headings - purple gradient matching sidebar */
.ptx-content h2.heading {
  font-size: 1.65rem !important;
  background: linear-gradient(130deg, #3b82f6, #8b5cf6, #d946ef) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(139, 92, 246, 0.4);
  letter-spacing: 0.5px;
}

.ptx-content h3.heading {
  background: linear-gradient(130deg, #3b82f6, #8b5cf6, #d946ef) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

/* Subsection heading - cyan to purple gradient */
.ptx-content h4.heading {
  font-size: 1.25rem !important;
  background: linear-gradient(120deg, #06b6d4, #8b5cf6, #d946ef) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  margin-top: 1.2rem;
  margin-bottom: 0.8rem;
}

/* Subsubsection heading - teal to purple gradient */
.ptx-content h5.heading {
  font-size: 1.1rem !important;
  background: linear-gradient(110deg, #14b8a6, #7c3aed, #c084fc) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  margin-top: 1rem;
  margin-bottom: 0.6rem;
}

/* Front Matter page title - matches website header gradient with more bright blue */
.ptx-content section.frontmatter h2.heading,
.ptx-content section.frontmatter h1.heading {
  background: linear-gradient(110deg, #00ffee, #00d4ff, #1e90ff) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  border-bottom-color: rgba(0, 255, 238, 0.3) !important;
}

.ptx-content section.introduction {
  background: rgba(255, 255, 255, 0.10);
  border-left: 3px solid var(--color-primary);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 4px;
}

.ptx-content section.introduction p {
  color: var(--color-muted);
  font-style: italic;
}

/* Paragraphs */
.ptx-content p {
  font-size: 1.05rem !important;
  line-height: 1.8;
  color: var(--color-text);
  margin-bottom: 1.5rem;
  letter-spacing: 0.2px;
}

/* Links - Cyan/Blue theme instead of purple */
.ptx-content a {
  color: #14b5ff !important;
  text-decoration: none;
  transition: color 0.3s ease;
}

.ptx-content a:hover {
  color: #00e8ff !important;
  text-decoration: underline;
}

/* Math Content */
.ptx-content .displaymath {
  background: rgba(0, 245, 219, 0.05) !important;
  border: 1px solid rgba(0, 245, 219, 0.2);
  border-radius: 8px;
  padding: 1.5rem !important;
  margin: 1.5rem 0 !important;
  overflow-x: auto;
}

.ptx-content mjx-container {
  color: var(--color-math) !important;
}

/* Definition, Theorem, Example blocks */
.ptx-content .definition-like,
.ptx-content .theorem-like,
.ptx-content .example-like,
.ptx-content .remark-like {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--color-primary);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.ptx-content .definition-like .heading,
.ptx-content .theorem-like .heading,
.ptx-content .example-like .heading {
  font-family: var(--font-heading) !important;
  color: var(--color-primary) !important;
  font-size: 1.1rem !important;
  margin-bottom: 1rem;
}

/* Alert boxes */
.ptx-content .assemblage-like {
  background: rgba(255, 166, 87, 0.1);
  border: 1px solid var(--color-warning);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
  color: var(--color-warning);
}

/* Code blocks - IBM Quantum Circuit Composer inspired */
.ptx-content code.code-inline,
.ptx-content pre {
  font-family: var(--font-mono) !important;
  background: #1a1d24 !important;
  color: #e0e0e0 !important;
  border: 1px solid rgba(60, 70, 85, 0.5);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.ptx-content code.code-inline {
  padding: 3px 8px;
  font-size: 0.88em;
  background: #252a33 !important;
  color: #5ccfe6 !important;
  border-radius: 4px;
  border: none;
}

.ptx-content pre {
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.92rem;
}

/* IBM Quantum-inspired syntax highlighting - colorful, clean, high contrast */
.ptx-content pre .keyword,
.ptx-content pre .kw { color: #5ccfe6 !important; } /* Cyan - keywords (include, if, qreg) */
.ptx-content pre .string,
.ptx-content pre .st { color: #c792ea !important; } /* Magenta/Purple - strings */
.ptx-content pre .comment,
.ptx-content pre .co { color: #546e7a !important; font-style: italic; } /* Muted gray - comments */
.ptx-content pre .function,
.ptx-content pre .fu { color: #82aaff !important; } /* Blue - functions */
.ptx-content pre .number,
.ptx-content pre .dv { color: #f9ae58 !important; } /* Gold/Yellow - numbers */
.ptx-content pre .operator,
.ptx-content pre .op { color: #89ddff !important; } /* Light cyan - operators */
.ptx-content pre .variable,
.ptx-content pre .va { color: #e0e0e0 !important; } /* Light gray - variables */
.ptx-content pre .type,
.ptx-content pre .dt { color: #ffcb6b !important; } /* Yellow - types */
.ptx-content pre .constant,
.ptx-content pre .cn { color: #f78c6c !important; } /* Orange - constants */
.ptx-content pre .builtin,
.ptx-content pre .bu { color: #5ccfe6 !important; } /* Cyan - builtins */
.ptx-content pre .attribute,
.ptx-content pre .at { color: #c792ea !important; } /* Purple - attributes */
.ptx-content pre .preprocessor,
.ptx-content pre .pp { color: #c3e88d !important; } /* Green - preprocessor */

/* Code block copy button styling */
.ptx-content pre.clipboardable {
  position: relative !important;
  padding-right: 50px !important;
}

.code-copy {
  position: absolute !important;
  top: 20px !important;
  right: 16px !important;
  background: linear-gradient(145deg, rgba(20, 181, 255, 0.3), rgba(121, 82, 245, 0.4)) !important;
  border: 1px solid rgba(20, 181, 255, 0.5) !important;
  border-radius: 4px !important;
  padding: 4px 6px !important;
  cursor: pointer;
  transition: all 0.3s ease !important;
  z-index: 10;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.code-copy:hover {
  background: linear-gradient(145deg, rgba(20, 181, 255, 0.5), rgba(121, 82, 245, 0.6)) !important;
  border-color: rgba(20, 181, 255, 0.8) !important;
  box-shadow: 0 0 12px rgba(20, 181, 255, 0.4) !important;
  transform: scale(1.05);
}

.code-copy .copyicon {
  color: #14b5ff !important;
  font-size: 16px !important;
}

.code-copy:hover .copyicon {
  color: #fff !important;
}

/* Lists */
.ptx-content ol, .ptx-content ul {
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.ptx-content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

/* Tags/Badges styling for index terms */
.ptx-content .idx {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  padding: 4px 10px;
  background: linear-gradient(145deg, rgba(0, 232, 255, 0.2), rgba(0, 112, 235, 0.2));
  border: 1px solid rgba(20, 181, 255, 0.5);
  border-radius: 50px;
  color: #5ddbff;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  font-weight: 500;
  display: inline-block;
  margin-right: 0.5rem;
}

/* Navigation buttons (Prev, Up, Next) */
.ptx-navbar {
  background: rgba(0, 0, 0, 0.6) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.75rem 1.5rem !important;
}

.ptx-navbar .button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.3), rgba(30, 130, 230, 0.35)) !important;
  border: 1px solid rgba(0, 200, 255, 0.45) !important;
  color: #00e5ff !important;
  padding: 8px 14px !important;
  border-radius: 8px !important;
  font-family: var(--font-heading) !important;
  font-size: 13px !important;
  cursor: pointer !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  transition: all 0.2s ease !important;
  text-transform: none !important;
}

.ptx-navbar .button:hover {
  background: linear-gradient(135deg, rgba(0, 230, 255, 0.45), rgba(50, 150, 250, 0.5)) !important;
  border-color: rgba(0, 220, 255, 0.65) !important;
  transform: scale(1.03) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(0, 200, 255, 0.35) !important;
}

.ptx-navbar .button.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Content buttons */
.ptx-content .button,
.ptx-content button,
.ptx-content input[type="button"],
.ptx-content input[type="submit"] {
  background: linear-gradient(135deg, rgba(20, 181, 255, 0.15), rgba(121, 82, 245, 0.1)) !important;
  border: 1px solid rgba(20, 181, 255, 0.3) !important;
  color: var(--color-text) !important;
  padding: 0.5rem 1rem !important;
  border-radius: 8px !important;
  font-family: var(--font-heading) !important;
  font-size: 0.9rem !important;
  transition: all 0.3s ease !important;
  cursor: pointer;
}

.ptx-content .button:hover,
.ptx-content button:hover,
.ptx-content input[type="button"]:hover,
.ptx-content input[type="submit"]:hover {
  background: linear-gradient(135deg, rgba(20, 181, 255, 0.25), rgba(121, 82, 245, 0.15)) !important;
  border-color: rgba(20, 181, 255, 0.5) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(20, 181, 255, 0.2);
}

/* Hide footer navigation buttons container entirely */
.ptx-content-footer {
  display: none !important;
  visibility: hidden !important;
}

/* Page footer at the very bottom - custom branding injected via build.sh */
.ptx-page-footer,
#ptx-page-footer {
  background: rgba(0, 0, 0, 0.7) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 2rem 1rem !important;
  text-align: center !important;
  position: relative;
  margin-top: auto;
}

/* Hide default PreTeXt/Runestone/MathJax logos (but not custom content) */
.ptx-page-footer .pretext-link,
.ptx-page-footer .runestone-link,
.ptx-page-footer .mathjax-link,
#ptx-page-footer .pretext-link,
#ptx-page-footer .runestone-link,
#ptx-page-footer .mathjax-link {
  display: none !important;
  visibility: hidden !important;
}

/* Force flexbox layout for custom footer content (overrides PreTeXt float rules) */
#ptx-page-footer > div,
.ptx-page-footer > div {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0.75rem !important;
}

#ptx-page-footer img,
#ptx-page-footer p,
.ptx-page-footer img,
.ptx-page-footer p {
  float: none !important;
  display: inline-block !important;
  margin: 0 !important;
  text-align: center !important;
}

/* Bibliography */
.ptx-content .biblio {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--color-primary);
}

.ptx-content .biblio .bibitem {
  color: var(--color-text);
}

/* Cross-references and linked notes */
.ptx-content .xref {
  color: #7952f5 !important;
  font-family: var(--font-heading);
  font-size: 0.9em;
  padding: 2px 8px;
  background: rgba(121, 82, 245, 0.12);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.ptx-content .xref:hover {
  background: rgba(121, 82, 245, 0.22);
  color: #9b7dff !important;
}

/* Reference labels (Definition, Theorem, etc.) */
.ptx-content .definition-like .heading .type,
.ptx-content .theorem-like .heading .type,
.ptx-content .example-like .heading .type,
.ptx-content .remark-like .heading .type {
  color: #7952f5 !important;
}

/* Term highlighting */
.ptx-content .terminology {
  color: var(--color-primary) !important;
  font-weight: 500;
  font-family: var(--font-heading);
}

/* Hide theme switcher button - light theme not supported */
#light-dark-button,
.light-dark-button,
button.light-dark-button {
  display: none !important;
  visibility: hidden !important;
}

/* Responsive Design */
@media (max-width: 800px) {
  .ptx-page > .ptx-main {
    padding: 1rem;
    margin: 1rem;
  }
  
  .ptx-content h1.heading {
    font-size: 2rem !important;
  }
  
  .ptx-content h2.heading {
    font-size: 1.4rem !important;
  }
}

/* ============================================
   GRAPH VIEW TOGGLE
   ============================================ */
#graph-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: url('space-bg.png') center center / cover no-repeat, #0a0a0f;
  z-index: 9999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#graph-overlay.visible {
  display: block;
  opacity: 1;
}

#graph-overlay #graph-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#graph-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(139, 92, 246, 0.4));
  border: 1px solid rgba(99, 102, 241, 0.5);
  border-radius: 8px;
  color: #a5b4fc;
  font-family: 'Aclonica', sans-serif;
  font-size: 13px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  margin-left: 8px;
}

#graph-toggle-btn:hover {
  background: linear-gradient(135deg, rgba(79, 150, 255, 0.5), rgba(159, 112, 255, 0.55));
  border-color: rgba(139, 92, 246, 0.7);
  transform: scale(1.03);
  color: #e0e7ff;
}

#graph-toggle-btn .graph-icon {
  font-size: 16px;
}

#graph-close-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, rgba(20, 20, 30, 0.9), rgba(30, 30, 45, 0.9));
  border: 1px solid rgba(20, 181, 255, 0.4);
  border-radius: 8px;
  color: #e0e0e0;
  font-family: 'Aclonica', sans-serif;
  font-size: 14px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

#graph-close-btn:hover {
  background: linear-gradient(135deg, rgba(20, 181, 255, 0.3), rgba(168, 85, 247, 0.3));
  border-color: rgba(168, 85, 247, 0.6);
}

/* Search UI Styling - PreTeXt uses dialog#ptx-search-modal */
dialog#ptx-search-modal,
.pretext-search {
  background: #0d1117 !important;
  border: 1px solid rgba(20, 181, 255, 0.4) !important;
  border-radius: 16px !important;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.8) !important;
  padding: 24px !important;
  max-width: 700px !important;
  width: 90vw !important;
  max-height: 80vh !important;
  overflow: hidden !important;
}

dialog#ptx-search-modal::backdrop {
  background: rgba(0, 0, 0, 0.85) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  backdrop-filter: blur(8px) !important;
}

#ptx-search-box {
  display: flex !important;
  gap: 12px !important;
  margin-bottom: 16px !important;
}

#ptx-search-box input,
#ptx-search-input {
  flex: 1 !important;
  background: rgba(20, 25, 35, 0.95) !important;
  border: 1px solid rgba(20, 181, 255, 0.4) !important;
  border-radius: 8px !important;
  color: #e0e0e0 !important;
  padding: 12px 16px !important;
  font-family: var(--font-body) !important;
  font-size: 15px !important;
}

#ptx-search-box input:focus,
#ptx-search-input:focus {
  outline: none !important;
  border-color: #14b5ff !important;
  box-shadow: 0 0 12px rgba(20, 181, 255, 0.3) !important;
}

#ptx-search-box input::placeholder {
  color: rgba(224, 224, 224, 0.5) !important;
}

#ptx-search-results {
  background: rgba(15, 20, 28, 0.98) !important;
  border: 1px solid rgba(20, 181, 255, 0.2) !important;
  border-radius: 12px !important;
  padding: 16px !important;
  max-height: 55vh !important;
  overflow-y: auto !important;
}

#ptx-search-results h2,
.search-results-heading {
  font-family: var(--font-heading) !important;
  background: linear-gradient(135deg, #14b5ff, #a855f7) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  font-size: 1.1rem !important;
  margin-bottom: 12px !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid rgba(20, 181, 255, 0.2) !important;
}

.ptx-search-result,
#ptx-search-results li,
#ptx-search-results a {
  display: block !important;
  padding: 12px 16px !important;
  margin: 8px 0 !important;
  background: rgba(25, 30, 40, 0.95) !important;
  border: 1px solid rgba(20, 181, 255, 0.15) !important;
  border-radius: 8px !important;
  color: #e0e0e0 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

.ptx-search-result:hover,
#ptx-search-results li:hover,
#ptx-search-results a:hover {
  background: rgba(20, 181, 255, 0.15) !important;
  border-color: rgba(20, 181, 255, 0.5) !important;
  color: #14b5ff !important;
}

#ptx-search-results .search-result-title {
  color: #14b5ff !important;
  font-weight: 600 !important;
}

#ptx-search-results .search-result-text {
  color: #b0b0b0 !important;
  font-size: 0.9em !important;
}

/* Close button for search */
dialog#ptx-search-modal button[type="button"],
.closesearchresults {
  background: linear-gradient(135deg, rgba(20, 181, 255, 0.25), rgba(168, 85, 247, 0.25)) !important;
  border: 1px solid rgba(20, 181, 255, 0.4) !important;
  border-radius: 6px !important;
  color: #14b5ff !important;
  padding: 8px 14px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

dialog#ptx-search-modal button[type="button"]:hover,
.closesearchresults:hover {
  background: linear-gradient(135deg, rgba(20, 181, 255, 0.4), rgba(168, 85, 247, 0.35)) !important;
  border-color: #14b5ff !important;
}

/* PreTeXt Search UI - Main Container */
.searchbox {
  position: relative;
}

/* Search modal - fixed centered overlay - HIGH SPECIFICITY to override PreTeXt defaults */
body.pretext .ptx-navbar .ptx-navbar-contents .searchbox .searchresultsplaceholder,
body.pretext .ptx-navbar .searchbox .searchresultsplaceholder,
body .ptx-navbar .searchbox #searchresultsplaceholder,
.ptx-navbar .searchresultsplaceholder,
.searchresultsplaceholder,
#searchresultsplaceholder {
  display: none;
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 10000 !important;
  background: rgba(13, 17, 23, 0.97) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(20, 181, 255, 0.25) !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(20, 181, 255, 0.08) !important;
  padding: 1.25rem 1.5rem !important;
  width: 560px !important;
  min-width: 560px !important;
  max-width: 560px !important;
  max-height: min(80vh, 600px) !important;
  overflow: hidden !important;
  flex-direction: column !important;
  gap: 1rem !important;
  box-sizing: border-box !important;
}

body.pretext .ptx-navbar .searchbox .searchresultsplaceholder.search-active,
body .ptx-navbar .searchbox #searchresultsplaceholder.search-active,
.searchresultsplaceholder.search-active,
#searchresultsplaceholder.search-active {
  display: flex !important;
}

/* Search controls row */
.search-results-controls {
  display: flex !important;
  gap: 0.75rem !important;
  align-items: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

/* Search input */
#ptxsearch,
.ptxsearch {
  flex: 1 !important;
  min-width: 0 !important;
  background: rgba(18, 22, 30, 0.95) !important;
  border: 1px solid rgba(20, 181, 255, 0.25) !important;
  border-radius: 10px !important;
  color: #e0e0e0 !important;
  padding: 12px 16px !important;
  font-family: 'Aclonica', sans-serif !important;
  font-size: 14px !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

#ptxsearch:focus,
.ptxsearch:focus {
  outline: none !important;
  border-color: rgba(20, 181, 255, 0.5) !important;
  box-shadow: 0 0 8px rgba(20, 181, 255, 0.2) !important;
}

#ptxsearch::placeholder {
  color: rgba(160, 160, 160, 0.5) !important;
  font-family: 'Aclonica', sans-serif !important;
}

/* Close button */
#closesearchresults,
.closesearchresults {
  background: rgba(20, 181, 255, 0.12) !important;
  border: 1px solid rgba(20, 181, 255, 0.25) !important;
  border-radius: 10px !important;
  color: #14b5ff !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  padding: 0 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

#closesearchresults:hover {
  background: rgba(20, 181, 255, 0.22) !important;
  border-color: rgba(20, 181, 255, 0.4) !important;
}

/* Search results list - scrollable */
#searchresults,
.searchresults {
  flex: 1 !important;
  overflow-y: auto !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Search results heading */
.search-results-heading {
  font-family: var(--font-heading) !important;
  background: linear-gradient(135deg, #14b5ff, #a855f7) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  font-size: 1.1rem !important;
  margin: 0 0 12px 0 !important;
}

/* Empty results message */
#searchempty,
.searchempty {
  color: rgba(180, 180, 180, 0.7) !important;
  font-style: italic !important;
  padding: 20px !important;
  text-align: center !important;
}

/* Search results list */
#searchresults,
.searchresults {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  max-height: 50vh !important;
  overflow-y: auto !important;
}

#searchresults li,
.searchresults li {
  margin: 8px 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

#searchresults a,
.searchresults a {
  display: block !important;
  padding: 12px 16px !important;
  background: rgba(25, 30, 40, 1) !important;
  border: 1px solid rgba(20, 181, 255, 0.15) !important;
  border-radius: 8px !important;
  color: #e0e0e0 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

#searchresults a:hover,
.searchresults a:hover {
  background: rgba(20, 181, 255, 0.2) !important;
  border-color: rgba(20, 181, 255, 0.5) !important;
  color: #14b5ff !important;
}

/* Search button in nav */
.searchwidget .searchbutton {
  background: linear-gradient(135deg, rgba(20, 181, 255, 0.2), rgba(168, 85, 247, 0.2)) !important;
  border: 1px solid rgba(20, 181, 255, 0.4) !important;
  border-radius: 8px !important;
  color: #14b5ff !important;
}

/* =========================================================
   RESPONSIVE SAFETY LAYER
   Purpose: prevent layout breakage on mobile
   Applies blunt overrides only — do not refactor upstream
   ========================================================= */

@media (max-width: 900px) {

  /* ---- Global sanity ---- */
  html, body {
    overflow-x: hidden !important;
  }

  body.pretext {
    background-attachment: scroll !important;
  }

  /* ---- Kill the two-column grid ---- */
  .ptx-page {
    display: block !important;
    grid-template-columns: none !important;
    grid-template-areas: none !important;
  }

  /* ---- Navbar / toolbar: FIX TO TOP + GIVE IT ROOM ---- */
  .ptx-navbar {
    position: sticky !important;
    top: 0 !important;
    bottom: auto !important;

    width: 100% !important;
    min-height: 56px !important;

    padding: 0.5rem 0.75rem !important;
    box-sizing: border-box !important;

    z-index: 1000 !important;
  }

  /* Ensure buttons never clip right edge */
  .ptx-navbar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  /* ---- Sidebar becomes normal flow content ---- */
  .ptx-sidebar {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;

    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;

    box-shadow: none !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
  }

  /* Make TOC scroll-safe */
  .ptx-sidebar .ptx-toc {
    max-height: 60vh !important;
    overflow-y: auto !important;
    padding: 0.75rem !important;
  }

  /* ---- Main content ---- */
  .ptx-main {
    width: 100% !important;
  }

  .ptx-page > .ptx-main {
    padding: 1rem !important;
    margin: 0 !important;
    min-height: auto !important;
  }

  /* Add breathing room below navbar */
  .ptx-content {
    max-width: 100% !important;
    padding: 0.75rem !important;
  }

  /* ---- Typography scaling ---- */
  .ptx-content h1.heading {
    font-size: 1.9rem !important;
  }

  .ptx-content h2.heading {
    font-size: 1.35rem !important;
  }

  .ptx-content h3.heading {
    font-size: 1.15rem !important;
  }

  .ptx-content p {
    font-size: 1rem !important;
  }

  /* ---- Reduce heavy visual effects ---- */
  .ptx-page > .ptx-main,
  .ptx-navbar,
  .ptx-masthead,
  .ptx-page-footer {
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
  }

  /* ---- Code blocks: prevent sideways hell ---- */
  .ptx-content pre {
    font-size: 0.85rem !important;
    padding: 1rem !important;
  }

  .ptx-content .displaymath {
    padding: 1rem !important;
  }

  /* ---- TOC items: tighter spacing ---- */
  .ptx-toc ul.structural li,
  .ptx-toc .toc-item {
    padding: 0.4rem 0.6rem !important;
    margin-bottom: 4px !important;
  }

  /* ---- Navbar buttons ---- */
  .ptx-navbar .button {
    font-size: 12px !important;
    padding: 6px 10px !important;
  }

  /* ---- Graph overlay safety ---- */
  #graph-toggle-btn {
    font-size: 12px !important;
    padding: 6px 10px !important;
  }

  #graph-close-btn {
    top: 12px !important;
    left: 12px !important;
  }
}

/* ---- Ultra-small phones ---- */
@media (max-width: 500px) {

  .ptx-content h1.heading {
    font-size: 1.6rem !important;
  }

  .ptx-content h2.heading {
    font-size: 1.2rem !important;
  }

  .ptx-content {
    padding: 0.5rem !important;
  }

  .ptx-sidebar .ptx-toc {
    max-height: 50vh !important;
  }
}