/* The post-quantum web: one mosaic carries the page; everything else stays quiet. */
:root {
  --paper: #f4f6f9;
  --surface: #ffffff;
  --ink: #18212f;
  --muted: #5a6577;
  --rule: #d8dde5;
  --pq: #2f7d57;
  --classical: #c27c0e;
  --old: #b4372a;
  --none: #dde2ea;
  --link: #1d5fa8;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --measure: 42rem;
}

* { box-sizing: border-box; }

html { background: var(--paper); color: var(--ink); }

body {
  margin: 0;
  font: 1rem/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--link); text-underline-offset: 0.15em; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

code, pre { font-family: var(--mono); font-size: 0.9em; }
pre {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
}

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

nav.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}
nav.top .home { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
nav.top .home span { font-weight: 400; color: var(--muted); margin-left: 0.4rem; }
nav.top ul { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 0; padding: 0; list-style: none; }
nav.top ul a { color: var(--ink); }

main { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem 3rem; }

section, .hero { margin: 0 0 4rem; }

.hero h1 {
  font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 750;
  max-width: 22ch;
  margin: 2rem 0 1rem;
}
.dek { font-size: 1.15rem; color: var(--muted); max-width: var(--measure); margin: 0 0 2rem; }
.meta { color: var(--muted); font-size: 0.95rem; max-width: var(--measure); }

h2 { font-size: 1.45rem; letter-spacing: -0.01em; margin: 0 0 1rem; }
section > p { max-width: var(--measure); }

/* The mosaic: one square per domain, in order of rank. */
.mosaic {
  display: grid;
  grid-template-columns: repeat(50, 1fr);
  gap: 2px;
  max-width: 60rem;
}
.mosaic-small { grid-template-columns: repeat(20, 1fr); max-width: 36rem; gap: 3px; }
.cell { aspect-ratio: 1; border-radius: 2px; display: block; }
.cell:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.pq { background: var(--pq); }
.classical { background: var(--classical); }
.old { background: var(--old); }
.none { background: var(--none); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  font-size: 0.95rem;
}
.legend li { display: flex; align-items: center; gap: 0.45rem; }
.swatch { width: 0.85rem; height: 0.85rem; border-radius: 2px; display: inline-block; }
.legend .n { font-variant-numeric: tabular-nums; color: var(--muted); }

/* Finding a site */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin: 0 0 1rem; }
.controls label { font-weight: 600; }
.controls input {
  font: inherit;
  font-family: var(--mono);
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  min-width: 16rem;
}
.lists { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.lists button, button.copy {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.lists button + button { border-left: 1px solid var(--rule); }
.lists button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
button.copy { border: 1px solid var(--rule); border-radius: 6px; }

.table-wrap {
  max-height: 34rem;
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
}
table.sites { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
table.sites th {
  position: sticky;
  top: 0;
  background: var(--surface);
  text-align: left;
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}
table.sites td { padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--paper); vertical-align: baseline; }
table.sites .rank, table.sites .score { text-align: right; font-variant-numeric: tabular-nums; width: 4.5rem; }
table.sites td.kx { background: none; }
table.sites td.kx::before {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
  margin-right: 0.5rem;
  background: var(--none);
}
table.sites td.kx.pq::before { background: var(--pq); }
table.sites td.kx.classical::before { background: var(--classical); }
table.sites td.kx.old::before { background: var(--old); }
table.sites td.kx.none { color: var(--muted); }
table.sites .via { color: var(--muted); font-size: 0.85em; }
table.sites tr:target, table.sites tr.found { background: #fff6d6; }
.empty, .badge-missing { color: var(--muted); }

/* Countries, most post-quantum first; the bar is the share. */
table.countries { border-collapse: collapse; width: 100%; max-width: 48rem; font-size: 0.95rem; }
table.countries th, table.countries td { padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--rule); text-align: left; }
table.countries th { font-weight: 600; }
table.countries .num { text-align: right; font-variant-numeric: tabular-nums; }
table.countries td.bar { position: relative; width: 14rem; }
table.countries td.bar span {
  position: absolute;
  left: 0;
  top: 50%;
  height: 0.6rem;
  width: calc(var(--share) * 9rem);
  transform: translateY(-50%);
  background: var(--pq);
  border-radius: 2px;
}
.add { color: var(--muted); }
.crumb { margin: 1.5rem 0 0; }
.hero h1 code { font-size: 0.85em; }

/* Trend */
svg.trend { width: 100%; max-width: 40rem; height: auto; font: 0.8rem var(--sans); }
svg.trend .grid { stroke: var(--rule); }
svg.trend .axis { fill: var(--muted); }
svg.trend .line { fill: none; stroke-width: 2.5; }
svg.trend .line.pq { stroke: var(--pq); }
svg.trend .line.tr { stroke: var(--classical); }
svg.trend .end.pq { fill: var(--pq); }
svg.trend .end.tr { fill: var(--classical); }
.note { color: var(--muted); }

/* The report reads as prose. */
.report { max-width: var(--measure); margin: 0 auto; font: 1.125rem/1.7 var(--serif); }
.report h1 {
  font: 750 clamp(1.9rem, 1.3rem + 2.2vw, 2.8rem)/1.15 var(--sans);
  letter-spacing: -0.02em;
  margin: 2rem 0 1rem;
}
.report h2 { font-family: var(--sans); margin: 2.75rem 0 0.75rem; }
.report .dek { font-family: var(--serif); }
.report figure { margin: 2rem 0; }
.report figure .mosaic { max-width: none; }
.report figcaption, .report .legend { font: 0.9rem/1.5 var(--sans); color: var(--muted); }
.report li { margin-bottom: 0.6rem; }
table.plain { border-collapse: collapse; font: 0.95rem var(--sans); margin: 1rem 0 1.5rem; }
table.plain th, table.plain td { padding: 0.4rem 1.25rem 0.4rem 0; border-bottom: 1px solid var(--rule); text-align: left; }
table.plain td + td, table.plain th + th { text-align: right; font-variant-numeric: tabular-nums; }

footer {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}
footer p { max-width: var(--measure); margin: 0; }

@media (max-width: 40rem) {
  .mosaic { grid-template-columns: repeat(25, 1fr); }
  .mosaic-small { grid-template-columns: repeat(10, 1fr); }
  table.countries td.bar { width: auto; }
  table.countries td.bar span { display: none; }
  table.sites th:nth-child(4), table.sites td:nth-child(4),
  table.sites th:nth-child(5), table.sites td:nth-child(5) { display: none; }
  .controls input { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
