/*
Theme Name: NaviX Dark
Theme URI: https://example.com/navix-dark
Author: Your Name
Author URI: https://example.com
Description: 经典紧凑导航主题，粉色点缀，支持暗色模式、分类展示与点击统计。
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Text Domain: navix-dark
*/

:root {
  --accent: #e91e8c;
  --accent-hover: #d0187d;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f2;
  --text: #2d2d2d;
  --text-muted: #6b6b6b;
  --text-light: #9a9a9a;
  --border: #e5e5e8;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --radius-sm: 4px;
  --header-height: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
  --bg: #141418;
  --surface: #1e1e24;
  --surface-2: #2a2a32;
  --text: #ececf0;
  --text-muted: #a0a0ab;
  --text-light: #6e6e78;
  --border: #33333d;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--header-height);
}

.brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.brand:hover {
  color: var(--accent);
}

.brand .custom-logo-link img {
  max-height: 36px;
  width: auto;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

.menu-toggle.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.main-nav {
  flex: 1;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
}

.nav-menu a {
  display: block;
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: 14px;
  border-radius: var(--radius-sm);
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a,
.nav-menu .current_page_item > a {
  color: var(--accent);
  background: var(--surface-2);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

/* ---- Hero ---- */
.hero {
  padding: 40px 0 28px;
  text-align: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
}

.hero p {
  margin: 8px 0 20px;
  color: var(--text-muted);
  font-size: 15px;
}

.hero-search {
  max-width: 520px;
  margin: 0 auto;
}

.hero-search-form {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hero-search-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.hero-search-form input {
  flex: 1;
  border: 0;
  outline: none;
  padding: 12px 16px;
  font-size: 14px;
  background: transparent;
  color: var(--text);
}

.hero-search-form button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--text-light);
  cursor: pointer;
}

.hero-search-form button:hover {
  color: var(--accent);
}

/* ---- Category Pills ---- */
.category-pills {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: var(--header-height);
  z-index: 90;
}

.category-pills-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-pills-inner::-webkit-scrollbar {
  display: none;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
  white-space: nowrap;
}

.category-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface);
  transform: translateY(-1px);
  text-decoration: none;
}

.category-pill.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface);
  font-weight: 700;
}

.category-pill-icon {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.category-pill-icon img {
  width: 18px;
  height: 18px;
  object-fit: cover;
  border-radius: 6px;
}

.category-pill .cat-icon-letter {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.category-pill-label {
  font-size: 13px;
  font-weight: 600;
}

/* ---- Main Content ---- */
.main-content {
  padding: 24px 0 48px;
}

.nav-section {
  margin-bottom: 32px;
}

.section-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-light);
  background: var(--surface-2);
  padding: 1px 8px;
  border-radius: 10px;
}

.section-desc {
  margin: -6px 0 14px 13px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Link Grid ---- */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.link-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.link-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.link-card-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  text-decoration: none;
  transition: none;
  height: auto;
}

.link-card-inner:hover {
  text-decoration: none;
  color: inherit;
}

.link-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  padding: 1px 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  z-index: 1;
}

.link-card-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-card-icon img {
  width: 34px;
  height: 34px;
  object-fit: cover;
}

.link-icon-placeholder {
  color: var(--text-light);
}

.link-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card-desc {
  font-size: 12px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card-url {
  font-size: 11px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Card Meta Row ---- */
.card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: 12px;
}

.card-clicks {
  white-space: nowrap;
}

.like-btn.btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.like-btn.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ---- Misc ---- */
.ad-slot {
  margin-bottom: 24px;
  border: 1px dashed var(--border);
  padding: 14px;
  text-align: center;
  border-radius: var(--radius);
  color: var(--text-muted);
  background: var(--surface);
}

.empty-panel,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
}

.site-footer {
  margin-top: 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  background: var(--surface);
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin: 16px 0;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.btn,
button.btn,
input[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover,
button.btn:hover,
input[type="submit"]:hover {
  background: var(--accent-hover);
}

.single-site .title {
  margin: 0 0 12px;
}

.single-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0;
}

.pagination .page-numbers {
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
}

.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .category-pills {
    position: static;
    top: auto;
    border-bottom-color: transparent;
    padding: 8px 0;
  }

  .menu-toggle {
    display: flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
  }

  .main-nav.is-open {
    display: block;
  }

  .nav-menu {
    flex-direction: column;
    gap: 2px;
  }

  .site-header {
    position: relative;
  }

  .site-header .header-inner {
    position: relative;
  }

  .category-pills-inner {
    gap: 6px;
  }

  .link-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 480px) {
  .link-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero {
    padding: 28px 0 20px;
  }
}
