@font-face {
  font-family: "Handwrit";
  src: url(fonts/Handwrit-Regular.woff2?v=9f8d261e) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Handwrit Alt";
  src: url(fonts/HandwritAlt-Regular.woff2?v=f6a183f6) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url(fonts/atkinson-next-latin.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url(fonts/atkinson-next-latin-ext.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #FFFFFF;
  --ink: #000000;
  --graphite: #555555;
  --guide: #B8B8B8;
  --guide-soft: #E2E2E2;
  --raised: #FFFFFF;
  --text: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --measure: 78ch;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--text);
}
a { color: inherit; text-decoration-color: var(--guide); text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 20px var(--gutter) 0;
}
.wordmark { font: 2.4rem/1 "Handwrit", cursive; text-decoration: none; }
.tagline { margin: 0; text-align: right; font: 400 clamp(1.5rem, 2.6vw, 2.2rem)/1.2 "Handwrit", cursive; }

/* No lone word or letter on the last line of any text */
p, li, h1, h2, h3 { text-wrap: pretty; }
h1, h2 { text-wrap: balance; }

/* Hero: the practice sheet */
.hero { padding: 28px 0 0; }
.sheet {
  position: relative;
  border-top: 1px solid var(--guide-soft);
  border-bottom: 1px solid var(--guide-soft);
  background: var(--raised);
}
.sheet::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--gutter) + 18px);
  width: 1px; background: var(--guide); pointer-events: none;
}
.tester {
  display: block; width: 100%; resize: none; border: 0; margin: 0;
  padding: 24px 16px 24px calc(var(--gutter) + 44px);
  background-color: transparent;
  background-origin: content-box; background-clip: content-box;
  background-repeat: repeat-y; background-attachment: local;
  color: var(--ink);
  font-family: "Handwrit", cursive;
  font-size: var(--size, 100px);
  line-height: 1.5;
  overflow: hidden;
  caret-color: var(--ink);
}
.tester:focus-visible { outline: none; }
.sheet:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.tester.alt { font-family: "Handwrit Alt", cursive; }

.controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px;
  padding: 16px var(--gutter); font-size: 1rem;
  border-bottom: 1px solid var(--guide-soft);
}
.switch { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; padding: 2px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch label { padding: 6px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.switch input:checked + label { background: var(--ink); color: var(--paper); }
.switch input:focus-visible + label { outline: 3px solid var(--ink); outline-offset: 2px; }
.size { display: inline-flex; align-items: center; gap: 10px; }
.size input { width: 160px; accent-color: var(--ink); }
.size output { min-width: 4ch; font-variant-numeric: tabular-nums; color: var(--graphite); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
.text-button {
  font: inherit; color: var(--ink); background: none; border: 0; padding: 4px 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--guide); text-underline-offset: 0.2em; text-decoration-thickness: 2px;
}
.text-button:hover { text-decoration-color: var(--ink); }

.lede {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px;
  padding: 32px var(--gutter) 8px;
}
.lede p { margin: 0; max-width: 70ch; }
.download-button {
  display: inline-flex; align-items: baseline; gap: 10px;
  padding: 14px 26px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-weight: 700; text-decoration: none; white-space: nowrap;
}
.download-button small { font-weight: 400; opacity: 0.8; font-size: 0.9rem; }
.download-button:hover { background: var(--graphite); }

/* Sections */
.section { padding: 88px var(--gutter) 0; }
.section h2 {
  margin: 0 0 18px; max-width: 22em;
  font: 400 clamp(2rem, 4.4vw, 3.3rem)/1.15 "Handwrit", cursive;
}
#download-title { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.section > p, .section .prose p { max-width: var(--measure); margin: 0 0 1em; }
.muted { color: var(--graphite); }

/* Handwrit Alt */
.doubles { margin-top: 32px; border-top: 1px solid var(--guide); }
.doubles-name { margin: 18px 0 0; font-size: 1rem; font-weight: 700; }
.doubles-sample {
  margin: 0; padding-bottom: 18px; border-bottom: 1px solid var(--guide);
  font: 3rem/1.3 "Handwrit", cursive; white-space: nowrap;
}
.doubles-sample.alt { font-family: "Handwrit Alt", cursive; }

/* Characters */
.char-layout { margin-top: 28px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 360px); gap: 32px; align-items: start; }
.glyph-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  border-top: 1px solid var(--guide-soft); border-left: 1px solid var(--guide-soft);
}
.glyph-grid button {
  appearance: none; font: inherit; color: var(--ink); background: transparent; cursor: pointer;
  aspect-ratio: 1; border: 0; border-right: 1px solid var(--guide-soft); border-bottom: 1px solid var(--guide-soft);
  font-family: "Handwrit", cursive; font-size: 2rem; line-height: 1; padding: 0;
}
.glyph-grid button:hover { background: var(--raised); }
.glyph-grid button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.glyph-grid button.space { font: 0.7rem/1.1 var(--text); color: var(--graphite); }
.glyph-grid button.space[aria-pressed="true"] { color: var(--paper); }
.inspector { position: sticky; top: 16px; }
.inspector-sheet {
  height: 300px; display: flex; align-items: flex-start; justify-content: center; overflow: hidden;
  background-color: var(--raised); background-repeat: no-repeat;
  border: 1px solid var(--guide-soft);
  font-family: "Handwrit", cursive; font-size: 170px; line-height: 300px;
}
.inspector-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 1rem; }
.inspector-meta code { font-family: var(--text); color: var(--graphite); }

/* Download */
.download-block { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; margin-top: 32px; align-items: start; }
.download-block h3 { font-size: 1.05rem; margin: 0 0 8px; }
.file-list { list-style: none; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--guide); }
.file-list li { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--guide); }
.file-list span { color: var(--graphite); text-align: right; }
.license-list { margin: 0 0 1em; padding-left: 1.2em; }
.license-list li { margin-bottom: 0.3em; }

/* Footer */
.site-footer {
  margin-top: 104px; padding: 28px var(--gutter) 40px; border-top: 1px solid var(--guide);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; font-size: 1rem; color: var(--graphite);
}
.site-footer p { margin: 0; }
.footer-mark { font: 1.8rem/1 "Handwrit", cursive; color: var(--ink); }

@media (max-width: 600px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .tagline { text-align: left; font-size: 1.5rem; }
}

@media (max-width: 820px) {
  .char-layout, .download-block { grid-template-columns: 1fr; }
  .inspector { position: static; order: -1; }
  .inspector-sheet { height: 220px; line-height: 220px; font-size: 130px; }
  .section { padding-top: 64px; }
  .sheet::before { left: calc(var(--gutter) + 8px); }
  .tester { padding-left: calc(var(--gutter) + 24px); }
}
