/* dankname — shared stylesheet. Identity: "the typed register".
   A clerk's birth register on cream index stock: Young Serif for names and headings,
   Albert Sans for reading, Courier Prime for every number (typed into the ledger),
   a rubber-stamp red for ranks, plum for girls and teal for boys. Light and dark. */

@font-face { font-family: "Young Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/young-serif-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Albert Sans"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/fonts/albert-sans-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/courier-prime-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/courier-prime-latin-700-normal.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --paper: #f5efe2;
  --card: #fffaf0;
  --ink: #1d212b;
  --muted: #585d6a;
  --rule: #d8ccb4;
  --rule-soft: #e9e0cd;
  --stamp: #b3361f;
  --girl: #a3336c;
  --boy: #17707f;
  --focus: #1d4ed8;
  --shadow: 0 1px 0 rgba(60, 40, 10, .08), 0 8px 24px -12px rgba(60, 40, 10, .25);
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Albert Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Courier Prime", "Courier New", ui-monospace, monospace;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15171c;
    --card: #1d2027;
    --ink: #ece5d6;
    --muted: #a9a79f;
    --rule: #3a3e49;
    --rule-soft: #2a2d35;
    --stamp: #ff8f73;
    --girl: #f08cbf;
    --boy: #5fcadb;
    --focus: #8ab4ff;
    --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule-soft) 31px 32px);
  color: var(--ink);
  font: 17px/1.55 var(--sans);
}
a { color: inherit; text-decoration-color: var(--stamp); text-underline-offset: 3px; }
a:hover { color: var(--stamp); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.wrap { max-width: 76rem; margin: 0 auto; padding: 0 1rem; }

/* masthead */
.mast { border-bottom: 2px solid var(--ink); background: var(--paper); }
.mast .wrap { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; padding-top: .7rem; padding-bottom: .55rem; }
.brand { font: 1.35rem/1 var(--serif); text-decoration: none; letter-spacing: -.01em; }
.brand b { color: var(--stamp); font-weight: 400; }
.mast .tag { color: var(--muted); font-size: .9rem; }

/* lookup form */
.lookup { padding-top: 1.1rem; padding-bottom: .4rem; }
.lookup h1 { font: 1.55rem/1.2 var(--serif); margin: 0 0 .7rem; max-width: 34ch; }
.lookup form { display: flex; gap: .5rem; max-width: 36rem; }
.lookup label.vh, .vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lookup input {
  flex: 1; min-width: 0; font: 1.25rem/1.2 var(--serif); padding: .6rem .8rem;
  color: var(--ink); background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius);
}
.lookup button {
  font: 700 1rem/1 var(--sans); padding: 0 1.1rem; border-radius: var(--radius); cursor: pointer;
  color: var(--card); background: var(--ink); border: 2px solid var(--ink);
}
.lookup button:hover { background: var(--stamp); border-color: var(--stamp); }
.try { margin: .6rem 0 0; font-size: .92rem; color: var(--muted); }
.try a { margin-right: .35rem; }

/* result */
.result { padding-top: .6rem; padding-bottom: 1.5rem; }
.result[hidden] { display: none; }
.status { color: var(--muted); min-height: 1.5em; margin: .2rem 0; }
.nameline { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .9rem; margin: .2rem 0 .8rem; }
.nameline h2 { font: 2.3rem/1.05 var(--serif); margin: 0; letter-spacing: -.01em; }
.nameline p { margin: 0; color: var(--muted); }

.grid { display: grid; gap: 1rem; }
.grid > * { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem; min-width: 0; }
.card h3 { font: 1.05rem/1.25 var(--serif); margin: 0 0 .5rem; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.stat { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem .75rem; box-shadow: var(--shadow); }
.stat .k { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: block; }
.stat .v { font: 700 1.3rem/1.2 var(--mono); display: block; margin-top: .15rem; overflow-wrap: anywhere; }
.stat .s { font-size: .85rem; color: var(--muted); display: block; }
.stat .v.small { font-size: 1rem; }
.stamp {
  display: inline-block; font: 700 .95rem/1 var(--mono); color: var(--stamp);
  border: 2px solid currentColor; border-radius: 4px; padding: .18rem .35rem; transform: rotate(-2deg);
}
.girl { color: var(--girl); }
.boy { color: var(--boy); }

.split { display: flex; height: .7rem; border-radius: 99px; overflow: hidden; margin: .4rem 0 .2rem; background: var(--rule-soft); }
.split i { display: block; height: 100%; }
.split .f { background: var(--girl); }
.split .m { background: var(--boy); }

/* chart */
.chartbox { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { stroke: var(--ink); stroke-width: 1.5; }
.chart .tick { fill: var(--muted); font: 12px var(--mono); }
.chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s-f { stroke: var(--girl); }
.chart .line.s-m { stroke: var(--boy); }
.chart .dot.s-f { fill: var(--girl); }
.chart .dot.s-m { fill: var(--boy); }
.chart .cursor { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .9rem; margin: .1rem 0 .4rem; }
.legend span::before { content: ""; display: inline-block; width: 1.1rem; height: 3px; vertical-align: middle; margin-right: .35rem; background: currentColor; border-radius: 2px; }
.readout { font: .95rem/1.4 var(--mono); min-height: 1.4em; margin: .4rem 0 0; }

/* tables */
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: .3rem .5rem; text-align: right; border-bottom: 1px solid var(--rule-soft); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font: 600 .8rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 2px solid var(--rule); }
td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.none { color: var(--muted); font-family: var(--sans); font-size: .85rem; font-style: italic; }
.scroll { overflow-x: auto; max-height: 26rem; overflow-y: auto; }
details summary { cursor: pointer; font-weight: 600; }
.gap-top { margin-top: .8rem; }
.hash { overflow-wrap: anywhere; }
.note { font-size: .92rem; color: var(--muted); margin: .5rem 0 0; }
.note b { color: var(--ink); }

/* prose */
.about { border-top: 2px solid var(--ink); padding-top: 1.2rem; padding-bottom: 2rem; }
.about .cols { display: grid; gap: 1.2rem; }
.about h2 { font: 1.3rem/1.25 var(--serif); margin: 0 0 .4rem; }
.about p, .about li { max-width: 68ch; }
.about ul { padding-left: 1.2rem; }
footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: .88rem; padding: 1rem 0 2rem; }

/* /name/<name>/ pages: same register, rendered at build time */
.card h2.h3, h2.h3 { font: 1.05rem/1.25 var(--serif); margin: 0 0 .5rem; }
.namepage .nameline h1 { font: 2.3rem/1.05 var(--serif); margin: 0; letter-spacing: -.01em; }
.namepage .lead { margin: 0 0 1rem; max-width: 62ch; font-size: 1.05rem; }
.namepage .lead .stamp { margin: 0 .1rem; }
.chartbox.fixed .tick { font-size: 12px; }
@media (max-width: 600px) { .chartbox.fixed .tick { font-size: 22px; } }
.muted { color: var(--muted); }
.again { border-top: 1px solid var(--rule); padding-top: 1rem; padding-bottom: 1.4rem; }
.toplists { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.toplists h3 { font: 1rem/1.25 var(--serif); margin: .2rem 0 .3rem; }
.toplist { list-style: none; padding: 0; margin: 0; }
.toplist li { padding: .15rem 0; border-bottom: 1px solid var(--rule-soft); }
.toplist a, .toplist b { display: flex; gap: .5rem; align-items: baseline; }
.toplist .muted { margin-left: auto; font-size: .9rem; }
.toplist [aria-current] b { color: var(--stamp); }

@media (min-width: 700px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .about .cols { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
  .lookup { padding-top: 1.6rem; }
  .lookup h1 { font-size: 2rem; }
  .grid.main { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid.lower { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (prefers-reduced-motion: no-preference) {
  .chart .line { transition: opacity .2s; }
}
