/* tapdict. One small stylesheet, set like a printed dictionary: serif headings, hairlines,
   no boxes. Fonts are served from this server (no external requests). */

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url("fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url("fonts/dm-sans-latin.woff2") format("woff2");
  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: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF;
}

:root {
  --bg: #faf7f1;
  --ink: #1e1d1a;
  --muted: #5d5a54;
  --faint: #8d8981;
  --rule: #e2dccf;
  --rule-strong: #c9c1b1;
  --accent: #0d6b63;
  --accent-hover: #09524c;
  --accent-ink: #ffffff;
  --mark: #fbe08a;
  --hover: #f2ede3;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --wrap: 64rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --ink: #ebe6dc;
    --muted: #aaa49a;
    --faint: #7e7970;
    --rule: #2f2c28;
    --rule-strong: #46423b;
    --accent: #5cc4b6;
    --accent-hover: #7fd5ca;
    --accent-ink: #0e1d1b;
    --mark: #6b5718;
    --hover: #211f1c;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.2rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.45rem, 1.2rem + 0.9vw, 1.85rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.25em; }
li + li { margin-top: 0.3em; }
code, kbd { font-family: var(--mono); font-size: 0.86em; background: var(--hover); padding: 0.1em 0.3em; border-radius: 3px; }
strong { font-weight: 500; }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.narrow { width: min(100% - 2rem, 40rem); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--bg); padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font-size: 0.78rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); font-weight: 500; }

/* ---------------------------------------------------------------- header & footer */

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: baseline; gap: 1rem 2rem; justify-content: space-between; padding: 1.1rem 0; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ink); text-decoration: none; font: 700 1.3rem/1 "Bricolage Grotesque", var(--sans); letter-spacing: -0.02em; align-self: center; }
.brand:hover { color: var(--ink); }
.brand svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; gap: 0.25rem 1.5rem; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.98rem; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

.site-footer { margin-top: 6rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.93rem; }
.site-footer .wrap { padding: 2.5rem 0 3rem; display: grid; gap: 2rem; grid-template-columns: 1.6fr 1fr 1fr; }
.site-footer h2 { font: 500 0.78rem/1.4 var(--sans); letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); margin-bottom: 0.7rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.site-footer p { margin: 0 0 0.6rem; max-width: 26rem; }
.site-footer .fine { color: var(--faint); font-size: 0.85rem; }

/* ---------------------------------------------------------------- home */

.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem); }
.hero .wrap { display: grid; gap: clamp(2.5rem, 6vw, 5rem); grid-template-columns: 1.15fr 0.85fr; align-items: center; }
.hero h1 { font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4rem); line-height: 1.05; }
.hero .lead { font-size: clamp(1.1rem, 1rem + 0.4vw, 1.25rem); color: var(--muted); max-width: 32rem; }
.mark { background: linear-gradient(transparent 62%, var(--mark) 62%); }
.actions { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; margin-top: 1.75rem; }

/* The e-reader page: one word is tapped, its entry pops up. */
.reader {
  margin: 0; justify-self: center; width: 100%; max-width: 24rem; background: #fffdf8; color: #1e1d1a;
  border: 1px solid var(--rule-strong); border-radius: 18px; padding: 1.5rem 1.5rem 1.7rem;
  font: 400 1.05rem/1.85 var(--serif); box-shadow: 0 1px 0 var(--rule), 0 18px 40px -24px rgb(60 45 20 / 35%);
}
@media (prefers-color-scheme: dark) { .reader { background: #22201c; color: #e8e2d6; box-shadow: none; } }
.reader .bar { display: flex; justify-content: space-between; font: 400 0.72rem/1 var(--sans); color: var(--faint); margin-bottom: 1rem; }
.reader p { margin: 0; }
.reader .tapped { background: var(--mark); border-radius: 2px; }
.popup { margin-top: 1rem; border-top: 1px solid var(--rule-strong); padding-top: 0.8rem; font: 400 0.95rem/1.5 var(--serif); }
.popup .hw { font-weight: 700; }
.popup .pos { color: var(--faint); font-style: italic; margin-left: 0.4rem; }
.popup .forms { color: var(--faint); font-size: 0.88rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 2.75rem;
  padding: 0.55rem 1.2rem; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-ink); font: 500 1rem/1.2 var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); text-decoration: none; }
.btn-quiet { background: transparent; color: var(--accent); }
.btn-quiet:hover { background: var(--accent); color: var(--accent-ink); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn svg { width: 17px; height: 17px; flex: none; }
.more { font-weight: 500; text-decoration: none; }
.more::after { content: " →"; }
.more:hover { text-decoration: underline; }

.section { padding: clamp(2.5rem, 5vw, 3.5rem) 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); flex-basis: 100%; }

/* The list of dictionaries, set like the index of a book. */
.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.index li { margin: 0; border-bottom: 1px solid var(--rule); }
.index a {
  display: grid; grid-template-columns: 1fr auto auto; gap: 0.25rem 2rem; align-items: baseline;
  padding: 0.9rem 0.5rem; margin: 0 -0.5rem; color: var(--ink); text-decoration: none;
}
.index a:hover { background: var(--hover); }
.index .name { font: 600 1.2rem/1.3 var(--serif); }
.index .to { color: var(--faint); font-weight: 400; font-style: italic; }
.index .n, .index .v { color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.index .v { min-width: 3.5rem; text-align: right; }
.index-group + .index-group { margin-top: 2.5rem; }
.index-group h2 { font-size: 1.1rem; font-family: var(--sans); font-weight: 500; color: var(--muted); margin-bottom: 0.5rem; }
.empty { padding: 1.5rem 0; color: var(--muted); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; counter-reset: step; }
.steps li { margin: 0; border-top: 1px solid var(--rule-strong); padding-top: 1rem; }
.steps li::before { counter-increment: step; content: counter(step); display: block; font: 600 2.2rem/1 var(--serif); color: var(--accent); margin-bottom: 0.6rem; }
.steps h3 { margin-bottom: 0.3rem; }
.steps p { margin: 0; color: var(--muted); }

.split { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: 1fr 1fr; align-items: start; }
.inline-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; }
.inline-links li { margin: 0; }

/* A remark in the margin: a rule on the left, no box. */
.aside-note { border-left: 3px solid var(--mark); padding: 0.15rem 0 0.15rem 1.1rem; max-width: 44rem; }
.aside-note h2, .aside-note h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.aside-note p { margin: 0 0 0.5rem; color: var(--muted); }
.aside-note p:last-child { margin-bottom: 0; }
.aside-note.info { border-left-color: var(--accent); }

/* ---------------------------------------------------------------- dictionary page */

.crumbs { font-size: 0.88rem; color: var(--faint); margin: 1.5rem 0 1rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; margin: 0; }
.crumbs li { margin: 0; }
.crumbs li + li::before { content: "/"; margin-right: 0.35rem; color: var(--rule-strong); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.page-head { padding: 0.5rem 0 2rem; }
.page-head .lead { font-size: 1.15rem; color: var(--muted); max-width: 40rem; }
.facts { display: flex; flex-wrap: wrap; gap: 0.75rem 2.5rem; margin: 1.5rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--rule); }
.facts div { margin: 0; }
.facts dt { font-size: 0.85rem; color: var(--faint); }
.facts dd { margin: 0; font: 600 1.25rem/1.3 var(--serif); font-variant-numeric: tabular-nums; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.layout > aside { display: grid; gap: 2rem; padding-top: 0.4rem; }
.layout > aside section { border-top: 1px solid var(--rule-strong); padding-top: 0.9rem; font-size: 0.95rem; }
.layout > aside h2 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.layout > aside p { margin: 0 0 0.5rem; color: var(--muted); }
.layout > aside .aside-note { border: 0; padding: 0; }
.layout > aside ul { margin: 0; padding-left: 1.1em; color: var(--muted); }

.downloads { list-style: none; padding: 0; margin: 1rem 0 0; border-top: 1px solid var(--rule-strong); }
.downloads li { margin: 0; border-bottom: 1px solid var(--rule); }
.dl { display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 1.5rem; align-items: center; padding: 1rem 0; }
.dl h3 { margin: 0; font-size: 1.15rem; }
.dl p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.93rem; }
.dl .sub { font-size: 0.85rem; color: var(--faint); margin-top: 0.2rem; }
.dl .sub a { color: var(--muted); }
.dl .status { grid-column: 1 / -1; font-size: 0.9rem; color: var(--muted); }
.dl .status:empty { display: none; }
.dl .status.error { color: #a8321f; }
@media (prefers-color-scheme: dark) { .dl .status.error { color: #f08a78; } }

.entries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2.5rem; border-top: 1px solid var(--rule-strong); }
.entry { border-bottom: 1px solid var(--rule); padding: 0.9rem 0; font-family: var(--serif); }
.entry h3 { font-size: 1.15rem; margin: 0 0 0.15rem; }
.entry div { white-space: pre-line; color: var(--muted); font-size: 0.98rem; line-height: 1.5; overflow-wrap: anywhere; }

.figures { margin: 1rem 0 0; border-top: 1px solid var(--rule-strong); }
.figures div { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1.25rem; padding: 0.9rem 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.figures dt { font: 600 1.45rem/1 var(--serif); color: var(--accent); font-variant-numeric: tabular-nums; }
.figures dd { margin: 0; color: var(--muted); }
.figures dd b { color: var(--ink); font-weight: 500; }

.history { width: 100%; border-collapse: collapse; font-size: 0.93rem; margin-top: 0.75rem; }
.history th, .history td { text-align: left; padding: 0.55rem 1rem 0.55rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.history th { color: var(--faint); font-weight: 400; font-size: 0.85rem; border-bottom-color: var(--rule-strong); }
.history td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- online dictionary */

.lookup { display: flex; gap: 0.6rem; max-width: 34rem; margin: 1.5rem 0 0; }
.lookup input {
  flex: 1; min-width: 0; min-height: 2.75rem; padding: 0.5rem 0.8rem; border: 1px solid var(--rule-strong);
  border-radius: 6px; background: transparent; color: var(--ink); font: inherit;
}
.lookup input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.lookup input::placeholder { color: var(--faint); }

.alphabet { display: flex; flex-wrap: wrap; gap: 0.15rem 0.2rem; margin: 1.5rem 0 0; font-family: var(--serif); }
.alphabet a { min-width: 2rem; padding: 0.25rem 0.35rem; text-align: center; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.alphabet a:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.alphabet a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.word-cloud { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font: 1.08rem/1.6 var(--serif); }
.word-cloud li { margin: 0; }
.word-cloud a { text-decoration: none; }
.word-cloud a:hover { text-decoration: underline; }

.wordlist { list-style: none; padding: 0; margin: 0 0 2rem; columns: 2 20rem; column-gap: 3rem; }
.wordlist li { margin: 0; padding: 0.3rem 0; break-inside: avoid; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 0.95rem; }
.wordlist a { font: 600 1.05rem/1.4 var(--serif); text-decoration: none; margin-right: 0.35rem; }
.wordlist a:hover { text-decoration: underline; }
.pager { display: flex; gap: 1.5rem; align-items: baseline; flex-wrap: wrap; }

.word h1 { font-size: clamp(2.4rem, 1.6rem + 3vw, 3.6rem); margin-top: 0.2rem; }
.article { font: 400 1.15rem/1.6 var(--serif); max-width: 40rem; }
.article p { margin: 0 0 0.6rem; }
.article ol { padding-left: 1.4em; margin: 0.4rem 0 1rem; }
.article ol li { margin-top: 0.35rem; }
.article i { color: var(--muted); }
.article small { font-size: 0.9rem; color: var(--muted); }
.article span { color: var(--muted); }
.word h2.label { margin: 2rem 0 0.4rem; font-family: var(--sans); }
.forms-list { font: 1.05rem/1.6 var(--serif); margin: 0; }
.near ul { font-family: var(--serif); font-size: 1.05rem; }
.word .lookup { margin-top: 2.5rem; }

pre { background: var(--hover); padding: 0.9rem 1rem; border-radius: 6px; overflow-x: auto; font-size: 0.85rem; line-height: 1.5; }
pre code { background: none; padding: 0; }

/* ---------------------------------------------------------------- search */

.search { max-width: 24rem; margin-bottom: 2rem; }
.search input {
  width: 100%; min-height: 2.75rem; padding: 0.55rem 0.1rem; border: 0; border-bottom: 1px solid var(--rule-strong);
  border-radius: 0; background: transparent; color: var(--ink); font: inherit;
}
.search input:focus { outline: none; border-bottom: 2px solid var(--accent); }
.search input::placeholder { color: var(--faint); }

/* ---------------------------------------------------------------- prose (guides, about, legal) */

.prose { max-width: 42rem; }
.prose .lead { font-size: 1.15rem; color: var(--muted); }
.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 1.75rem; }
.prose ol > li, .prose ul > li { margin-top: 0.5em; }
.prose .aside-note { margin: 2rem 0; }
.prose address { font-style: normal; }
.guide-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule-strong); max-width: 42rem; }
.guide-list li { margin: 0; border-bottom: 1px solid var(--rule); padding: 0.9rem 0; }
.guide-list a { font: 600 1.2rem/1.3 var(--serif); text-decoration: none; }
.guide-list a:hover { text-decoration: underline; }
.guide-list p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }
.legal h2 { font-size: 1.3rem; }
.legal h3 { font-size: 1.1rem; }
.legal p, .legal li { font-size: 0.98rem; }
.lang-sep { margin: 3rem 0 2rem; padding-top: 2rem; border-top: 1px solid var(--rule-strong); }

details.faq { border-bottom: 1px solid var(--rule); padding: 1rem 0; }
details.faq:first-of-type { border-top: 1px solid var(--rule-strong); }
details.faq summary { cursor: pointer; font: 600 1.15rem/1.4 var(--serif); list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--faint); font: 400 1.4rem/1 var(--sans); }
details.faq[open] summary::after { content: "−"; }
details.faq div { padding-top: 0.5rem; color: var(--muted); }
details.faq div p:last-child { margin-bottom: 0; }

.spinner { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .hero .wrap, .split { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; gap: 1.5rem; }
  .entries { grid-template-columns: 1fr; }
  .site-footer .wrap { grid-template-columns: 1fr 1fr; }
  .site-footer .wrap > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  body { font-size: 1rem; }
  .index a { grid-template-columns: 1fr auto; }
  .index .n { grid-column: 1; grid-row: 2; }
  .index .v { grid-column: 2; grid-row: 1; }
  .dl { grid-template-columns: 1fr; }
  .lookup { flex-direction: column; }
  .lookup .btn { align-self: flex-start; }
  .dl .btn { justify-self: start; }
  .facts { gap: 0.75rem 1.75rem; }
  .figures div { grid-template-columns: 4.5rem 1fr; gap: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}
@media print {
  .site-header .nav, .site-footer, .actions, .downloads .btn { display: none; }
  body { background: #fff; color: #000; }
}
