/* ------------------------------------------------------------------
   Header
   ------------------------------------------------------------------ */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.site-header .mark { display: flex; align-items: baseline; gap: 0.6rem; text-decoration: none; }
.site-header .initials {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--paper);
  background: var(--accent);
  padding: 0.15rem 0.35rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
}
.site-header .name { font-size: 1.1rem }
.site-header nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}
.site-header nav a { text-decoration: none; color: var(--ink-2); padding: 0.2rem 0; }
.site-header nav a:hover { color: var(--accent); }
.site-header nav a[aria-current='page'] { color: var(--ink); box-shadow: inset 0 -1px 0 var(--accent); }
.site-header .theme {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: 0.25rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.site-header .theme:hover { color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */
.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.site-footer .links { display: flex; gap: 1rem; }
.site-footer a { text-decoration: none; }

/* ------------------------------------------------------------------
   Home
   ------------------------------------------------------------------ */
.intro {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) auto;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 1rem;
}
.intro h2 { font-weight: 400; margin: 0.4rem 0 1rem; }
.intro h2 em { color: var(--accent); }
.intro .lede { font-size: 1.12rem; text-align: justify; }
.intro .now {
  padding: 0.6rem 0.8rem;
  background: var(--paper-2);
  border-radius: 3px;
  font-size: 0.95rem;
  color: var(--ink-2);
}
.intro .now .label { color: var(--accent); margin-right: 0.4rem; }
.intro-links {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
}
.portrait { margin: 2rem 0 0; }
.portrait img {
  display: block;
  width: 180px;
  height: auto;
  border-radius: 2px;
  filter: grayscale(0.2);
  transform: rotate(1.5deg);
  box-shadow: 0 1px 0 var(--rule), 6px 8px 0 var(--paper-2);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.intro:has(.portrait-link:hover) .portrait img,
.intro:has(.portrait-link:focus-visible) .portrait img {
  opacity: 1;
  transform: none;
}
.section-title { display: flex; align-items: baseline; gap: 0.75rem; }
.section-title .label { color: var(--accent); }
.more { font-family: var(--mono); font-size: 0.75rem; margin-top: 0.75rem; }
@media (max-width: 46rem) {
  .intro { grid-template-columns: 1fr; gap: 0; }
  .portrait { order: -1; margin: 0 0 1rem; }
  .portrait img { width: 120px; }
}

/* ------------------------------------------------------------------
   Publication list
   ------------------------------------------------------------------ */
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { padding: 0.9rem 0; border-bottom: 1px dashed var(--rule); }
.pub:last-child { border-bottom: 0; }
.pub .title { font-size: 1.05rem; font-weight: 500; line-height: 1.35; }
.pub .authors, .pub .venue { color: var(--ink-2); font-size: 0.92rem; }
.pub .authors strong { color: var(--ink); font-weight: 500; }
.pub .links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.5rem;
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.pub .links a, .pub summary {
  text-decoration: none;
  color: var(--accent);
  /* border: 1px solid currentColor;
  border-radius: 2px; */
  padding: 0.05rem 0.4rem;
  cursor: pointer;
}
.pub .links a:hover, .pub summary:hover { background: var(--accent-soft); }
.pub details { display: contents; }
.pub summary { list-style: none; display: inline-block; }
.pub summary::-webkit-details-marker { display: none; }
.pub details[open] summary { background: var(--accent-soft); }
.pub details p {
  flex-basis: 100%;
  font-family: var(--serif);
  font-size: 0.9rem;
  letter-spacing: 0;
  color: var(--ink-2);
  margin: 0.4rem 0 0;
  padding-left: 0.75rem;
  border-left: 2px solid var(--rule);
}

/* Publications page */
.page-intro { color: var(--ink-2); margin-bottom: 1.5rem; }
.year {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.year h2 { margin: 1.15rem 0 0; color: var(--accent); }
@media (max-width: 34rem) {
  .year { grid-template-columns: 1fr; gap: 0; }
}

/* ------------------------------------------------------------------
   Post list
   ------------------------------------------------------------------ */
.posts { list-style: none; margin: 0; padding: 0; }
.posts li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.25rem 1rem; padding: 0.7rem 0; }
.posts time { padding-top: 0.35rem; }
.posts a { font-size: 1.05rem; text-decoration: none; font-weight: 500; }
.posts a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.posts p { margin: 0.1rem 0 0; color: var(--ink-2); font-size: 0.92rem; }
@media (max-width: 34rem) {
  .posts li { grid-template-columns: 1fr; }
  .posts time { padding-top: 0; }
}

/* ------------------------------------------------------------------
   Single post
   ------------------------------------------------------------------ */
.post header { margin-bottom: 2rem; }
.post h1 { font-size: clamp(2rem, 5vw, 2.6rem); font-weight: 400; margin-top: 0.4rem; }
.post .dek { font-size: 1.15rem; font-style: italic; color: var(--ink-2); }
.post .draft { color: var(--accent); }
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.pager a { display: flex; flex-direction: column; text-decoration: none; max-width: 48%; }
.pager .next { text-align: right; margin-left: auto; }

/* ------------------------------------------------------------------
   Trail maps ({% gpxmap %} shortcode)
   ------------------------------------------------------------------ */
.trail { margin: 2rem 0; }
.trail-map + .trail-profile { margin-top: 1.75rem; } /* room for the readout */
.trail-map {
  height: 22rem;
  border-radius: 3px;
  background: var(--paper-2);
  z-index: 0; /* keep Leaflet's panes below the page's own stacking */
}
.trail-profile {
  position: relative;
  height: 3.5rem;
  margin-top: 0.5rem;
  cursor: crosshair;
  touch-action: pan-y; /* horizontal drag scrubs, vertical swipe still scrolls */
  user-select: none;
}
.trail-profile:focus-visible { outline: 1px solid var(--ink-3); outline-offset: 3px; }
.trail-profile svg { display: block; width: 100%; height: 100%; }
.trail-cursor {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--ink-3);
  pointer-events: none;
}
.trail-dot {
  position: absolute; width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--trail);
  border: 2px solid var(--paper);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.trail-readout {
  position: absolute; top: -1.35rem;
  font-size: 0.78rem; line-height: 1.2;
  color: var(--ink-2);
  background: var(--paper);
  padding: 0 0.3rem;
  white-space: nowrap;
  pointer-events: none;
}
.trail-cursor[hidden], .trail-dot[hidden], .trail-readout[hidden] { display: none; }
.trail-profile .area { fill: var(--paper-2); }
.trail-profile .line { fill: none; stroke: var(--ink-3); stroke-width: 1.25; }
.trail figcaption { font-size: 0.85rem; color: var(--ink-3); margin-top: 0.4rem; }
.trail figcaption a { color: inherit; }
/* Leaflet's stylesheet loads after ours, so these selectors are one step more specific. */
.trail .trail-map.leaflet-container { background: var(--paper-2); font-family: var(--serif); }
.trail .trail-map .leaflet-control-attribution { font-size: 0.65rem; background: color-mix(in srgb, var(--paper) 80%, transparent); color: var(--ink-3); }
.trail .trail-map .leaflet-control-attribution a { color: var(--ink-2); }
.trail .leaflet-bar a { background: var(--paper); color: var(--ink-2); border-color: var(--rule); }
.trail .leaflet-bar { border: 1px solid var(--rule); box-shadow: none; }
@media (max-width: 34rem) { .trail-map { height: 16rem; } }

/* ------------------------------------------------------------------
   Click-to-enlarge (src/js/lightbox.js)
   ------------------------------------------------------------------ */
.prose img.zoomable {
  box-shadow: 0 1px 0 var(--rule), 6px 8px 0 var(--paper-2);
  border-radius: 3px;
}
.prose img.zoomable { cursor: zoom-in; }
.prose img.zoomable:focus-visible { outline: 1px solid var(--ink-3); outline-offset: 3px; }
.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: zoom-out;
}
.lightbox::backdrop { background: var(--paper); }
.lightbox figure {
  height: 100%;
  margin: 0;
  padding: 3rem 1rem 1.5rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem;
}
.lightbox-image { min-height: 0; display: flex; justify-content: center; }
.lightbox-image img {
  display: block;
  max-width: min(94vw, 100%);
  max-height: calc(100vh - 8rem);
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 2px;
}
.lightbox figcaption { max-width: 40rem; font-size: 0.9rem; text-align: center; color: var(--ink-3); }
.lightbox-close {
  position: fixed; top: 0.75rem; right: 1rem;
  border: 0; background: none; padding: 0.25rem 0.5rem;
  font: inherit; font-size: 1.6rem; line-height: 1;
  color: var(--ink-3); cursor: pointer;
}
.lightbox-close:hover { color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .lightbox[open], .lightbox[open]::backdrop { animation: lightbox-in 150ms ease-out; }
  @keyframes lightbox-in { from { opacity: 0; } }
}