:root {
  color-scheme: dark;
  --black: #000;
  --white: #fff;
  --muted: #a0a0a0;
  --line: #3a3a3a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: Arial, Helvetica, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
a { color: inherit; }

.site-header,
main,
footer {
  width: min(1500px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--white);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  color: var(--white);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -1.4px;
  text-decoration: none;
}

.wordmark i { font-style: normal; }
nav { display: flex; align-items: center; gap: 24px; }
nav span {
  color: var(--muted);
  font: 11px ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.surprise {
  padding: 9px 13px;
  border: 1px solid var(--white);
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  cursor: pointer;
}
.surprise:hover { background: var(--white); color: var(--black); }

.browse { padding: 68px 0 100px; }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
  margin-bottom: 38px;
}
h1 {
  margin: 0 0 10px;
  font-size: clamp(42px, 6.5vw, 90px);
  line-height: .95;
  letter-spacing: -.065em;
}
.section-heading > div > p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}
#result-count {
  margin: 0 0 4px;
  color: var(--muted);
  font: 11px ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
  white-space: nowrap;
}

.controls { margin-bottom: 32px; }
.search-box {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 17px;
  border: 1px solid var(--white);
  border-radius: 12px;
  background: var(--black);
}
.search-icon {
  width: 16px;
  height: 16px;
  position: relative;
  border: 1.5px solid var(--white);
  border-radius: 50%;
}
.search-icon::after {
  content: "";
  width: 6px;
  height: 1.5px;
  position: absolute;
  right: -5px;
  bottom: -2px;
  background: var(--white);
  transform: rotate(45deg);
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--white);
  font-size: 16px;
}
.search-box input::placeholder { color: #777; }
kbd {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font: 11px ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}
.filters button {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.filters button:hover { border-color: var(--white); }
.filters button.active { border-color: var(--white); background: var(--white); color: var(--black); }

.directory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--white);
  border-left: 1px solid var(--white);
}

.loading-state,
.javascript-required {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 1px solid var(--white);
  text-align: left;
}
.no-js .loading-state { display: none; }
.loading-state > div,
.javascript-required {
  font-size: 13px;
}
.loading-state strong,
.loading-state div span,
.javascript-required strong,
.javascript-required span {
  display: block;
}
.loading-state strong,
.javascript-required strong {
  margin-bottom: 7px;
  font-size: 14px;
}
.loading-state div span,
.javascript-required span { color: var(--muted); }
.loader {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: loading-spin .7s linear infinite;
}
.javascript-required {
  min-height: 280px;
  flex-direction: column;
  gap: 0;
  padding: 30px;
  text-align: center;
}
.javascript-required strong {
  direction: rtl;
  font-size: clamp(20px, 3vw, 34px);
  line-height: 1.5;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }

.dictionary-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-right: 1px solid var(--white);
  border-bottom: 1px solid var(--white);
  background: var(--black);
  color: var(--white);
  text-decoration: none;
  transition: background .14s ease, color .14s ease;
}
.dictionary-card:hover { background: var(--white); color: var(--black); }
.dictionary-card:focus-visible { outline: 3px solid var(--white); outline-offset: -7px; }
.card-top { display: flex; justify-content: space-between; align-items: start; }
.card-number {
  color: var(--muted);
  font: 10px ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.arrow { font-size: 20px; transition: transform .15s ease; }
.dictionary-card:hover .arrow { transform: translate(3px, -3px); }
.dictionary-card h3 {
  margin: 28px 0 10px;
  font-size: 23px;
  line-height: 1.05;
  letter-spacing: -.035em;
}
.dictionary-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.dictionary-card:hover p,
.dictionary-card:hover .card-number,
.dictionary-card:hover .card-meta { color: #333; }
.card-bottom { margin-top: auto; display: flex; justify-content: space-between; align-items: end; gap: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font: 8px ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.card-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font: 9px ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-align: right;
}

.empty-state {
  padding: 80px 20px;
  border: 1px solid var(--white);
  text-align: center;
}
.empty-state span { font-size: 34px; }
.empty-state h3 { margin: 15px 0 8px; font-size: 28px; }
.empty-state p { color: var(--muted); }
.empty-state button {
  padding: 9px 14px;
  border: 1px solid var(--white);
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  cursor: pointer;
}

footer {
  min-height: 110px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  border-top: 1px solid var(--white);
  font-size: 11px;
}
footer p { margin: 0; color: var(--muted); text-align: center; }
.footer-mark { justify-self: start; }
.updated { justify-self: end; text-transform: uppercase; letter-spacing: .08em; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 950px) {
  .directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .site-header, main, footer { width: calc(100% - 28px); }
  .site-header { height: 64px; }
  nav span { display: none; }
  .surprise { padding: 7px 10px; font-size: 10px; }
  .browse { padding: 45px 0 75px; }
  .section-heading { display: block; margin-bottom: 28px; }
  h1 { font-size: 48px; }
  .section-heading > div > p { max-width: 330px; font-size: 13px; line-height: 1.45; }
  #result-count { margin-top: 20px; }
  kbd { display: none; }
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: -14px;
    padding: 0 14px 5px;
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: 0 0 auto; }
  .directory-grid { grid-template-columns: 1fr; }
  .dictionary-card { min-height: 230px; }
  footer { grid-template-columns: 1fr 1fr; padding: 28px 0; }
  footer > p:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
