/* Base look modelled on affnav: a dense grid of compact Cards on a soft background,
   with a Visit button that stands out by colour and contrast rather than size. */

:root {
  --bg: #f1f3f6;
  --surface: #ffffff;
  --border: #e3e6eb;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #2563eb;
  --visit-bg: #c2410c;
  --visit-bg-hover: #9a3412;
  --visit-text: #ffffff;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1d2128;
    --border: #2b313a;
    --text: #e6e8ec;
    --muted: #9aa3af;
    --accent: #60a5fa;
    --visit-bg: #ff6a33;
    --visit-bg-hover: #ff824f;
    --visit-text: #14171c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
}

.site-header .search-form { margin-left: auto; flex: 0 1 360px; }

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

.search-form { display: flex; min-width: 0; }

.search-form input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.search-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.search-form button {
  padding: 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.search-page h1 { margin: 0 0 12px; font-size: 20px; }
.search-page .search-form { max-width: 520px; margin-bottom: 16px; }
.empty a { color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); margin-top: 40px; color: var(--muted); font-size: 13px; }
.site-footer .wrap { display: flex; gap: 16px; justify-content: space-between; padding-top: 18px; padding-bottom: 24px; }
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.form-page { max-width: 620px; margin: 0 auto 20px; }
.form-page h1 { margin: 0 0 8px; font-size: 22px; }
.form-page .lead { color: var(--muted); margin: 0 0 18px; line-height: 1.6; }
.form-page .lead a { color: var(--accent); }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field input, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: #b91c1c; font-size: 13px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.button {
  padding: 9px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.site-name {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

.category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  margin-bottom: 20px;
}

.category h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.category h2 a { color: inherit; text-decoration: none; }
.category h2 a:hover { color: var(--accent); }

.more { margin: 10px 0 0; font-size: 12px; }
.more a, .breadcrumb a { color: var(--accent); text-decoration: none; }
.more a:hover, .breadcrumb a:hover { text-decoration: underline; }

.breadcrumb { margin: 0 0 10px; font-size: 13px; }

.category-header h1 { margin: 0 0 8px; font-size: 22px; }
.category-header .intro { color: var(--muted); max-width: 760px; margin-bottom: 14px; }
.category-header .intro p { margin: 0 0 8px; line-height: 1.6; }

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}

.card { position: relative; }

.card-link {
  color: inherit;
  text-decoration: none;
}

/* The whole Card opens the Listing page; Visit sits above this layer. */
.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.card .visit { position: relative; z-index: 1; }

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

.logo {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
}

.logo-placeholder {
  display: grid;
  place-items: center;
  background: var(--border);
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgb(0 0 0 / .06);
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.visit {
  flex: none;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--visit-bg);
  color: var(--visit-text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.visit:hover { background: var(--visit-bg-hover); }

.visit:focus-visible,
.site-name:focus-visible,
.category-menu a:focus-visible,
.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.empty { color: var(--muted); }

.category-menu {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0;
  margin: -8px 0 12px;
}

.category-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.category-menu a {
  display: block;
  white-space: nowrap;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.category-menu a:hover { border-color: var(--accent); color: var(--accent); }

.category { scroll-margin-top: 56px; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: -4px 0 12px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 6px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.tab:hover { color: var(--text); }

.tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-panel:focus-visible { outline: none; }

.listing {
  max-width: 760px;
  margin: 0 auto 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px 24px;
}

.draft-banner {
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #fef3c7;
  color: #78350f;
}

.discontinued-notice {
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--border);
}

.similar { max-width: 760px; margin: 0 auto 40px; }

.listing-categories {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.listing-categories li,
.listing-categories a {
  color: var(--muted);
  text-decoration: none;
}

.listing-categories li {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.listing-categories a:hover { color: var(--accent); }

.listing-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.listing-header .logo { width: 64px; height: 64px; border-radius: 12px; font-size: 26px; }
.listing-title { flex: 1; min-width: 0; }
.listing-title h1 { margin: 0; font-size: 24px; }
.listing-title .tagline { font-size: 14px; -webkit-line-clamp: unset; }
.listing-header .visit { padding: 8px 18px; font-size: 14px; }

.write-up h2 { margin: 22px 0 6px; font-size: 16px; }
.write-up p { margin: 0 0 8px; line-height: 1.6; }
.write-up ul { margin: 0; padding-left: 20px; line-height: 1.7; }

.listing-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.listing-facts dt { color: var(--muted); font-size: 12px; }
.listing-facts dd { margin: 2px 0 0; font-weight: 600; }

@media (prefers-color-scheme: dark) {
  .draft-banner { background: #422006; color: #fde68a; }
}

@media (max-width: 480px) {
  .site-header .wrap { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; gap: 8px; }
  .site-header .search-form { flex-basis: 100%; }
  .listing { padding: 16px; }
  .listing-header { flex-wrap: wrap; }
  .listing-header .visit { width: 100%; text-align: center; }
  .category { padding: 12px; }
  .cards {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }
  .card { flex-direction: column; align-items: stretch; }
  .visit { align-self: flex-start; }
}
