/* Dark slate by default to match the apps themselves; light when the OS asks. */
:root {
  color-scheme: dark light;
  --bg: #0f172a;
  --card: #1e293b;
  --card-hover: #243249;
  --border: #334155;
  --border-hover: #475569;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --chip-bg: #0f172a;
  --notice-bg: rgba(251, 191, 36, 0.14);
  --notice-text: #fbbf24;
  --notice-border: rgba(251, 191, 36, 0.35);
  --tip-bg: #f1f5f9;
  --tip-text: #0f172a;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --card: #ffffff;
    --card-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --text: #0f172a;
    --muted: #475569;
    --accent: #0284c7;
    --chip-bg: #f1f5f9;
    --notice-bg: #fef3c7;
    --notice-text: #92400e;
    --notice-border: #fcd34d;
    --tip-bg: #0f172a;
    --tip-text: #f1f5f9;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
}

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

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 48px 16px 32px;
}

header {
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 36px;
  height: 36px;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.lede {
  margin: 12px 0 0;
  max-width: 56ch;
  color: var(--muted);
}

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background-color 0.15s, border-color 0.15s;
}

.card:hover {
  background: var(--card-hover);
  border-color: var(--border-hover);
}

.card:focus-within:has(.card-link:focus-visible) {
  border-color: var(--accent);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  /* A hairline ring so light icons (the QR one) keep their edge on light cards. */
  box-shadow: 0 0 0 1px var(--border);
}

.icon img {
  display: block;
  width: 100%;
  height: 100%;
}

.title {
  min-width: 0;
}

h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

/* The whole card is the link: the anchor's ::after covers it. Badges sit above. */
.card-link {
  text-decoration: none;
}

.card-link:focus-visible {
  outline: none;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.host {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}

.tagline {
  margin: 0;
  flex: 1;
  font-size: 14.5px;
  color: var(--muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}

.chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  line-height: 18px;
  text-decoration: none;
}

.chip svg {
  width: 13px;
  height: 13px;
  flex: none;
}

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

.notice {
  cursor: help;
  border-color: var(--notice-border);
  background: var(--notice-bg);
  color: var(--notice-text);
}

.notice-wrap {
  position: relative;
  z-index: 2;
}

.tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: max-content;
  max-width: min(260px, calc(100vw - 48px));
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--tip-bg);
  color: var(--tip-text);
  font-size: 13px;
  line-height: 1.45;
  visibility: hidden;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s, transform 0.12s, visibility 0.12s;
  pointer-events: none;
}

.notice-wrap:hover .tip,
.notice:focus-visible + .tip,
.notice[aria-expanded="true"] + .tip {
  visibility: visible;
  opacity: 1;
  transform: none;
}

footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13.5px;
}

footer a {
  color: var(--muted);
}

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

.not-found {
  padding: 64px 0;
}

.not-found a {
  color: var(--accent);
}

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