/**
 * @file
 * Element defaults and typography.
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) * 0.75);
}

@media (prefers-reduced-motion: no-preference) {
  html:focus-within {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--c-text);
  background: var(--c-page);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.5em;
  color: var(--c-heading);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.01em; }
h4 { font-size: var(--fs-lg); }
h5,
h6 { font-size: var(--fs-base); }

p,
ul,
ol,
dl,
blockquote,
pre,
table,
figure {
  margin: 0 0 1.25em;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--c-link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--c-link-hover);
  text-decoration-thickness: 0.14em;
}

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: 2px;
}

[tabindex="-1"]:focus {
  outline: none;
}

::selection {
  color: var(--hh-navy);
  background: var(--hh-green);
}

hr {
  height: 0;
  margin: 2.5rem 0;
  border: 0;
  border-top: 2px dashed var(--c-border-strong);
}

strong,
b {
  font-weight: 750;
}

small {
  font-size: var(--fs-sm);
}

blockquote {
  margin-inline: 0;
  padding: 0.75rem 1.25rem;
  color: var(--c-text-muted);
  border-left: 4px solid var(--hh-tan);
  font-size: var(--fs-lg);
  font-style: italic;
}

/* Code: inline as a tan tag, blocks as a terminal. */
code,
kbd,
samp,
pre,
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-variant-ligatures: none;
}

:not(pre) > code {
  padding: 0.12em 0.4em;
  background: var(--c-code-bg);
  border-radius: 0.35em;
  overflow-wrap: anywhere;
}

pre {
  overflow-x: auto;
  padding: 1.1rem 1.25rem;
  color: var(--hh-cream);
  background: var(--hh-navy);
  border-radius: var(--radius);
  border-left: 4px solid var(--hh-green);
  line-height: 1.55;
  tab-size: 2;
}

kbd {
  padding: 0.1em 0.45em;
  background: var(--c-raised);
  border: 1px solid var(--c-border-strong);
  border-bottom-width: 3px;
  border-radius: 0.35em;
}

mark {
  color: var(--hh-navy);
  background: color-mix(in srgb, var(--hh-green) 55%, transparent);
  border-radius: 0.2em;
  padding-inline: 0.15em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

caption {
  margin-bottom: 0.5rem;
  color: var(--c-text-muted);
  text-align: start;
}

th,
td {
  padding: 0.65rem 0.85rem;
  text-align: start;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}

thead th {
  color: var(--hh-cream);
  background: var(--hh-navy);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 0;
}

thead th:first-child { border-start-start-radius: var(--radius-sm); }
thead th:last-child { border-start-end-radius: var(--radius-sm); }

thead th a {
  color: inherit;
}

tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--c-code-bg) 45%, transparent);
}

/* Utility */
.visually-hidden.focusable:focus,
.skip-link:focus {
  position: fixed !important;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  width: auto !important;
  height: auto !important;
  clip: auto !important;
  padding: 0.75rem 1.25rem;
  color: var(--hh-navy);
  background: var(--hh-green);
  border: 2px solid var(--hh-navy);
  border-radius: var(--radius-pill);
  font-weight: 750;
  text-decoration: none;
}

.prose {
  max-width: var(--measure);
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.prose h3 {
  margin-top: 1.8em;
}

.prose img {
  border-radius: var(--radius);
}
