*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #111;
}

body {
  font-size: 1rem;
  background-color: #fff;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);   /* 32px → 44px */
  line-height: 1.15;
  margin: 0.6em 0;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);  /* 26px → 34px */
  line-height: 1.25;
  margin: 0.75em 0;
}

h3 {
  font-size: clamp(1.3rem, 2.5vw, 1.7rem); /* 21px → 27px */
  line-height: 1.35;
  margin: 0.9em 0;
}

h4 {
  font-size: clamp(1.1rem, 2vw, 1.3rem);  /* 18px → 21px */
  line-height: 1.45;
  margin: 1.1em 0;
}

h5 {
  font-size: 1rem;
  line-height: 1.55;
  margin: 1.3em 0;
}

h6 {
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 1.5em 0;
}

/* Visual hierarchy bonus */
h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #111;
}

h4, h5, h6 {
  font-weight: 500;
  color: #333;
}

/* Anchor / deep-link safety */
h1, h2, h3, h4, h5, h6 {
  scroll-margin-top: 6rem;
  overflow-wrap: break-word;
}

p {
  margin: 0.75em 0;
  max-width: 72ch; /* ideal reading width */
  overflow-wrap: break-word;
}

h1 + p,
h2 + p,
h3 + p {
  margin-top: 0.25em;
}

article {
  max-width: 72ch;
  word-break: normal;
  hyphens: auto;
}

article h2 {
  margin-top: 2em;
}

a {
  color: #0a58ca;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid #0a58ca;
  outline-offset: 2px;
}

ul, ol {
  margin: 1em 0;
  padding-left: 1.5em;
  max-width: 72ch;
}

blockquote {
  margin: 1.5em 0;
  padding-left: 1em;
  border-left: 4px solid #ddd;
  color: #555;
  max-width: 72ch;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

pre {
  padding: 1em;
  overflow-x: auto;
  background: #f7f7f7;
  border-radius: 6px;
}

input, textarea, select, button {
  font: inherit;
}

label {
  font-weight: 500;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

main h1:first-of-type {
  margin-top: 0;
}

@media print {
  body {
    color: #000;
    background: none;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  a {
    color: #000;
    text-decoration: none;
  }
}
