/* Site style. Two skies: night (dark, default) and day (light).
   The theme is set on <html data-theme="dark|light"> by the inline script in each page head. */

/* ---------- Night sky (default) ---------- */
:root {
  --bg: #0a0e1a;
  --bg-raise: #111829;
  --ink: #e2e6ef;
  --muted: #9ba5b9;
  --rule: #253049;
  --tint: #131c31;
  --link: #b8a3f4;
  --link-hover: #ddd2ff;
  --accent: #8f6ee8;           /* rules, current-page marker */
  --heading: #d4c8fb;
  --notice-border: #8f6ee8;
  --table-head: #b8a3f4;
  --head-ink: #f1f3f9;
  --head-muted: #aab4cc;
  --img-border: #253049;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

/* ---------- Day sky ---------- */
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-raise: #ffffff;
  --ink: #1d2128;
  --muted: #59606d;
  --rule: #d6dde7;
  --tint: #f0f6fc;
  --link: #4F2683;
  --link-hover: #2c1452;
  --accent: #4F2683;
  --heading: #3a1c61;
  --notice-border: #2f7fd0;
  --table-head: #59606d;
  --head-ink: #10233d;
  --head-muted: #1b3352;
  --img-border: #d6dde7;
  color-scheme: light;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.58;
}

/* star field in the side margins at night (visible on wide screens); a bright Moon dims it (--stars-op, set by sky.js) */
:root:not([data-theme="light"]) body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("../img/stars.svg");
  background-size: 480px 480px;
  opacity: var(--stars-op, 1);
}
/* the text column itself stays solid so stars never sit behind words */
:root:not([data-theme="light"]) .page { background: var(--bg); box-shadow: 0 0 0 1px #121a2e; }

/* ---------- Masthead (full width sky band) ---------- */
.masthead {
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--accent);
  background:
    radial-gradient(ellipse 60% 140% at 78% 120%, rgba(143, 110, 232, 0.28), transparent 70%),
    radial-gradient(ellipse 45% 90% at 15% -10%, rgba(80, 120, 220, 0.22), transparent 70%),
    url("../img/stars.svg"),
    linear-gradient(180deg, #050816 0%, #0d1530 100%);
  background-size: auto, auto, 480px 480px, auto;
}
:root[data-theme="light"] .masthead {
  background:
    url("../img/contrails_bg_soft.svg") center / 100% 100% no-repeat,
    linear-gradient(180deg, #4d97dc 0%, #8fc3ec 55%, #d3e9f8 100%);
}
.masthead .wrap {
  position: relative;
  z-index: 1;
  max-width: 1020px;
  margin: 0 auto;
  padding: 1.5em 16px 1.1em;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.6em 2em;
}
.masthead .affil {
  margin: 0 0 0.35em;
  font-family: var(--sans);
  font-size: 0.78em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--head-muted);
}
.masthead .affil a { color: var(--head-muted); text-decoration: none; }
.masthead .affil a:hover { color: var(--head-ink); text-decoration: underline; }
.masthead .name { margin: 0; font-family: var(--sans); font-size: 2.1em; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.masthead .name a { color: var(--head-ink); text-decoration: none; }
.masthead .role { margin: 0.25em 0 0; font-family: var(--sans); font-weight: 600; color: var(--head-ink); }
/* keep the name and title readable over stars, meteors, planes and contrails */
.masthead .affil, .masthead .name, .masthead .role { text-shadow: 0 1px 3px rgba(5, 8, 22, 0.85), 0 0 12px rgba(5, 8, 22, 0.6); }
:root[data-theme="light"] .masthead .affil, :root[data-theme="light"] .masthead .name, :root[data-theme="light"] .masthead .role { text-shadow: 0 0 6px rgba(255, 255, 255, 0.85), 0 0 14px rgba(214, 235, 250, 0.9); }

/* sky effects layer: Moon, moonlight and aircraft (js/sky.js) */
.sky-fx { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sky-fx .moonwash { position: absolute; inset: 0; background: #5a76b8; opacity: 0; transition: opacity 2s; }
.sky-fx svg { position: absolute; left: 0; top: 0; }
.sky-fx svg.moon { pointer-events: auto; }
.sky-fx svg.sats { width: 100%; height: 100%; }
:root[data-theme="light"] .sky-fx svg.sats { display: none; }
.sky-fx .flight line { filter: blur(0.6px); }
.sky-fx .flight .body { fill: rgba(255, 255, 255, 0.95); }
.sky-fx .flight .trail { stroke: rgba(255, 255, 255, 0.85); }
.sky-fx .flight .navlight { display: none; }
:root:not([data-theme="light"]) .sky-fx .flight .body { fill: rgba(10, 14, 26, 0.6); }
:root:not([data-theme="light"]) .sky-fx .flight .trail { stroke: rgb(205, 214, 238); stroke-opacity: var(--trail-night, 0.15); }
:root:not([data-theme="light"]) .sky-fx .flight .navlight { display: inline; }
.sky-fx .flight .tstop { stop-color: #ffffff; }
.sky-fx .flight .shorttrail { filter: blur(0.5px); }
:root:not([data-theme="light"]) .sky-fx .flight .tstop { stop-color: rgb(205, 214, 238); }
:root:not([data-theme="light"]) .sky-fx .flight .shorttrail { opacity: calc(var(--trail-night, 0.15) * 2.2); }
.sky-fx .blink { animation: navblink 2.4s ease-in-out infinite; }
.sky-fx .strobe { animation: strobe 1.5s steps(1) infinite; }
@keyframes navblink { 50% { opacity: 0.35; } }
@keyframes strobe { 0% { opacity: 1; } 10%, 100% { opacity: 0; } }

/* meteors across the night masthead (created by js/sky.js) */
.sky-fx .meteor {
  position: absolute;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(205, 225, 255, 0.55) 60%, rgba(255, 255, 255, 1));
  transform-origin: 100% 50%;
  pointer-events: none;
  opacity: 0;
}
:root[data-theme="light"] .sky-fx .meteor { display: none; }

/* sky switch */
.sky-switch {
  font-family: var(--sans);
  font-size: 0.8em;
  color: var(--head-muted);
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.sky-switch button {
  font: inherit;
  color: var(--head-ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  padding: 0.2em 0.6em;
  cursor: pointer;
}
:root[data-theme="light"] .sky-switch button { background: rgba(255, 255, 255, 0.55); border-color: rgba(16, 35, 61, 0.25); }
.sky-switch button[aria-pressed="true"],
:root[data-theme="light"] .sky-switch button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
:root:not([data-theme="light"]) .sky-switch button[aria-pressed="true"] { background: #6a4bc9; border-color: #6a4bc9; }
/* without JavaScript the switch cannot work, so hide it */
html:not(.js) .sky-switch { display: none; }

/* ---------- Page grid ---------- */
.page {
  max-width: 1020px;
  margin: 0 auto;
  padding: 1.8em 16px 2em;
  display: grid;
  grid-template-columns: 11.5em minmax(0, 1fr);
  grid-template-areas: "nav main" "foot foot";
  column-gap: 2.4em;
}

.sitenav { grid-area: nav; font-family: var(--sans); font-size: 0.92em; }
.sitenav li { border-bottom: 1px solid var(--rule); }
.sitenav li:first-child { border-top: 1px solid var(--rule); }
.sitenav a {
  display: block;
  padding: 0.42em 0.6em;
  color: var(--ink);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sitenav a:hover { background: var(--tint); color: var(--link); }
.sitenav a[aria-current="page"] { border-left-color: var(--accent); color: var(--link); font-weight: bold; }
.sitenav .nav-extra { margin-top: 1.4em; font-size: 0.92em; line-height: 1.75; color: var(--muted); }
.sitenav .nav-extra a { display: inline; padding: 0; border: 0; color: var(--link); text-decoration: underline; }

main { grid-area: main; min-width: 0; }

/* ---------- Text ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: normal; line-height: 1.25; }
main h1 { font-size: 1.75em; margin: 0 0 0.6em; }
h2 {
  font-size: 1.35em;
  margin: 1.8em 0 0.6em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--rule);
  color: var(--heading);
}
main > h2:first-child { margin-top: 0; }
h3 { font-size: 1.12em; font-weight: bold; margin: 1.4em 0 0.4em; }
p { margin: 0 0 0.9em; }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline-color: var(--link); }

ul, ol { padding-left: 1.4em; }
li { margin-bottom: 0.3em; }
blockquote { margin: 1em 0 1.2em; padding-left: 1em; border-left: 3px solid var(--rule); color: var(--muted); font-style: italic; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.muted { color: var(--muted); opacity: 1; }
small, .small { font-size: 0.85em; }
.stamp { font-family: var(--sans); font-size: 0.78em; color: var(--muted); }

/* ---------- Images and figures ---------- */
.portrait { float: right; width: 210px; margin: 0.2em 0 1em 1.6em; text-align: center; }
.portrait img { display: block; width: 100%; border: 1px solid var(--img-border); }
.portrait figcaption { margin-top: 0.4em; font-family: var(--sans); color: var(--muted); }
figure.wide img { display: block; width: 100%; border: 1px solid var(--img-border); }
figure figcaption { font-family: var(--sans); color: var(--muted); margin-top: 0.35em; }
.fig-right { float: right; width: 44%; margin: 0.3em 0 1em 1.4em; }
.fig-right img { display: block; width: 100%; border: 1px solid var(--img-border); }

/* What-we-do animation strip */
.howto { clear: both; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1em; margin: 1.2em 0 0.4em; }
.howto figure { margin: 0; }
.howto img { display: block; width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--img-border); }
.howto figcaption { font-size: 0.86em; line-height: 1.4; margin-top: 0.45em; }
.howto figcaption b { color: var(--ink); }

/* ---------- Boxes ---------- */
.notice {
  clear: both;
  background: var(--tint);
  border-left: 4px solid var(--notice-border);
  padding: 0.9em 1.1em 0.3em;
  margin: 1.6em 0;
}
.notice h2, .notice h3 { margin-top: 0; border: 0; padding: 0; }

.facts { list-style: none; padding: 0; margin: 0.4em 0 1em; border-top: 1px solid var(--rule); }
.facts li {
  margin: 0;
  padding: 0.45em 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr);
  column-gap: 1em;
}
.facts b { font-family: var(--sans); font-size: 0.95em; color: var(--heading); }


/* ---------- Tables ---------- */
table { font-size: 0.93em; margin: 0.4em 0 1.4em; }
th, td { border-bottom: 1px solid var(--rule); padding: 0.45em 0.6em 0.45em 0; text-align: left; }
thead th {
  font-family: var(--sans);
  font-size: 0.86em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--table-head);
  border-bottom: 2px solid var(--accent);
  font-weight: normal;
}
caption { font-family: var(--sans); color: var(--muted); font-size: 0.9em; padding-bottom: 0.3em; }

/* ---------- News ---------- */
.news { list-style: none; padding: 0; }
.news li { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); column-gap: 1em; margin-bottom: 0.55em; }
.news time { font-family: var(--sans); font-size: 0.86em; color: var(--muted); padding-top: 0.15em; }

/* ---------- Publications ---------- */
.pub-controls { font-family: var(--sans); font-size: 0.9em; background: var(--tint); padding: 0.7em 0.9em; }
.pub-controls input, .pub-controls select {
  font: inherit; padding: 0.2em 0.35em; color: var(--ink);
  border: 1px solid var(--rule); background: var(--bg-raise);
}
.pub-year { font-size: 1.1em; font-weight: bold; color: var(--heading); border: 0; }
.pub-list { font-size: 0.95em; }
.pub-title { font-weight: bold; }
.pub-journal { font-style: italic; }
.pub-note { font-family: var(--sans); font-size: 0.82em; color: var(--link); margin-left: 0.3em; }
.pub-links { font-family: var(--sans); font-size: 0.82em; }
.pub-count { font-family: var(--sans); color: var(--muted); }

/* ---------- GMN page ---------- */
.gmn-map { width: 100%; height: auto; display: block; background: var(--tint); border: 1px solid var(--rule); }
.gmn-map .land { fill: #1d2843; stroke: #33416a; stroke-width: 0.2; }
:root[data-theme="light"] .gmn-map .land { fill: #dfe8f2; stroke: #b8c7d8; }
.gmn-map .grat { stroke: var(--rule); stroke-width: 0.25; fill: none; }
.gmn-map .stn { fill: #ffd76a; }
:root[data-theme="light"] .gmn-map .stn { fill: #4F2683; }
.legend { font-family: var(--sans); font-size: 0.82em; color: var(--muted); }
.legend .dot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; vertical-align: middle; margin: 0 0.3em 0 0.8em; }
.legend .dot.stn { background: #ffd76a; }
:root[data-theme="light"] .legend .dot.stn { background: #4F2683; }
.live-img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); background: #fff; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2em; }
.link-list { columns: 2; column-gap: 2em; }
.link-list li { break-inside: avoid; }
.operators { columns: 4 11em; column-gap: 1.5em; font-size: 0.82em; line-height: 1.5; padding: 0; list-style: none; }
.operators li { margin: 0; break-inside: avoid; }
details.ops summary { cursor: pointer; font-family: var(--sans); color: var(--link); margin: 0.5em 0; }


/* ---------- Footer ---------- */
.sitefoot {
  grid-area: foot;
  margin-top: 3em;
  padding-top: 0.8em;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8em;
  color: var(--muted);
}
.sitefoot p { margin: 0 0 0.3em; }
.sitefoot a { color: var(--muted); }

/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .page { display: block; padding-top: 0; }
  .masthead .name { font-size: 1.75em; }
  .sitenav { margin: 0 0 1.4em; border-bottom: 1px solid var(--rule); }
  .sitenav ul { display: flex; flex-wrap: wrap; }
  .sitenav li, .sitenav li:first-child { border: 0; }
  .sitenav a { padding: 0.55em 0.7em 0.45em 0; border-left: 0; border-bottom: 2px solid transparent; }
  .sitenav a[aria-current="page"] { border-bottom-color: var(--accent); }
  .sitenav .nav-extra { display: none; }
  .portrait { width: 130px; margin-left: 1em; }
  .fig-right { float: none; width: 100%; margin: 1em 0; }
  .facts li, .news li, .commits li { grid-template-columns: 1fr; }
  .howto { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .link-list { columns: 1; }
}


.clear { clear: both; }

/* ---------- Citations and references ---------- */
a.cite { text-decoration: none; }
a.cite:hover { text-decoration: underline; }
/* home page: opening paragraph with the main facts */
.lede { font-size: 1.08em; }
.group-table .now { font-family: var(--sans); font-size: 0.82em; line-height: 1.35; display: inline-block; margin-top: 0.2em; }
/* research page: invited talks */
.talks li { margin-bottom: 0.35em; }
/* home page: selected work by theme */
.work { list-style: none; padding: 0; margin: 0.3em 0 1em; }
.work li { margin: 0 0 0.8em; padding-left: 0.8em; border-left: 3px solid var(--rule); }
.work .ref { display: block; font-family: var(--sans); font-size: 0.84em; margin-top: 0.2em; }
h3 a { color: inherit; text-decoration: none; }
h3 a:hover { text-decoration: underline; }
.refs { list-style: none; font-size: 0.88em; line-height: 1.5; padding-left: 1.6em; }
.refs li { margin-bottom: 0.45em; text-indent: -1.6em; scroll-margin-top: 1em; }
.refs li:target { background: var(--tint); outline: 1px solid var(--rule); }

/* group tables: fixed columns, with most of the width for the project */
.group-table { table-layout: fixed; min-width: 640px; }
.group-table th:nth-child(1) { width: 17%; }
.group-table th:nth-child(2) { width: 18%; }
.group-table th:nth-child(3) { width: 42%; }
.group-table th:nth-child(4) { width: 13%; }
.group-table th:nth-child(5) { width: 10%; }
.group-table .who, .group-table .nowrap { white-space: normal; }

/* ---------- readability and layout refinements ---------- */
td, th { vertical-align: top; }
main p, main li, main figcaption { max-width: 44em; }
@media (min-width: 761px) {
  .sitenav { position: sticky; top: 1em; align-self: start; }
}
.masthead .role .t { white-space: nowrap; }
/* media page: lighter year labels */
#media-list h2 { font-size: 1.1em; font-weight: bold; border-bottom: 0; margin: 1.4em 0 0.4em; }
/* tables become stacked cards on phones */
@media (max-width: 760px) {
  .stack thead { position: absolute; left: -9999px; }
  .stack tr { display: block; border-bottom: 1px solid var(--rule); padding: 0.5em 0; }
  .stack td { display: block; border: 0; padding: 0.1em 0; width: auto !important; }
  .stack td[data-label]::before { content: attr(data-label) ": "; font-family: var(--sans); font-size: 0.8em; color: var(--muted); }
  .group-table.stack { min-width: 0; table-layout: auto; }
}

blockquote.bio { font-style: normal; color: var(--ink); }

/* figures that open a full-size image */
a.zoom { display: block; cursor: zoom-in; }
a.zoom:hover img { outline: 2px solid var(--link); outline-offset: 1px; }

/* GitHub contribution calendar */
.gh-calendar { overflow-x: auto; margin: 0.4em 0 0.2em; }
.gh-calendar svg { display: block; min-width: 640px; width: 100%; height: auto; }
.gh-calendar .cal-lbl { font: 9px var(--sans); fill: var(--muted); }
.gh-calendar .l0 { fill: var(--tint); stroke: var(--rule); stroke-width: 0.5; }
.gh-calendar .l1 { fill: #3d2d6b; } .gh-calendar .l2 { fill: #5b42a3; }
.gh-calendar .l3 { fill: #8466db; } .gh-calendar .l4 { fill: #c2b0ff; }
:root[data-theme="light"] .gh-calendar .l1 { fill: #d9cdf3; }
:root[data-theme="light"] .gh-calendar .l2 { fill: #a98ae0; }
:root[data-theme="light"] .gh-calendar .l3 { fill: #7445c4; }
:root[data-theme="light"] .gh-calendar .l4 { fill: #4F2683; }
