@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f0eee6;
  --text: #1f1e1d;
  --muted: #5e5d59;
  --selection: rgb(180 162 126 / 32%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1f1e1d;
    --text: #f0eee6;
    --muted: #b0aea5;
    --selection: rgb(214 198 165 / 24%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1e1d;
  --text: #f0eee6;
  --muted: #b0aea5;
  --selection: rgb(214 198 165 / 24%);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem)/1.6 "Newsreader", Georgia, serif;
}

.page {
  max-width: 38.75rem;
  margin: 0 auto;
  padding: clamp(1.875rem, 5vh, 3.5rem) 1.25rem 4rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2rem;
  margin-bottom: 2.1875rem;
}

h1 {
  margin: 0;
  font-size: 1.44em;
  font-weight: 600;
  line-height: 1.1;
  text-wrap: balance;
}

h1 a {
  text-decoration: none;
}

h1 a:hover {
  color: var(--muted);
}

h2 {
  margin: 0 0 0.7em;
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

section {
  margin-top: 1.3em;
}

a {
  color: inherit;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 0.065em;
  text-underline-offset: 0.12em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

a:hover {
  text-decoration-color: var(--text);
}

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

::selection {
  background: var(--selection);
  color: inherit;
}

:target {
  scroll-margin-top: 1.5rem;
}

.theme-toggle {
  flex: 0 0 2.75rem;
  width: 2.75rem;
  height: 2.75rem;
  margin: -0.375rem -0.125rem -0.375rem 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:not([hidden]) {
  display: grid;
  place-items: center;
}

.theme-toggle-track {
  position: relative;
  display: block;
  width: 2.5rem;
  height: 1.25rem;
  border: 0.0625rem solid var(--text);
  border-radius: 999px;
  background: var(--bg);
}

.theme-toggle-track::before {
  content: "";
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  background: var(--text);
  transition: transform 160ms ease;
}

.theme-toggle[aria-checked="true"] .theme-toggle-track::before {
  transform: translateX(1.25rem);
}

@media (prefers-reduced-motion: reduce) {
  a,
  .theme-toggle-track::before {
    transition: none;
  }
}

@media print {
  .theme-toggle {
    display: none !important;
  }
}
