/* Stats site styles. Palette, type and header/footer follow
   https://bilby-dev.github.io (static/css/style.css there). */

:root {
  --bg: #ffffff;
  --bg-soft: #f2f7fc;
  --bg-tint: #e4eef8;
  --ink: #0b2540;
  --muted: #4b6782;
  --line: #d6e4f1;
  --blue-900: #0f3557;
  --blue-700: #286190;
  --blue-500: #4f86b5;
  --blue-300: #9cc3e4;
  --blue-200: #c4dbef;
  --blue-100: #e3eef8;
  --card: #ffffff;
  --link: var(--blue-700);
  --heading: var(--blue-900);
  --shadow: 0 1px 2px #0b25400d, 0 8px 28px -8px #0b254026;
  --radius: 14px;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1622; --bg-soft: #0e1d2c; --bg-tint: #12263a; --ink: #e6eff8; --muted: #9db3c9;
    --line: #1f3850; --card: #102233; --blue-100: #15304a; --blue-200: #2a5276;
    --link: #8fc0ea; --heading: var(--ink);
    --shadow: 0 1px 2px #0006, 0 10px 30px -10px #000a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17.5px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--link); }
h1, h2, h3, .wordmark { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; }
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: -1px;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px;
  background: #fff; color: #000; border-radius: 6px; transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { position: relative; display: flex; align-items: center; gap: 14px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.brand .wordmark { font-size: 1.65rem; color: var(--heading); }
.version {
  font: 600 .75rem/1 var(--mono); padding: 5px 8px; border-radius: 999px; text-decoration: none;
  background: var(--blue-100); color: var(--link);
}
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 8px 12px; border-radius: 8px; }
.site-nav a:hover { background: var(--bg-tint); }
.site-nav a[aria-current="page"] { color: var(--link); font-weight: 600; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--ink); }

/* --------------------------------------------------------------- hero */
.hero { position: relative; overflow: hidden; padding: 64px 0 72px; background: linear-gradient(180deg, var(--bg-soft), var(--bg)); }
.hero-rings {
  position: absolute; inset: -40% -20% auto auto; width: 1100px; height: 1100px; pointer-events: none;
  background: repeating-radial-gradient(ellipse at center, transparent 0 46px, color-mix(in srgb, var(--blue-300) 35%, transparent) 46px 47px);
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent);
  mask-image: radial-gradient(closest-side, #000 30%, transparent);
  transform: rotate(-45deg) scaleX(1.6); opacity: .7;
}
.hero-inner { position: relative; }
.hero h1 { margin: 0; font-size: clamp(2.4rem, 5.6vw, 4rem); color: var(--heading); }
.lede { margin: 20px 0 8px; font-size: 1.15rem; color: var(--muted); max-width: 40em; }
.updated { margin: 0 0 32px; font-size: .9rem; color: var(--muted); }
.updated time { font-weight: 600; color: var(--ink); }

.stat-grid {
  list-style: none; margin: 0 0 28px; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px;
}
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 20px 20px 18px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.stat-value { font: 600 2.2rem/1.1 var(--serif); color: var(--link); }
.stat-label { font-size: .92rem; color: var(--ink); line-height: 1.35; }
.stat-sub { font-size: .82rem; color: var(--muted); }

/* ------------------------------------------------------------ sections */
.section { padding: 80px 0; }
.plots { background: var(--bg-soft); border-top: 1px solid var(--line); }
.section-title { font-size: clamp(1.8rem, 3.4vw, 2.4rem); margin: 0 0 12px; color: var(--heading); }
.section-head { max-width: 680px; margin-bottom: 32px; }
.section-head p { margin: 0; color: var(--muted); }

.plot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.plot-card {
  margin: 0; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: border-color .15s, transform .2s;
}
.plot-card:hover { border-color: var(--blue-300); transform: translateY(-2px); }
.plot-media { display: block; padding: 12px; background: var(--card); }
/* plots drawn on white keep a white "paper" panel in dark mode */
.plot-media.paper { background: #fff; }
.plot-media img { width: 100%; }
.plot-card figcaption { padding: 16px 22px 20px; border-top: 1px solid var(--line); }
.plot-card h3 { margin: 0 0 6px; font-size: 1.2rem; }
.plot-card p { margin: 0; color: var(--muted); font-size: .95rem; }

.welcome { margin-top: 40px; padding: 24px 28px; border-radius: var(--radius); background: var(--blue-100); }
.welcome-title { margin: 0 0 4px; font-size: 1.3rem; }
.welcome p { margin: 0 0 14px; color: var(--muted); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 4px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 500; font-size: .92rem; }

/* ------------------------------------------------------------- footer */
.site-footer { background: var(--blue-900); color: #c8daec; padding: 64px 0 28px; font-size: .92rem; }
.footer-inner { display: grid; grid-template-columns: 1.1fr 1.5fr; gap: 48px; }
.footer-brand { display: flex; gap: 16px; align-items: flex-start; }
.footer-brand img { border-radius: 12px; }
.footer-brand .wordmark { font-size: 1.6rem; color: #fff; }
.footer-brand p { margin: 6px 0 0; }
.footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-links h3 { margin: 0 0 12px; font-family: var(--sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: #8fb3d6; }
.footer-links a { display: block; color: #e6eff8; text-decoration: none; padding: 3px 0; }
.footer-links a:hover { text-decoration: underline; }
.footer-note { margin-top: 48px; padding-top: 20px; border-top: 1px solid #ffffff1f; color: #8fb3d6; font-size: .82rem; }
.footer-note a { color: #e6eff8; }

/* tall activity plot fills the left column; the others stack beside it */
.plot-card#activity { grid-row: span 2; }
.plot-card { display: flex; flex-direction: column; }
.plot-card .plot-media { flex: 1; display: flex; align-items: center; }
.plot-media { cursor: zoom-in; }
.chips a { color: inherit; text-decoration: none; }
.chips a:hover { color: var(--link); text-decoration: underline; }

/* full-page image popup */
.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--ink);
}
.lightbox::backdrop { background: #0b2540d9; backdrop-filter: blur(2px); }
.lightbox-inner {
  box-sizing: border-box; width: 100%; height: 100%; padding: 56px 24px 24px;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox img {
  max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius);
  background: var(--card); padding: 12px; box-shadow: var(--shadow); cursor: default;
}
.lightbox-close {
  position: fixed; top: 12px; right: 16px; width: 40px; height: 40px; border-radius: 999px; border: 0;
  background: var(--card); color: var(--ink); font-size: 1.6rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.lightbox-close:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
body.lightbox-open { overflow: hidden; }

/* --------------------------------------------------------- responsive */
@media (max-width: 1020px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .plot-grid { grid-template-columns: 1fr; }
  .plot-card#activity { grid-row: auto; }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none; position: absolute; top: 68px; left: -16px; right: -16px; flex-direction: column; align-items: stretch;
    padding: 12px 16px 20px; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .site-nav.open { display: flex; }
  .hero { padding: 40px 0 48px; }
  .section { padding: 56px 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat { padding: 16px; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat-value { font-size: 1.8rem; }
  .plot-media { padding: 6px; }
  .lightbox-inner { padding: 60px 8px 8px; }
  .lightbox img { padding: 4px; }
  .plot-card figcaption { padding: 14px 16px 16px; }
  .footer-inner, .footer-links { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .footer-links { grid-template-columns: 1fr; }
}
