.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1.5rem;
  background: var(--header-background);
}

.header-links {
  display: flex;
  gap: 1rem;
}

.header-links a {
  color: var(--page-foreground);
  font-weight: 700;
  text-decoration: none;
}

.header-links a:hover {
  text-decoration: underline;
}

.header-links a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.ascii-cat {
  position: relative;
  border: 0;
  padding: 0.25rem;
  background: none;
  color: #000;
  font: bold 1rem/1.5 "Source Code Pro", monospace;
  letter-spacing: -0.125em;
  cursor: pointer;
}

body[data-theme="dark"] .ascii-cat {
  color: #fff;
}

.cat-sleep {
  position: absolute;
  top: -0.5rem;
  right: -1.5rem;
  display: none;
  letter-spacing: normal;
}

.ascii-cat[aria-pressed="false"] .cat-sleep {
  display: block;
  animation: cat-bounce 1s infinite alternate ease-in-out;
}

.cat-face > span {
  display: block;
  white-space: pre;
}

.theme-picker {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
}

.theme-menu {
  position: relative;
}

.theme-toggle {
  border: 0;
  padding: 0.25rem 0;
  background: transparent;
  color: var(--page-foreground);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.theme-arrow {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 1.2rem;
  transition: transform 150ms ease;
}

.theme-toggle[aria-expanded="true"] .theme-arrow {
  transform: rotate(180deg);
}

.theme-options {
  position: absolute;
  z-index: 1;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 9rem;
  padding: 0.35rem;
  border: 1px solid var(--page-foreground);
  border-radius: 0.5rem;
  background: var(--page-background);
  box-shadow: 0 0.4rem 1rem rgb(0 0 0 / 18%);
}

.theme-options[hidden] {
  display: none;
}

.theme-option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.3rem;
  padding: 0.5rem 0.65rem;
  background: transparent;
  color: var(--page-foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.theme-option:hover,
.theme-option[aria-pressed="true"] {
  background: var(--header-background);
}

.theme-toggle:focus-visible,
.theme-option:focus-visible,
.ascii-cat:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@keyframes cat-bounce {
  to {
    transform: translateY(-0.25rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cat-sleep {
    animation: none;
  }
}

@media (max-width: 600px) {
  .site-header {
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
  }

  .header-links {
    gap: 0.5rem;
  }

  .header-links a {
    font-size: 0.8rem;
  }

  .ascii-cat {
    font-size: 0.9rem;
  }

  .theme-picker {
    gap: 0.2rem;
  }

  .theme-picker > span {
    display: none;
  }
}

@media (max-width: 400px) {
  .site-header {
    display: grid;
    grid-template-columns: auto 1fr;
    row-gap: 0.25rem;
  }

  .header-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
  }

  .theme-picker {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
}
