@font-face {
  font-family: "Brygada";
  src: url("/fonts/brygada-1918-normal-400-700.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Brygada";
  src: url("/fonts/brygada-1918-italic-400-700.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("/fonts/courier-prime-normal-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("/fonts/courier-prime-normal-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #f3eee3;
  --paper-deep: #ebe3d1;
  --ink: #1c1a16;
  --ink-soft: #57513f;
  --rule: #cdc1a8;
  --grid: rgba(28, 26, 22, 0.045);
  --stain: #a3263f;
  --stain-wash: rgba(163, 38, 63, 0.08);
  --serif: "Brygada", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "Courier Prime", "Courier New", Courier, monospace;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .11 0 0 0 0 .10 0 0 0 0 .08 0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 180px 180px, 28px 28px, 28px 28px;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--stain);
  color: var(--paper);
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--stain);
  outline-offset: 3px;
}

.sheet {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 44px) 16px 72px;
}

/* Running head, like the top line of a catalogue page */
.masthead {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--ink);
  font: 700 0.75rem/1.2 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  animation: rise 0.6s ease-out both;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
  margin-top: clamp(40px, 9vw, 112px);
}

/* The dictionary entry */
.entry {
  position: relative;
  container-type: inline-size;
  padding-top: 8px;
}

.headword {
  --chars: 18;
  margin: 0;
  font-weight: 500;
  font-size: clamp(1.45rem, 4.6vw, 3.6rem);
  font-size: clamp(1.45rem, calc(100cqw / (var(--chars) * 0.56)), 5.4rem);
  line-height: 1;
  letter-spacing: -0.015em;
  white-space: nowrap;
  animation: rise 0.7s 0.08s ease-out both;
}

.headword .tld {
  font-style: italic;
  font-weight: 400;
  color: var(--ink-soft);
}

.sense {
  margin: 1.4rem 0 0;
  padding: 0.9rem 0 0;
  max-width: 34rem;
  border-top: 1px solid var(--rule);
  font-size: 1.125rem;
  line-height: 1.5;
  animation: rise 0.7s 0.18s ease-out both;
}

.sense .word {
  font-style: italic;
  font-weight: 700;
}

.sense .kind {
  margin: 0 0.35em 0 0.3em;
  font: 400 0.82rem/1 var(--mono);
  letter-spacing: 0.08em;
  color: var(--stain);
}

.sense .def::before {
  content: "\2014\00a0";
  color: var(--ink-soft);
}

.lede {
  margin: 1.6rem 0 0;
  max-width: 30rem;
  color: var(--ink-soft);
  animation: rise 0.7s 0.26s ease-out both;
}

/* Rubber stamp */
.stamp {
  position: absolute;
  top: -2.1rem;
  right: 0;
  padding: 0.35em 0.7em 0.3em;
  border: 3px double var(--stain);
  border-radius: 4px;
  color: var(--stain);
  font: 700 0.95rem/1 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transform: rotate(-7deg);
  mix-blend-mode: multiply;
  opacity: 0.88;
  animation: stamp 0.45s 0.75s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

/* The inquiry slip */
.slip {
  position: relative;
  padding: 28px clamp(20px, 3vw, 32px) 24px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgba(28, 26, 22, 0.06), 0 18px 40px -28px rgba(28, 26, 22, 0.45);
  animation: rise 0.7s 0.34s ease-out both;
}

/* Perforated top edge */
.slip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 12px;
  background: radial-gradient(circle at 6px 6px, var(--paper) 3.2px, transparent 3.6px) 0 0 / 14px 12px repeat-x;
}

.slip-title,
.more-title {
  margin: 0 0 18px;
  font: 700 0.78rem/1.2 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field span {
  display: block;
  margin-bottom: 4px;
  font: 400 0.78rem/1.3 var(--mono);
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 400 1.0625rem/1.4 var(--serif);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #8a826f;
  font-style: italic;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--stain);
  background: var(--stain-wash);
}

.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

button {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  border: 0;
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  font: 700 0.9rem/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

button:hover {
  background: var(--stain);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.status {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-size: 1rem;
}

.status.is-error {
  color: var(--stain);
}

.status.is-sent {
  padding: 10px 12px;
  border-left: 3px solid var(--stain);
  background: var(--stain-wash);
}

.fine {
  margin: 10px 0 0;
  font: 400 0.78rem/1.4 var(--mono);
  color: var(--ink-soft);
}

/* Other names, as specimen tags */
.more {
  margin-top: clamp(56px, 9vw, 104px);
  padding-top: 18px;
  border-top: 1.5px solid var(--ink);
}

.more ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.more a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px 8px 30px;
  border: 1px solid var(--rule);
  background: rgba(255, 252, 245, 0.55);
  font: 400 0.92rem/1.2 var(--mono);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.more a::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 50%;
}

.more a:hover {
  border-color: var(--stain);
  color: var(--stain);
}

.more a:hover::before {
  border-color: var(--stain);
}

/* Confirmation page for browsers without JavaScript */
.notice {
  max-width: 34rem;
  margin: clamp(40px, 10vw, 120px) auto 0;
}

.notice h1 {
  margin: 0 0 12px;
  font-weight: 500;
  font-size: 2.2rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(-16deg) scale(1.7);
  }
  to {
    opacity: 0.88;
    transform: rotate(-7deg) scale(1);
  }
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .stamp {
    top: -1.6rem;
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
