/* ==========================================================================
   ELEMENTS — resets and bare HTML element styling
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--s-8);
}

body {
  margin: 0;
  padding-bottom: var(--agebar-space);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--t-base);
  line-height: 1.62;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--s-4);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h1 {
  font-size: var(--t-mega);
  line-height: 0.94;
  letter-spacing: -0.035em;
}

h2 {
  font-size: var(--t-xxl);
}

h3 {
  font-size: var(--t-lg);
  letter-spacing: -0.012em;
}

h4 {
  font-size: var(--t-md);
  letter-spacing: 0;
}

p {
  margin: 0 0 var(--s-4);
  max-width: var(--measure);
}

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

strong {
  font-weight: 700;
}

em {
  font-style: italic;
}

small {
  font-size: var(--t-xs);
}

/* Links — accent-coloured with a small chevron suffix */
a {
  color: var(--ink);
  text-decoration: none;
}

main a:not([class]),
.colophon a:not([class]),
.agebar a:not([class]) {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--lime-deep);
  text-underline-offset: 3px;
}

main a:not([class])::after,
.agebar a:not([class])::after {
  content: "\00a0›";
  text-decoration: none;
  font-weight: 700;
  color: var(--lime-deep);
}

main a:not([class]):hover,
main a:not([class]):focus-visible {
  background: var(--tint-lime);
}

:focus-visible {
  outline: 3px solid var(--lime-deep);
  outline-offset: 2px;
}

/* Lists — hanging indents, no visible bullet */
ul,
ol {
  margin: 0 0 var(--s-5);
  padding: 0;
  list-style: none;
  max-width: var(--measure);
}

ul > li,
ol > li {
  margin-bottom: var(--s-3);
  padding-left: var(--s-6);
  text-indent: calc(var(--s-6) * -1);
}

ol {
  counter-reset: hang;
}

ol > li::before {
  counter-increment: hang;
  content: counter(hang, decimal-leading-zero) "\00a0\00a0";
  font-weight: 700;
  color: var(--lime-deep);
}

ul > li::before {
  content: "";
  display: inline-block;
  width: var(--s-4);
  height: 2px;
  margin-right: var(--s-4);
  vertical-align: 0.35em;
  background: var(--lime-deep);
}

li > ul,
li > ol {
  margin: var(--s-3) 0 0;
  text-indent: 0;
}

figure {
  margin: 0;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

/* Tables — zebra rows, no vertical rules */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: var(--s-4) var(--s-4);
  text-align: left;
  vertical-align: top;
  border: 0;
}

thead th {
  background: var(--ink);
  color: var(--on-ink);
  font-size: var(--t-label);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  line-height: 1.35;
  vertical-align: bottom;
}

tbody tr:nth-child(odd) {
  background: var(--tint-1);
}

blockquote {
  margin: 0;
}

hr {
  border: 0;
  height: 2px;
  background: var(--tint-2);
  margin: var(--s-7) 0;
}

dl {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
