@font-face {
  font-family: "Inconsolata";
  src: url("assets/fonts/inconsolata-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --font-mono: "Inconsolata", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 0.4rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.8rem;
  --tap: 44px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #000000;
  --surface: #121212;
  --surface-hi: #1f1f1f;
  --text: #fafafa;
  --text-2: #cfcfcf;
  --muted: #a3a3a3;
  --border: #6a6a6a;
  --border-strong: #7d7d7d;
  --border-soft: #2a2a2a;
  --accent: #34d399;
  --accent-soft: rgba(52, 211, 153, 0.16);
  --accent-ink: #34d399;
  --light-fill: rgba(52, 211, 153, 0.14);
  --shadow-lift: none;
}

[data-theme="light"] {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hi: #f0f0f0;
  --text: #0a0a0a;
  --text-2: #333333;
  --muted: #595959;
  --border: #8c8c8c;
  --border-strong: #7a7a7a;
  --border-soft: #e2e2e2;
  --accent: #047857;
  --accent-soft: rgba(4, 120, 87, 0.12);
  --accent-ink: #047857;
  --light-fill: rgba(4, 120, 87, 0.09);
  --shadow-lift: 0 14px 26px -16px rgba(0, 0, 0, 0.3);
}

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

html,
body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3.5rem 1rem 4rem;
  line-height: 1.55;
  transition: background-color 200ms linear, color 200ms linear;
  -webkit-font-smoothing: antialiased;
}

.preload,
.preload * {
  transition: none !important;
}

/* While the circular theme reveal runs, colours must already be final,
   otherwise the revealed side is still cross-fading underneath the wipe. */
.theme-switching,
.theme-switching *:not(.icon) {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- header / hero ---- */

.site-head {
  width: min(1000px, 100%);
  text-align: center;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.65rem;
  letter-spacing: 0.01em;
}

h1 a {
  text-decoration: none;
  color: var(--text);
  transition: opacity 150ms linear;
}

h1 a:hover {
  opacity: 0.85;
}

h1 .dot {
  color: var(--accent);
}

h1 .sub {
  color: var(--muted);
}

.tagline {
  color: var(--muted);
  margin-top: 0.35rem;
  margin-bottom: 2.25rem;
  font-size: 0.95rem;
}

/* ---- utility nav (theme + github) ---- */

.utility {
  position: fixed;
  top: 0;
  right: 0;
  display: flex;
  gap: 0.35rem;
  margin: 1.1rem 1.25rem;
  z-index: 10;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color 150ms linear, background-color 150ms linear, transform 120ms var(--ease-out);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn .icon {
  width: 20px;
  height: 20px;
}

/* theme toggle: the two icons are stacked and swap with a quarter turn */

#theme-toggle .icon {
  position: absolute;
  inset: 0;
  margin: auto;
  transition: opacity 200ms linear, transform 420ms var(--ease-out);
}

#theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

[data-theme="light"] #theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

[data-theme="light"] #theme-toggle .icon-sun {
  opacity: 1;
  transform: none;
}

/* ---- main ---- */

.container {
  width: min(1000px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.search {
  position: relative;
  width: min(480px, 100%);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--muted);
  pointer-events: none;
  transition: color 150ms linear;
}

.search:focus-within .search-icon {
  color: var(--text);
}

input[type="search"] {
  font-family: var(--font-mono);
  width: 100%;
  min-height: var(--tap);
  background-color: var(--surface);
  border: 1px solid var(--border);
  padding: 0 14px 0 44px;
  border-radius: var(--radius-lg);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  transition: border-color 150ms linear;
}

input[type="search"]::placeholder {
  color: var(--muted);
}

input[type="search"]:hover {
  border-color: var(--text-2);
}

/* keyboard hint for the "/" shortcut; only where a keyboard is likely */

.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.22rem 0.5rem;
  pointer-events: none;
  transition: opacity 150ms linear;
}

input[type="search"]:focus ~ .search-kbd,
input[type="search"]:not(:placeholder-shown) ~ .search-kbd {
  opacity: 0;
}

@media (hover: none), (pointer: coarse) {
  .search-kbd {
    display: none;
  }
}

/* ---- filters ---- */

.filters {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 660px;
  margin: 1.5rem 0 0.25rem;
}

.chip {
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 0.9rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms linear, border-color 150ms linear, background-color 150ms linear,
    transform 120ms var(--ease-out);
}

.chip:hover {
  border-color: var(--text-2);
  color: var(--text);
}

.chip:active {
  transform: scale(0.96);
}

.chip.active {
  border-color: var(--accent);
  color: var(--accent-ink);
  background-color: var(--accent-soft);
}

/* With the sliding indicator present, it carries the accent border and fill,
   so the active chip itself only keeps the accent text. */

.filters.has-indicator .chip.active {
  border-color: transparent;
  background-color: var(--surface);
}

.chip-indicator {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background-color: var(--accent-soft);
  pointer-events: none;
  transition: transform 300ms var(--ease-out), width 300ms var(--ease-out), height 300ms var(--ease-out);
}

.chip-indicator.no-anim {
  transition: none;
}

/* ---- readout / count / status ---- */

.readout {
  width: min(680px, 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  text-align: center;
}

.readout b {
  font-weight: 600;
  color: var(--text);
}

.readout .synced {
  color: var(--accent-ink);
}

.readout .stale {
  color: var(--text-2);
}

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

.status {
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
  padding: 1rem 0;
}

.status code {
  font-family: var(--font-mono);
  color: var(--text-2);
}

.loading .dots::after {
  content: "...";
  animation: dots 1.4s steps(4, end) infinite;
  clip-path: inset(0 100% 0 0);
}

@keyframes dots {
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* ---- grid / cards ---- */

.grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  text-align: left;
  margin-bottom: 1.5rem;
}

/* The card is the still box: it answers the pointer, takes focus and holds
   its place in the grid. The face inside it is what is drawn, and the only
   part that lifts or tilts. So an edge that has just moved away from the
   pointer can never drop the hover and flicker. */
.card {
  position: relative;
  display: grid;
  border-radius: var(--radius-lg);
}

.card:hover {
  z-index: 1;
}

.card-face {
  position: relative;
  isolation: isolate;
  min-width: 0;
  background-color: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: inherit;
  padding: 1.1rem 1.15rem;
  transition: border-color 150ms linear, transform 250ms var(--ease-out), box-shadow 220ms var(--ease-out);
}

.card:hover .card-face {
  border-color: var(--border);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

/* ---- card tilt ----
   app.js marks the card under the pointer and gives it an axis and an angle;
   the face is pressed down on the pointer's side. */

.card.lean:hover .card-face {
  transform: perspective(400px) translateY(-3px) rotate3d(var(--tilt-x, 0), var(--tilt-y, 0), 0, var(--tilt, 0deg));
}

/* ---- pointer light ----
   The one light on the page: it follows the pointer and marks the card under
   it as "current" (and brushes the borders of its neighbours). app.js sets
   --mx / --my per card; without them the light sits off-canvas. */

.card-face::before,
.card-face::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 260ms linear;
}

.card-face::before {
  inset: -1px;
  padding: 1px;
  background: radial-gradient(
    270px circle at var(--mx, -999px) var(--my, -999px),
    var(--accent),
    transparent 72%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  z-index: 1;
}

.card-face::after {
  inset: 0;
  background: radial-gradient(
    340px circle at var(--mx, -999px) var(--my, -999px),
    var(--light-fill),
    transparent 70%
  );
  z-index: -1;
}

.grid.lit .card-face::before,
.grid.lit .card:hover .card-face::after {
  opacity: 1;
}

/* The fill light lifts the card surface a little, so the tag outlines on the
   lit card step up one shade to stay above 3:1 against it. */
.card:hover .badge,
.card:hover .aliases > li {
  border-color: var(--border-strong);
}

/* The card the address bar points at (#slug): opened from a shared link, or
   the one whose link was just copied. Listed after :hover so it keeps the
   accent border while hovered. */
.card.is-target .card-face {
  border-color: var(--accent);
}

/* A linked card takes focus on arrival; the ring follows the card's corners. */
.card:focus-visible {
  border-radius: var(--radius-lg);
}

/* Cards a filter change removed, fading out where they stood. app.js places
   the layer before the grid, so the arriving cards paint over it. */
.leaving {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.leaving .card {
  position: absolute;
}

/* ---- theme switch: circular reveal (progressive enhancement) ---- */

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.card-term {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

/* ---- term links ----
   The term is a link to its own address. The padding (cancelled by the
   margin) grows the hit area past 44px without moving the text. */

.term-link {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.5rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: transform 120ms var(--ease-out);
}

/* inline-block keeps the hover underline off the "#" */
.term-link::after {
  content: "#";
  display: inline-block;
  margin-left: 0.4em;
  font-weight: 500;
  color: var(--muted);
  opacity: 0;
  transition: opacity 150ms linear, color 150ms linear;
}

.card:hover .term-link::after,
.term-link:focus-visible::after,
.card.is-target .term-link::after {
  opacity: 1;
}

.term-link:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.term-link:hover::after,
.card.is-target .term-link::after {
  color: var(--accent-ink);
}

.term-link:active {
  transform: scale(0.97);
}

/* no hover on touch screens, so the "#" is always there to be found */
@media (hover: none) {
  .term-link::after {
    opacity: 1;
  }
}

.badge {
  font-family: var(--font-mono);
  flex: none;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.12rem 0.5rem;
  transition: border-color 150ms linear;
}

.card-full {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  overflow-wrap: anywhere;
}

/* Each skin is shown as its own texture, with its ID and queue time below. */
.skin-top {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.skin-main {
  flex: 1;
  min-width: 0;
}

.skin-main .card-head {
  margin-bottom: 0.35rem;
}

.skin-main .card-term {
  font-size: 1.2rem;
}

.skin-main .card-full {
  margin-bottom: 0;
}

.skin-thumb {
  width: 72px;
  height: 96px;
  flex: none;
  background: var(--surface-hi);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  image-rendering: pixelated;
}

.skin-thumb-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 1.4rem;
}

.card-meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.7rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.card-meta span {
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-def {
  color: var(--muted);
  font-size: 0.98rem;
}

.aliases {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.aliases > li {
  color: var(--muted);
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.08rem 0.5rem;
  transition: border-color 150ms linear;
}

mark {
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
}

/* ---- toast (copy confirmation) ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  width: max-content;
  max-width: calc(100% - 2rem);
  padding: 0.6rem 0.9rem;
  background-color: var(--surface-hi);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  font-size: 0.9rem;
  text-align: left;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 160ms linear, transform 220ms var(--ease-out);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast strong {
  font-weight: 600;
  color: var(--text);
}

.toast span {
  font-family: var(--font-mono);
  color: var(--text-2);
  overflow-wrap: anywhere;
}

/* ---- focus ---- */

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

/* ---- footer ---- */

.site-foot {
  width: min(680px, 100%);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.site-foot a {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-foot a:hover {
  color: var(--accent-ink);
}

.foot-note {
  margin-top: 0.35rem;
  color: var(--muted);
}

.noscript {
  color: var(--text-2);
  padding: 1rem;
  text-align: center;
}

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

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

@media (max-width: 600px) {
  body {
    padding-top: 4.5rem;
  }

  h1 {
    font-size: 1.45rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .utility {
    margin: 0.75rem;
  }
}
