:root {
  --bg: #ffffff;
  --panel: #fcfcfd;
  --panel-2: #ffffff;
  --text: #16181d;
  --muted: #5c626d;
  --accent: #1f4e79;   /* deep academic blue */
  --marker: #a4322a;   /* muted brick red */
  --border: #dce0e6;
  --rule: #1b1d22;
  --serif: Georgia, "Times New Roman", Cambria, "Source Serif Pro", serif;
  --mono: "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  font-size: 110%;          /* scale the whole UI up ~10% */
}

body {
  margin: 0;
  font-family: var(--serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  font-size: 1rem;
}

main {
  max-width: 48.75rem;       /* was 780px; now scales with root font */
  margin: 0 auto;
  padding: 3rem 1.5rem 4.5rem;
}

/* ---- Header ---------------------------------------------------------- */
header { margin-bottom: 1.75rem; }

h1 {
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 0.35rem;
}

.lede {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-style: italic;
  font-size: 0.98rem;
}

.rule {
  border: none;
  border-top: 1.5px solid var(--rule);
  margin: 0;
}

i, em { font-style: italic; }

a { color: var(--accent); text-decoration-thickness: 0.5px; }

/* ---- Controls -------------------------------------------------------- */
form {
  margin: 1.5rem 0 0.25rem;
  padding: 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 190px;
}

.field span {
  font-family: var(--serif);
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

select, input {
  box-sizing: border-box;
  height: 2.6rem;          /* equal height across Safari/Chrome */
  margin: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 0 0.65rem;
  font-size: 1rem;
  line-height: normal;
  font-family: var(--serif);
}

/* Reset native chrome so the select height is predictable, add a custom arrow */
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 1.9rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235c626d' stroke-width='1.6' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 0.7rem auto;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(31, 78, 121, 0.12);
}

button {
  box-sizing: border-box;
  height: 2.6rem;
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0 1.5rem;
  font-size: 0.98rem;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  flex: 0 0 auto;
}

button:hover { background: #1a4368; }

/* ---- Parameter line -------------------------------------------------- */
.params {
  margin: 1.1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
}

.params .model-name { font-weight: 600; }

.params .model-params {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.params .sep { color: var(--border); margin: 0 0.45em; }

.block .note {
  margin: 0.4rem 0 0;
  text-align: right;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
}

/* ---- Result tables --------------------------------------------------- */
#results { margin-top: 1.6rem; }

.block { margin: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

caption {
  caption-side: top;
  text-align: left;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0 0.5rem;
}

thead th { display: none; }

tbody tr:first-child td { border-top: 1.5px solid var(--rule); }

td {
  padding: 0.5rem 0.2rem;
  border-bottom: 1px solid var(--border);
  vertical-align: baseline;
}

tbody tr:last-child td { border-bottom: 1.5px solid var(--rule); }

td.label { color: var(--text); }

.info {
  text-decoration: none;
  color: var(--accent);
  font-size: 0.82em;
  vertical-align: super;
  cursor: help;
  margin-left: 0.1em;
}
.info:hover { color: var(--marker); }

/* explanation page prose */
.prose h2 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
.prose p { margin: 0.9rem 0; }
.prose .back { margin-top: 2.25rem; font-size: 0.95rem; }

td.value {
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}

td.value .alt { margin-left: 1.4rem; }

td.value .unit {
  color: var(--muted);
  font-weight: 400;
  font-style: normal;   /* units in upright (roman) type */
  margin-left: 0.4rem;
  font-size: 0.86em;
}

/* ---- Figure ---------------------------------------------------------- */
.figure-wrap {
  margin: 2rem 0;
}

.figure-wrap figcaption {
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 0.6rem;
  line-height: 1.5;
}

.figure-wrap figcaption .fnum { font-weight: 600; color: var(--text); }

.plots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 1.25rem;
}

@media (max-width: 34rem) {
  .plots { grid-template-columns: minmax(0, 1fr); }
}

.panel { margin: 0; }

.panel svg { width: 100%; height: auto; display: block; }

/* Nature-style figures: Helvetica/Arial sans-serif throughout */
.panel text { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
.panel .axis { stroke: var(--rule); stroke-width: 1; }
.panel .grid { stroke: var(--border); stroke-width: 0.75; }
.panel .tick { fill: var(--muted); font-size: 13px; }
.panel .axtitle { fill: var(--text); font-size: 14px; }
/* Panel title, in HTML above the SVG so formulas can be set in MathML. It is
   bottom-aligned in a fixed band, so that a one-line title and a stacked
   fraction still leave every plot in a row starting at the same height, and its
   content sits in a span because a flex container would trim the spaces around
   "-" and ",". */
.panel .ptitle {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 3.1em;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.25;
  margin: 0 0 0.15rem;
}

.panel .ptitle i { font-style: italic; }

/* Formulas keep the browser's own math font, which sets them the way TeX would;
   the plain-text titles above stay in the figure's sans-serif face. */
.panel .ptitle math {
  font-weight: 400;
  font-size: 1.16em;
  margin: 0 auto;
}
.panel .ztag { fill: var(--marker); font-size: 10.5px; font-style: italic; }

/* hover read-out */
.panel .capture { cursor: crosshair; }
.panel .hline { stroke: #8a8f98; stroke-width: 1; stroke-dasharray: 4 3; }
.panel .hdot { fill: #8a8f98; }
.panel .htext {
  fill: var(--text);
  font-size: 10.5px;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* ---- Footer ---------------------------------------------------------- */
footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

footer a { color: var(--muted); }
