/* Base Typography and Element Styles */

* {
  box-sizing: border-box;
}

/* Lobotomized owl: consistent vertical rhythm */
* + * {
  margin-top: var(--line-height);
}

html {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  flex-direction: column;
  align-items: center;
  background: var(--color-background);
  color: var(--color-text);
}

body {
  position: relative;
  width: 100%;
  margin: 0;
  padding: var(--line-height) var(--padding-base);
  max-width: calc(min(80ch, round(down, 100%, 1ch)));
  line-height: var(--line-height);
  overflow-x: hidden;
}

@media screen and (max-width: 30rem) {
  :root {
    font-size: var(--font-size-mobile);
  }
  body {
    padding: var(--line-height) var(--padding-mobile);
  }
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  margin: calc(var(--line-height) * 2) 0 var(--line-height);
  line-height: var(--line-height);
}

h1, h2 {
  font-size: inherit;
}

/* Paragraphs */
p {
  margin-bottom: var(--line-height);
  word-break: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* Links */
a {
  color: var(--color-link);
  text-decoration: none;
  text-decoration-thickness: var(--border-thickness);
}

a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

/* Main content area */
main {
  margin: 0;
  padding: 0;
}

/* Preformatted text */
pre {
  white-space: pre;
  overflow-x: auto;
  margin: var(--line-height) 0;
  overflow-y: hidden;
  font-family: inherit;
}

/* Tables — borderless, pure columnar text */
table {
  width: calc(round(down, 100%, 1ch));
  border-collapse: collapse;
  margin: 0 0 calc(var(--line-height) * 2);
}

th, td {
  border: none;
  padding: 0 2ch 0 0;
  line-height: var(--line-height);
  vertical-align: top;
  text-align: left;
}

th:last-child, td:last-child {
  padding-right: 0;
}

th {
  font-weight: var(--font-weight-bold);
}

/* Horizontal rules — zero layout impact */
hr {
  display: block;
  height: 0;
  margin: calc(var(--line-height) * 2) 0;
  border: none;
  box-shadow: 0 0 0 calc(var(--border-thickness) / 2) var(--color-text);
}

/* Images */
img {
  display: block;
  width: 100%;
  object-fit: contain;
  overflow: hidden;
}

/* Strong / em */
strong {
  font-weight: var(--font-weight-bold);
}

em {
  font-style: italic;
}
