/* Shared typography, paper background, navigation and contact positioning. */
:root {
  --bg-color: #e7e5e2;
  --bg-image-opacity: 0.28;
  --text: #111;
  --muted: rgba(0,0,0,.6);
  --contact-size: 14px;
}

html,body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-color);
  color: var(--text);
  font-family: ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("/background.jpg")center / cover no-repeat;
  opacity: var(--bg-image-opacity);
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(70% 60% at 50% 30%,rgba(255,255,255,.45),rgba(255,255,255,.86));
  pointer-events: none;
  z-index: -1;
}

.logo {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 20;
}

nav {
  text-transform: uppercase;
}

nav a {
  color: var(--text);
  text-decoration: none;
  opacity: .75;
}

nav a:hover {
  opacity: 1;
}

.contact {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 20;
  text-align: right;
  font-size: var(--contact-size);
  color: var(--muted);
}

.contact a {
  color: var(--text);
  text-decoration: none;
}

/* Keyboard location and current section, without adding visible controls. */
nav a[aria-current="page"] { opacity: 1; }
/* Transparent original handwriting; the SVG wrappers only frame the PNGs. */
nav .handwritten-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  line-height: 1;
}
.nav-artwork {
  display: block;
  width: 72px;
  height: auto;
}
nav a[href="/write/"] .nav-artwork { width: 84px; }
.handwritten-contact {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: calc(100vw - 28px);
}
.handwritten-contact img {
  display: block;
  width: min(310px, calc(100vw - 28px));
  height: auto;
}
nav .handwritten-link:focus-visible,
.handwritten-contact:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}
@media(max-width:740px) {
  .nav-artwork { width: 58px; }
  nav a[href="/write/"] .nav-artwork { width: 68px; }
  .handwritten-contact img { width: min(270px, calc(100vw - 28px)); }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (prefers-reduced-motion: reduce) {
  body nav a, body .logo { transition: none; }
}
