/* Site chrome on top of tufte.css + pandoc.css + tufte-extra.css.
   Light-only — Tufte CSS owns body/heading/link/table/code typography. */

/* Tighten vertical rhythm around the article: Tufte's defaults
   (article padding 5rem; h1 margin-top 4rem) leave too much air
   between the nav, the title, and the footer. */
article {
  padding: 1.5rem 0;
}

article > header h1.title {
  margin-top: 1rem;
}

/* Tufte width rules target `section > p` etc., which only match when
   --section-divs wraps content. Pages without H2 headings (e.g., index.md),
   or content before the first H2, end up as direct article children.
   Mirror Tufte's section-child width rules onto article-child elements. */
article > p,
article > footer,
article > table,
article > blockquote {
  width: 55%;
}

article > dl,
article > ol,
article > ul {
  width: 50%;
  -webkit-padding-start: 5%;
  padding-inline-start: 5%;
}

@media (max-width: 760px) {
  article > p,
  article > footer,
  article > table,
  article > blockquote {
    width: 100%;
  }
  article > dl,
  article > ol,
  article > ul {
    width: 90%;
  }
}


@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
html { scroll-behavior: smooth; }

:focus-visible {
  outline: 2px solid #0e7490;
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: #fffff8;
  color: #0e7490;
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  z-index: 10000;
}
.skip-link:focus { top: 0; }

/* Header nav (lives outside <article>, inside body's Tufte width).
   Constrain to the same 55% body-text column so it aligns with paragraphs. */
header > nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: 0.75rem;
  border-bottom: 1px solid #d1d5db;
  margin-bottom: 1.5rem;
  width: 55%;
  font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
}

@media (max-width: 760px) {
  header > nav { width: 100%; }
}

header > nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

header > nav a {
  text-decoration: none;
  background: none;
  text-shadow: none;
  color: #111;
}

header > nav a:hover { color: #0e7490; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: #111;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}

@media (max-width: 500px) {
  .nav-toggle { display: block; }
  header > nav { flex-wrap: wrap; }
  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.25rem 0;
    padding-top: 0.5rem;
    border-top: 1px solid #d1d5db;
  }
  header > nav.open .nav-links { display: flex; }
}

/* Collapsible TOC — kept minimal to fit the Tufte aesthetic (no card, no
   background, no border; just an italic "Contents" toggle above a flat list). */
.toc-box {
  margin: 1.5rem 0 2rem;
  width: 55%;
}

@media (max-width: 760px) {
  .toc-box { width: 100%; }
}

.toc-label {
  font-style: italic;
  font-size: 1.8rem;
  cursor: pointer;
  list-style: none;
  margin-bottom: 0.6rem;
  color: #555;
}
.toc-label::-webkit-details-marker { display: none; }
.toc-label::before {
  content: "▸";
  display: inline-block;
  width: 1rem;
  margin-right: 0.5rem;
}
.toc-box[open] .toc-label::before { content: "▾"; }

.toc-box ul {
  margin: 0;
  padding-left: 1rem;
  list-style: none;
  width: auto;
}
.toc-box ul li { margin-block: 0.15rem; }
.toc-box ul li a { background: none; text-shadow: none; }

/* Homepage headshot */
img.headshot {
  display: block;
  margin-inline: auto;
  max-width: 18rem;
}
figure:has(img.headshot) figcaption { display: none; }

/* Back-to-top button */
.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  display: inline-block;
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  border: 1px solid #d1d5db;
  background: #fffff8;
  color: #111;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  text-decoration: none;
  text-shadow: none;
}
.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Post date byline (blog posts + blog index cards) */
.post-date {
  color: #555;
}
article > header .post-date {
  margin-block: -0.5rem 1rem;
}

/* Blog index entries */
.post-card {
  margin-bottom: 1.5rem;
  width: 55%;
}

@media (max-width: 760px) {
  .post-card { width: 100%; }
}

.post-card h2 {
  margin-block: 0 0.4rem;
  font-size: 1.6rem;
}

.post-card p:last-child { margin-bottom: 0; }

.post-card .post-date {
  font-size: 0.95rem;
  margin-block: 0;
}

/* Footer — match body-text column width */
footer {
  border-top: 1px solid #d1d5db;
  margin-top: 1.5rem;
  padding-block: 1rem;
  font-size: 1.1rem;
  color: #555;
  width: 55%;
  font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
}

@media (max-width: 760px) {
  footer { width: 100%; }
}

footer a {
  background: none;
  text-shadow: none;
}
