/* Mobile-first, readable single-column layout */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: #fff;
  color: #111;

  /* Use a modern, readable default font stack */
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans", "Liberation Sans", sans-serif;

  /* Scales nicely across devices */
  font-size: clamp(16px, 4vw, 19px);
  line-height: 1.6;

  /* Prevent long tokens/URLs from breaking layout */
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

/* Keep content centered on large screens but full width on mobile */
article {
  width: 100%;
  max-width: 72ch;
  margin: 0 auto;
  padding: clamp(12px, 4vw, 28px);
}

/* Headings: readable and not overly huge on small screens */
h1, h2, h3, h4, h5 {
  line-height: 1.25;
  margin: 1.2em 0 0.5em;
}

h2.titleHead {
  font-size: clamp(22px, 6vw, 34px);
  margin-top: 0.2em;
}

.author {
  font-size: 0.95em;
  opacity: 0.9;
}

/* Paragraph spacing */
p {
  margin: 0.7em 0;
}

/* Lists: better indentation on mobile */
ol, ul {
  padding-left: 1.25em;
  margin: 0.6em 0 0.9em;
}

li {
  margin: 0.35em 0;
}

/* Images: never overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Tables: make them scroll horizontally on small screens */
table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
}

th, td {
  padding: 0.4em 0.6em;
  vertical-align: top;
}

/* Figure captions etc. */
figure {
  margin: 1.0em 0;
}

figcaption {
  font-size: 0.92em;
  opacity: 0.9;
  margin: 0.4em 0 0.2em;
}

/* Table of contents: make links easier to tap */
.tableofcontents a {
  display: inline-block;
  padding: 0.15em 0;
}

/* Optional: slightly tighten huge gaps produced by conversion artifacts */
br.newline {
  line-height: 1.2;
}

/* Links */
a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Mobile padding fix --- */
@media (max-width: 640px) {

  body {
    padding-left: 14px;
    padding-right: 14px;
  }

  article {
    padding-left: 0;
    padding-right: 0;
  }

  /* Keep headings away from edges */
  h1, h2, h3 {
    margin-left: 2px;
    margin-right: 2px;
  }

  /* Lists look cramped otherwise */
  ol, ul {
    padding-left: 1.15em;
  }
}
