/* 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 ---- */
.site-header {
  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.8);
  font: 600 0.78rem/1.4 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}
@media (max-width: 40rem) {
  .site-nav { margin-left: 0; gap: 0.2rem 0.7rem; font-size: 0.9rem; }
}
.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; }
body:has(.hero) .site-name,
body:has(.hero) .site-affil { display: none; }   /* the hero shows them */
.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, .site-affil 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, .site-affil a:hover {
  color: #fff;
  text-decoration-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 / project list: thumbnail beside text, stacked on phones. */
.projects { list-style: none; padding: 0; margin: 0; }
.project {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}
.project:first-child { border-top: 0; }
.project img {
  width: 100%;
  height: auto;
  max-height: 11rem;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
}
.project h3 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.project h3 a { color: var(--ink); text-decoration: none; }
.project h3 a:hover { color: var(--accent); }
.project p { margin: 0; }
@media (max-width: 40rem) {
  .project { grid-template-columns: 1fr; gap: 0.75rem; }
  .project img { max-height: 14rem; justify-self: start; width: auto; max-width: 100%; }
}

.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; }
