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

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

body {
  --page: var(--measure);
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--text-body);
  line-height: var(--leading);
}

body:has(.project-group .project-figure) {
  --page: var(--measure-wide);
}

h1, h2, h3, p, ul, ol, dl, dd, figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

[hidden] {
  display: none !important;
}

code {
  font-family: var(--font-mono);
  font-size: var(--text-code);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.label {
  font-size: var(--text-small);
  color: var(--muted);
}

.site-header,
main,
.site-footer {
  width: min(100% - 2 * var(--gutter), var(--page));
  margin-inline: auto;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-5) var(--space-4);
}

.site-name {
  margin-right: auto;
  color: var(--ink);
  font-weight: 700;
  text-decoration-line: none;
}

.site-name:hover {
  text-decoration-line: underline;
}

.site-nav ul {
  display: flex;
  gap: var(--space-5);
}

.site-header .site-links {
  display: none;
}

.site-nav a,
.site-links a {
  display: block;
  padding-block: var(--space-1);
  text-decoration-line: none;
}

.site-nav a:hover,
.site-links a:hover {
  text-decoration-line: underline;
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.4em;
}

main {
  padding-block: var(--space-6) var(--space-8);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-1) var(--space-5);
  padding-block: var(--space-4) var(--space-6);
  border-top: 1px solid var(--rule);
  font-size: var(--text-small);
  color: var(--muted);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
}

.theme-switch {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: var(--space-1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-round);
  background: none;
  color: var(--faint);
  font: inherit;
  cursor: pointer;
}

.theme-switch::before {
  content: "";
  position: absolute;
  inset: var(--space-1) 50% var(--space-1) var(--space-1);
  border: 1px solid var(--muted);
  border-radius: var(--radius-round);
  background: var(--hover);
}

.theme-switch[aria-checked="true"]::before {
  inset: var(--space-1) var(--space-1) var(--space-1) 50%;
}

.theme-switch-option {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--space-6);
  height: var(--space-5);
  transition: color 0.15s ease-out;
}

.theme-switch[aria-checked="false"] .theme-switch-option:first-child,
.theme-switch[aria-checked="true"] .theme-switch-option:last-child,
.theme-switch:hover .theme-switch-option {
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .theme-switch-option {
    transition: none;
  }
}

@media (max-width: 34rem) {
  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-2) var(--space-4);
  }

  .site-name {
    grid-area: 1 / 1;
    justify-self: start;
  }

  .theme-switch {
    grid-area: 1 / 2;
    justify-self: end;
  }

  .site-nav {
    grid-area: 2 / 1;
  }

  .site-nav ul,
  .site-header .site-links {
    gap: var(--space-1) var(--space-4);
  }

  .site-header .site-links {
    display: flex;
    grid-area: 2 / 2;
    justify-content: end;
  }
}
