:root {
  color-scheme: light dark;
  --color-text-primary: #000;
  --color-text-secondary: #222;
  --color-light: #fff;
  --flow-space: clamp(1rem, 1.3143rem + 1.5286vw, 1.7rem);
  --text-fluid-16-20: clamp(1rem, 0.9286rem + 0.3571vw, 1.25rem);
  --text-fluid-24-32: clamp(1.5rem, 1.3571rem + 0.7143vw, 2rem);
  --text-fluid-32-56: clamp(2rem, 1.5714rem + 2.1429vw, 3.5rem);
  --text-fluid-18-24: clamp(1.125rem, 1.0179rem + 0.5357vw, 1.5rem);
}

/* Reset */

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

/* Prevent font size inflation + aliasing */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  font-size: 100%;
}

/* Remove default margin in favor of better control in authored CSS */
body,
h1,
h2,
h3,
h4,
h5,
p,
figure,
blockquote,
dl,
dd,
ul,
ol,
li,
pre,
code {
  margin-block: 0;
  margin-inline: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.6;
}

/* Set shorter line heights on headings and interactive elements */
h1,
h2,
h3,
h4,
button,
input,
label {
  line-height: 1.1;
}

/* Balance text wrapping on headings */
h1,
h2,
h3,
h4,
h5 {
  text-wrap: balance;
  max-width: 21ch;
  letter-spacing: 0.3px;
}

h1 {
  max-width: 17ch;
}

/* Keep the line width accessible */
p,
pre,
code,
strong,
ul,
li {
  text-wrap: pretty;
  max-width: 65ch;
  overflow-wrap: break-word;
}

hr {
  margin-block: 0;
  border: 1px solid currentColor;
}

/* Make images easier to work with */
img,
picture,
object,
svg {
  max-width: 100%;
  display: block;
  font-style: italic;
}

/* Make b element less bold */
b {
  font-weight: 500;
}

/* Keep the image's aspect ratio */
img,
picture {
  height: 100%;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

/* End of Reset */

body {
  font-family: "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif;
  font-weight: 400;
  font-size: 1rem;
  color: var(--color-text-secondary);

  display: grid;
  place-content: center;

  max-width: min(85vw, 922px);
  margin-inline: auto;
  margin-block: 2rem;
}

body > * + * {
  margin-block-start: var(--flow-space);
}

::selection {
  color: var(--color-light);
  background-color: var(--color-text-primary);
}

img,
svg {
  user-select: none;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: Avenir, Montserrat, Corbel, "URW Gothic", source-sans-pro, sans-serif;
  color: var(--color-text-primary);
}

pre,
code {
  font-family:
    ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

pre {
  background-color: #f1f1f1;
  padding: 0.5rem;
  border-radius: 0.7rem;
}

/* Fluid typography */
h1,
h1 a {
  font-size: var(--text-fluid-32-56);
}

h2,
h2 a {
  font-size: var(--text-fluid-24-32);
}

h3,
h3 a,
small {
  font-size: var(--text-fluid-18-24);
}

h1 a,
h2 a,
h3 a {
  color: var(--color-text-primary);
}

p,
span,
strong,
a,
li,
h5,
h5,
h6 {
  font-size: var(--text-fluid-16-20);
}

a {
  text-decoration: transparent;
  text-underline-offset: 0.25rem;
}

ul li a {
  font-weight: 500;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.25rem;
}

[data-section="heading"] {
  display: flex;
  gap: 1rem;
  align-items: center;
}

[data-section="heading"] img {
  width: min(240px, 10rem);
  height: auto;
  border-radius: 0.15rem;
}

[data-section="heading"] img:hover {
  transition: all 30ms ease-in-out;
  filter: saturate(150%);
}

[data-section="heading"] h1 small {
  display: block;
  font-style: italic;
  margin-block-start: 0.75rem;
  color: var(--color-text-secondary);
}

[data-section="book-and-swag"] {
  width: fit-content;
  font-weight: 500;
}

img[alt="code concerns over time"] {
  width: min(100%, 60ch);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-text-primary: #fff;
    --color-text-secondary: #fafafa;
  }

  pre {
    background-color: #222;
    /* color: var(--color-text-secondary); */
  }

  ::selection {
    background-color: var(--color-light);
    color: #000;
  }
}
