:root {
  --paper: #f6f0e1;
  --paper-edge: #ebe2cc;
  --ink: #1d1a16;
  --muted: #5d554a;
  --navy: #1b2c52;
  --red: #b22234;
  --rule: #cbbd9d;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.55;
  background:
    radial-gradient(ellipse at top, transparent 60%, var(--paper-edge) 100%),
    var(--paper);
}

a {
  color: var(--navy);
}

a:hover {
  color: var(--red);
}

.flagband {
  height: 14px;
  background: repeating-linear-gradient(
    to bottom,
    var(--red) 0 2px,
    #fff 2px 4px
  );
  border-bottom: 4px solid var(--navy);
}

.masthead {
  text-align: center;
  padding: 2.5rem 1.25rem 1.75rem;
  border-bottom: 3px double var(--rule);
  max-width: 46rem;
  width: 100%;
  margin: 0 auto;
}

.established {
  margin: 0;
  color: var(--red);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.masthead h1 {
  margin: 0.35rem 0 0.25rem;
  font-size: clamp(2.1rem, 7vw, 3.6rem);
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.02em;
  line-height: 1.05;
}

.masthead h1 a {
  color: var(--navy);
  text-decoration: none;
}

.tagline {
  margin: 0.5rem 0 0;
  font-style: italic;
  color: var(--muted);
  font-size: 1.15rem;
}

main {
  flex: 1;
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.search {
  display: flex;
  gap: 0.5rem;
}

.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fffdf7;
  color: var(--ink);
}

.search input:focus-visible,
.search button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.search button {
  font: inherit;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 2px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
}

.search button:hover {
  background: var(--red);
}

.count {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.count a {
  margin-left: 0.5rem;
}

.letter h2 {
  margin: 2rem 0 0.25rem;
  color: var(--red);
  font-size: 1.6rem;
  border-bottom: 1px solid var(--rule);
}

.entry {
  padding: 1rem 0;
}

.letter .entry + .entry {
  border-top: 1px dotted var(--rule);
}

.word {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

h1.word {
  font-size: clamp(2rem, 6vw, 2.8rem);
  margin-top: 0.5rem;
}

.word a {
  color: var(--ink);
  text-decoration: none;
}

.word a:hover {
  color: var(--red);
}

.pos {
  margin-left: 0.4rem;
  font-size: 1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
}

.definition {
  margin: 0.25rem 0 0;
  font-size: 1.2rem;
  white-space: pre-line;
}

h1.word + .definition {
  font-size: 1.5rem;
}

.example {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-style: italic;
}

.empty {
  margin: 2.5rem 0;
  text-align: center;
  font-style: italic;
  color: var(--muted);
}

.back {
  margin-top: 2rem;
}

footer {
  text-align: center;
  padding: 1.25rem;
  border-top: 3px double var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
  font-variant: small-caps;
  letter-spacing: 0.08em;
}

footer p {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
