/* mathfonts: a catalog of OpenType math fonts. The page is a type designer's guide sheet in a
   notebook: blue baseline, x-height and cap-height guides repeat down the page, a red margin line
   runs along the left, and cards carry the black corner marks of the printed grid. Black ink and
   guide blue; the equations are the images. */
:root {
  --paper: #fdfdfb;
  --surface: #ffffff;
  --ink: #111214;
  --muted: #5b5f68;
  --line: #d8dbe1;
  --accent: #2f6bd0;
  --accent-soft: #e6eefb;
  --guide: #3b78d8;
  --margin: #d24a5c;
  --warn: #9a5b00;
  --fail: #b3261e;
  --display: "Literata", "Iowan Old Style", Georgia, serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1114; --surface: #15181c; --ink: #eceef2; --muted: #9da3ad; --line: #2a2e35;
    --accent: #6a9ee8; --accent-soft: #18233a; --guide: #5d93e6; --margin: #e0707f; --warn: #e0a64a; --fail: #f2867d; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1114; --surface: #15181c; --ink: #eceef2; --muted: #9da3ad; --line: #2a2e35;
  --accent: #6a9ee8; --accent-soft: #18233a; --guide: #5d93e6; --margin: #e0707f; --warn: #e0a64a; --fail: #f2867d; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background-color: var(--paper); color: var(--ink); font: 15px/1.6 var(--body);
  /* every 64px: cap height, x-height, then the baseline, as on the printed grid */
  background-image:
    repeating-linear-gradient(to bottom, transparent 0 63px, color-mix(in srgb, var(--guide) 34%, transparent) 63px 64px),
    repeating-linear-gradient(to bottom, transparent 0 41px, color-mix(in srgb, var(--guide) 16%, transparent) 41px 42px, transparent 42px 64px),
    repeating-linear-gradient(to bottom, transparent 0 28px, color-mix(in srgb, var(--guide) 10%, transparent) 28px 29px, transparent 29px 64px); }
/* the notebook's margin line */
body::after { content: ""; position: fixed; top: 0; bottom: 0; left: calc(28px + env(safe-area-inset-left, 0px)); width: 1.5px; background: var(--margin); opacity: .65; z-index: 4; pointer-events: none; }
@media (min-width: 1300px) { body::after { left: calc((100vw - 1200px) / 2 - 22px); } }
@media (max-width: 700px) { body::after { left: calc(7px + env(safe-area-inset-left, 0px)); } }
a { color: var(--accent); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1200px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(30px, 4.2vw, 44px); line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 18px; }
p { margin: 0; max-width: 68ch; }
code, pre { font-family: var(--mono); font-size: 13px; }
.sub { color: var(--muted); font-size: 13px; }
.eyebrow { font: 500 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
.top .wrap { display: flex; align-items: center; gap: 20px; min-height: 58px; }
.logo { font: 600 20px var(--display); color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo em { font-style: normal; color: var(--guide); }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--surface); }
.iconbtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.iconbtn:hover { color: var(--ink); background: var(--surface); border-color: var(--line); }
.iconbtn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
#theme .ic { display: none; }
#theme[data-mode="system"] .i-system, #theme[data-mode="light"] .i-light, #theme[data-mode="dark"] .i-dark { display: block; }

main { padding-block: 32px 72px; display: grid; gap: 28px; }
.intro { display: grid; gap: 10px; }
.intro p { color: var(--muted); font-size: 16px; }
footer { border-top: 1px solid var(--line); padding-block: 24px 40px; color: var(--muted); font-size: 13px; }
footer .wrap { display: grid; gap: 6px; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 13px var(--body); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.group { display: grid; gap: 6px; }
.group > span { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
select { font: 13px var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 5px 8px; }
.count { font: 12px var(--mono); color: var(--muted); }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.card { position: relative; display: grid; grid-template-rows: 1fr auto; min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 0; transition: border-color .15s, transform .15s; }
.card::before, .card::after, .hero::before, .hero::after { content: ""; position: absolute; width: 6px; height: 6px; background: var(--ink); pointer-events: none; }
.card::before, .hero::before { top: 0; left: 0; }
.card::after, .hero::after { bottom: 0; right: 0; }
.card:hover { border-color: var(--ink); transform: translateY(-2px); }
.card .spec { display: grid; place-items: center; padding: 28px 14px 20px; min-height: 132px; font-size: 22px; color: var(--ink); text-decoration: none; overflow: hidden; }
.card .spec svg { height: auto; transition: opacity .2s; }
.card .spec.loading svg { opacity: .25; }
.meta { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 10px 10px 10px 14px; }
.meta .who { display: grid; min-width: 0; flex: 1; }
.meta .who a { font-weight: 600; font-size: 14px; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .who a::after { content: ""; position: absolute; inset: 0 0 52px 0; }
.meta .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .iconbtn { position: relative; z-index: 1; width: 30px; height: 30px; }
.meter { width: 18px; height: 18px; border-radius: 50%; flex: none; background: conic-gradient(var(--accent) calc(var(--v) * 1%), var(--line) 0); position: relative; z-index: 1; }
.meter::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--surface); }

.comparebar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 6; display: flex; gap: 12px; align-items: center; padding: 8px 8px 8px 16px; background: var(--ink); color: var(--surface); border-radius: 999px; font-size: 14px; box-shadow: 0 6px 24px rgb(0 0 0 / .18); animation: rise .2s ease-out; }
.comparebar a { background: var(--accent); color: var(--surface); text-decoration: none; padding: 6px 14px; border-radius: 999px; font-weight: 500; }
.comparebar button { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; font: inherit; }
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }

/* font page */
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-size: 14px; }
.fontpage { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.fontpage > div { display: grid; gap: 22px; min-width: 0; }
.hero { position: relative; display: grid; place-items: center; padding: 44px 16px; font-size: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; overflow-x: auto; }
.specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.specs figure { margin: 0; display: grid; gap: 10px; padding: 22px 12px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; font-size: 20px; min-width: 0; }
.specs figure > div { display: grid; place-items: center; min-height: 70px; overflow-x: auto; }
.specs figcaption { font-size: 12px; color: var(--muted); text-align: center; }
aside { display: grid; gap: 16px; align-content: start; position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 0; padding: 10px 14px; font: 500 14px var(--body); border: 1px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--ink); }
dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 13.5px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.checks { display: grid; gap: 6px; font-size: 13.5px; list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks .pass { color: var(--accent); }
.checks .warn { color: var(--warn); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 18px 20px; display: grid; gap: 12px; min-width: 0; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.missing { font-size: 17px; white-space: nowrap; }
pre { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 2px; padding: 12px 14px; overflow-x: auto; line-height: 1.6; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }

/* compare */
.pickers { display: flex; flex-wrap: wrap; gap: 12px; }
.group.grow { flex: 1 1 100%; }
#grid-tex { font: 15px/1.5 var(--mono); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 8px 12px; width: 100%; }
textarea { font: 15px/1.5 var(--mono); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 10px 12px; width: 100%; resize: vertical; }
input[type="file"] { font: 13px var(--body); color: var(--ink); }
.write-out { min-height: 180px; transition: opacity .2s; }
.write-out.loading { opacity: .35; }
.write-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.write-bar .warn { color: var(--warn); }
.compare { display: grid; grid-template-columns: 160px repeat(var(--n, 3), minmax(220px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 2px; overflow-x: auto; }
.compare > div { padding: 18px 16px; border-bottom: 1px solid var(--line); min-height: 88px; display: grid; place-items: center; font-size: 21px; }
.compare > .label { place-items: center start; font-size: 13px; color: var(--muted); }
.compare > .head { min-height: 0; place-items: start; font-size: 14px; }
.compare > .cell { border-left: 1px solid var(--line); }

/* contribute */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 14px; counter-reset: s; }
.steps li { counter-increment: s; display: grid; gap: 4px; align-content: start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; font-size: 14px; }
.steps li b::before { content: counter(s) " · "; color: var(--accent); font-family: var(--mono); }
.prose { display: grid; gap: 14px; max-width: 76ch; }
.prose ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

@media (max-width: 820px) {
  .fontpage { grid-template-columns: 1fr; }
  aside { position: static; }
  .compare { grid-template-columns: 110px repeat(var(--n, 3), minmax(200px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card .spec svg { transition: none; }
  .card:hover { transform: none; }
  .comparebar { animation: none; }
}

/* draw.html: the grid's cells, filled */
.levels li b::before { content: none; }
.examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 14px; }
.example { margin: 0; display: grid; gap: 8px; align-content: start; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; }
.example figcaption { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.example figcaption .ic { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.example.ok .ic { color: var(--accent); }
.example.bad .ic { color: var(--fail); }
.cell { width: 100%; height: auto; display: block; }
.cell .box { fill: none; stroke: var(--ink); stroke-width: 6; }
.cell .guide { fill: none; stroke: #4f8fdc; stroke-width: 6; }
.cell .guide.dash { stroke-dasharray: 18 14; }
.cell .sample { fill: var(--muted); opacity: .75; }
.cell .code { font: 64px var(--mono); fill: var(--muted); }
.cell .ink { fill: var(--ink); }
.pieces { display: grid; grid-template-columns: repeat(3, minmax(0, 120px)) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.pieces .result { place-items: center; }
.pieces .built { font-size: 38px; color: var(--ink); }
@media (max-width: 560px) { .pieces { grid-template-columns: repeat(3, 1fr); } .pieces .result { grid-column: 1 / -1; } }
@media (max-width: 560px) {
  .top .wrap { flex-wrap: wrap; gap: 2px 12px; padding-block: 8px; }
  .logo { flex: 1; }
  .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; margin-inline: -10px; }
  .nav a { white-space: nowrap; }
  .examples { gap: 10px; }
  .example { padding: 8px; }
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* keep the content to the right of the margin line */
@media (min-width: 701px) and (max-width: 1299px) { .wrap { padding-left: max(52px, env(safe-area-inset-left, 0px)); } }
.sizes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 14px; }
.size { position: relative; display: grid; gap: 8px; align-content: start; padding: 16px; background: var(--surface); border: 1px solid var(--line); }
.size b { font: 600 18px var(--display); }
.size > span { color: var(--muted); font-size: 14px; }
