/* Import Lexxy editor styles from the gem */
@import url("/assets/lexxy-variables-9ed4761f.css");
@import url("/assets/lexxy-content-887ae3e2.css");
@import url("/assets/lexxy-editor-84aedae1.css");

/* Override Tailwind's Preflight reset for Lexxy editor content */
/* Tailwind resets heading/blockquote styles, so we restore them here with higher specificity */
/* Target both .lexxy-content (for rendered content) and .lexxy-editor__content (for editor) */
.lexxy-content h1,
.lexxy-content h2,
.lexxy-content h3,
.lexxy-content h4,
.lexxy-content h5,
.lexxy-content h6,
.lexxy-editor__content h1,
.lexxy-editor__content h2,
.lexxy-editor__content h3,
.lexxy-editor__content h4,
.lexxy-editor__content h5,
.lexxy-editor__content h6 {
  display: block;
  font-weight: bold;
  margin-block: 0 1em;
}

.lexxy-content h1, .lexxy-editor__content h1 { font-size: 2rem; }
.lexxy-content h2, .lexxy-editor__content h2 { font-size: 1.5rem; }
.lexxy-content h3, .lexxy-editor__content h3 { font-size: 1.25rem; }
.lexxy-content h4, .lexxy-editor__content h4 { font-size: 1rem; }
.lexxy-content h5, .lexxy-editor__content h5 { font-size: 0.875rem; }
.lexxy-content h6, .lexxy-editor__content h6 { font-size: 0.75rem; }

.lexxy-content blockquote,
.lexxy-editor__content blockquote {
  border-left: 0.25em solid var(--lexxy-color-ink-lighter, #d1d5db);
  font-style: italic;
  margin: 1em 0;
  padding: 0.5em 1em;
}

.lexxy-content ul,
.lexxy-editor__content ul {
  list-style-type: disc;
  margin: 1em 0;
  padding-left: 2em;
}

.lexxy-content ol,
.lexxy-editor__content ol {
  list-style-type: decimal;
  margin: 1em 0;
  padding-left: 2em;
}

.lexxy-content li,
.lexxy-editor__content li {
  display: list-item;
  margin: 0.25em 0;
}

.lexxy-content p,
.lexxy-editor__content p {
  margin-block: 0 1em;
}

/* Make the Lexxy editor have internal scrolling with sticky toolbar */
lexxy-editor {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow: hidden;
}

lexxy-editor lexxy-toolbar {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--lexxy-color-canvas, #fff);
  border-bottom: 1px solid var(--lexxy-color-ink-lighter, #d1d5db);
}

lexxy-editor .lexxy-editor__content {
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
}

/* Prism Tomorrow Night Theme adapted for Lexxy */

/* 
   CRITICAL FIX: Target both the container <pre> and the inner <code> 
   to ensure whitespace is preserved and styles are applied correctly.
*/

pre[data-language],
pre[class*="language-"],
code[class*="language-"] {
  color: #ccc;
  background: #2d2d2d;
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  font-size: 1em;
  text-align: left;
  
  /* Ensure newlines are respected */
  white-space: pre !important;
  
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.5;

  -moz-tab-size: 4;
  -o-tab-size: 4;
  tab-size: 4;

  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

/* Specific resets for the PRE container */
pre[data-language],
pre[class*="language-"] {
  padding: 1em;
  margin: .5em 0;
  overflow: auto;
  border-radius: 0.3em;
}

/* Specific resets for the inner CODE element */
pre[data-language] code,
pre[class*="language-"] code {
  /* Remove background/padding from inner code to avoid double-boxing */
  background: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  
  /* Ensure it behaves as a block of code */
  display: block;
  width: auto;
  min-width: 100%;
}

/* Token colors */
.token.comment,
.token.block-comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #999;
}

.token.punctuation {
  color: #ccc;
}

.token.tag,
.token.attr-name,
.token.namespace,
.token.deleted {
  color: #e2777a;
}

.token.function-name {
  color: #6196cc;
}

.token.boolean,
.token.number,
.token.function {
  color: #f08d49;
}

.token.property,
.token.class-name,
.token.constant,
.token.symbol {
  color: #f8c555;
}

.token.selector,
.token.important,
.token.atrule,
.token.keyword,
.token.builtin {
  color: #cc99cd;
}

.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.variable {
  color: #7ec699;
}

.token.operator,
.token.entity,
.token.url {
  color: #67cdcc;
}

.token.important,
.token.bold {
  font-weight: bold;
}
.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

.token.inserted {
  color: green;
}
