/*
 * lex-content.css - Lex Document Rendering
 *
 * Styles for rendering Lex format documents as HTML.
 * All styles are scoped to .lex-* classes to avoid conflicts with site shell.
 * Used both on the Jekyll site and for standalone Lex HTML exports.
 */

/* === Lex Document Container === */
.lex-document {
  max-width: var(--lex-width-document);
  margin: 0 auto;
  padding: var(--lex-space-200) var(--lex-space-150);
  font-family: var(--lex-font-text);
  font-size: 0.9rem;
  line-height: 1.25;
  color: var(--lex-normal);
}

/* === Sessions (Headings and Sections) === */
.lex-session {
  margin: var(--lex-space-150) 0;
}

.lex-session:first-child {
  margin-top: 0;
}

.lex-document > .lex-session {
  margin: var(--lex-space-200) 0;
}

.lex-document > .lex-session:first-child {
  margin-top: 0;
}

/* === Content Containers === */
.lex-content {
  padding-left: var(--lex-indent-content);
}

/* === Headings === */
.lex-document h1,
.lex-document h2,
.lex-document h3,
.lex-document h4,
.lex-document h5,
.lex-document h6 {
  font-family: var(--lex-font-headings);
  font-weight: 700;
  color: var(--lex-normal);
  line-height: 1.25;
  margin: var(--lex-space-150) 0;
}

.lex-document h1 {
  font-size: 1em;
  margin-top: 0;
  margin-bottom: var(--lex-space-100);
}

.lex-document h2 {
  font-size: 1em;
  margin-top: var(--lex-space-150);
}

.lex-document h3 {
  font-size: 1em;
  margin-top: var(--lex-space-125);
}

.lex-document h4 {
  font-size: 1em;
  margin-top: var(--lex-space-100);
}

.lex-document h5 {
  font-size: 1em;
  margin-top: var(--lex-space-100);
}

.lex-document h6 {
  font-size: 1em;
  margin-top: var(--lex-space-100);
  font-weight: 600;
}

.lex-session > h1:first-child,
.lex-session > h2:first-child,
.lex-session > h3:first-child,
.lex-session > h4:first-child,
.lex-session > h5:first-child,
.lex-session > h6:first-child {
  margin-top: 0;
}

/* === Paragraphs === */
.lex-paragraph {
  margin: var(--lex-space-100) 0;
  line-height: 1.25;
  color: var(--lex-normal);
}

.lex-paragraph:first-child {
  margin-top: 0;
}

.lex-document h1 + .lex-paragraph,
.lex-document h2 + .lex-paragraph,
.lex-document h3 + .lex-paragraph,
.lex-document h4 + .lex-paragraph,
.lex-document h5 + .lex-paragraph,
.lex-document h6 + .lex-paragraph {
  margin-top: 0;
}

/* === Lists === */
.lex-list {
  margin: var(--lex-space-100) 0;
  padding-left: var(--lex-space-200);
  list-style: none;
  line-height: 1.25;
}

.lex-list:first-child {
  margin-top: 0;
}

.lex-list-item {
  margin: var(--lex-space-050) 0;
}

.lex-list .lex-list {
  margin: var(--lex-space-050) 0;
}

.lex-list-item::marker {
  color: var(--lex-muted);
}

/* === Definition Lists === */
.lex-definition {
  margin: var(--lex-space-100) 0;
}

.lex-definition dt {
  font-weight: 600;
  font-style: italic;
  color: var(--lex-normal);
  margin-top: var(--lex-space-100);
}

.lex-definition dt:first-child {
  margin-top: 0;
}

.lex-definition dd {
  margin-left: var(--lex-space-150);
  margin-top: var(--lex-space-025);
  margin-bottom: var(--lex-space-050);
  line-height: 1.25;
}

/* === Verbatim (Code Blocks) === */
.lex-verbatim {
  background: var(--lex-code-bg);
  padding: var(--lex-space-100) var(--lex-space-125);
  margin: var(--lex-space-125) 0;
  border-radius: var(--lex-radius-md);
  overflow-x: auto;
  border: var(--lex-border-thin) solid var(--lex-border);
  font-size: 0.9rem;
}

.lex-verbatim code {
  background: none;
  padding: 0;
  font-size: 0.9em;
  line-height: 1.5;
  color: var(--lex-normal);
  font-family: var(--lex-font-verbatim);
}

.lex-verbatim[data-language]::before {
  content: attr(data-language);
  display: block;
  margin-bottom: var(--lex-space-050);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: lowercase;
  color: var(--lex-faint);
  font-family: var(--lex-font-headings);
}

/* === Inline Elements === */
.lex-document strong {
  font-weight: 700;
  color: var(--lex-normal);
}

.lex-document em {
  font-style: italic;
  color: var(--lex-normal);
}

.lex-document code {
  font-family: var(--lex-font-verbatim);
  font-size: 0.9em;
  background: var(--lex-code-bg);
  color: var(--lex-normal);
  padding: var(--lex-space-025) var(--lex-space-075);
  border-radius: var(--lex-radius-sm);
}

/* === Math === */
.lex-math {
  font-family: 'Times New Roman', Times, serif;
  font-style: italic;
  color: var(--lex-normal);
}

/* === Sequence Markers === */
.seq_marker {
  color: var(--lex-muted);
  font-weight: 400;
  margin-right: 0;
}

/* === Links === */
.lex-document a {
  color: var(--lex-muted);
  text-decoration: underline;
  text-underline-offset: var(--lex-outline-width);
  transition: color 0.2s ease;
}

.lex-document a:hover {
  color: var(--lex-normal);
}

.lex-document a:visited {
  color: var(--lex-muted);
}

.lex-document a:focus {
  outline: var(--lex-outline-width) solid var(--lex-muted);
  outline-offset: var(--lex-outline-width);
}

/* === Images === */
.lex-document img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* === Selection === */
.lex-document ::selection {
  background: var(--lex-faintest);
  color: var(--lex-normal);
}

/* === Responsive === */
@media (max-width: 40rem) {
  .lex-document {
    padding: var(--lex-space-100);
    font-size: 1rem;
  }

  .lex-session {
    padding-left: var(--lex-space-100);
  }

  .lex-definition dd {
    margin-left: var(--lex-space-100);
  }

  .lex-verbatim {
    padding: var(--lex-space-075);
    margin: var(--lex-space-100) calc(-1 * var(--lex-space-075));
    border-radius: 0;
  }
}

/* === Print === */
@media print {
  .lex-document {
    max-width: 100%;
    padding: 0;
    font-size: 11pt;
    color: #000;
  }

  .lex-session {
    padding-left: var(--lex-space-100);
  }

  .lex-document h1 { font-size: 18pt; }
  .lex-document h2 { font-size: 16pt; }
  .lex-document h3 { font-size: 14pt; }
  .lex-document h4 { font-size: 12pt; }
  .lex-document h5,
  .lex-document h6 { font-size: 11pt; }

  .lex-document a {
    color: #000;
    text-decoration: underline;
  }

  .lex-verbatim {
    border: var(--lex-border-thin) solid #ccc;
    page-break-inside: avoid;
  }
}
