:root {
  --bg: #f5f4ef;
  --ink: #1b1b19;
  --muted: #8b887f;
  --faint: #d9d6cc;
  --accent: #e4572e;
  --serif: "Newsreader", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --ink: #e9e7e1;
    --muted: #7d7a72;
    --faint: #2c2b28;
    --accent: #ff7a50;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration: none; }

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

kbd {
  font-family: var(--mono);
  font-size: 10px;
  border: 1px solid var(--faint);
  border-radius: 3px;
  padding: 0 4px;
  color: var(--muted);
}

/* ---------- layout ---------- */

.page {
  max-width: 36rem;
  margin: 0 auto;
  padding: 22vh 20px 160px;
}

.name {
  font-size: 19px;
  font-weight: 500;
  display: inline-block;
  cursor: default;
}

.lede { color: var(--muted); margin-top: 2px; }
.lede .ink { color: var(--ink); }

/* inline links — the whole navigation lives inside sentences */
.go {
  color: var(--ink);
  cursor: pointer;
  background-image: linear-gradient(var(--faint), var(--faint));
  background-size: 100% 1px;
  background-position: 0 92%;
  background-repeat: no-repeat;
  transition: background-size 0.6s ease, color 0.6s ease;
}
.sleep .go {
  color: var(--muted);
  background-size: 0% 1px;
}
.go:nth-of-type(2) { transition-delay: 0.08s; }
.go:nth-of-type(3) { transition-delay: 0.16s; }
.go:nth-of-type(4) { transition-delay: 0.24s; }
.go:nth-of-type(5) { transition-delay: 0.32s; }
.go:hover, .go.on { transition-delay: 0s; }
.go:hover, .go.on { background-image: linear-gradient(var(--accent), var(--accent)); }
.go.on { color: var(--accent); }

a.u {
  background-image: linear-gradient(var(--faint), var(--faint));
  background-size: 100% 1px;
  background-position: 0 92%;
  background-repeat: no-repeat;
  transition: background-image 0.2s;
}
a.u:hover { background-image: linear-gradient(var(--ink), var(--ink)); }

/* ---------- drawer ---------- */

.drawer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(.2,.7,.2,1);
}
.drawer.open { grid-template-rows: 1fr; }
.drawer > div { overflow: hidden; }

.panel { padding-top: 44px; }
.panel[hidden] { display: none; }

.panel > * {
  opacity: 0;
  transform: translateY(6px);
  animation: rise 0.5s cubic-bezier(.2,.7,.2,1) forwards;
}
.panel > *:nth-child(2) { animation-delay: 0.04s; }
.panel > *:nth-child(3) { animation-delay: 0.08s; }
.panel > *:nth-child(4) { animation-delay: 0.12s; }
.panel > *:nth-child(5) { animation-delay: 0.16s; }
.panel > *:nth-child(6) { animation-delay: 0.2s; }
.panel > *:nth-child(n+7) { animation-delay: 0.24s; }

@keyframes rise { to { opacity: 1; transform: none; } }

.label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel p + p { margin-top: 0.9em; }

/* rows: date | thing */
.row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0 16px;
  padding: 9px 0;
  border-top: 1px solid var(--faint);
}
.row:last-child { border-bottom: 1px solid var(--faint); }
.row .mono { padding-top: 6px; }
.row .t { display: block; }
.row .d { display: block; color: var(--muted); font-size: 16px; line-height: 1.45; }
a.row { transition: padding-left 0.25s ease; }
a.row:hover { padding-left: 6px; }
a.row:hover .t { color: var(--accent); }
.arrow { font-family: var(--mono); font-size: 12px; color: var(--muted); }

@media (max-width: 520px) {
  body { font-size: 18px; }
  .page { padding-top: 14vh; }
  .row { grid-template-columns: 1fr; }
  .row .mono { padding-top: 0; }
}

/* ---------- portrait that follows the cursor over the name ---------- */

.portrait {
  position: fixed;
  width: 132px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.94) rotate(-2deg);
  transition: opacity 0.25s, transform 0.35s cubic-bezier(.2,.7,.2,1);
  z-index: 5;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}
.portrait.show { opacity: 1; transform: scale(1) rotate(-2deg); }
@media (hover: none) { .portrait, .hint, .flip { display: none; } }

/* ---------- the world: a world model of Boston, behind everything ---------- */

.world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.page { position: relative; z-index: 1; }
.readout.swap { opacity: 0 !important; }

/* ---------- the field: an MPPI-controlled dot that wanders the page ---------- */

.field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}
body::after {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 44px;
  background: linear-gradient(to bottom, transparent, var(--bg) 60%);
  pointer-events: none;
  z-index: 3;
}
@media (max-width: 640px) { .hint { display: none; } }

.readout {
  z-index: 5;
  position: fixed;
  bottom: 6px;
  right: 20px;
  pointer-events: auto;
  opacity: 0.0;
  transition: opacity 0.6s;
}
.readout.show { opacity: 1; }
.readout:hover { color: var(--ink); }
.hint {
  position: fixed;
  bottom: 6px;
  left: 20px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.6s;
}
.hint.show { opacity: 1; }

/* ---------- command palette ---------- */

.palette {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10;
}
.palette.open { display: flex; }
.palette-box {
  width: min(420px, calc(100vw - 32px));
  background: var(--bg);
  border: 1px solid var(--faint);
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
  overflow: hidden;
  animation: rise 0.2s ease forwards;
}
.palette input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--faint);
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 14px 16px;
  outline: none;
}
.palette input::placeholder { color: var(--muted); }
.palette ul { list-style: none; max-height: 50vh; overflow: auto; padding: 6px; }
.palette li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.palette li.sel { background: var(--faint); }

/* ---------- article (blog posts) ---------- */

.article h1 { font-size: 30px; font-weight: 400; line-height: 1.2; margin: 14px 0 6px; }
.article h3 { font-size: 19px; font-weight: 500; margin: 1.8em 0 0.4em; }
.article p, .article ul { margin-top: 0.9em; }
.article ul { padding-left: 1.2em; }
.article .body a { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
