* {
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  box-sizing: border-box;
}
:root {
  --lh: 1.5em;
  --bg: #ffffff;
  --ink: #1a1a1a;
  --dim: #888888;
  --accent: #c00f29;
  --rule: #e5e5e5;
  --selection: #ddd;
  --toggle-bg: #1a1a1a;
  --toggle-thumb: #ffffff;
}
[data-theme="dark"] {
  --bg: #0a0a0a;
  --ink: #f0f0f0;
  --dim: #777777;
  --accent: #c00f29;
  --rule: #2d2d2d;
  --selection: #333;
  --toggle-bg: #f0f0f0;
  --toggle-thumb: #0a0a0a;
}
@media (max-width: 600px) {
  [data-theme="dark"] {
    --rule: #5a5a5a;
  }
}
::selection {
  background: var(--selection);
  color: var(--ink);
}
html {
  height: 100%;
  background: var(--bg);
}
body {
  font: 1em/var(--lh) monospace;
  background: var(--bg);
  color: var(--ink);
  padding: 16vh 2em 0;
  display: grid;
  grid: 1fr / minmax(auto, 64ch);
  justify-content: center;
  height: 100%;
  transition:
    background-color 200ms ease,
    color 200ms ease;
}
a {
  display: inline-block;
  padding: 0.16666em;
  margin-left: -0.16666em;
  text-decoration: none;
}
i {
  font-style: italic;
}
h1,
p,
nav {
  margin-bottom: var(--lh);
}
h2 {
  margin-bottom: var(--lh);
}
hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin-bottom: var(--lh);
}
blockquote {
  margin-bottom: var(--lh);
  padding-left: 1.5em;
  border-left: 2px solid var(--rule);
}
ol,
ul {
  padding-left: 1.5em;
  margin-bottom: var(--lh);
}
body.poem hr ~ p {
  text-align: center;
}
sup {
  font-size: 0.7em;
  vertical-align: super;
}
sup a {
  display: inline;
  padding: 0;
  margin: 0;
}
img,
video {
  max-width: 100%;
  height: auto;
  margin-bottom: var(--lh);
}
video {
  background: #000;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1em;
  margin-bottom: var(--lh);
}
.gallery figure {
  margin: 0;
  text-align: center;
}
.gallery img {
  margin-bottom: 0;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  cursor: pointer;
  background: var(--bg);
}
.gallery figcaption {
  font-size: 0.75em;
  color: var(--dim);
  margin-top: 0.3em;
}
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.lightbox.active {
  display: flex;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  margin: 0;
  cursor: default;
}
.refs {
  font-size: 0.85em;
  color: var(--dim);
  margin-top: var(--lh);
}
.refs p {
  margin-bottom: 0;
}
footer {
  padding: calc(var(--lh) * 2) 0 8vh;
}
footer p {
  margin: 0;
}
@media (max-device-width: 600px) {
  body {
    padding-top: 2em;
    justify-content: start;
  }
  footer {
    padding-bottom: 2em;
  }
}

/* === Top-right navigation (default for non-home pages) === */
.topnav {
  position: fixed;
  top: calc(1.25rem + 24px + 0.85rem);
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4em;
  font-size: 0.9rem;
  line-height: 1.3;
  z-index: 999;
}
.topnav a {
  padding: 0;
  margin: 0;
}
@media (max-device-width: 600px) {
  .topnav {
    top: calc(1rem + 24px + 0.75rem);
    right: 1rem;
    font-size: 0.85rem;
  }
}

/* === Hub pages (home, art, contact): centered horizontal nav === */
body.hub .topnav {
  top: 38vh;
  left: 0;
  right: 0;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  font-size: 1rem;
  line-height: 1;
}
@media (max-device-width: 600px) {
  body.hub .topnav {
    top: 32vh;
    gap: 1.25rem;
    font-size: 0.95rem;
  }
}

/* === Sibling-dim hover: focus the pointed item, fade the rest === */
nav a {
  transition: opacity 220ms ease;
}
nav:has(a:hover) a:not(:hover) {
  opacity: 0.3;
}

/* === Theme toggle (iOS-style pill) === */
.theme-toggle {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  z-index: 1000;
}
.theme-toggle__track {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--toggle-bg);
  border-radius: 999px;
  position: relative;
  transition: background-color 200ms ease;
}
.theme-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--toggle-thumb);
  border-radius: 50%;
  transition:
    transform 200ms ease,
    background-color 200ms ease;
}
[data-theme="dark"] .theme-toggle__thumb {
  transform: translateX(20px);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 999px;
}
@media (max-device-width: 600px) {
  .theme-toggle {
    top: 1rem;
    right: 1rem;
  }
}
