html, body { overscroll-behavior: none; }

html {
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  max-width: 72ch;
  margin: 0 auto;
  padding: 2rem 1rem;
}

body {
  margin: 0;
}

/* Prose spacing */
p, ul, ol, dl, blockquote, pre, table, figure, details {
  margin: 0 0 1rem;
}

h1, h2, h3, h4, h5, h6 {
  margin: 2rem 0 0.5rem;
  font-weight: normal;
  line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4, h5, h6 { font-size: 1rem; }

/* First heading in section needs no top margin */
section > h1:first-child,
section > h2:first-child,
section > h3:first-child,
article > h2:first-child {
  margin-top: 0;
}

a {
  color: inherit;
}

/* Header nav */
body > header {
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid;
}

body > header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

body > header nav > ul {
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Hero */
hgroup {
  margin: 3rem 0;
}

hgroup > p {
  margin: 0;
  color: #666;
}

/* Inline elements */
code, kbd, samp {
  font-family: monospace;
  font-size: 0.9em;
}

kbd {
  border: 1px solid;
  padding: 0.1em 0.3em;
}

mark {
  background: #ff0;
  padding: 0 0.2em;
}

/* Blockquote */
blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 2px solid;
}

blockquote footer {
  color: #666;
}

/* Code blocks */
pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid;
}

pre code {
  font-size: 0.85rem;
}

/* Lists */
ul, ol {
  padding-left: 1.5rem;
}

ul ul, ol ol, ul ol, ol ul {
  margin-bottom: 0;
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
}

dt {
  font-weight: bold;
}

dd {
  margin: 0;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid;
  margin: 1rem 0;
}

/* Forms */
fieldset {
  border: 1px solid;
  padding: 1rem;
  margin: 0 0 1rem;
}

legend {
  font-weight: bold;
}

label {
  display: block;
  margin-bottom: 0.75rem;
}

label:has(input[type="checkbox"]),
label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
textarea,
select {
  display: inline-block;
  width: 100%;
  height: 2rem;
  margin-top: 0.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid;
  border-radius: 2px;
  background: transparent;
  font: inherit;
  line-height: 1.5;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

textarea {
  height: auto;
  min-height: 4rem;
  resize: vertical;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

select[multiple] {
  height: auto;
  background-image: none;
  padding-right: 0.5rem;
}

input[type="color"] {
  margin-top: 0.25rem;
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"],
a[role="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid;
  border-radius: 2px;
  background: transparent;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
  vertical-align: middle;
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
a[role="button"]:hover {
  background: #000;
  color: #fff;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:disabled:hover {
  background: transparent;
  color: inherit;
}

/* Menu (button groups) */
menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

caption {
  text-align: left;
  margin-bottom: 0.5rem;
  color: #666;
}

th, td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid;
}

th {
  font-weight: bold;
}

tfoot td {
  color: #666;
}

/* Details */
details {
  border: 1px solid;
  padding: 0.5rem 1rem;
}

details + details {
  border-top: none;
}

summary {
  cursor: pointer;
  font-weight: bold;
}

details[open] summary {
  margin-bottom: 0.5rem;
}

/* Dialog */
dialog {
  border: 1px solid;
  padding: 1.5rem;
  max-width: 90vw;
  width: 24rem;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

dialog > header {
  margin-bottom: 1rem;
}

dialog > header h4 {
  margin: 0;
}

dialog > footer {
  margin-top: 1rem;
}

/* Progress & Meter */
progress, meter {
  display: block;
  width: 100%;
  height: 1rem;
  margin-top: 0.25rem;
}

/* Figure */
figure {
  margin: 0 0 1rem;
}

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

figcaption {
  margin-top: 0.5rem;
  color: #666;
  font-size: 0.9rem;
}

/* Article as card */
article article,
section > article {
  border: 1px solid;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Aside as callout */
aside {
  border-left: 2px solid;
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: #f5f5f5;
}

aside h4 {
  margin: 0 0 0.5rem;
}

aside p:last-child {
  margin-bottom: 0;
}

/* Breadcrumb nav */
nav[aria-label="Breadcrumb"] ol {
  display: flex;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}

nav[aria-label="Breadcrumb"] li:not(:last-child)::after {
  content: "/";
  margin-left: 0.5rem;
}

/* Pagination nav */
nav[aria-label="Pagination"] ul {
  display: flex;
  gap: 0.25rem;
  padding: 0;
  list-style: none;
}

nav[aria-label="Pagination"] a {
  display: block;
  padding: 0.5rem 0.75rem;
  border: 1px solid;
  text-decoration: none;
}

nav[aria-label="Pagination"] a[aria-current="page"] {
  background: #000;
  color: #fff;
}

/* Tabs */
menu[role="tablist"] {
  border-bottom: 1px solid;
  gap: 0;
}

menu[role="tablist"] button {
  height: auto;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
}

menu[role="tablist"] button[aria-selected="true"] {
  border-bottom-color: #000;
}

menu[role="tablist"] button:hover {
  background: transparent;
  color: inherit;
}

/* Search */
search form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

search label {
  flex: 1;
  margin: 0;
}

search input {
  margin: 0;
}

search button {
  flex-shrink: 0;
}

/* Footer */
body > footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid;
}

/* Section spacing */
main > article {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #ddd;
}

main > article:last-child {
  border-bottom: none;
}

section {
  margin-bottom: 2rem;
}

/* Address */
address {
  font-style: normal;
}
