:root {
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --ink: #1c1a16;
  --ink-2: #4a463d;
  --ink-3: #8a8374;
  --rule: #d6cebd;
  --accent: #34508e;       /* ink blue */
  --accent-soft: #34508e1f;
  --accent-2: #2f5d62;     /* deep teal, used sparingly */
  --dot: #9b9383;

  --f-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --f-body: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --measure: 40rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161512;
    --paper-2: #1e1c18;
    --ink: #ece6d8;
    --ink-2: #bdb5a4;
    --ink-3: #847d6f;
    --rule: #34302a;
    --accent: #94abe0;
    --accent-soft: #94abe026;
    --accent-2: #7fb3b0;
    --dot: #5d584e;
  }
}
:root[data-theme="dark"] {
  --paper: #161512;
  --paper-2: #1e1c18;
  --ink: #ece6d8;
  --ink-2: #bdb5a4;
  --ink-3: #847d6f;
  --rule: #34302a;
  --accent: #94abe0;
  --accent-soft: #94abe026;
  --accent-2: #7fb3b0;
  --dot: #5d584e;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--paper); }
a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.mono { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem clamp(16px, 4vw, 3rem);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.bar .brand { font-family: var(--f-display); font-size: 1.35rem; text-decoration: none; line-height: 1; display: inline-flex; align-items: center; gap: 0.6rem; }
.zmark {
  width: 1.8rem; height: 1.6rem; background: var(--accent);
  -webkit-mask: url(img/z-bold.png) center / contain no-repeat; mask: url(img/z-bold.png) center / contain no-repeat;
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.bar .brand:hover .zmark { transform: skewX(-12deg); }
.bar nav { display: flex; gap: 1.4rem; align-items: center; }
.bar nav a { text-decoration: none; color: var(--ink-2); }
.bar nav a:hover, .bar nav a.on { color: var(--accent); }
.theme-btn {
  background: none; border: 1px solid var(--rule); color: var(--ink-2);
  width: 2rem; height: 2rem; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 760px) { .bar nav a:not(.keep) { display: none; } }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
  padding: clamp(2.5rem, 7vw, 6rem) clamp(16px, 4vw, 3rem) clamp(2rem, 4vw, 3rem);
  max-width: 78rem; margin: 0 auto;
}
.eyebrow { color: var(--ink-3); display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1.25rem; }
.eyebrow::before { content: ""; width: 2.5rem; height: 1px; background: var(--accent); }
h1 {
  font-family: var(--f-display); font-weight: 400;
  font-size: clamp(3.6rem, 11vw, 8.5rem);
  line-height: 0.88; letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
}
h1 .it { font-style: italic; color: var(--accent); }
.lede { font-size: clamp(1.2rem, 2vw, 1.45rem); line-height: 1.45; color: var(--ink-2); max-width: 34rem; margin: 0 0 1.75rem; font-weight: 300; }
.lede em { color: var(--ink); font-style: italic; }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.85rem; border: 1px solid var(--rule); border-radius: 999px;
  text-decoration: none; color: var(--ink-2); background: var(--paper);
  transition: border-color .2s, color .2s, transform .2s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.pill svg { width: 14px; height: 14px; }

/* portrait plate */
figure.portrait { margin: 0; justify-self: end; width: 100%; max-width: 30rem; }
.plate {
  position: relative; aspect-ratio: 1 / 1; width: 100%;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 4px;
  display: grid; place-items: center; overflow: hidden;
  background-image: radial-gradient(var(--rule) 1px, transparent 1.2px);
  background-size: 18px 18px;
}
.plate img {
  position: relative; width: 78%; height: auto; display: block;
  transform: rotate(-3deg); transition: transform .6s cubic-bezier(.2,.8,.2,1);
}
.plate:hover img { transform: rotate(2deg) translateY(-4px); }
.plate-mark { position: absolute; left: 0.8rem; bottom: 0.6rem; color: var(--ink-3); }
:root[data-theme="dark"] .plate img { filter: invert(0.9) sepia(0.25); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .plate img { filter: invert(0.9) sepia(0.25); }
}
figcaption { margin-top: 0.6rem; font-size: 0.95rem; color: var(--ink-3); font-style: italic; }
figcaption b { font-family: var(--f-mono); font-style: normal; font-weight: 500; font-size: 0.72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin-right: 0.5rem; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  figure.portrait { justify-self: start; max-width: 22rem; }
}

/* ---------- body layout ---------- */
.wrap {
  max-width: 78rem; margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 3rem) 4rem;
  display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 4rem);
}
.toc { position: sticky; top: 5rem; align-self: start; padding-top: 3rem; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.toc li { counter-increment: s; }
.toc ol a {
  display: flex; gap: 0.8rem; align-items: baseline; padding: 0.3rem 0;
  text-decoration: none; color: var(--ink-3); transition: color .2s;
}
.toc ol a::before { content: counter(s, decimal-leading-zero); font-family: var(--f-mono); font-size: 0.7rem; }
.toc ol a:hover { color: var(--ink); }
.toc ol a.on { color: var(--accent); }
.toc ol a.on::after { content: ""; flex: 1; height: 1px; background: var(--accent); align-self: center; }
.toc .contact { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.95rem; color: var(--ink-2); line-height: 1.45; }
.toc .contact .mono { color: var(--ink-3); display: block; margin-bottom: 0.35rem; }
@media (max-width: 860px) {
  .wrap { grid-template-columns: 1fr; }
  .toc { display: none; }
}

section { padding-top: 3rem; scroll-margin-top: 4rem; }
section + section { border-top: 1px solid var(--rule); margin-top: 3rem; }
.sec-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; }
.sec-head .num { font-family: var(--f-mono); font-size: 0.72rem; color: var(--accent); }
h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(2.2rem, 4.5vw, 3rem); line-height: 1; margin: 0; letter-spacing: -0.01em; }
h2 i { color: var(--ink-3); }
h3 { font-family: var(--f-body); font-weight: 500; font-size: 1.125rem; margin: 0; line-height: 1.35; }

p { max-width: var(--measure); margin: 0 0 1rem; }
.about p:first-of-type::first-letter {
  font-family: var(--f-display); float: left; font-size: 4.4rem; line-height: 0.8;
  padding: 0.35rem 0.6rem 0 0; color: var(--accent);
}

.interests { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.5rem; max-width: var(--measure); }
.interests span {
  font-family: var(--f-mono); font-size: 0.75rem; padding: 0.3rem 0.65rem;
  border-radius: 3px; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--rule);
}

/* ---------- news ---------- */
.news { list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.news li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px dashed var(--rule); }
.news li:last-child { border-bottom: 0; }
.news .mono { color: var(--ink-3); padding-top: 0.3rem; }

/* ---------- publications ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.75rem; }
.filters button {
  font: inherit; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: .04em; text-transform: uppercase;
  background: none; color: var(--ink-3); border: 1px solid var(--rule); border-radius: 999px;
  padding: 0.35rem 0.8rem; cursor: pointer;
}
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.pubs { position: relative; }
.year-group { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1.25rem; }
.year-group[hidden] { display: none; }
.year-group .yr {
  font-family: var(--f-display); font-size: 2rem; line-height: 1; color: var(--ink-3);
  position: sticky; top: 5rem; align-self: start; padding-top: 0.2rem;
}
.pub {
  position: relative; padding: 0 0 1.6rem 1.25rem; border-left: 1px solid var(--rule);
  transition: border-color .25s;
}
.pub[hidden] { display: none; }
.pub::before {
  content: ""; position: absolute; left: -5px; top: 0.55rem; width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--ink-3); transition: all .25s;
}
.pub:hover { border-left-color: var(--accent); }
.pub:hover::before { background: var(--accent); border-color: var(--accent); transform: scale(1.3); }
.pub h3 { font-size: 1.2rem; }
.pub .authors { color: var(--ink-2); font-size: 1rem; margin: 0.25rem 0; }
.pub .authors b { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pub .venue { font-style: italic; color: var(--ink-2); font-size: 1rem; }
.pub .meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; align-items: center; margin-top: 0.5rem; }
.tag { font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: .05em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 2px; }
.tag.venue-tag { background: var(--accent-soft); color: var(--accent); }
.tag.first { color: var(--accent-2); border: 1px solid currentColor; }
.pub .meta a { font-family: var(--f-mono); font-size: 0.72rem; text-decoration: none; color: var(--ink-3); }
.pub .meta a:hover { color: var(--accent); }
.pub .meta a::before { content: "↗ "; }

/* ---------- experience ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 7rem 1fr; gap: 1.25rem; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.timeline > li:last-child { border-bottom: 0; }
.timeline .when { color: var(--ink-3); padding-top: 0.3rem; }
.timeline .role { color: var(--accent); font-style: italic; }
.timeline .where { color: var(--ink-2); font-size: 1rem; }
.timeline p { font-size: 1rem; color: var(--ink-2); margin: 0.4rem 0 0; }
.timeline ul { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: 1rem; color: var(--ink-2); max-width: var(--measure); }
.timeline ul li::marker { color: var(--accent); content: "— "; }
@media (max-width: 560px) {
  .timeline > li, .news li { grid-template-columns: 1fr; gap: 0.2rem; }
  .year-group { grid-template-columns: 1fr; gap: 0.5rem; }
  .year-group .yr { position: static; }
}

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 2rem 3rem; }
.card-title { color: var(--ink-3); margin: 0 0 0.75rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--rule); }
.plain { list-style: none; margin: 0; padding: 0; font-size: 1rem; }
.plain li { padding: 0.35rem 0; color: var(--ink-2); }
.plain li b { color: var(--ink); font-weight: 500; }
.plain .mono { color: var(--ink-3); margin-right: 0.5rem; }

.lang { display: grid; grid-template-columns: auto 1fr auto; gap: 0.35rem 0.9rem; align-items: center; font-size: 1rem; }
.lang .meter { height: 3px; background: var(--rule); border-radius: 2px; position: relative; }
.lang .meter span { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 2px; }
.lang .mono { color: var(--ink-3); }

footer {
  max-width: 78rem; margin: 0 auto; padding: 2rem clamp(16px, 4vw, 3rem) 3rem;
  border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  color: var(--ink-3);
}
footer .sig { font-family: var(--f-display); font-style: italic; font-size: 1.5rem; color: var(--ink-2); }

footer { position: relative; }
.footer-cat {
  position: absolute; top: -37px; left: 42%; width: 150px; height: 77px;
  background: var(--ink-3);
  -webkit-mask: url(img/cat-hang.png) center / contain no-repeat; mask: url(img/cat-hang.png) center / contain no-repeat;
}
.footer-cat { transition: background-color .2s; transform-origin: 50% 0; }
.footer-cat:hover, footer:has(.surprise:hover) .footer-cat { background: var(--accent); animation: swing .6s ease-in-out; }
@keyframes swing { 25% { transform: rotate(4deg); } 75% { transform: rotate(-4deg); } }
footer .surprise { text-decoration: none; color: var(--ink-3); align-self: center; }
footer .surprise:hover { color: var(--accent); }
h4.card-title.sub { margin: 2rem 0 0; }
.timeline.compact > li { padding: 0.8rem 0; }
.timeline.compact h3 { font-size: 1.05rem; }

.gallery { columns: 3 13rem; column-gap: 1rem; margin-top: 1.5rem; }
.g-item { break-inside: avoid; margin: 0 0 1rem; }
.g-item a { display: block; overflow: hidden; border-radius: 3px; border: 1px solid var(--rule); background: var(--paper-2); }
.g-item img { display: block; width: 100%; height: auto; filter: saturate(0.85); transition: transform .5s cubic-bezier(.2,.8,.2,1), filter .3s; }
.g-item a:hover img { transform: scale(1.03); filter: none; }
.g-item figcaption { margin-top: 0.4rem; font-size: 0.9rem; }
.g-item figcaption .mono { color: var(--ink-2); font-style: normal; margin-right: 0.3rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ---------- off the clock page ---------- */
.page { max-width: 78rem; margin: 0 auto; padding: clamp(2.5rem, 7vw, 6rem) clamp(16px, 4vw, 3rem) 4rem; }
.page > .links { margin-bottom: 1rem; }
.chapter { display: grid; grid-template-columns: minmax(0, 16rem) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 4rem); }
.page > .chapter:first-of-type { border-top: 1px solid var(--rule); margin-top: 3rem; }
.ch-head { position: sticky; top: 5rem; align-self: start; }
.ch-head .num { display: block; font-family: var(--f-mono); font-size: 0.72rem; color: var(--accent); margin-bottom: 0.6rem; }
.ch-body .interests { margin-top: 1rem; }
.gallery.one { columns: 1; max-width: 36rem; }
@media (max-width: 760px) {
  .chapter { grid-template-columns: 1fr; gap: 1rem; }
  .ch-head { position: static; }
}
