/* sciapis.com (SciAPIs) — synoptic-chart palette. Blue (cold front) marks forecast
   data; red (warm front) marks the written forecasts that sit
   on top of it. Colour carries that meaning everywhere it appears. */

:root {
  --paper: #f2f5f6;
  --paper-deep: #e4eaee;
  --ink: #13263c;
  --graphite: #4f5e6e;
  --rule: #c3cfd8;
  --cold: #1d4f9e;
  --warm: #a8222e;
  --code-bg: #13263c;
  --code-ink: #e3eaf0;
  --code-dim: #93a6b8;

  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --measure: 40rem;
  --frame: 68rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
}

a { color: var(--cold); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--cold); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 0.6em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.25rem); letter-spacing: -0.01em; }
h2 { font-size: 1.75rem; margin-top: 2.4em; }
h3 { font-size: 1.25rem; margin-top: 1.8em; }
p, ul, ol, table, pre { margin: 0 0 1.1em; }
p, li { max-width: var(--measure); }

code, pre, kbd { font-family: var(--mono); font-size: 0.875em; }
:not(pre) > code { background: var(--paper-deep); padding: 0.1em 0.3em; border-radius: 3px; }

pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 1rem 1.15rem;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.5;
  max-width: 100%;
}
pre .c { color: var(--code-dim); }

.wrap { max-width: var(--frame); margin: 0 auto; padding: 0 1.5rem; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 0.75rem; z-index: 2; }

/* header */
.masthead { border-bottom: 1px solid var(--rule); }
.masthead .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1rem; padding-bottom: 1rem; }
.wordmark { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: 0.01em; }
.wordmark span { color: var(--graphite); font-weight: 400; font-size: 1rem; margin-left: 0.5rem; letter-spacing: 0; }
.brand { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; }
.brand .project { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--ink); text-decoration: none; margin-left: 0.6rem; padding-left: 0.6rem; border-left: 1px solid var(--rule); }
.brand .project span { color: var(--graphite); font-weight: 400; font-size: 1rem; }
.brand a:hover { text-decoration: underline; }
.masthead nav { display: flex; gap: 1.5rem; }
.masthead nav a { color: var(--ink); text-decoration: none; }
.masthead nav a:hover, .masthead nav a[aria-current="page"] { text-decoration: underline; }
.masthead nav a.cta { color: var(--cold); font-weight: 600; }

main { padding-bottom: 4rem; }

/* hero: the isobar field is the one decorative thing on the site */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.hero .wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); gap: 2rem; align-items: center; padding-top: 4rem; padding-bottom: 3.5rem; }
.hero h1 { max-width: 17ch; }
.hero .lede { font-size: 1.2rem; color: var(--graphite); max-width: 34rem; }
.hero figure { margin: 0; }
.hero svg { width: 100%; height: auto; display: block; }
.hero figcaption { font-size: 0.8125rem; color: var(--graphite); margin-top: 0.4rem; }

.actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.75rem; }
.button {
  display: inline-block; padding: 0.7rem 1.2rem; border-radius: 4px;
  background: var(--cold); color: #fff; text-decoration: none; font-weight: 600;
  border: 2px solid var(--cold); font: inherit; font-weight: 600; cursor: pointer;
}
.button:hover { background: #163f80; border-color: #163f80; }
.button.quiet { background: transparent; color: var(--cold); }
.button.quiet:hover { background: var(--paper-deep); }
.button[disabled] { opacity: 0.6; cursor: progress; }

/* sections */
.section { padding-top: 1rem; }
.section > h2:first-child { margin-top: 2.2em; }
.intro { font-size: 1.125rem; color: var(--graphite); }

.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 2.5rem; }
.pair > div { min-width: 0; }
.pair h3 { margin-top: 0.4em; }

/* front markers: triangle = forecast data, semicircle = written forecasts */
.mark { display: inline-block; width: 0.75em; height: 0.75em; margin-right: 0.45em; vertical-align: -0.02em; }
.mark.data { background: var(--cold); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.mark.text { background: var(--warm); border-radius: 0.75em 0.75em 0 0; height: 0.4em; vertical-align: 0.12em; }
.data-c { color: var(--cold); }
.text-c { color: var(--warm); }

.legend { font-size: 0.9375rem; color: var(--graphite); display: flex; gap: 1.5rem; flex-wrap: wrap; }

/* tables */
.table-scroll { overflow-x: auto; margin-bottom: 1.1em; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.7rem 1rem 0.7rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-weight: 600; font-size: 0.9375rem; color: var(--graphite); border-bottom: 2px solid var(--ink); }
td.num, th.num { text-align: right; }
.plan-name { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.price { font-family: var(--serif); font-size: 1.2rem; }
.price small { font-family: var(--sans); color: var(--graphite); font-size: 0.8125rem; }

.note { border-left: 3px solid var(--rule); padding-left: 1rem; color: var(--graphite); }

/* docs */
.docs { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 3rem; padding-top: 2.5rem; }
.toc { position: sticky; top: 1.5rem; align-self: start; font-size: 0.9375rem; }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0.35rem 0; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.docs h2 { scroll-margin-top: 1.5rem; }
.docs h3 { scroll-margin-top: 1.5rem; font-family: var(--mono); font-size: 1.05rem; font-weight: 600; }
.docs article > h1 { margin-bottom: 0.4em; }

dl.params { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.35rem 1.25rem; margin: 0 0 1.1em; max-width: var(--measure); }
dl.params dt { font-family: var(--mono); font-size: 0.875rem; padding-top: 0.15rem; }
dl.params dd { margin: 0; }

/* forms */
.form-page { max-width: 34rem; padding-top: 3rem; }
label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
input[type="email"] {
  width: 100%; font: inherit; padding: 0.65rem 0.75rem; border: 1px solid var(--graphite);
  border-radius: 4px; background: #fff; color: var(--ink);
}
input[type="email"]:focus-visible { outline-offset: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.field { margin-bottom: 1.1rem; }
.field.check { display: flex; gap: 0.6rem; align-items: flex-start; }
.field.check input { margin-top: 0.3em; width: 1.1rem; height: 1.1rem; flex: none; }
.field.check label { font-weight: normal; }
.hint { font-size: 0.9375rem; color: var(--graphite); }
.status { margin-top: 1.25rem; padding: 0.85rem 1rem; border-left: 3px solid var(--cold); background: var(--paper-deep); }
.status.error { border-left-color: var(--warm); }
.status:empty { display: none; }
.keybox { display: flex; gap: 0.75rem; align-items: stretch; flex-wrap: wrap; margin: 1rem 0; }
.keybox code { flex: 1 1 20rem; display: block; background: var(--code-bg); color: var(--code-ink); padding: 0.8rem 1rem; border-radius: 4px; word-break: break-all; font-size: 0.9375rem; }

/* footer */
footer { border-top: 1px solid var(--rule); font-size: 0.875rem; color: var(--graphite); }
footer .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 2rem; padding-top: 2rem; padding-bottom: 2.5rem; }
footer p { margin: 0 0 0.5em; max-width: 44rem; }
footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: flex-start; }
footer a { color: var(--graphite); }

@media (max-width: 52rem) {
  .hero .wrap { grid-template-columns: 1fr; padding-top: 2.5rem; }
  .hero figure { max-width: 26rem; }
  .pair { grid-template-columns: 1fr; }
  .docs { grid-template-columns: 1fr; gap: 1rem; }
  .toc { position: static; border-bottom: 1px solid var(--rule); padding-bottom: 1rem; }
  footer .wrap { grid-template-columns: 1fr; }
}

@media (max-width: 30rem) {
  body { font-size: 1rem; }
  .masthead nav { gap: 1rem; }
  .wordmark span, .brand .project span { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero .isobars path { stroke-dasharray: 900; stroke-dashoffset: 900; animation: draw 1.6s ease-out forwards; }
  .hero .isobars path:nth-child(2) { animation-delay: 0.1s; }
  .hero .isobars path:nth-child(3) { animation-delay: 0.2s; }
  .hero .isobars path:nth-child(4) { animation-delay: 0.3s; }
  .hero .isobars path:nth-child(5) { animation-delay: 0.4s; }
  .hero .isobars path:nth-child(6) { animation-delay: 0.5s; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}
.page-head { margin-top: 2.5rem; }

/* SciAPIs home: one card per project */
.projects { list-style: none; padding: 0; margin: 0 0 1.1em; display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.25rem; }
.projects li { max-width: none; border: 1px solid var(--rule); border-radius: 4px; padding: 1.25rem 1.4rem; background: #fff; }
.projects h3 { margin-top: 0; }
.projects .tag { color: var(--graphite); font-family: var(--sans); font-size: 1rem; font-weight: 400; }
.projects li p:last-child { margin-bottom: 0; }
/* wide tables scroll sideways on narrow screens rather than crush their columns */
.table-scroll > table { min-width: 38rem; }
