:root {
  --bg: #fcfcfb;
  --text: #171717;
  --muted: #8a8a87;
  --line: rgb(0 0 0 / 0.07);
  --hover: rgb(0 0 0 / 0.025);
  --focus: rgb(0 0 0 / 0.35);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0e;
    --text: #ededec;
    --muted: #7c7c79;
    --line: rgb(255 255 255 / 0.08);
    --hover: rgb(255 255 255 / 0.03);
    --focus: rgb(255 255 255 / 0.4);
  }
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(56px, 12vw, 120px) 24px 64px;
}

header {
  margin-bottom: 48px;
}

h1 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
}

header p {
  max-width: 46ch;
  margin: 0;
  color: var(--muted);
  text-wrap: pretty;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 12px;
}

.controls[hidden] {
  display: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: color 150ms ease;
}

button:hover,
button[aria-pressed="true"] {
  color: var(--text);
}

sup {
  margin-left: 2px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  vertical-align: 5px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-toggle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
}

.search-toggle:hover,
.search-toggle[aria-expanded="true"] {
  color: var(--text);
}

.search-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.search input {
  width: 180px;
  max-width: 60vw;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 150ms ease;
  -webkit-appearance: none;
}

.search input::placeholder {
  color: var(--muted);
}

.search input:focus {
  border-bottom-color: var(--focus);
}

.search input[hidden] {
  display: none;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
}

.list li {
  border-top: 1px solid var(--line);
}

.list li[hidden] {
  display: none;
}

.list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 180px 12px;
  align-items: center;
  gap: 16px;
  margin: 0 -10px;
  padding: 11px 10px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.list a:hover {
  background: var(--hover);
}

.list a:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: -1px;
}

.name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.favicon {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.icon.fallback .favicon {
  visibility: hidden;
}

.icon.fallback::before {
  content: attr(data-letter);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
}

.meta,
.domain {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain {
  font-size: 13px;
}

.arrow {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity 150ms ease, transform 200ms cubic-bezier(0.2, 0, 0, 1);
}

.list a:hover .arrow,
.list a:focus-visible .arrow {
  opacity: 1;
  transform: none;
}

.empty {
  margin: 24px 0 0;
  color: var(--muted);
}

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 40px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.to-top {
  color: var(--muted);
  text-decoration: none;
}

.to-top:hover,
.to-top:focus-visible {
  color: var(--text);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

footer a:hover {
  color: var(--text);
}

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

@media (max-width: 640px) {
  .filters {
    column-gap: 14px;
  }

  .list a {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .domain,
  .arrow {
    display: none;
  }

}

.hover-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 420px;
  height: 262px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.16);
  pointer-events: none;
}

.hover-preview[hidden],
.hover-preview iframe[hidden],
.hover-preview img[hidden] {
  display: none;
}

.hover-preview iframe {
  width: 1280px;
  height: 800px;
  border: 0;
  transform: scale(0.328125);
  transform-origin: 0 0;
}

.hover-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

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

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