/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/*
 *= require tailwind
 */

.editor-toolbar button:focus-visible {
  outline: 2px solid var(--color-ring) !important;
  outline-offset: 2px;
  color: var(--color-foreground);
}

/* Rich text content styling */
.prose {
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Mobile-specific prose improvements */
@media (max-width: 640px) {
  .prose {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .prose h1 { font-size: 1.5rem; }
  .prose h2 { font-size: 1.25rem; }
  .prose h3 { font-size: 1.125rem; }
  .prose h4 { font-size: 1rem; }
  .prose h5 { font-size: 0.95rem; }
  .prose h6 { font-size: 0.9rem; }

  .prose p { margin-bottom: 0.75em; }
  .prose ul, .prose ol { padding-left: 1.25em; }
}

.prose h1 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.125;
}

.prose h2 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.25;
}

.prose h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.375;
}

.prose h4 {
  margin-top: 1.25em;
  margin-bottom: 0.5em;
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.375;
}

.prose h5 {
  margin-top: 1.25em;
  margin-bottom: 0.5em;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.5;
}

.prose h6 {
  margin-top: 1.25em;
  margin-bottom: 0.5em;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.5;
}

.prose p {
  margin-bottom: 1em;
}

.prose ul,
.prose ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
  list-style-position: outside;
}

.prose ul {
  list-style-type: disc;
}

.prose ol {
  list-style-type: decimal;
}

.prose li {
  margin-bottom: 0.375rem;
}

.prose pre {
  background-color: var(--color-muted);
  color: var(--color-foreground);
  padding: 1em;
  border-radius: 0.375rem;
  overflow-x: auto;
  word-wrap: normal;
  white-space: pre;
}

/* Mobile code block improvements */
@media (max-width: 640px) {
  .prose pre {
    padding: 0.75em;
    font-size: 0.8rem;
    border-radius: 0.25rem;
  }
}

.prose code {
  background-color: var(--color-muted);
  color: var(--color-foreground);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.prose blockquote {
  border-left: 4px solid var(--color-border);
  padding-left: 1em;
  margin: 1em 0;
  font-style: italic;
  color: var(--color-muted-foreground);
}

/* Markdown tables share a readable baseline in every post surface. */
.prose table {
  display: block;
  max-width: 100%;
  margin-block: 1.25rem;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.5;
  hyphens: none;
  overflow-wrap: normal;
  scrollbar-width: thin;
}

.prose th,
.prose td {
  min-width: 12rem;
  padding: 0.65rem 0.875rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--color-muted);
  color: var(--color-foreground);
  font-weight: 600;
}

.prose thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.prose tbody tr:nth-child(even) {
  background: color-mix(in oklch, var(--color-muted) 30%, transparent);
}

.prose table:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

.topic-post-content {
  min-width: 0;
  font-size: 1rem;
  line-height: 1.7;
  hyphens: none;
  overflow-wrap: anywhere;
}

.topic-post-card {
  border-left: 3px solid transparent;
}

.topic-post-content > :not(table):not(pre):not(.post-math-display):not(.editor-table-block) {
  max-width: 72ch;
}

.topic-post-content > :first-child { margin-top: 0; }
.topic-post-content > :last-child { margin-bottom: 0; }
.topic-post-content pre { max-width: 100%; }

.topic-reply-composer .editor-toolbar {
  position: relative;
  z-index: auto;
  padding: 0.375rem;
  border-radius: 0.375rem 0.375rem 0 0;
  box-shadow: none;
}

.topic-reply-content {
  padding-left: calc(1rem + 3px);
}

@media (min-width: 640px) {
  .topic-reply-content {
    padding-left: calc(1.5rem + 3px);
  }
}

.topic-discussion-shell {
  max-width: 64rem;
  margin-inline: auto;
}

.topic-details-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(100%, 24rem);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-foreground);
}

.topic-details-panel[open] {
  display: flex;
  flex-direction: column;
}

.topic-details-panel::backdrop {
  background: rgb(0 0 0 / 35%);
}

body:has(.topic-details-panel:modal) {
  overflow: hidden;
}

@media (max-width: 639px) {
  .topic-details-panel {
    width: 100%;
    border-left: 0;
  }
}

@media (min-width: 1280px) {
  .topic-discussion-shell.topic-details-open {
    max-width: 80rem;
  }

  .topic-details-open .topic-discussion-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22rem;
    align-items: start;
  }

  .topic-details-panel {
    position: sticky;
    inset: auto;
    top: 1rem;
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 2rem);
    border-radius: 0 0.5rem 0.5rem 0;
  }
}

.topic-post-content :is(h1, h2, h3, h4, h5, h6),
.post-heading-anchor {
  scroll-margin-top: 5rem;
}

.post-heading-anchor {
  display: block;
  height: 0;
}

.prose .editor-table-block {
  max-width: 100%;
  margin: 1.25rem 0;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  scrollbar-color: color-mix(in oklch, var(--color-primary) 40%, var(--color-border)) transparent;
  scrollbar-width: thin;
}

.prose .editor-table-block::-webkit-scrollbar {
  height: 0.45rem;
}

.prose .editor-table-block::-webkit-scrollbar-track {
  background: transparent;
}

.prose .editor-table-block::-webkit-scrollbar-thumb {
  border-radius: 9999px;
  background: color-mix(in oklch, var(--color-primary) 40%, var(--color-border));
}

.prose .editor-table-block table {
  margin: 0;
}

.topic-post-outline {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--color-muted) 42%, transparent);
  font-size: 0.78rem;
  line-height: 1.35;
}

.topic-post-outline ol {
  padding: 0;
  margin: 0;
  list-style: none;
}

.topic-post-outline li + li {
  margin-top: 0.25rem;
}

.topic-post-outline ol ol {
  margin-top: 0.25rem;
  padding-left: 0.75rem;
}

.topic-post-outline a {
  display: block;
  overflow-wrap: anywhere;
  padding: 0.36rem 0.55rem;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--color-muted-foreground);
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.topic-post-outline a:hover {
  border-left-color: var(--color-primary);
  background: color-mix(in oklch, var(--color-primary) 7%, transparent);
  color: var(--color-foreground);
}

.topic-post-outline summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  color: var(--color-foreground);
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.topic-post-outline summary::-webkit-details-marker {
  display: none;
}

.topic-post-outline[open] summary {
  border-bottom: 1px solid var(--color-border);
}

.topic-post-outline nav {
  max-height: 18rem;
  padding: 0.65rem;
  overflow-y: auto;
}

.topic-post-outline-count {
  color: var(--color-muted-foreground);
  font-size: 0.72rem;
  font-weight: 500;
}

/* Enhanced Annotation Styles - Theme Aware */
.annotation-selection-toolbar {
  transform: translate(-50%, calc(-100% - 0.6rem));
}

.annotation-selection-toolbar::after {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 0.65rem;
  height: 0.65rem;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-popover);
  content: "";
  transform: translate(-50%, -50%) rotate(45deg);
}

.annotation-marker {
  background-color: oklch(from var(--color-warning) l c h / 0.2);
  border-bottom: 2px solid var(--color-warning);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  padding: 1px 2px;
  border-radius: 2px;
}

.annotation-marker:hover {
  background-color: oklch(from var(--color-warning) l c h / 0.4);
  box-shadow: 0 2px 4px var(--color-accent-glow);
}

/* New DOM-based annotation highlights */
.annotation-highlight {
  background-color: oklch(from var(--color-warning) l c h / 0.3);
  border-bottom: 2px solid var(--color-warning);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 1px 2px;
  border-radius: 2px;
  position: relative;
  color: var(--color-foreground);
}

.annotation-highlight:hover {
  background-color: oklch(from var(--color-warning) l c h / 0.5);
  box-shadow: 0 2px 4px var(--color-accent-glow);
  color: var(--color-foreground);
}

/* Status-specific annotation styles */
.annotation-highlight[data-status="resolved"] {
  background-color: oklch(from var(--color-success) l c h / 0.2);
  border-bottom-color: var(--color-success);
  color: var(--color-foreground);
}

.annotation-highlight[data-status="hidden"] {
  background-color: oklch(from var(--color-muted) l c h / 0.3);
  border-bottom-color: var(--color-muted-foreground);
  color: var(--color-foreground);
}

.annotation-resolved {
  background-color: oklch(from var(--color-success) l c h / 0.2);
  border-bottom: 2px solid var(--color-success);
  color: var(--color-foreground);
}

.annotation-resolved:hover {
  background-color: oklch(from var(--color-success) l c h / 0.4);
  color: var(--color-foreground);
}

/* Annotation threading indicators */
.annotation-thread-indicator {
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  background-color: var(--color-info);
  border-radius: 50%;
}

.annotation-highlight[data-thread-depth="1"] .annotation-thread-indicator {
  background-color: var(--color-primary);
}

.annotation-highlight[data-thread-depth="2"] .annotation-thread-indicator {
  background-color: var(--color-destructive);
}

/* Annotation popup and panels */
.annotation-popup {
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--color-border);
  background: var(--color-popover);
  z-index: 1000;
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.annotation-detail-panel {
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  box-shadow:
    -10px 0 15px -3px rgba(0, 0, 0, 0.1),
    -4px 0 6px -2px rgba(0, 0, 0, 0.05);
}

.annotation-detail-panel.show {
  transform: translateX(0);
}

/* Annotation sidebar */
.annotation-sidebar {
  background: var(--color-card);
  backdrop-filter: blur(8px);
  border-left: 1px solid var(--color-border);
}

/* Annotation creation modal */
.annotation-modal-backdrop {
  backdrop-filter: blur(4px);
}

/* Annotation status badges */
.annotation-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.annotation-status-active {
  background-color: oklch(from var(--color-info) l c h / 0.2);
  color: var(--color-info);
}

.annotation-status-resolved {
  background-color: oklch(from var(--color-success) l c h / 0.2);
  color: var(--color-success);
}

.annotation-status-hidden {
  background-color: var(--color-muted);
  color: var(--color-muted-foreground);
}

/* Post highlighting */
.post-highlight {
  transition: all 0.3s ease;
}

.post-highlight .border {
  border-color: var(--color-primary) !important;
  border-width: 2px !important;
}

/* Selection styles */
::selection {
  background-color: oklch(from var(--color-primary) l c h / 0.3);
  color: var(--color-foreground);
}

::-moz-selection {
  background-color: oklch(from var(--color-primary) l c h / 0.3);
  color: var(--color-foreground);
}

/* Annotation count badge */
.annotation-count {
  font-size: 0.75rem;
  background-color: var(--color-warning);
  color: var(--color-warning-foreground);
  border-radius: 9999px;
  padding: 0.125rem 0.375rem;
  margin-left: 0.25rem;
}

/* Deep link animations */
@keyframes highlightPulse {
  0% {
    background-color: oklch(from var(--color-warning) l c h / 0.3);
  }
  50% {
    background-color: oklch(from var(--color-warning) l c h / 0.5);
  }
  100% {
    background-color: transparent;
  }
}

.deep-link-highlight {
  animation: highlightPulse 2s ease-out;
}

/* Post image styles */
.editor-image {
  margin: 1.5rem 0;
  text-align: center;
}

.editor-image img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.editor-image.with-border img {
  border: 1px solid var(--color-border);
}

.editor-image.with-background {
  background-color: var(--color-muted);
  padding: 1rem;
  border-radius: 0.5rem;
}

.editor-image.stretched img {
  width: 100%;
}

.image-caption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-muted-foreground);
  font-style: italic;
}

/* Post attachment styles */
.editor-attachment {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  margin: 1rem 0;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background-color: var(--color-muted);
  transition: background-color 0.2s ease;
}

.editor-attachment:hover {
  background-color: var(--color-accent);
}

.attachment-icon {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  background-color: var(--color-primary);
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-extension {
  color: var(--color-primary-foreground);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.attachment-details {
  flex-grow: 1;
  min-width: 0;
}

.attachment-title {
  font-weight: 600;
  color: var(--color-foreground);
  margin-bottom: 0.25rem;
  word-wrap: break-word;
}

.attachment-name {
  color: var(--color-foreground);
  font-size: 0.875rem;
  word-wrap: break-word;
}

.attachment-size {
  color: var(--color-muted-foreground);
  font-size: 0.75rem;
  margin-top: 0.125rem;
}

.attachment-download {
  flex-shrink: 0;
  background-color: var(--color-primary);
  color: var(--color-primary-foreground);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.attachment-download:hover {
  background-color: var(--color-primary);
  opacity: 0.9;
  color: white;
  text-decoration: none;
}

/* ============================================
   MENTION STYLING - Theme Aware
   ============================================ */

.mention,
.mention-valid {
  color: var(--color-info);
  background-color: var(--color-info);
  opacity: 1;
  background: oklch(from var(--info) l c h / 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.mention:hover,
.mention-valid:hover {
  background: oklch(from var(--info) l c h / 0.25);
}

.mention-invalid {
  color: var(--color-destructive);
  background: oklch(from var(--destructive) l c h / 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
}

.mention-invalid:hover {
  background: oklch(from var(--destructive) l c h / 0.25);
}

/* ============================================
   PRIORITY INDICATORS - Theme Aware
   ============================================ */

.priority-low {
  color: var(--color-muted-foreground);
}

.priority-medium {
  color: var(--color-warning);
}

.priority-high {
  color: var(--color-destructive);
}

/* ============================================
   ROLE BADGES - Theme Aware
   ============================================ */

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.role-badge-owner {
  background-color: var(--color-primary);
  opacity: 0.15;
  color: var(--color-primary);
}

.role-badge-admin {
  background-color: var(--color-info);
  opacity: 0.15;
  color: var(--color-info);
}

.role-badge-member {
  background-color: var(--color-muted);
  color: var(--color-muted-foreground);
}

/* ============================================
   EDITOR ENHANCEMENTS
   ============================================ */

/* Editor wrapper focus state */
.editor-wrapper .border:focus-within {
  border-color: var(--color-ring);
}

/* Editor toolbar */
.editor-toolbar {
  border-color: var(--color-border);
  position: sticky;
  top: 0;
  z-index: 45;
  background-color: color-mix(in oklab, var(--color-background) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 color-mix(in oklab, var(--color-border) 70%, transparent);
}

.editor-surface {
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.editor-surface:focus-within {
  border-color: var(--color-ring);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--color-ring) 22%, transparent);
}

.editor-content-area {
  min-width: 0;
}

/* Mobile toolbar improvements */
@media (max-width: 640px) {
  .editor-toolbar {
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .editor-toolbar button {
    padding: 0.5rem;
  }

  .editor-toolbar .w-px {
    display: none;
  }
}

/* ============================================
   TOAST ANIMATIONS
   ============================================ */

.animate-in {
  animation-duration: 0.2s;
  animation-fill-mode: both;
}

.animate-out {
  animation-duration: 0.15s;
  animation-fill-mode: both;
}

.slide-in-from-top-2 {
  animation-name: slideInFromTop;
}

.slide-out-to-top-2 {
  animation-name: slideOutToTop;
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideOutToTop {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
}

/* Toast theme colors */
.bg-success {
  background-color: oklch(from var(--color-success) l c h / 1);
}

.text-success-foreground {
  color: white;
}

.bg-info {
  background-color: oklch(from var(--color-info) l c h / 1);
}

.text-info-foreground {
  color: white;
}

/* ============================================
   LOADING SKELETON
   ============================================ */

.editor-loading {
  min-height: 100px;
}

/* ============================================
   IMPROVED MENTION DROPDOWN
   ============================================ */

.mention-autocomplete {
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
              0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.mention-autocomplete .mention-item {
  transition: background-color 0.1s ease;
}

.mention-autocomplete .mention-item.selected,
.mention-autocomplete .mention-item:hover {
  background-color: var(--color-accent);
}

/* Fix mention dropdown positioning on mobile */
@media (max-width: 640px) {
  .mention-autocomplete {
    position: fixed !important;
    left: 1rem !important;
    right: 1rem !important;
    width: auto !important;
    max-width: calc(100vw - 2rem);
  }
}

/* ============================================
   UPLOAD PROGRESS
   ============================================ */

.upload-progress-bar {
  transition: width 0.3s ease;
}

/* ============================================
   KEYBOARD SHORTCUT HINTS
   ============================================ */

kbd {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.75rem;
}

.syntax-highlight {
  --syntax-comment: #65706e;
  --syntax-keyword: #8b36a5;
  --syntax-string: #216d3a;
  --syntax-number: #a14d10;
  --syntax-title: #2456a6;
  --syntax-variable: #99422e;
}

.dark .syntax-highlight {
  --syntax-comment: #a3ada9;
  --syntax-keyword: #d8a5ee;
  --syntax-string: #9dd6a2;
  --syntax-number: #efbd8b;
  --syntax-title: #a2c8ff;
  --syntax-variable: #f0aaa0;
}

.syntax-highlight .hljs-comment,
.syntax-highlight .hljs-quote { color: var(--syntax-comment); }
.syntax-highlight .hljs-keyword,
.syntax-highlight .hljs-selector-tag,
.syntax-highlight .hljs-literal,
.syntax-highlight .hljs-meta { color: var(--syntax-keyword); }
.syntax-highlight .hljs-string,
.syntax-highlight .hljs-regexp,
.syntax-highlight .hljs-addition { color: var(--syntax-string); }
.syntax-highlight .hljs-number,
.syntax-highlight .hljs-attr,
.syntax-highlight .hljs-symbol { color: var(--syntax-number); }
.syntax-highlight .hljs-title,
.syntax-highlight .hljs-built_in,
.syntax-highlight .hljs-type,
.syntax-highlight .hljs-name { color: var(--syntax-title); }
.syntax-highlight .hljs-variable,
.syntax-highlight .hljs-deletion { color: var(--syntax-variable); }

/* One text document in both Markdown editing modes. */
.editor-mode-controls { margin-left: auto; }
.markdown-modes { display: flex; gap: .125rem; }
.markdown-modes button { min-height: 2rem; padding: .25rem .5rem; border-radius: .35rem; font-size: .75rem; color: var(--color-muted-foreground); }
.markdown-modes button[aria-pressed="true"] { background: var(--color-muted); color: var(--color-foreground); }
.markdown-modes button:focus-visible { outline: 2px solid var(--color-ring); }
.editor-content-area .cm-editor { background: transparent; color: var(--foreground); }
.editor-content-area .cm-editor.cm-focused { outline: none; }
/* Turbo can restore CodeMirror styles after this stylesheet. Keep this rule more specific. */
.editor-content-area .cm-editor .cm-content { min-height: var(--editor-min-height, 150px); font-family: inherit; line-height: 1.7; padding: .25rem 0; caret-color: var(--foreground); }
.editor-content-area .cm-scroller { font-family: inherit; overflow: auto; }
.editor-content-area .cm-line { padding: 0 .25rem; }
.editor-content-area .md-heading { font-weight: 650; line-height: 1.4; padding-top: .5rem; padding-bottom: .35rem; }
.editor-content-area .md-heading-1 { font-size: 1.75rem; }
.editor-content-area .md-heading-2 { font-size: 1.4rem; }
.editor-content-area .md-heading-3 { font-size: 1.2rem; }
.md-strong { font-weight: 700; }
.md-emphasis { font-style: italic; }
.md-strike { text-decoration: line-through; }
.md-code { font-family: monospace; background: var(--muted); border-radius: .2rem; }
.markdown-embeds { font-size: .875rem; }
.editor-content-area[data-markdown-mode="source"] .cm-content { font-family: ui-monospace, monospace; }
.editor-content-area .md-code-line { background: var(--muted); font-family: ui-monospace, monospace; font-size: .9em; padding-inline: .65rem; }
.editor-content-area .md-code-info { color: var(--muted-foreground); font-size: .8em; }
.markdown-reference { display: inline-block; border-radius: .4rem; background: var(--muted); padding: .5rem .75rem; }

.post-math { hyphens: none; overflow-wrap: normal; }
.post-math-display {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  padding: .75rem 0;
}

.prose .footnote-ref { font-size: .75em; line-height: 0; }
.prose .footnotes {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .875em;
}
.prose .footnotes li { scroll-margin-top: 5rem; }
.prose .footnote-ref a { scroll-margin-top: 5rem; }
.prose .footnote-backref { margin-left: .25em; }

.glossary-reference { position: relative; display: inline; }
.glossary-trigger { color: inherit; font: inherit; text-decoration: underline dotted; text-underline-offset: .2em; cursor: pointer; }
.glossary-trigger:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.glossary-card { position: absolute; z-index: 30; top: 100%; left: 0; width: min(20rem, 80vw); padding: .85rem; background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: .5rem; box-shadow: 0 8px 24px #0003; font-size: .875rem; line-height: 1.4; }
.glossary-card[hidden] { display: none; }
.glossary-card strong, .glossary-definition { display: block; margin-bottom: .5rem; }
.glossary-definition { white-space: pre-wrap; }
.glossary-card a { color: var(--info); }
