/* =================================================================
   jterilla.github.io — shared stylesheet
   A quiet, content-first academic index.

   Design intent (merged pass):
   - White ground. The artwork and the book cover supply all the colour;
     the page itself stays neutral so the work reads clearly.
   - One system-sans voice, no external font dependency.
   - Name first. The page identifies the person, then shows the art.
   - Section headings are real headings in the content column — no left
     rail, no decorative ticks. Hierarchy comes from size, weight, air,
     and a single hairline between sections.
   - Restraint over ornament: no shadows, no cards, no brand colour.
     Links earn a quiet underline; colour appears only as focus feedback.
   - Robust by construction: every flexible track has a 0 minimum so text
     wraps instead of overflowing, at every width.
   ================================================================= */

/* ---------- Design tokens ---------- */
:root {
  --bg:        #ffffff;
  --bg-sunken: #f6f7f8;
  --ink:       #16181d;   /* near-black, 17:1 on white */
  --muted:     #595f6b;   /* secondary text — AA (6.4:1) on white */
  --faint:     #ebecef;   /* the lightest hairline */
  --rule:      #d4d7dd;   /* a visible hairline */
  --focus:     #16181d;   /* focus/hover feedback = ink, not a brand hue */

  --page:    62rem;   /* outer measure */
  --measure: 40rem;   /* comfortable reading measure for prose */

  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --display: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
             "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial,
             "Noto Sans", sans-serif;

  --gutter:  clamp(1.25rem, 5vw, 2.5rem);   /* horizontal page padding */
  --section: clamp(2.5rem, 5vw, 4rem);      /* vertical rhythm between sections */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0e1013;
    --bg-sunken: #16191e;
    --ink:       #e8eaed;
    --muted:     #9aa1ac;   /* AA (7.3:1) on --bg */
    --faint:     #1f2228;
    --rule:      #2c3037;
    --focus:     #e8eaed;
  }
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(1rem, 0.96rem + 0.22vw, 1.075rem);
  line-height: 1.6;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern" 1, "liga" 1;
}

img { max-width: 100%; height: auto; }

::selection { background: color-mix(in oklab, var(--ink) 13%, transparent); }

/* ---------- Layout ---------- */
.wrap {
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main { display: block; }

/* A section is a rhythmic block separated by air and a hairline. */
.section { padding-block: var(--section); }
.section + .section { border-top: 1px solid var(--faint); }

/* Prose paragraphs read on a comfortable measure */
p { margin: 0 0 1rem; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

/* ---------- Typography ---------- */
h1, h2, h3 { color: var(--ink); text-wrap: balance; }

h1 {
  font-family: var(--display);
  font-size: clamp(2.25rem, 1.75rem + 2.4vw, 3.55rem);
  font-weight: 580;
  line-height: 1;
  letter-spacing: -0.048em;
  margin: 0;
}

h2 {
  font-family: var(--display);
  font-size: clamp(1.18rem, 1.06rem + 0.5vw, 1.45rem);
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -0.018em;
  margin: 0;
}

h3 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.28;
  letter-spacing: -0.012em;
  margin: 1.25rem 0 0.4rem;
}

em, i, cite { font-style: italic; }
strong, b { font-weight: 600; }

/* Eyebrow / overline — the one letterspaced element */
.eyebrow,
.role {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.7rem;
}

/* Real section headings, given air above their content.
   The // prefix labels each section — a quiet nod to code comments and
   to the notational mark-making in the banner. Decorative only; if you
   keep it, move it into the markup as <span aria-hidden> so screen
   readers don't announce "slash slash". */
.section-head { margin-bottom: 1.5rem; }
.section-head h2 { margin: 0; }
.section-head h2::before {
  content: "//";
  margin-inline-end: 0.5ch;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Links ---------- */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-skip-ink: auto;
  transition: text-decoration-color 120ms ease, text-decoration-thickness 120ms ease;
}
a:hover {
  text-decoration-color: var(--ink);
  text-decoration-thickness: 1.5px;
}
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
  text-decoration-color: transparent;
}
:focus:not(:focus-visible) { outline: none; }

/* ---------- Skip link ---------- */
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 10;
  background: var(--ink); color: var(--bg);
  padding: 0.55rem 0.85rem; border-radius: 4px;
  text-decoration: none;
}

/* ---------- Generic lists ---------- */
.list { list-style: none; padding: 0; margin: 0; }

/* ===============================================================
   HOMEPAGE
   =============================================================== */

/* Masthead — name first, the facts beside it.
   align-items:end gives a composed baseline; every track min is 0 and
   nothing is set to nowrap, so the columns can never overflow. */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: clamp(2rem, 6vw, 5rem);
  align-items: end;
  padding-block: clamp(2.75rem, 6vw, 5rem) clamp(1.75rem, 3vw, 2.5rem);
}
.identity { min-width: 0; }
.intro h1 { letter-spacing: -0.052em; }
.fields {
  margin: 0.78rem 0 0;
  max-width: 32rem;
  color: var(--muted);
  font-size: clamp(0.98rem, 0.94rem + 0.18vw, 1.06rem);
  line-height: 1.45;
}
.intro-copy {
  min-width: 0;
  margin: 0;
  max-width: 34rem;
  color: var(--ink);
  font-size: clamp(1.04rem, 0.99rem + 0.28vw, 1.2rem);
  line-height: 1.6;
}
/* Stack the masthead early: two narrow columns read worse than one
   confident column on small tablets / large phones. */
@media (max-width: 820px) {
  .intro {
    grid-template-columns: 1fr;
    row-gap: 1.4rem;
    align-items: start;
    padding-block: 2.25rem 1.75rem;
  }
  .intro-copy { max-width: var(--measure); }
}

/* The artwork as a full-bleed band beneath the identity — atmosphere,
   not a hero. Caption is constrained to the page measure and uses
   --muted so it clears AA. */
.art-band { margin: 0; width: 100%; }
.art-band img {
  display: block;
  width: 100%;
  height: clamp(11rem, 26vw, 22rem);
  object-fit: cover;
  object-position: center 44%;
  border-block: 1px solid var(--faint);   /* frame the pale art directly; no rule under the credit */
}
.art-band figcaption {
  max-width: var(--page);
  margin-inline: auto;
  padding: 0.6rem var(--gutter) 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

/* Publications — a proper bibliography, venue flush right. */
.pubs { display: grid; gap: 0; }
.pub {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: baseline;
  padding-block: 0.95rem;
}
.pub:first-child { padding-top: 0; }
.pub + .pub { border-top: 1px solid var(--faint); }
.pub-main { min-width: 0; max-width: 44rem; }
.pub-title {
  font-family: var(--display);
  font-size: 1.045rem;
  font-weight: 500;
  line-height: 1.33;
  letter-spacing: -0.012em;
  text-decoration-color: color-mix(in oklab, var(--ink) 30%, transparent);
}
.pub-authors {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
  margin-top: 0.15rem;
}
.pub-venue {
  justify-self: end;
  text-align: right;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .pub { grid-template-columns: 1fr; row-gap: 0.3rem; }
  .pub-venue { justify-self: start; text-align: left; white-space: normal; }
}

/* The book, as a composed figure. The cover sits on a hairline frame —
   no coloured mat, so it works for any cover. */
.book {
  display: grid;
  grid-template-columns: clamp(120px, 16vw, 150px) minmax(0, 1fr);
  gap: clamp(1.25rem, 4vw, 2.25rem);
  align-items: start;
}
.book-cover { width: 100%; align-self: start; border: 1px solid var(--rule); }
.book-cover img { display: block; width: 100%; }
.book-copy { min-width: 0; }
.book-copy > :first-child { margin-top: 0; }
.book .arrow-link { margin-top: 0.5rem; }
@media (max-width: 460px) {
  .book {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }
  .book .book-cover {
    width: min(150px, 46vw);
    max-width: 150px;
  }
}

/* Students — name + year, thesis in italic beneath. */
.people li { padding-block: 0.8rem; max-width: 46rem; }
.people li:first-child { padding-top: 0; }
.people li + li { border-top: 1px solid var(--faint); }
.person-line { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: baseline; }
.person-name { font-weight: 600; letter-spacing: -0.01em; }
.person-year { color: var(--muted); font-variant-numeric: tabular-nums; }
.person-thesis { display: block; color: var(--muted); margin-top: 0.12rem; }

/* Arrow / text links — quiet, deliberate affordances. */
.arrow-link, .text-link {
  display: inline-block;
  text-decoration-color: var(--rule);
}
.arrow-link { text-decoration: none; font-size: 0.97rem; }
.arrow-link::after {
  content: " \2192";
  display: inline-block;
  transition: transform 140ms ease;
}
.arrow-link:hover { text-decoration: underline; text-decoration-color: var(--ink); }
.arrow-link:hover::after { transform: translateX(3px); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: var(--section); }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.5rem 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-row a { color: var(--ink); }

/* ===============================================================
   BOOK PAGE
   =============================================================== */

/* Breadcrumb */
.crumb { padding-block: 1.25rem 0; }
.crumb-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
}
.crumb-row a { color: var(--muted); text-decoration-color: var(--faint); }
.crumb-row a:hover { color: var(--ink); text-decoration-color: var(--ink); }

.book-hero {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: clamp(1.25rem, 4vw, 2.5rem);
  align-items: start;
  padding-block: clamp(1.75rem, 1.25rem + 2vw, 2.75rem) 0;
}
.book-hero .book-cover { width: 150px; }
.book-hero > div { min-width: 0; }
.book-hero h1 {
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  line-height: 1.04;
  margin-bottom: 0.5rem;
}
.book-hero .credit { font-size: 0.85rem; color: var(--muted); margin-top: 1rem; }
@media (max-width: 620px) {
  .book-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }
  .book-hero .book-cover {
    width: min(160px, 48vw);
    max-width: 160px;
  }
}

/* Action links — framed, minimal radius; not pills. */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  max-width: none;
}
.actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.78rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--ink);
  background: transparent;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.actions a:hover { border-color: var(--ink); background: var(--bg-sunken); }
.actions a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Two editorial columns separated by air + a hairline. */
.columns { display: grid; gap: clamp(1.75rem, 4vw, 3rem); }
@media (min-width: 760px) {
  .columns.two { grid-template-columns: 1fr 1fr; column-gap: clamp(2.5rem, 5vw, 4rem); }
  .columns.two > * + * {
    border-left: 1px solid var(--faint);
    padding-left: clamp(2.5rem, 5vw, 4rem);
  }
}

/* Numbered chapter list — index in muted, tabular. */
.numbered { list-style: none; padding: 0; margin: 0; }
.numbered li {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  gap: 0.6rem;
  padding-block: 0.42rem;
  align-items: baseline;
}
.numbered li .n {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Plain stacked list (playlist, reviews). */
.stack li { padding-block: 0.45rem; }
.stack li + li { border-top: 1px solid var(--faint); }

/* ===============================================================
   COURSE PAGE — a dated journal / timeline
   =============================================================== */

.course-head { padding-block: clamp(1.75rem, 1.25rem + 2vw, 2.75rem) 1.25rem; }
.course-head h1 {
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  line-height: 1.04;
  margin: 0 0 0.9rem;
}
.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.course-meta span { display: inline-flex; align-items: center; }
.course-meta span + span::before {
  content: "";
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--rule);
  margin-right: 1.1rem;
}

/* The stream: a continuous rail with a neutral marker per entry. */
.stream {
  position: relative;
  margin-top: 1.5rem;
  padding-left: 1.75rem;
  border-left: 1px solid var(--rule);
}
.entry { position: relative; padding-block: 0.4rem 2.4rem; }
.entry:last-child { padding-bottom: 0.4rem; }
.entry::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem - 1px);
  top: 0.7rem;
  width: 9px; height: 9px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--muted);
}
.entry > header { border: 0; padding: 0; margin: 0 0 0.5rem; }
.entry h2 { font-size: 1.18rem; font-weight: 600; margin: 0.1rem 0 0.2rem; }
.entry .sub {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.entry .content { color: var(--ink); }
.entry .content p { margin: 0 0 0.8rem; max-width: var(--measure); }
/* The author wrote body copy in <p class="sub"> — restore it to body color. */
.entry .content p.sub {
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
}
.entry .content ul,
.entry .content ol { max-width: var(--measure); padding-left: 1.3rem; margin: 0 0 0.9rem; }
.entry .content li { padding-block: 0.18rem; }
.entry .content blockquote {
  margin: 0.8rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-style: italic;
  max-width: var(--measure);
}

/* The syllabus entry gets a quiet, filled marker. */
.entry.syllabus::before { background: var(--muted); }
.entry.syllabus { padding-top: 0.4rem; }

/* ===============================================================
   TYPOGRAPHY PASS — system sans throughout
   The earlier contrasting display accent is removed. The name, section headings,
   publication titles, book titles, and thesis titles now all share the
   same system-sans voice, with hierarchy coming from weight, tracking,
   leading, and spacing rather than a second typeface.
   =============================================================== */
.book-copy h3 { font-weight: 500; }
.person-thesis em { font-style: italic; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Print ---------- */
@media print {
  :root { --bg: #fff; --ink: #000; --muted: #333; --faint: #ccc; --rule: #ccc; }
  body { font-size: 11pt; }
  .art-band, .crumb, .course-meta, .site-footer, .skip-link { display: none !important; }
  .wrap { max-width: none; }
  .stream { border: 0; padding-left: 0; }
  .entry::before { display: none; }
  .entry { break-inside: avoid; }
  .pub, .people li { break-inside: avoid; }
  a { text-decoration: underline; }
}


/* ---------- Teaching archive helpers ---------- */
.course-list { max-width: var(--measure); }
.course-list li { padding-block: 0.8rem; }
.course-list li + li { border-top: 1px solid var(--faint); }
.course-title { font-weight: 600; letter-spacing: -0.01em; }
.course-summary { display: block; color: var(--muted); margin-top: 0.15rem; }
