/* Prevent horizontal scroll on mobile */
html,
body {
  overflow-x: hidden;
}

article {
  max-width: 680px;
  margin: 60px auto;
  padding: 0 24px;
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.8;
  color: #292929;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}

article h1 {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
  text-align: left;
}

article h2 {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  letter-spacing: 0;
  text-align: left;
}

article h3 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 12px;
  text-align: left;
  color: #444;
}

article p {
  margin-bottom: 1.5em;
}

article li {
  margin-bottom: 0.5em;
}

article li li {
  margin-bottom: 0;
}

article ul,
article ol {
  padding-left: 24px;
  margin-bottom: 1.5em;
  text-align: left;
}

/* Code blocks - highlight.js compatible */
article pre {
  color: #d4d4d4;
  overflow-x: auto;
  margin: 32px -10%;
  width: 120%;
  font-size: 0.9rem;
  line-height: 1.6;
}

article code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

article :not(pre) > code {
  background: rgba(0, 0, 0, 0.06);
  padding: 3px 6px;
  border-radius: 4px;
  color: #1a1a1a;
  font-size: 0.9rem;
}

article pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  text-align: left;
}

/* Blockquotes - Scientific style */
article blockquote {
  border-left: 3px solid #333;
  margin: 32px -10%;
  width: 120%;
  padding: 4px 0 4px 24px;
  font-style: italic;
  color: #333;
  font-size: 1.05rem;
  box-sizing: border-box;
}

article blockquote p {
  margin: 0;
}

/* Strong text in blockquotes for notes */
article blockquote strong {
  font-style: normal;
  font-weight: 700;
}

/* Tables - Monospace, code-like */
article table {
  border-collapse: collapse;
  width: 120%;
  margin: 32px -10%;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  text-align: left;
}

article th,
article td {
  border: 1px solid #d0d0d0;
  padding: 10px 14px;
  text-align: left;
}

article th {
  background: #f5f5f5;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

article img {
  max-width: 120%;
  width: 120%;
  height: auto;
  margin: 32px -10%;
  border-radius: 4px;
}

article img:has(+ em) {
  margin-bottom: 0;
}

article img + em {
  display: block;
  font-size: 0.85rem;
  color: #666;
  text-align: center;
}

article a {
  color: inherit;
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid var(--secondary, #f4b400);
  margin: 0;
  transition: all 0.1s ease;
}

article a:hover {
  padding-bottom: 0;
  border-bottom: 4px solid var(--secondary, #f4b400);
}

.back-link {
  font-family: var(--font-heading);
  font-size: 0.9rem;
}

article hr {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin: 48px 0;
}

article ul {
  list-style-type: disc;
}

article ul ul {
  list-style-type: circle;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* Numbered lists with bold headings (for technique explanations) */
article ol {
  list-style: none;
  counter-reset: step-counter;
  padding-left: 0;
}

article ol > li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 48px;
  margin-bottom: 1.5em;
}

article ol > li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--secondary, #f4b400);
  line-height: 1.2;
}

article ol > li strong:first-child {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  display: block;
  margin-bottom: 0.5em;
}

/* Abbreviations with dotted underline */
article abbr[title] {
  text-decoration: underline dotted;
  text-decoration-color: rgba(0, 0, 0, 0.3);
  cursor: help;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  article {
    padding: 0 16px;
    margin: 30px auto;
    font-size: 1rem;
    line-height: 1.7;
    overflow-x: hidden;
  }

  article h1 {
    font-size: 1.75rem;
  }

  article h2 {
    font-size: 1.25rem;
    margin-top: 36px;
  }

  article h3 {
    font-size: 1rem;
    margin-top: 24px;
  }

  /* Reset breakout on mobile */
  article pre,
  article blockquote,
  article table,
  article img {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  article pre {
    padding: 0;
    font-size: 0.8rem;
    border-radius: 0;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    box-sizing: border-box;
  }

  article blockquote {
    margin-left: 0;
    margin-right: 0;
    padding-left: 16px;
  }

  article table {
    font-size: 0.75rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  article th,
  article td {
    padding: 8px 10px;
    white-space: nowrap;
  }

  article img {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
  }

  /* Numbered lists on mobile */
  article ol > li {
    padding-left: 36px;
  }

  article ol > li::before {
    font-size: 1.25rem;
  }

  article ol > li strong:first-child {
    font-size: 1rem;
  }
}
