/* Joshua Stough's site. Shared stylesheet for every page.
   Bucknell navy-to-orange band for the header (and the homepage hero), light page
   below. Band text is white; the orange end is deepened to #b5531a so white text
   stays above 4.5:1 contrast across the whole band. Bright Bucknell orange is only
   used where it carries no text.
   Pages with <html class="themed"> also get the dark theme; older pages stay light
   because their inline colors and white-background figures assume it. */

:root {
  --navy: #003865;          /* Bucknell blue */
  --orange: #e87722;        /* Bucknell orange (decorative only) */
  --band: linear-gradient(90deg, #003865 0%, #003865 25%, #b5531a 100%);
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1b2433;
  --muted: #5a6372;
  --line: #e3e0da;
  --link: #0b5394;
  --accent: #a84b14;        /* text-safe orange on light backgrounds */
  --chip-bg: #fdf0e6;
  --chip-ink: #9a4410;
  --shadow: 0 1px 2px rgba(0, 30, 60, 0.06), 0 12px 32px -14px rgba(0, 30, 60, 0.22);
  --wrap: 66rem;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Roboto Mono", "Courier New", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root.themed {
    --band: linear-gradient(90deg, #002647 0%, #002647 25%, #93420f 100%);
    --bg: #0f1621;
    --surface: #172030;
    --ink: #e8eef6;
    --muted: #a9b4c4;
    --line: #263247;
    --link: #9cc4f0;
    --accent: #f0a060;
    --chip-bg: #2a2119;
    --chip-ink: #ffb27a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

h1, h2, h3 { font-family: var(--sans); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 2.2rem; margin: 1.5rem 0 1rem; }
h2 { font-size: 1.55rem; margin: 2.25rem 0 0.9rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

.eyebrow {
  font: 600 0.8rem/1.4 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Header: the navy-to-orange band ---- */
/* It stays at the top while scrolling; scroll-padding keeps anchor targets clear of it. */
html { scroll-padding-top: 5.5rem; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--band);
  color: #fff;
  border-bottom: 3px solid var(--orange);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding-top: 0.95rem;
  padding-bottom: 0.95rem;
}
.site-name {
  font: 700 1.3rem/1.2 var(--mono);
  color: #fff;
  text-decoration: none;
}
.site-name:hover { color: #fff; }
.site-affil {
  color: rgba(255, 255, 255, 0.85);
  font: 600 0.85rem/1.4 var(--sans);
  letter-spacing: 0.02em;
}
.site-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}
/* Too narrow for one row: the nav gets its own row, starting at the left. */
@media (max-width: 50rem) {
  .site-nav { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 40rem) {
  /* Phones: keep the sticky header short. Sized so the six links, or three links
     plus the name, fit one row on a 360px screen. */
  .site-nav { gap: 0.2rem 0.6rem; font-size: 0.875rem; }
  .site-header .wrap { padding-top: 0.55rem; padding-bottom: 0.55rem; column-gap: 0.75rem; }
  .site-name { font-size: 1rem; }
  .site-affil { font-size: 0.8rem; }
}
.site-nav a {
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: #fff; border-bottom-color: rgba(255, 255, 255, 0.6); }
.site-nav a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }

/* ---- Layout ---- */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
main.page { max-width: var(--wrap); margin: 0 auto; padding: 0 1rem 2.5rem; overflow-wrap: anywhere; }
main.page img { max-width: 100%; }
main.page table { max-width: 100%; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .wrap { padding-top: 1.25rem; padding-bottom: 2rem; }

/* ---- Components for the rewritten pages ---- */
.lede { font-size: 1.08rem; color: var(--muted); }
.muted { color: var(--muted); }

/* Homepage hero: continues the header band edge to edge. The band gradient only
   varies left to right, so header and hero join without a seam. */
body:has(.hero) .site-header { border-bottom: 0; transition: box-shadow 0.2s; }
/* The name and CS@Bucknell keep their place but stay hidden until the hero's name
   scrolls away (index.html adds .past-hero), so the header never changes height.
   They share the nav's row, so the homepage header stays one row at every width:
   where that row has no room for CS@Bucknell, it is left out (the hero shows it). */
body:has(.hero) .site-name,
body:has(.hero) .site-affil { visibility: hidden; opacity: 0; transition: opacity 0.2s, visibility 0.2s; }
body:has(.hero) .site-header.past-hero .site-name,
body:has(.hero) .site-header.past-hero .site-affil { visibility: visible; opacity: 1; }
@media (max-width: 50rem) {
  body:has(.hero) .site-affil { display: none; }
  body:has(.hero) .site-nav { margin-left: auto; flex-basis: auto; }
}
body:has(.hero) .site-header.past-hero { box-shadow: 0 3px 0 var(--orange); }
/* Phones: one row. Past the hero, the name takes the place of the last nav links
   (they're a tap away at the top); tapping it scrolls back up. */
@keyframes fade-in { from { opacity: 0; } }
@media (max-width: 40rem) {
  body:has(.hero) .site-nav { margin-left: 0; }
  body:has(.hero) .site-name { display: none; order: 1; margin-left: auto; }
  body:has(.hero) .site-header.past-hero .site-name { display: block; animation: fade-in 0.2s; }
  body:has(.hero) .site-header.past-hero .site-nav a:nth-child(n+4) { display: none; }
}
.hero {
  margin: 0 calc(50% - 50vw) 0;
  padding: 1.5rem calc(50vw - 50%) 2.5rem;
  background: var(--band);
  border-bottom: 3px solid var(--orange);
  color: #fff;
}
.intro {
  display: grid;
  grid-template-columns: 1fr 22rem;
  gap: 2.5rem;
  align-items: center;
}
.intro .eyebrow { color: rgba(255, 255, 255, 0.82); margin: 0; }
.intro h1 {
  margin: 0.3rem 0 0.4rem;
  font: 700 clamp(2.2rem, 6vw, 3.2rem)/1.1 var(--mono);
  color: #fff;
}
.intro .role { font-weight: 500; margin: 0 0 0.9rem; color: #fff; }
/* Links in the band's labels: white with a soft underline, as on the GitHub page */
.intro .eyebrow a, .intro .role a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  text-underline-offset: 0.25em;
}
.intro .eyebrow a:hover, .intro .role a:hover {
  color: #fff;
  text-decoration-color: #fff;
}
/* CS@Bucknell in the header: soft gray, no underline, white on hover */
.site-affil a { color: inherit; text-decoration: none; }
.site-affil a:hover { color: #fff; }
.intro .lede { color: rgba(255, 255, 255, 0.92); }
.intro .lede a { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.6); }
.intro .lede a:hover { text-decoration-color: #fff; }
.intro img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.55);
}
@media (max-width: 48rem) {
  .intro { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* Homepage picture: a random pick from assets/hero_random.js, linked and captioned.
   It keeps its own shape and is never shown at more than twice its pixel width
   (--ar and --max2x are set by the script). */
.hero-pic { margin: 0; text-align: center; --cap: 24rem; }
.hero-pic > a {
  display: block;
  width: min(100%, var(--max2x, 1760px), calc(var(--cap) * var(--ar, 1.333)));
  margin: 0 auto;
}
/* Beside the text, the picture never makes the band taller than the text:
   the figure is a size container stretched to the text's height, and the
   picture shrinks to fit it, leaving room for a two-line caption. */
@media (min-width: 48.01rem) {
  .hero-pic {
    container-type: size;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .hero-pic > a { width: min(100cqw, var(--max2x, 1760px), calc((100cqh - 3rem) * var(--ar, 1.333))); }
}
.intro .hero-pic img { display: block; }
.hero-pic figcaption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.82);
  text-wrap: balance;   /* two lines of similar length, not one long and one stub */
}
.hero-pic figcaption a {
  color: inherit;
  white-space: nowrap;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  text-underline-offset: 0.2em;
}
.hero-pic figcaption a:hover { color: #fff; text-decoration-color: #fff; }
@media (max-width: 48rem) { .hero-pic { --cap: 20rem; } }

/* Pill links on the band */
.pills { display: flex; flex-wrap: wrap; gap: 0.6rem; padding: 0; margin: 1.1rem 0 0; list-style: none; }
.pills a {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}
.pills a:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }
/* Pill links on light surfaces (cards) */
.card .pills { margin-top: 0.75rem; gap: 0.45rem; }
.card .pills a {
  padding: 0.25rem 0.75rem;
  border-color: var(--line);
  background: var(--chip-bg);
  color: var(--chip-ink);
  font-size: 0.85rem;
}
.card .pills a:hover { border-color: var(--accent); background: var(--chip-bg); color: var(--accent); }

/* Card grid (software and research) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.25rem;
  padding: 0;
  list-style: none;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card img {
  display: block;
  width: 100%;
  height: 10rem;
  object-fit: contain;
  background: #fff;
}
.card img.cover { object-fit: cover; }
/* Pictures grow a little on hover, as on profstough.github.io. The link
   frames the picture and clips the zoom. */
.card > a:first-child:not(.art) { display: block; overflow: hidden; border-bottom: 1px solid var(--line); }
.card > a img { transition: transform 0.3s; }
.card > a:hover img { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { .card > a img { transition: none; } }
.card .art {
  height: 10rem;
  display: grid;
  place-items: center;
  background: var(--band);
  color: #fff;
  font: 700 3rem/1 var(--mono);
  border-bottom: 3px solid var(--orange);
}
.card .body { padding: 0.8rem 1rem 1rem; }
.card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.card .links { margin-top: 0.6rem; font-size: 0.88rem; display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; }

/* Research page cards: the homepage cards plus a venue line and a blurb that
   shows its first lines until "More" is pressed (the script is in research.html). */
.card > img:first-child { border-bottom: 1px solid var(--line); }
.card .meta { margin: 0 0 0.5rem; font-size: 0.85rem; font-weight: 500; color: var(--accent); }
.research-cards .card h3 { line-height: 1.3; }
.card .blurb { line-height: 1.55; }
.card .blurb.clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
  cursor: pointer;   /* tapping it opens it */
}
/* The body fills the card, so "More" sits at the bottom, level across a row */
.research-cards .card .body { flex: 1; display: flex; flex-direction: column; }
.card .more {
  margin-top: auto;
  align-self: flex-start;
  padding: 0.35rem 0 0;
  border: 0;
  background: none;
  color: var(--link);
  font: 600 0.85rem/1.4 var(--sans);
  cursor: pointer;
}
/* A larger, invisible tap area (about 44px tall) around the small "More" */
.card .more { position: relative; }
.card .more::before { content: ""; position: absolute; inset: -0.6rem -0.75rem -0.6rem -0.5rem; }
.card .more::after { content: " \25BE"; }
.card .more[aria-expanded="true"]::after { content: " \25B4"; }
.card .more:hover { color: var(--accent); text-decoration: underline; }

/* Teaching page: course cards (pills level across a row) and past courses as
   compact rows by school, each term a small chip. */
.course-cards { grid-template-columns: repeat(3, 1fr); }   /* six courses: 3 across, 2 across, or 1 */
@media (max-width: 52rem) { .course-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 36rem) { .course-cards { grid-template-columns: 1fr; } }
.course-cards .card .body { flex: 1; display: flex; flex-direction: column; }
.course-cards .card .pills { margin-top: auto; padding-top: 0.75rem; }
.course-cards .card .more { margin-top: 0; }   /* the pills, not "More", sit at the bottom */
/* Cards without a picture: the course title fills the navy-orange tile */
.course-cards .art { text-decoration: none; padding: 0 1.25rem; }
.course-cards .art h3 {
  margin: 0;
  color: #fff;
  font: 700 1.45rem/1.25 var(--mono);
  text-align: center;
  text-wrap: balance;
}
.course-cards .art:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.schools { columns: 2 24rem; column-gap: 2.5rem; margin-top: 1rem; }
.school { break-inside: avoid; margin-bottom: 1.5rem; }
.school h3 {
  margin: 0 0 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--orange);
  font-size: 1rem;
}
.school h3 span { font-weight: 400; color: var(--muted); font-size: 0.88rem; margin-left: 0.3rem; }
.course-rows { list-style: none; padding: 0; margin: 0; }
.course-rows li {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.93rem;
  line-height: 1.45;
}
.course-rows li:last-child { border-bottom: 0; }
.course-rows .code { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); padding-top: 0.08rem; }
.terms { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; margin-left: 0.35rem; vertical-align: 0.05em; }
.terms a {
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-ink);
  font-size: 0.78rem;
  line-height: 1.6;
  text-decoration: none;
  white-space: nowrap;
}
.terms a:hover { border-color: var(--accent); color: var(--accent); }
.also { margin-top: 0.5rem; color: var(--muted); font-size: 0.93rem; }

.link-list { padding-left: 1.2rem; }
.link-list li { margin: 0.35rem 0; }
.course-group h3 { margin-bottom: 0.25rem; }

.archived-note {
  background: var(--chip-bg);
  border: 1px solid #f2c48d;
  border-left: 4px solid var(--orange);
  color: #3d2a12;
  padding: 0.7rem 1rem;
  margin: 1rem;
  font: 15px/1.5 var(--sans);
  border-radius: 8px;
}
.archived-note a { color: #7a3d00; }
