/* The website's name pages (/names, /names/<name>): the app's type and colours, no script needed */
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/Newsreader-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
:root {
  color-scheme: light;
  --bg: #f1ecfa;
  --surface: #ffffff;
  --ink: #2a2433;
  --ink-2: #5b5368;
  --ink-3: #6f6780;
  --line: #e5ddf3;
  --accent: #5b4bb0;
  --accent-ink: #ffffff;
  --accent-soft: #ece8fa;
  --chart-fill: rgba(91, 75, 176, 0.16);
  /* name colours, darkened from the app's so they read as text */
  --girl: #b03a68;
  --girl-soft: #fbe6ee;
  --boy: #2c66ad;
  --boy-soft: #e3eefa;
  --unisex: #6b4fb8;
  --unisex-soft: #ece8fa;
  --up: #1d7a4b;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1c1a22;
    --surface: #25222d;
    --ink: #f1eef6;
    --ink-2: #c8c2d3;
    --ink-3: #a39cb0;
    --line: #332f3d;
    --accent: #b9adf2;
    --accent-ink: #1c1a22;
    --accent-soft: #312b47;
    --chart-fill: rgba(185, 173, 242, 0.18);
    --girl: #ea8db0;
    --girl-soft: #3d2731;
    --boy: #7eb0ee;
    --boy-soft: #22324a;
    --unisex: #b7a2ee;
    --unisex-soft: #312b47;
    --up: #5cc48c;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16.5px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
[hidden] {
  display: none !important;
}

/* ---- the bar at the top */
.top {
  max-width: 760px;
  margin: 0 auto;
  padding-block: max(16px, env(safe-area-inset-top, 0px)) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.brand {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 560;
  color: var(--ink);
  text-decoration: none;
  padding-block: 6px;
}
.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  align-items: center;
}
.top nav a {
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  padding-block: 10px;
}
.top nav a:hover {
  text-decoration: underline;
}
.top nav a.go {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.top nav a.go:hover {
  text-decoration: none;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding-block: 8px 40px;
}
.crumbs {
  font-size: 14px;
  color: var(--ink-3);
  margin-top: 18px;
}
.crumbs a {
  color: var(--ink-3);
}
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 540;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}
h1 {
  font-size: clamp(44px, 11vw, 76px);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 12px;
  overflow-wrap: anywhere;
}
h2 {
  font-size: 26px;
  margin-bottom: 10px;
}
h3 {
  font-size: 20px;
  margin-bottom: 8px;
}
p {
  margin: 0 0 12px;
  max-width: 66ch;
}
section {
  margin-top: 34px;
}
.lede {
  font-size: 18px;
  color: var(--ink-2);
  margin-top: 10px;
}
.lede .pron {
  font-style: italic;
}
/* the short answer under a name's heading */
.answer {
  font-size: 17px;
  margin-top: 14px;
}

/* gender label and name links take the app's girl, boy and unisex colours */
.g {
  display: inline-block;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 2px 12px;
}
.g.g-girl {
  color: var(--girl);
  background: var(--girl-soft);
}
.g.g-boy {
  color: var(--boy);
  background: var(--boy-soft);
}
.g.g-unisex {
  color: var(--unisex);
  background: var(--unisex-soft);
}
a.g-girl {
  color: var(--girl);
}
a.g-boy {
  color: var(--boy);
}
a.g-unisex {
  color: var(--unisex);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips span {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---- meaning and origin */
.origin {
  font-weight: 600;
  color: var(--ink);
}
.meaning {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.25;
  font-style: italic;
  color: var(--ink);
}
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 18px;
  margin: 16px 0;
}
.facts dt {
  font-weight: 600;
  color: var(--ink-3);
}
.facts dd {
  margin: 0;
  min-width: 0;
}
.note {
  font-size: 14px;
  color: var(--ink-3);
}

/* ---- each country's figures */
.country {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px clamp(16px, 4vw, 26px) 16px;
}
.country p {
  color: var(--ink-2);
}
/* the figures at a glance, as on the app's name page */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin: 6px 0 16px;
}
.tiles div {
  background: var(--surface);
  padding: 12px 14px 13px;
  min-width: 0;
}
.tiles dt {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
}
.tiles dd {
  margin: 0;
  display: grid;
  gap: 2px;
}
.tiles b {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.tiles span {
  font-size: 13px;
  color: var(--ink-3);
}
@media (max-width: 640px) {
  .tiles {
    grid-template-columns: 1fr 1fr;
  }
}
.chart {
  margin: 18px 0 8px;
}
.chart svg {
  display: block;
  width: 100%;
  height: 150px;
}
.chart .area {
  fill: var(--chart-fill);
}
.chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2px;
  stroke-linejoin: round;
}
.chart figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}
details {
  margin-top: 10px;
}
summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  padding-block: 10px;
}
/* the table runs its full length (no scrolling box for keyboards to reach), with its header held
   at the top of the screen; clip rounds the corners without making a scrolling box */
.table {
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 12px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}
th,
td {
  text-align: right;
  padding: 6px 14px;
  border-bottom: 1px solid var(--line);
}
th:first-child {
  text-align: left;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 13px;
}
tbody th {
  font-weight: 600;
}

/* ---- the look-up form */
.find {
  margin: 22px 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  max-width: 480px;
}
.find label {
  font-weight: 600;
  font-size: 15px;
}
.find div {
  display: flex;
  gap: 8px;
}
.find input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
}
.find input:focus-visible,
.find button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.find button {
  min-height: 46px;
  font: inherit;
  font-weight: 650;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 8px 20px;
  cursor: pointer;
}

/* ---- lists of names */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: none;
}
.links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  font-weight: 600;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 14px;
}
.links a:hover {
  border-color: currentColor;
}
.letters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  margin: 24px 0;
}
.letters a,
.letters span {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 12px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 560;
  text-decoration: none;
}
.letters a {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}
.letters a:hover {
  border-color: var(--accent);
}
.letters a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.letters span {
  color: var(--ink-3);
  opacity: 0.6;
}
.tops {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.toplist {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 18px 10px;
  min-width: 0;
}
.toplist ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toplist li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.toplist li:last-child {
  border-bottom: 0;
}
.toplist .rank {
  min-width: 2.2em;
  text-align: right;
  color: var(--ink-3);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.toplist li a {
  font-weight: 600;
  text-decoration: none;
  min-width: 0;
  overflow-wrap: anywhere;
}
.toplist li a:hover {
  text-decoration: underline;
}
.toplist .count {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.az {
  columns: 4 140px;
  column-gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.az li {
  line-height: 2;
  break-inside: avoid;
}
.az a {
  text-decoration: none;
}
.az a:hover {
  text-decoration: underline;
}

/* ---- the invitation to the app */
.cta {
  margin-top: 40px;
  background: var(--accent-soft);
  border-radius: 20px;
  padding: 24px clamp(16px, 4vw, 28px);
}
.cta p {
  color: var(--ink-2);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 650;
  text-decoration: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---- footer */
.foot {
  max-width: 760px;
  margin: 0 auto;
  padding-block: 20px max(32px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-3);
}
.foot p {
  max-width: none;
}
.foot a {
  color: var(--ink-3);
}

@media (max-width: 480px) {
  .brand {
    font-size: 22px;
  }
  .top nav {
    gap: 4px 12px;
  }
  .top nav a {
    font-size: 14px;
  }
  .top nav a.go {
    padding: 6px 12px;
  }
  h2 {
    font-size: 23px;
  }
  .meaning {
    font-size: 24px;
  }
  .az {
    columns: 2;
  }
}
@media print {
  .top nav,
  .cta,
  .letters {
    display: none;
  }
}

/* ---- what the figures say, and the trends pages */
.chart .band {
  fill: var(--accent);
  opacity: 0.1;
}
.spellings,
.nicks {
  list-style: none;
  margin: 4px 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.spellings li,
.nicks li {
  font-size: 15px;
}
.nicks span,
.spellings span,
.moves span,
.endings span {
  color: var(--ink-3);
  font-size: 14px;
}
.pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px 24px;
}
.pair h3 {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 650;
  color: var(--ink-2);
  margin: 4px 0 8px;
}
.pair .table {
  background: var(--surface);
}
td.nm,
th.nm {
  text-align: left;
}
td.nm a {
  font-weight: 600;
  text-decoration: none;
}
td.nm span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-3);
}
td.up {
  color: var(--up);
  font-weight: 650;
}
.moves,
.endings {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.moves a,
.endings a {
  font-weight: 600;
  text-decoration: none;
}
.note {
  font-size: 13.5px;
  color: var(--ink-3);
}
.chart .line.girl {
  stroke: var(--girl);
}
.chart .line.boy {
  stroke: var(--boy);
}
.chart figcaption .legend {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}
.chart .key {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.chart .key.girl {
  background: var(--girl);
}
.chart .key.boy {
  background: var(--boy);
}

/* ---- a name's facts at a glance */
.glance {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 14px 0 0;
}
.glance div {
  min-width: 0;
}
.glance dt {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}
.glance dd {
  margin: 2px 0 0;
  font-weight: 600;
}
.glance .pron {
  font-style: italic;
  font-weight: 500;
}
.glance + .chips {
  margin-top: 16px;
}

/* ---- the lists: top 100s by year, origins, ideas */
.toplist h2 {
  font-size: 22px;
  margin-bottom: 8px;
}
.toplist .chg {
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.years {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.years a {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.years a:hover {
  border-color: var(--accent);
}
.years a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.pager {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}
.pager a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 650;
}
.pager a[rel="next"] {
  margin-left: auto;
}
.named {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.named a,
.hub a {
  font-weight: 650;
  text-decoration: none;
}
.named a:hover,
.hub a:hover {
  text-decoration: underline;
}
.named span {
  color: var(--ink-3);
  font-size: 15px;
}
.hub {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.hub li {
  max-width: 66ch;
}
.hub a {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 560;
}
.hub span {
  display: block;
  color: var(--ink-2);
  font-size: 15.5px;
}
.moves .more {
  color: var(--ink-3);
  font-size: 14px;
}
.points {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 8px;
  max-width: 66ch;
}
.points + .after {
  margin-top: 14px;
}
.sources {
  margin-top: 40px;
}
.sources h2 {
  font-size: 20px;
}
