:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --border: #e5e3df;
  --text: #1c1b1a;
  --text-muted: #6b6864;
  --accent: #2f6f4f;
  --accent-contrast: #ffffff;
  --badge-bg: #f0efec;
  --badge-free-bg: #e5f3ea;
  --badge-free-text: #1f6b40;
  --row-alt: #f7f6f4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --surface: #1f2023;
    --border: #303236;
    --text: #ecebe8;
    --text-muted: #a0a0a0;
    --accent: #5ec488;
    --accent-contrast: #0c1210;
    --badge-bg: #2a2b2f;
    --badge-free-bg: #133823;
    --badge-free-text: #7bd6a4;
    --row-alt: #1b1c1f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 1.75rem;
  margin: 1.5rem 0 0.5rem;
}

.lede,
.directory-lede {
  color: var(--text-muted);
  max-width: 60ch;
}

/* Navbar */

.navbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.navbar-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.9rem 24px;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  flex-shrink: 0;
}

.navbar-brand:hover {
  text-decoration: none;
}

.navbar-brand-icon {
  width: 30px;
  height: 30px;
  color: var(--accent);
  flex-shrink: 0;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.9rem;
}

.navbar-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.navbar-nav a svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.navbar-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.navbar-nav a.is-active {
  color: var(--text);
  font-weight: 600;
}

/* Navbar mobile menu toggle */

.navbar-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  flex-shrink: 0;
  cursor: pointer;
}

.navbar-menu-toggle svg {
  width: 20px;
  height: 20px;
}

/* Navbar search */

.navbar-search {
  position: relative;
  margin-left: auto;
  width: 100%;
  max-width: 260px;
}

.navbar-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.navbar-search-input {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem 0.45rem 2.35rem;
}

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

.navbar-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.navbar-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.navbar-search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 48px);
  max-height: 60vh;
  overflow-y: auto;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.navbar-search-result {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  color: var(--text);
}

.navbar-search-result:hover,
.navbar-search-result.is-selected {
  background: var(--row-alt);
  text-decoration: none;
}

.navbar-search-result-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
}

.navbar-search-result-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.navbar-search-empty {
  padding: 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .navbar-inner {
    flex-wrap: wrap;
  }

  .navbar-search {
    order: 3;
    max-width: none;
    margin-left: 0;
  }

  .navbar-search-results {
    left: 0;
    right: 0;
    width: auto;
  }
}

@media (max-width: 640px) {
  .navbar-menu-toggle {
    display: inline-flex;
    order: 1;
  }

  .navbar-nav {
    display: none;
    order: 4;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
  }

  .navbar-nav.is-open {
    display: flex;
  }

  .navbar-nav a {
    padding: 0.6rem 0.25rem;
  }

  .navbar-nav a svg {
    width: 20px;
    height: 20px;
  }
}

/* Page body: content + right sidebar, between navbar and footer */

.page-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}

.content {
  min-width: 0;
}

.content-inner {
  padding: 1.5rem 24px 3rem;
}

/* Sidebar */

.sidebar {
  position: sticky;
  top: 1.5rem;
  border-left: 1px solid var(--border);
  padding: 1.5rem 24px 1.5rem 1.5rem;
}

.sidebar-heading {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 0.6rem;
  margin-bottom: 0.5rem;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sidebar-link-icon {
  display: inline-flex;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.sidebar-link-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-link:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--row-alt);
}

.sidebar-link.is-current {
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  background: var(--badge-free-bg);
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 24px 2rem;
}

.footer-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
}

.footer-brand-link:hover {
  text-decoration: none;
}

.footer-brand-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.footer-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.footer-description {
  margin: 0.7rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 38ch;
}

.footer-heading {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-col a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.footer-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.1rem 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-bottom p {
  margin: 0;
  max-width: 60ch;
}

.footer-top-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  color: var(--text-muted);
  white-space: nowrap;
}

.footer-top-link:hover {
  color: var(--accent);
  text-decoration: none;
}

@media (max-width: 760px) {
  .page-body {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sidebar {
    position: static;
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 1.25rem 24px 2rem;
  }

  .sidebar-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .sidebar-link {
    border-left: none;
    border-radius: 999px;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    padding: 2.25rem 20px 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* Directory tabs */

.directory-tabs {
  margin: 1.25rem 0;
}

.tab-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-bottom: none;
  transform: translateY(1px);
}

.tab-link-icon {
  display: inline-flex;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.tab-link-icon svg {
  width: 100%;
  height: 100%;
}

.tab-link:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--row-alt);
}

.tab-link.is-active {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--border);
}

.tab-more {
  position: relative;
}

.tab-more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  transform: translateY(1px);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-more-toggle:hover {
  color: var(--text);
  background: var(--row-alt);
}

.tab-more-toggle.is-active {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--border);
}

.tab-more-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.tab-more-ellipsis {
  display: block;
}

.tab-more-toggle[aria-expanded="true"] .tab-more-chevron {
  transform: rotate(180deg);
}

.tab-more-menu {
  position: absolute;
  z-index: 15;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 180px;
  margin: 0;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.tab-more-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}

.tab-more-item:hover {
  background: var(--row-alt);
  text-decoration: none;
}

.tab-more-item.is-active {
  color: var(--accent);
  font-weight: 600;
  background: var(--badge-free-bg);
}

.tab-panel {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 0.25rem;
  background: var(--surface);
}

.tab-panel .table-wrap {
  margin: 0;
  border: none;
  border-radius: 0 0 8px 8px;
  box-shadow: none;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem 0.75rem;
}

.table-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.table-search-icon {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.table-search-input {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.9rem 0.55rem 2.5rem;
}

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

.table-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.table-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.table-filter {
  position: relative;
  flex-shrink: 0;
}

.table-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.table-filter-toggle:hover {
  border-color: var(--accent);
}

.table-filter-toggle.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--badge-free-bg);
}

.table-filter-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.filter-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.45);
}

.filter-modal-backdrop[hidden] {
  display: none;
}

body.filter-modal-open {
  overflow: hidden;
}

.filter-modal {
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25);
}

.filter-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.filter-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.filter-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.filter-modal-close svg {
  width: 16px;
  height: 16px;
}

.filter-modal-close:hover {
  color: var(--text);
  background: var(--row-alt);
}

.filter-modal-body {
  padding: 1.1rem;
}

.filter-modal-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  border-top: 1px solid var(--border);
}

.filter-group + .filter-group {
  margin-top: 0.9rem;
}

.filter-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-select {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.filter-option input {
  accent-color: var(--accent);
}

.filter-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-range-sep {
  color: var(--text-muted);
  flex-shrink: 0;
}

.filter-input {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.filter-reset {
  flex: 1 1 auto;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.filter-reset:hover {
  color: var(--text);
  background: var(--row-alt);
}

.filter-apply {
  flex: 1 1 auto;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
}

.filter-apply:hover {
  opacity: 0.92;
}

.table-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.9rem 0.5rem 0.6rem;
}

.pagination-pages {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.pagination-link:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--row-alt);
}

.pagination-link.is-active {
  color: var(--accent);
  background: var(--badge-free-bg);
}

.pagination-link.is-disabled {
  color: var(--text-muted);
  opacity: 0.4;
}

@media (max-width: 640px) {
  .tab-list {
    gap: 0.2rem;
  }

  .tab-link,
  .tab-more-toggle {
    padding: 0.5rem 0.7rem;
    font-size: 0.86rem;
  }
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.92rem;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

thead th:hover {
  color: var(--accent);
}

.th-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-right: 0.35rem;
  vertical-align: -2px;
  color: var(--text-muted);
}

thead th:hover .th-icon {
  color: var(--accent);
}

thead th[aria-sort="ascending"]::after {
  content: " \2191";
}

thead th[aria-sort="descending"]::after {
  content: " \2193";
}

tbody td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:nth-child(even) {
  background: var(--row-alt);
}

.directory-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 600;
}

.favicon {
  border-radius: 3px;
  flex-shrink: 0;
}

.directory-name-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.directory-name-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.visit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--text-muted);
}

.visit-link:hover {
  color: var(--accent);
  background: var(--row-alt);
}

.visit-link-icon {
  width: 15px;
  height: 15px;
}

/* Badges */

.badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  margin: 0 0.25rem 0.25rem 0;
}

a.badge:hover {
  text-decoration: none;
  outline: 1px solid var(--accent);
}

.badge-category {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.badge-icon {
  display: inline-flex;
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  color: var(--accent);
}

.badge-icon svg {
  width: 100%;
  height: 100%;
}

.badge-free {
  background: var(--badge-free-bg);
  color: var(--badge-free-text);
  font-weight: 600;
}

.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;
}

/* Save toggle (bookmark a directory in this browser -- see js/saved-directories.js) */

.save-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
}

.save-toggle:hover {
  color: var(--accent);
  background: var(--row-alt);
}

.save-toggle-icon {
  width: 16px;
  height: 16px;
  fill: none;
}

.save-toggle.is-saved {
  color: var(--accent);
}

.save-toggle.is-saved .save-toggle-icon {
  fill: currentColor;
}

.saved-count-badge {
  font-size: 0.85em;
  color: var(--text-muted);
  font-weight: 400;
}

.navbar-nav a.is-active .saved-count-badge {
  color: inherit;
}

/* Category list (one row per category) */

.category-list {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
}

.category-row-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text);
  flex: 1 1 300px;
  min-width: 0;
}

.category-row-link:hover {
  text-decoration: none;
}

.category-row-link:hover h2 {
  text-decoration: underline;
}

.category-row-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--badge-bg);
  color: var(--accent);
}

.category-row-icon svg {
  width: 24px;
  height: 24px;
}

.category-row-info {
  min-width: 0;
}

.category-row-info h2 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
}

.category-row-info p {
  margin: 0 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.category-count {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
}

.category-row-directories {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  flex: 1 1 260px;
}

.category-directory-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--row-alt);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.category-directory-icon:hover {
  border-color: var(--accent);
}

.category-directory-icon .favicon {
  width: 20px;
  height: 20px;
}

/* Directory single page */

.directory-hero {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem;
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.directory-hero-logo {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--badge-bg);
  border: 1px solid var(--border);
}

.directory-hero-logo .favicon {
  border-radius: 8px;
}

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

.directory-hero-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.directory-hero-title-row h1 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.directory-hero-title-row .save-toggle {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}

.directory-hero-title-row .save-toggle-icon {
  width: 26px;
  height: 26px;
}

.directory-hero-visit {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.social-link svg {
  width: 14px;
  height: 14px;
}

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
}

.btn-primary:hover {
  opacity: 0.9;
  text-decoration: none;
  color: var(--accent-contrast);
}

.directory-hero-submit {
  margin-top: 0.9rem;
}

.founder-x-link {
  display: inline-flex;
  color: var(--text-muted);
  margin-left: 0.3rem;
  vertical-align: middle;
}

.founder-x-link:hover {
  color: var(--accent);
}

.founder-x-link svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 480px) {
  .directory-hero {
    flex-direction: column;
  }

  .directory-hero-logo {
    width: 64px;
    height: 64px;
  }
}

.directory-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0;
}

.badge-dr {
  color: var(--text-muted);
}

.directory-hero .directory-lede {
  margin: 0.35rem 0 0;
  max-width: 65ch;
}

/* Category single page */

.category-page-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.category-page-header h1 {
  margin: 0;
}

.category-page-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--badge-bg);
  color: var(--accent);
}

.category-page-icon svg {
  width: 20px;
  height: 20px;
}

.fact-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1.25rem 0;
}

.fact-list div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fact-list dt {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.fact-icon-svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.directory-plans h2,
.directory-alternatives h2 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.section-icon {
  display: inline-flex;
  color: var(--accent);
}

.section-icon .fact-icon-svg {
  width: 19px;
  height: 19px;
}

.fact-list dd {
  margin: 0;
}

.fact-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.history-chart {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
  color: var(--accent);
}

.history-chart-svg {
  display: block;
  width: 100%;
  max-width: 168px;
  height: 40px;
}

.history-chart-line {
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.history-chart-svg.is-down {
  color: #c0392b;
}

@media (prefers-color-scheme: dark) {
  .history-chart-svg.is-down {
    color: #e5766a;
  }
}

.history-chart-delta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}

.history-chart-delta.is-down {
  color: #c0392b;
}

.history-chart-delta.is-flat {
  color: var(--text-muted);
  font-weight: 500;
}

@media (prefers-color-scheme: dark) {
  .history-chart-delta.is-down {
    color: #e5766a;
  }
}

.directory-plans {
  margin: 2rem 0;
}

.directory-plans h2,
.directory-alternatives h2 {
  font-size: 1.15rem;
  margin: 0 0 0.85rem;
}

.plan-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.plan-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.1rem;
}

.plan-card.is-featured {
  border-color: var(--accent);
  border-width: 2px;
  padding: calc(1.25rem - 1px) calc(1.1rem - 1px);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 18%, transparent);
}

.plan-card-badge {
  position: absolute;
  top: -0.6rem;
  right: 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.plan-card-name {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.plan-card-price {
  margin: 0 0 0.5rem;
}

.plan-card-price-amount {
  font-size: 1.5rem;
  font-weight: 700;
}

.plan-card-price-period {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.plan-card-desc {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.plan-card-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.88rem;
}

.plan-card-features li {
  padding-left: 1.3rem;
  position: relative;
}

.plan-card-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.plans-note {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.directory-alternatives {
  margin: 2rem 0;
}

.alt-preview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.alt-preview-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  color: var(--text);
}

.alt-preview-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.alt-preview-card .favicon {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.alt-preview-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.alt-preview-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.alt-preview-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.directory-body {
  max-width: 70ch;
}

.alternatives-cta {
  margin-top: 0.85rem;
  font-weight: 600;
}

.directory-guides {
  margin: 2rem 0;
}

.guide-preview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.guide-preview-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  color: var(--text);
}

.guide-preview-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.guide-preview-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.guide-preview-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.guide-preview-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.plain-list {
  list-style: none;
  padding: 0;
}

.plain-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

/* Guides */

.guide-subtitle {
  margin-top: 0.25rem;
}

.guide-block-heading {
  margin-top: 2rem;
}

.guide-block-text {
  max-width: 70ch;
}

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

.directory-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  color: var(--text);
  box-shadow: var(--shadow);
}

.directory-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.directory-card-title {
  font-weight: 600;
  flex: 1;
}

.directory-card-dr {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.directory-card-desc {
  margin: 0.5rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.directory-card-meta .badge {
  margin: 0 0.25rem 0.25rem 0;
}

.guide-index {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.guide-index-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  color: var(--text);
  box-shadow: var(--shadow);
}

.guide-index-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.guide-index-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}
