/* AGOS Tools: one design system for the hub and every tool.
   Paper, ink and one ochre accent; hairline rules; type does the work. */

@font-face { font-family: "Plex"; src: url("/assets/fonts/IBMPlexSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/assets/fonts/IBMPlexSans-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/assets/fonts/IBMPlexSans-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Condensed"; src: url("/assets/fonts/IBMPlexSansCondensed-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("/assets/fonts/Spectral-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("/assets/fonts/Spectral-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("/assets/fonts/Spectral-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --paper: #f4f1ea;
  --paper-2: #ece7dc;
  --sheet: #fffdf8;
  --mat: #dcd6c8;
  --ink: #1b1b19;
  --ink-2: #4a463e;
  --ink-3: #807a6e;
  --rule: #d4ccbb;
  --rule-strong: #b9b09c;
  --ochre: #d99916;
  --ochre-ink: #8f5f00;
  --signal: #d2431f;
  --ok: #2f6b4f;

  --f-text: "Plex", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-label: "Plex Condensed", "Plex", system-ui, sans-serif;
  --f-display: "Spectral", Georgia, serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --r: 3px;
  --measure: 66ch;
  --page: 1240px;
  --ease: cubic-bezier(.45, 0, .55, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--f-text);
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ochre-ink); }
:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; }
h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-family: var(--f-display); font-size: clamp(2rem, 4.2vw, 3.1rem); letter-spacing: -0.01em; }
h2 { font-family: var(--f-display); font-size: 1.45rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
.label, .step-title, .tile-soon {
  font: 600 0.74rem/1 var(--f-label);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
mark.ph { background: #ffe08a; color: var(--ink); padding: 0 .2em; border-radius: 2px; }

/* ---- masthead and colophon ---- */
.masthead {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s5) var(--s5) var(--s4);
  display: flex; align-items: baseline; gap: var(--s5); flex-wrap: wrap;
}
/* The lockup: AGOS and TOOLS on one baseline, the ochre bar under both. Proportions from the logo artwork
   (letters 128.5 units tall, bar 36.9 thick, 12.4 below the baseline); TOOLS's cap height is 45 % of AGOS's. */
.brand { display: inline-block; text-decoration: none; --H: 20px; }
.lockup { position: relative; display: inline-flex; align-items: baseline; gap: calc(var(--H) * 0.3);
  height: calc(var(--H) * (1 + 0.0965 + 0.287)); }
.lockup img { display: block; height: var(--H); width: auto; }
.lockup::after { content: ""; position: absolute; left: 0; right: 0; top: calc(var(--H) * 1.0965); height: calc(var(--H) * 0.287); background: var(--ochre); }
.brand-tools { font: 600 calc(var(--H) * 0.45 / 0.698) / 1 var(--f-label); letter-spacing: 0.14em; margin-right: -0.14em; text-transform: uppercase; color: var(--ink); }
.crumbs { font-size: 0.86rem; color: var(--ink-3); display: flex; gap: var(--s2); flex-wrap: wrap; }
.crumbs a { text-decoration: none; }
.crumbs a:first-child { display: none; }
.crumbs .sep:first-of-type { display: none; }
.crumbs [aria-current] { color: var(--ink-2); }

main { max-width: var(--page); margin: 0 auto; padding: 0 var(--s5); }

.colophon {
  max-width: var(--page); margin: var(--s8) auto 0; padding: var(--s6) var(--s5) var(--s5);
  border-top: 1px solid var(--rule);
  font-size: 0.86rem; color: var(--ink-2);
}
.menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s5); }
.menu ul { list-style: none; margin: var(--s3) 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.menu .label { color: var(--ink-3); }
.menu a { text-decoration: none; }
.menu a:hover { text-decoration: underline; }
.menu [aria-current] { color: var(--ink); font-weight: 600; }
.menu [aria-current]::before { content: ""; display: inline-block; width: 10px; height: 3px; background: var(--ochre); vertical-align: middle; margin-right: 6px; }
.menu .soon { color: var(--ink-3); }
.colophon-legal { display: flex; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid var(--rule); color: var(--ink-3); }
.colophon-legal a { text-decoration: none; color: var(--ink-2); }
.colophon-legal a:hover { text-decoration: underline; }

/* ---- home ---- */
.hero { padding: var(--s7) 0 var(--s7); max-width: 52rem; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: var(--measure); margin-top: var(--s4); }
.promises { list-style: none; padding: 0; margin: var(--s6) 0 0; display: flex; gap: var(--s5) var(--s6); flex-wrap: wrap; color: var(--ink-2); font-size: 0.92rem; }
.promises li { display: flex; align-items: center; gap: var(--s2); }
.glyph { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.cluster h2, .related h2 { margin-bottom: var(--s4); }
.cluster + .cluster { margin-top: var(--s7); }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s4); }
.tile { position: relative; min-height: 158px; }
.tile a, .tile.soon { display: flex; flex-direction: column; gap: var(--s2); height: 100%; padding: var(--s5) var(--s4) var(--s4); border-radius: var(--r); text-decoration: none; }
.tile.live a {
  background: var(--sheet);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 0 var(--rule);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
/* The brand bar: a short ochre rule along the top edge of everything that is ready. */
.tile.live a::before { content: ""; position: absolute; left: var(--s4); top: -1px; width: 36px; height: 4px; background: var(--ochre); }
.tile.live a:hover { transform: translateY(-2px); box-shadow: 0 6px 18px -8px rgba(27,27,25,.35); border-color: var(--rule-strong); color: inherit; }
.tile.soon { border: 1px dashed var(--rule-strong); color: var(--ink-3); background: transparent; }
.tile-name { font: 600 1.15rem/1.2 var(--f-display); color: var(--ink); }
.tile.soon .tile-name { color: var(--ink-3); }
.tile-blurb { font-size: 0.9rem; color: var(--ink-2); }
.tile.soon .tile-blurb { color: var(--ink-3); }
.tile .glyph { color: var(--ink-2); margin-bottom: var(--s1); }
.tile.soon .glyph { color: var(--rule-strong); }
.tile-soon { position: absolute; top: var(--s4); right: var(--s4); color: var(--ink-3); }

/* ---- documents ---- */
.prose { max-width: var(--measure); padding: var(--s6) 0; }
.prose h1 { margin-bottom: var(--s5); }
.prose h2 { font-size: 1.2rem; margin: var(--s6) 0 var(--s2); }
.prose p + p { margin-top: var(--s3); }
.prose .updated { margin-top: var(--s6); color: var(--ink-3); font-size: 0.88rem; }

/* ---- tool pages ---- */
.tool-head { padding: var(--s5) 0 var(--s5); }
.tool-head .lede { margin-top: var(--s2); }

.howto, .facts, .related { margin-top: var(--s8); }
.howto h2 { margin-bottom: var(--s5); }
.howto-steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s5); }
.howto-steps li { counter-increment: step; border-top: 1px solid var(--ink); padding-top: var(--s3); }
.howto-steps li::before { content: counter(step); font: 600 2rem/1 var(--f-display); color: var(--ochre); display: block; margin-bottom: var(--s2); }
.howto-steps h3 { margin-bottom: var(--s1); }
.howto-steps p { font-size: 0.93rem; color: var(--ink-2); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s7); }
.fact h2 { font-size: 1.2rem; margin-bottom: var(--s3); }
.fact h2:not(:first-child) { margin-top: var(--s6); }
.fact p { color: var(--ink-2); max-width: var(--measure); }
.stock-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.stock-table th { text-align: left; font: 600 0.72rem/1 var(--f-label); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); padding: 0 0 var(--s2); border-bottom: 1px solid var(--ink); }
.stock-table td { padding: var(--s2) 0; border-bottom: 1px solid var(--rule); }
.stock-table td:last-child, .stock-table th:last-child { text-align: right; }
.prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.price { border: 1px solid var(--rule); border-radius: var(--r); padding: var(--s3); background: var(--sheet); display: flex; flex-direction: column; gap: 2px; }
.price-name { font: 600 0.72rem/1 var(--f-label); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.price-amount { font: 600 1.6rem/1.2 var(--f-display); }
.price-what { font-size: 0.82rem; color: var(--ink-2); }
.noscript { padding: var(--s5); background: var(--paper-2); }

/* ---- the tool: bench (left) and proof (right) ---- */
.tool {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--sheet);
  min-height: 640px;
}
.bench { border-right: 1px solid var(--rule); display: flex; flex-direction: column; }
.step { padding: var(--s4) var(--s4) var(--s5); border-bottom: 1px solid var(--rule); }
.step:last-child { border-bottom: 0; }
.step-title { display: flex; align-items: center; gap: var(--s2); color: var(--ink-2); margin-bottom: var(--s3); }
.step-title b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--ink-2); font-size: 0.7rem; letter-spacing: 0; }
.step.done .step-title b { background: var(--ink); color: var(--sheet); border-color: var(--ink); }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s1);
  padding: var(--s5) var(--s3); border: 1.5px dashed var(--rule-strong); border-radius: var(--r);
  text-align: center; cursor: pointer; color: var(--ink-2);
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.drop:hover, .drop.over { border-color: var(--ochre); background: #fbf3e0; }
.drop strong { font-weight: 600; color: var(--ink); }
.drop small { color: var(--ink-3); font-size: 0.78rem; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.source { display: none; align-items: center; gap: var(--s2); margin-top: var(--s3); font-size: 0.9rem; }
.source.on { display: flex; }
.source .count { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.source .doc { width: 14px; height: 18px; border: 1.5px solid var(--ink-2); border-radius: 2px; position: relative; flex: none; }
.source .doc::after { content: ""; position: absolute; left: 2px; right: 2px; top: 4px; height: 6px; border-top: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); }
details.paste { margin-top: var(--s3); }
details.paste summary { cursor: pointer; font-size: 0.9rem; color: var(--ink-2); list-style: none; }
details.paste summary::before { content: "+ "; color: var(--ink-3); }
details.paste[open] summary::before { content: "– "; }
textarea, input[type="text"], input[type="number"], select {
  font: inherit; font-size: 0.92rem; color: var(--ink);
  background: #fff; border: 1px solid var(--rule-strong); border-radius: var(--r);
  padding: 6px 8px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; margin-top: var(--s2); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.82rem; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 13px) 55%, calc(100% - 9px) 55%; background-size: 4px 4px; background-repeat: no-repeat; padding-right: 24px; }
select.unset { color: var(--ink-3); }

.map { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s3); align-items: center; font-size: 0.9rem; }
.map label { color: var(--ink-2); white-space: nowrap; }

.templates { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.template { padding: 0; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; align-items: stretch; font: inherit; font-size: 0.8rem; color: var(--ink-2); }
.template canvas { width: 100%; height: auto; display: block; border-radius: 2px; box-shadow: 0 0 0 1px var(--rule); transition: box-shadow .15s var(--ease), transform .15s var(--ease); background: #fff; }
.template:hover canvas { transform: translateY(-1px); }
.template[aria-pressed="true"] canvas { box-shadow: 0 0 0 2px var(--ink); }
.template[aria-pressed="true"] { color: var(--ink); font-weight: 600; }

.swatches { display: flex; gap: var(--s2); margin-top: var(--s4); align-items: center; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .12s var(--ease); padding: 0; }
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--sheet), 0 0 0 4px var(--ink); }
.swatch.custom { position: relative; overflow: hidden; background: conic-gradient(#e4572e, #f2b134, #17a398, #3a6fd8, #b8336a, #e4572e); }
.swatch.custom input { position: absolute; inset: -6px; width: 40px; height: 40px; opacity: 0; cursor: pointer; }

.logo-row { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); font-size: 0.9rem; }
.logo-drop { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; color: var(--ink-2); border: 1px dashed var(--rule-strong); border-radius: var(--r); padding: 6px 10px; }
.logo-drop:hover, .logo-drop.over { border-color: var(--ochre); }
.logo-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.logo-drop img { max-height: 28px; max-width: 90px; display: block; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 1.1rem; padding: 2px 6px; line-height: 1; }
.icon-btn:hover { color: var(--signal); }

.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--r); overflow: hidden; }
.seg button { font: inherit; font-size: 0.86rem; border: 0; background: #fff; padding: 5px 12px; cursor: pointer; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.seg button + button { border-left: 1px solid var(--rule-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }
.seg .lock { width: 9px; height: 11px; flex: none; }

.stocks { display: flex; flex-direction: column; gap: 6px; margin-top: var(--s3); }
.stock { display: grid; grid-template-columns: 34px 1fr auto; gap: var(--s3); align-items: center; padding: 6px 8px; border: 1px solid transparent; border-radius: var(--r); cursor: pointer; font: inherit; font-size: 0.9rem; text-align: left; background: none; color: var(--ink); }
.stock:hover { background: var(--paper); }
.stock[aria-pressed="true"] { border-color: var(--ink); background: #fff; }
.stock svg { width: 34px; height: 44px; display: block; }
.stock .per { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 0.82rem; }

.print-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.align { margin-top: var(--s4); font-size: 0.88rem; }
.align summary { cursor: pointer; color: var(--ink-2); list-style: none; }
.align summary::before { content: "+ "; color: var(--ink-3); }
.align[open] summary::before { content: "– "; }
.align-grid { display: grid; grid-template-columns: auto 72px auto 72px; gap: var(--s2); align-items: center; margin-top: var(--s3); }
.align-grid span { color: var(--ink-3); }
.align .btn { margin-top: var(--s3); }

.btn { font: 600 0.92rem/1 var(--f-text); border-radius: var(--r); padding: 11px 16px; cursor: pointer; border: 1px solid var(--ink); background: #fff; color: var(--ink); display: inline-flex; gap: var(--s2); align-items: center; justify-content: center; text-decoration: none; }
.btn:hover { background: var(--paper); color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--sheet); }
.btn.primary:hover { background: #33312c; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.small { padding: 7px 10px; font-size: 0.84rem; }
.export { margin-top: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.export .btn.primary { width: 100%; padding: 14px 16px; font-size: 1rem; }

/* What the export will hold: a strip of ticks, one per row, filled up to the free limit. */
.meter { display: flex; align-items: center; gap: var(--s3); font-size: 0.86rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meter-bar { flex: 1; height: 8px; border-radius: 4px; background: repeating-linear-gradient(135deg, var(--rule) 0 3px, transparent 3px 6px); position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px var(--rule); }
.meter-fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 4px; transition: width .3s var(--ease); }
.meter.full .meter-fill { background: var(--ok); }

.unlock { border: 1px solid var(--ochre); border-radius: var(--r); background: #fdf6e6; padding: var(--s4); display: none; flex-direction: column; gap: var(--s3); }
.unlock.on { display: flex; animation: rise .25s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.unlock h3 { font: 600 1.1rem/1.2 var(--f-display); }
.buy { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.buy a { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); border: 1px solid var(--rule-strong); border-radius: var(--r); background: #fff; text-decoration: none; }
.buy a:hover { border-color: var(--ink); color: inherit; }
.buy .amount { font: 600 1.3rem/1.1 var(--f-display); }
.buy .name { font-size: 0.82rem; color: var(--ink-2); }
.keyrow { display: flex; gap: var(--s2); }
.keyrow input { font-family: ui-monospace, Menlo, monospace; font-size: 0.82rem; }
.keyrow input.bad { border-color: var(--signal); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.keymsg { font-size: 0.82rem; color: var(--signal); }
.keymsg:empty { display: none; }
.licensed { display: none; align-items: center; gap: var(--s2); font-size: 0.86rem; color: var(--ok); }
.licensed.on { display: flex; }
.licensed .icon-btn { margin-left: auto; font-size: 0.8rem; }

.proof { background: var(--mat); position: relative; min-width: 0; display: flex; flex-direction: column; border-radius: 0 var(--r) var(--r) 0; }
.proof-bar { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s4); font-size: 0.86rem; color: var(--ink-2); border-bottom: 1px solid rgba(27,27,25,.08); flex-wrap: wrap; }
.proof-bar .sum { font-variant-numeric: tabular-nums; }
.issues { position: relative; }
.issues summary { list-style: none; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; color: var(--signal); }
.issues summary::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--signal); }
.issues ul { position: absolute; z-index: 3; top: 1.8em; left: 0; margin: 0; padding: var(--s3); list-style: none; background: #fff; border: 1px solid var(--rule-strong); border-radius: var(--r); box-shadow: 0 8px 24px -10px rgba(0,0,0,.35); width: max-content; max-width: 320px; max-height: 260px; overflow: auto; font-size: 0.84rem; color: var(--ink); }
.issues li + li { margin-top: 4px; }
.issues li span { color: var(--ink-3); }
.zoom { margin-left: auto; display: inline-flex; gap: 2px; }
.zoom button { border: 1px solid transparent; background: none; cursor: pointer; padding: 2px 6px; border-radius: var(--r); color: var(--ink-2); font: inherit; }
.zoom button[aria-pressed="true"] { border-color: var(--ink-2); }
.sheets { padding: var(--s5); display: flex; flex-wrap: wrap; gap: var(--s5); justify-content: center; align-content: flex-start; overflow: auto; max-height: 82vh; }
.sheet { position: relative; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 10px 26px -14px rgba(0,0,0,.45); transition: opacity .25s var(--ease); }
.sheet canvas { display: block; width: 100%; height: 100%; }
.sheet .pageno { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 0.74rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.proof.sample .sheet { opacity: .55; }
.proof.dragging::after { content: ""; position: absolute; inset: 10px; border: 2px dashed var(--ochre); border-radius: var(--r); pointer-events: none; background: rgba(217,153,22,.07); }

@media (max-width: 860px) {
  .tool { grid-template-columns: 1fr; }
  .bench { border-right: 0; border-bottom: 1px solid var(--rule); }
  .proof { border-radius: 0 0 var(--r) var(--r); }
  .sheets { max-height: none; }
  .prices { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .masthead, .colophon, .howto, .facts, .related { display: none; } }
