/* ==========================================================================
   NavHub — Midnight Ledger
   深墨蓝黑底 / 暖白文字 / 琥珀铜主色 / 青瓷绿次色
   衬线标题 + 等宽 URL，卡片克制，强调层级靠留白与字重
   ========================================================================== */

:root {
  /* 层次：越靠上层越亮 */
  --ink-900: #0b0e13;
  --ink-850: #0e1116;
  --ink-800: #12161d;
  --ink-750: #161b23;
  --ink-700: #1b212a;
  --ink-600: #232a35;
  --ink-500: #2e3644;

  --paper:    #e8e4dc;
  --paper-2:  #b8b3aa;
  --paper-3:  #7f8288;
  --paper-4:  #5a5e66;

  --accent:      #d8a25c;
  --accent-soft: rgba(216, 162, 92, .14);
  --accent-line: rgba(216, 162, 92, .32);
  --jade: #5fb3a8;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 6px 24px -8px rgba(0,0,0,.6);
  --shadow-3: 0 24px 60px -20px rgba(0,0,0,.75);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC",
           "Source Han Serif SC", "Noto Serif CJK SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas,
          "Liberation Mono", monospace;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --gutter: clamp(20px, 5vw, 64px);
  --cols: 4;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ink-850);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
  min-height: 100vh;
}

/* 极轻的顶部光晕，避免纯黑的死板 */
body::before {
  content: "";
  position: fixed;
  inset: -30% -20% auto -20%;
  height: 70vh;
  background:
    radial-gradient(60% 100% at 22% 0%, rgba(216,162,92,.10), transparent 70%),
    radial-gradient(50% 90% at 82% 8%, rgba(95,179,168,.08), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-line); color: #fff; }

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

/* ------------------------------------------------------------------ 布局 */

.shell {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--gutter) 96px;
}

/* ------------------------------------------------------------------ 头部 */

.masthead {
  padding: clamp(48px, 9vw, 104px) 0 clamp(28px, 4vw, 44px);
  border-bottom: 1px solid var(--ink-600);
  margin-bottom: clamp(28px, 4vw, 44px);
}

.masthead__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

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

.brand__mark {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 24px;
  color: var(--ink-900);
  background: linear-gradient(150deg, var(--accent), #b8823c);
  box-shadow: var(--shadow-2);
  flex: none;
  user-select: none;
}

.brand__mark img { width: 100%; height: 100%; border-radius: var(--radius); object-fit: cover; }

.brand__name {
  font-family: var(--serif);
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -.015em;
  margin: 0;
}

.brand__sub {
  margin: 6px 0 0;
  color: var(--paper-3);
  font-size: 14.5px;
  letter-spacing: .01em;
  max-width: 46ch;
}

.masthead__meta {
  display: flex; align-items: center; gap: 20px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--paper-4);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.masthead__meta b { color: var(--paper-2); font-weight: 500; }

.admin-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--ink-500);
  border-radius: 999px;
  color: var(--paper-2);
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.admin-link:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.admin-link svg { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ 工具条 */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 0;
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--ink-850) 86%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.toolbar.is-stuck { border-bottom-color: var(--ink-600); }

.search {
  position: relative;
  flex: 1 1 320px;
  min-width: 240px;
}
.search svg {
  position: absolute; left: 15px; top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--paper-4);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 12px 44px 12px 44px;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius);
  color: var(--paper);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.search input::placeholder { color: var(--paper-4); }
.search input:hover { border-color: var(--ink-500); }
.search input:focus {
  outline: none;
  border-color: var(--accent-line);
  background: var(--ink-750);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search__clear {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  display: none; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--ink-600);
  color: var(--paper-2);
  cursor: pointer;
  font-size: 15px; line-height: 1;
}
.search__clear:hover { background: var(--ink-500); color: var(--paper); }
.search.has-value .search__clear { display: grid; }

/* 分类筛选 */
.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.chip {
  --c: var(--paper-3);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--paper-2);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease);
}
.chip__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent);
  flex: none;
}
.chip:hover { background: var(--ink-800); color: var(--paper); }
.chip.is-active {
  background: var(--ink-750);
  border-color: color-mix(in srgb, var(--c) 40%, transparent);
  color: var(--paper);
}
.chip__n { font-family: var(--mono); font-size: 11px; color: var(--paper-4); }
.chip.is-active .chip__n { color: var(--c); }

/* ------------------------------------------------------------------ 公告条 */

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 18px;
  margin-bottom: 28px;
  border: 1px solid var(--ink-600);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--ink-800);
  color: var(--paper-2);
  font-size: 14.5px;
}
.notice svg { width: 16px; height: 16px; color: var(--accent); flex: none; margin-top: 3px; }

/* ------------------------------------------------------------------ 分组 */

.group { margin-bottom: clamp(40px, 6vw, 64px); scroll-margin-top: 90px; }

.group__head {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink-700);
}
.group__bar { width: 3px; height: 18px; border-radius: 2px; background: var(--c); align-self: center; }
.group__title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: .01em;
  margin: 0;
}
.group__count { font-family: var(--mono); font-size: 12px; color: var(--paper-4); margin-left: auto; }

/* ------------------------------------------------------------------ 卡片网格 */

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .22s var(--ease), border-color .22s var(--ease),
              background .22s var(--ease), box-shadow .22s var(--ease);
  animation: rise .45s var(--ease) both;
}
.card::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, color-mix(in srgb, var(--c) 12%, transparent), transparent 55%);
  opacity: 0;
  transition: opacity .25s var(--ease);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--c) 42%, var(--ink-600));
  background: var(--ink-750);
  box-shadow: var(--shadow-2);
}
.card:hover::after { opacity: 1; }
.card:active { transform: translateY(-1px); }

.card__icon {
  width: 40px; height: 40px;
  flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 18px;
  color: #0b0e13;
  background: var(--c);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.card__icon img { width: 100%; height: 100%; object-fit: cover; }

.card__body { min-width: 0; flex: 1; }

.card__name {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--paper);
  margin: 0 0 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}
.card__desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--paper-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.1em;
}
.card__url {
  display: inline-block;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .01em;
  color: var(--paper-4);
  max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .2s var(--ease);
}
.card:hover .card__url { color: var(--c); }

.card__star {
  position: absolute; top: 12px; right: 12px;
  width: 16px; height: 16px;
  color: var(--c);
  opacity: .85;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ 搜索反馈 */

.empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--paper-3);
  border: 1px dashed var(--ink-600);
  border-radius: var(--radius-lg);
}
.empty h3 { font-family: var(--serif); font-size: 20px; color: var(--paper-2); margin: 0 0 8px; font-weight: 500; }
.empty p { margin: 0; font-size: 14.5px; }

mark {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--paper);
  border-radius: 2px;
  padding: 0 1px;
}

/* ------------------------------------------------------------------ 页脚 */

.foot {
  margin-top: 72px;
  padding-top: 28px;
  border-top: 1px solid var(--ink-600);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--paper-4);
}
.foot__links { display: flex; gap: 20px; flex-wrap: wrap; }
.foot__links a { color: var(--paper-3); transition: color .2s var(--ease); }
.foot__links a:hover { color: var(--accent); }
.foot__mono { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; }

/* ------------------------------------------------------------------ 响应式 */

@media (max-width: 1180px) { :root { --cols: 3; } }
@media (max-width: 860px)  { :root { --cols: 2; } }
@media (max-width: 560px)  {
  :root { --cols: 1; }
  .masthead__row { align-items: flex-start; }
  .brand__mark { width: 40px; height: 40px; font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* 键盘可达性：Tab 到卡片时给出明显焦点环 */
.card:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
