/* Coffer Data — site styles */

@font-face {
  font-family: "Public Sans";
  src: url("/assets/fonts/public-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #F5F6F4;
  --surface: #FFFFFF;
  --ink: #16202C;
  --ink-2: #4B5664;
  --rule: #D8DCD7;
  --brass: #9A7426;
  --brass-ink: #7A5B1C;
  --brass-wash: #F1E8D4;
  --blend: #3D72B8;
  --focus: #3D72B8;
  --radius-s: 4px;
  --radius-m: 8px;
  --measure: 66ch;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10151B;
    --surface: #171D25;
    --ink: #E6E9ED;
    --ink-2: #A3ADB8;
    --rule: #29313B;
    --brass: #B88F3A;
    --brass-ink: #D2AE62;
    --brass-wash: #2B2519;
    --blend: #5E8FD0;
    --focus: #7FA8E0;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brass-ink); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 8px 12px;
}
.skip:focus { left: 8px; top: 8px; z-index: 10; }

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Header ---------- */

.site-header { border-bottom: 1px solid var(--rule); }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 18px;
  padding-bottom: 18px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark svg { width: 26px; height: 26px; flex: none; }
.wordmark span { white-space: nowrap; }

.site-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.5vw, 28px);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.site-nav a { text-decoration: none; font-size: 0.95rem; color: var(--ink-2); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"] { text-decoration: underline; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: var(--radius-s);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid var(--ink);
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--brass-ink); border-color: var(--brass-ink); color: var(--paper); }
.btn-plain { background: transparent; color: var(--ink); }
.btn-plain:hover { border-color: var(--brass-ink); color: var(--brass-ink); }
.site-nav .btn { color: var(--paper); padding: 8px 14px; font-size: 0.92rem; }
.site-nav .btn:hover { color: var(--paper); }

/* ---------- Type ---------- */

h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); font-weight: 750; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em; }

p { margin: 0 0 1em; max-width: var(--measure); }
.lead { font-size: clamp(1.1rem, 1.6vw, 1.25rem); color: var(--ink-2); line-height: 1.55; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }

code, .code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--brass-wash);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* ---------- Sections ---------- */

.section { padding: clamp(56px, 8vw, 104px) 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section-head { max-width: 46rem; margin-bottom: 36px; }
.section-head h2 { margin-bottom: 14px; }

/* ---------- Hero ---------- */

.hero { padding: clamp(48px, 7vw, 88px) 0 clamp(56px, 7vw, 96px); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.hero h1 { margin-bottom: 22px; max-width: 13ch; }
.hero .lead { margin-bottom: 30px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.chart-figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: 18px 18px 14px;
  position: relative;
}

.chart-title { font-weight: 650; font-size: 0.98rem; margin: 0 0 6px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  font-size: 0.85rem;
  color: var(--ink-2);
}
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend svg { width: 22px; height: 8px; flex: none; }

.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }

.chart-figure figcaption { font-size: 0.82rem; color: var(--ink-2); margin-top: 6px; }

.ch-grid { stroke: var(--rule); stroke-width: 1; }
.ch-axis { fill: var(--ink-2); font-size: 12.5px; font-family: inherit; }
.ch-posted { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-promo-band { fill: var(--brass-wash); }
.ch-promo-line { stroke: var(--brass); stroke-width: 2; stroke-linecap: round; }
.ch-blend { fill: none; stroke: var(--blend); stroke-width: 2; stroke-dasharray: 6 4; stroke-linejoin: round; stroke-linecap: round; }
.ch-label { fill: var(--ink); font-size: 13px; font-family: inherit; }
.ch-label-muted { fill: var(--ink-2); font-size: 12.5px; font-family: inherit; }
.ch-dot { fill: var(--brass); stroke: var(--surface); stroke-width: 2; }
.ch-cross { stroke: var(--ink-2); stroke-width: 1; opacity: 0; }
.ch-hit { fill: transparent; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.8rem;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: var(--radius-s);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 10px));
}
.tooltip strong { font-weight: 650; }
.tooltip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

details.table-view { margin-top: 10px; font-size: 0.85rem; }
details.table-view summary { cursor: pointer; color: var(--ink-2); }
details.table-view table { margin-top: 10px; }

/* ---------- Tables ---------- */

table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-weight: 650; color: var(--ink-2); font-size: 0.85rem; border-bottom-color: var(--ink-2); }
td.num, th.num { text-align: right; }
.col-name { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.86rem; white-space: nowrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Example row */
.row-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
.row-grid .notes h2 { margin-bottom: 16px; }
.row-grid .notes p { color: var(--ink-2); }
.example-row {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  overflow: hidden;
}
.example-row table { font-size: 0.9rem; }
.example-row tbody th[scope="rowgroup"] {
  background: var(--brass-wash);
  color: var(--brass-ink);
  font-weight: 650;
  font-size: 0.82rem;
  padding: 7px 14px;
}
.example-row td { padding: 7px 14px; }
.example-row td:last-child { text-align: right; font-weight: 550; }
.example-row tr:last-child td { border-bottom: 0; }

/* Three things blended data loses */
.loses {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 48px);
}
.loses h3 { margin-bottom: 10px; }
.loses p { color: var(--ink-2); margin: 0; }

/* Process steps (a real sequence) */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 36px);
}
.steps li { counter-increment: step; position: relative; padding-top: 44px; }
.steps li::before {
  content: counter(step);
  position: absolute; top: 0; left: 0;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1.5px solid var(--brass);
  color: var(--brass-ink);
  border-radius: 50%;
  font-weight: 650;
  font-size: 0.9rem;
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute; top: 15px; left: 40px; right: -10px;
  height: 1.5px; background: var(--rule);
}
.steps h3 { margin-bottom: 8px; }
.steps p { color: var(--ink-2); font-size: 0.97rem; margin: 0; }

/* Delivery */
.delivery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 48px);
}
.delivery h3 { margin-bottom: 8px; }
.delivery p { color: var(--ink-2); margin: 0; }

/* CTA */
.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.cta h2 { margin-bottom: 10px; }
.cta p { margin: 0; color: var(--ink-2); }

/* ---------- Document pages ---------- */

.doc-head { padding: clamp(44px, 6vw, 72px) 0 clamp(24px, 3vw, 36px); border-bottom: 1px solid var(--rule); }
.doc-head h1 { font-size: clamp(2rem, 4.2vw, 3rem); margin-bottom: 14px; max-width: 20ch; }
.doc-head .lead { margin-bottom: 0; }

.doc-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  padding-top: clamp(36px, 5vw, 56px);
  padding-bottom: clamp(64px, 8vw, 104px);
}

.toc { position: sticky; top: 24px; align-self: start; font-size: 0.92rem; }
.toc p { font-weight: 650; margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 6px; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--ink); }

.prose h2 { font-size: 1.5rem; margin: 2.2em 0 0.6em; scroll-margin-top: 20px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.6em 0 0.5em; }
.prose ul, .prose ol { padding-left: 1.25em; max-width: var(--measure); margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose table { margin: 0.5em 0 1.5em; }

.dict-group { margin-bottom: 40px; }
.dict-group h2 { margin-bottom: 6px; }
.dict-group > p { color: var(--ink-2); }
.dict-group table { background: var(--surface); }
.type { color: var(--ink-2); white-space: nowrap; font-size: 0.86rem; }
.req { font-size: 0.75rem; color: var(--brass-ink); font-weight: 600; margin-left: 6px; }

/* ---------- Form ---------- */

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 72px);
  padding-top: clamp(36px, 5vw, 56px);
  padding-bottom: clamp(64px, 8vw, 104px);
  align-items: start;
}
.form-layout .prose ul { padding-left: 1.1em; }

form.sample {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: clamp(20px, 3vw, 32px);
  display: grid;
  gap: 18px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 0.92rem; }
.field .hint { font-size: 0.82rem; color: var(--ink-2); font-weight: 400; }
.field input, .field select, .field textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  width: 100%;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 0; font-size: 0.95rem; }
.form-status[data-state="ok"] { color: var(--ink); background: var(--brass-wash); padding: 12px 14px; border-radius: var(--radius-s); }
.form-status[data-state="error"] { color: var(--ink); border-left: 3px solid var(--brass); padding: 4px 0 4px 12px; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--rule); padding: 36px 0 48px; font-size: 0.88rem; color: var(--ink-2); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin: 0 0 4px; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .hero-grid, .row-grid, .form-layout { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { max-width: 16ch; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps li::after { display: none; }
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; border-bottom: 1px solid var(--rule); padding-bottom: 16px; }
  .toc ul { display: flex; flex-wrap: wrap; gap: 6px 18px; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .loses, .delivery, .steps { grid-template-columns: minmax(0, 1fr); }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .site-nav li.secondary { display: none; }
  .chart-figure { padding: 14px 12px 12px; }
  th, td { padding: 8px 8px; }
  .ch-axis { font-size: 22px; }
  .ch-label, .ch-label-muted, .ch-anno, .ch-axis-minor { display: none; }
  .example-row table { font-size: 0.82rem; }
  .example-row td:last-child { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
  .ch-posted, .ch-promo-line { stroke: CanvasText; }
  .ch-blend { stroke: LinkText; }
}

/* ---------- Dataset catalog ---------- */

.catalog {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  overflow: hidden;
}
.catalog table { font-size: 0.95rem; }
.catalog caption { text-align: left; padding: 12px 16px; color: var(--ink-2); }
.catalog th, .catalog td { padding: 14px 16px; }
.catalog thead th { background: transparent; }
.catalog tbody th { font-weight: 650; white-space: nowrap; }
.catalog tbody tr:last-child th, .catalog tbody tr:last-child td { border-bottom: 0; }
.catalog .grain { white-space: nowrap; color: var(--ink-2); }
.catalog .covers { color: var(--ink-2); }
.catalog tr.is-available th a { color: var(--ink); }
.catalog tr.is-planned th { font-weight: 550; color: var(--ink-2); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--brass);
  flex: none;
}
.status-available::before { background: var(--brass); }
.status-next::before { background: transparent; }
.status-planned { color: var(--ink-2); font-weight: 500; }
.status-planned::before { border-color: var(--rule); border-style: dashed; }

.after-catalog { margin-top: 16px; color: var(--ink-2); font-size: 0.95rem; }

.page-body { padding-top: clamp(36px, 5vw, 56px); padding-bottom: clamp(64px, 8vw, 104px); }
.shared { margin-top: clamp(40px, 5vw, 64px); max-width: 46rem; }
.shared h2 { margin-bottom: 14px; }
.shared ul { padding-left: 1.2em; margin: 0 0 1.2em; }
.shared li { margin-bottom: 0.4em; }

.crumb { font-size: 0.9rem; color: var(--ink-2); margin-bottom: 14px; }
.crumb a { color: var(--ink-2); }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 40px;
  margin: 28px 0 0;
}
.facts dt { font-size: 0.82rem; color: var(--ink-2); margin-bottom: 2px; }
.facts dd { margin: 0; font-weight: 600; }

@media (max-width: 640px) {
  .catalog thead { display: none; }
  .catalog tr { display: block; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
  .catalog tbody tr:last-child { border-bottom: 0; }
  .catalog tbody th, .catalog td { display: block; padding: 0; border: 0; white-space: normal; }
  .catalog tbody th { font-size: 1rem; }
  .catalog td.grain { margin-top: 2px; font-size: 0.88rem; }
  .catalog td:has(.status) { margin-top: 6px; }
  .catalog td.covers { margin-top: 6px; font-size: 0.9rem; }
}

.hero-grid h2 { margin-bottom: 16px; }
