/* ============================================================
   网址导航 — 样式表
   风格沿用博客主题 latex-minimal：衬线宋体、暖纸色、细边框
   ============================================================ */

:root {
  --font-serif: "Cambria", "Palatino Linotype", "Palatino", "Times New Roman", "STSongti-SC", "Songti SC", "SimSun", "宋体", serif;
  --font-mono: "Consolas", "Menlo", "Monaco", "Courier New", monospace;
  --radius: 3px;
  --gap: 1.25rem;
  --transition: 180ms ease;
  --sidebar-w: 15rem;
}

[data-theme="dark"] {
  --bg:            #1a1a1c;
  --bg-surface:    #222224;
  --bg-code:       #28282b;
  --bg-hover:      #2a2a2d;
  --text:          #d4cfc6;
  --text-muted:    #8a857c;
  --text-faint:    #5c5852;
  --border:        #333334;
  --border-light:  #2a2a2c;
  --accent:        #c2855b;
  --accent-dim:    #8a5e3f;
  --rule:          #3a3a3c;
  --selection-bg:  #3d3326;
  --selection-text:#e0d8c8;
  --shadow:        rgba(0, 0, 0, .35);
}

[data-theme="light"] {
  --bg:            #fdfcf8;
  --bg-surface:    #f6f3ed;
  --bg-code:       #f0ede6;
  --bg-hover:      #efeae1;
  --text:          #2d2c28;
  --text-muted:    #6b6760;
  --text-faint:    #a09b92;
  --border:        #ddd8cf;
  --border-light:  #ebe6db;
  --accent:        #a0522d;
  --accent-dim:    #c2855b;
  --rule:          #d5d0c7;
  --selection-bg:  #e8dcc8;
  --selection-text:#2d2c28;
  --shadow:        rgba(60, 50, 35, .10);
}

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

html { font-size: 17px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }

body {
  font-family: var(--font-serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  display: flex;
  flex-direction: column;
}

::selection { background: var(--selection-bg); color: var(--selection-text); }

h1, h2, h3 { font-weight: 500; line-height: 1.25; color: var(--text); }

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

code { font-family: var(--font-mono); font-size: .85em; background: var(--bg-code); padding: .15em .4em; border-radius: var(--radius); }

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

.skip-link {
  position: absolute; top: -100%; left: 1rem; z-index: 1000;
  background: var(--accent); color: #fff; padding: .5rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { top: .5rem; }

/* ---------------- Header ---------------- */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: .9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.25rem;
}
.brand { min-width: 0; }
.site-title { font-size: 1.2rem; font-weight: 600; color: var(--text-muted); letter-spacing: -.01em; }
.crumb-base { color: var(--text-muted); }
.crumb-base:hover { color: var(--accent); }
.crumb-sep { color: var(--text-faint); padding: 0 .15em; }
.crumb-current { color: var(--accent); }
.site-subtitle { font-size: .82rem; color: var(--text-muted); margin-top: .15rem; }

.header-actions { display: flex; align-items: center; gap: .75rem; }

.search-box {
  position: relative; display: flex; align-items: center;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0 .55rem; min-width: 15rem;
  transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--accent); }
.search-icon { width: 1rem; height: 1rem; color: var(--text-faint); flex: none; }
.search-box input {
  font-family: inherit; font-size: .9rem; color: var(--text);
  background: none; border: none; outline: none; padding: .45rem .5rem; width: 100%;
}
.search-box input::placeholder { color: var(--text-faint); }
.clear-btn {
  border: none; background: none; color: var(--text-faint); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 0 .15rem;
}
.clear-btn:hover { color: var(--accent); }

.theme-toggle {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: var(--radius); width: 2.1rem; height: 2.1rem; cursor: pointer;
  font-size: .95rem; line-height: 1; flex: none;
  transition: color var(--transition), border-color var(--transition);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-dim); }

/* ---------------- Layout ---------------- */
.layout {
  max-width: 1180px; width: 100%; margin: 0 auto; padding: 1.75rem 1.5rem 3rem;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 2rem;
  flex: 1;
}

/* ---------------- Sidebar ---------------- */
.sidebar { position: sticky; top: 5.2rem; align-self: start; max-height: calc(100vh - 6.5rem); overflow-y: auto; }
.sidebar-title {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-faint); margin-bottom: .7rem; font-weight: 600;
}
.cat-list { list-style: none; }
.cat-item + .cat-item { margin-top: .1rem; }
.cat-link {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
  padding: .38rem .55rem; border-radius: var(--radius);
  color: var(--text-muted); font-size: .92rem;
  border-left: 2px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.cat-link:hover { background: var(--bg-surface); color: var(--text); }
.cat-link.is-active {
  color: var(--accent); background: var(--bg-surface);
  border-left-color: var(--accent); font-weight: 600;
}
.cat-count { font-family: var(--font-mono); font-size: .72rem; color: var(--text-faint); }
.cat-link.is-active .cat-count { color: var(--accent-dim); }

/* ---------------- Toolbar ---------------- */
.toolbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem;
  padding-bottom: .9rem; border-bottom: 1px solid var(--rule);
}
.tag-bar { display: flex; flex-wrap: wrap; gap: .4rem; flex: 1; min-width: 0; }
.tag-chip {
  font-family: inherit; font-size: .78rem; line-height: 1;
  padding: .32rem .6rem; border-radius: 999px; cursor: pointer;
  background: var(--bg-surface); border: 1px solid var(--border-light); color: var(--text-muted);
  transition: all var(--transition);
}
.tag-chip:hover { color: var(--text); border-color: var(--accent-dim); }
.tag-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-chip .tag-n { font-family: var(--font-mono); font-size: .7rem; opacity: .7; margin-left: .25rem; }
.tag-more { border-style: dashed; color: var(--text-faint); }
.result-count { font-size: .82rem; color: var(--text-faint); white-space: nowrap; font-family: var(--font-mono); }

/* ---------------- Content ---------------- */
.content { display: flex; flex-direction: column; gap: 2.2rem; }

.section-head { margin-bottom: .9rem; }
.section-title {
  font-size: 1.18rem; font-weight: 500; letter-spacing: -.01em;
  display: flex; align-items: baseline; gap: .6rem;
}
.section-title .section-n { font-family: var(--font-mono); font-size: .78rem; color: var(--text-faint); font-weight: 400; }
.section-desc { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }

.card-grid {
  display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
}

.card {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .6rem .7rem;
  background: var(--bg-surface); border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.card:hover { border-color: var(--accent-dim); background: var(--bg-hover); transform: translateY(-1px); }
.card:hover .card-title { color: var(--accent); }

.avatar {
  flex: none; width: 1.9rem; height: 1.9rem; border-radius: var(--radius);
  display: grid; place-items: center;
  font-size: .95rem; font-weight: 600; color: #fff;
  background: var(--accent-dim);
  user-select: none;
}
.card-body { min-width: 0; }
.card-title {
  display: block; font-size: .92rem; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color var(--transition);
}
.card-url {
  display: block; font-family: var(--font-mono); font-size: .72rem; color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: .1rem;
}
.card-tags { margin-top: .35rem; display: flex; flex-wrap: wrap; gap: .25rem; }
.card-tag {
  font-size: .68rem; line-height: 1; padding: .22rem .4rem; border-radius: 2px;
  color: var(--text-muted); background: var(--bg-code);
}
.card-tag.is-hit { color: var(--accent); border: 1px solid var(--accent-dim); }

.empty-state { color: var(--text-muted); text-align: center; padding: 3rem 0; }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.2rem 1.5rem; text-align: center;
  font-size: .8rem; color: var(--text-faint);
}
.site-footer .footer-credit { margin-top: .35rem; font-size: .95em; }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 1.2rem; padding: 1.1rem 1rem 2.5rem; }
  .sidebar { position: static; max-height: none; overflow: visible; }
  .cat-list { display: flex; flex-wrap: wrap; gap: .35rem; }
  .cat-item + .cat-item { margin-top: 0; }
  .cat-link { border-left: none; border: 1px solid var(--border-light); border-radius: 999px; padding: .28rem .7rem; }
  .cat-link.is-active { border-color: var(--accent); }
  .header-inner { flex-direction: column; align-items: stretch; gap: .8rem; }
  .header-actions { justify-content: space-between; }
  .search-box { min-width: 0; flex: 1; }
}
