/* ============================================================
   公羊的技术笔记 · 深色未来科技风
   ============================================================ */

:root {
  --bg-0: #050810;
  --bg-1: #0a0f1e;
  --bg-2: #0d1428;
  --cyan: #00d4ff;
  --violet: #7c3aed;
  --pink: #ec4899;
  --amber: #f59e0b;
  --green: #22c55e;
  --text-1: #e8edf7;
  --text-2: #9aa7c2;
  --text-3: #5d6a86;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.09);
  --radius: 18px;
  --nav-h: 64px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124, 58, 237, 0.14), transparent 60%),
    radial-gradient(1000px 500px at 10% 0%, rgba(0, 212, 255, 0.10), transparent 55%),
    var(--bg-0);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(0, 212, 255, 0.35); }

a { color: inherit; text-decoration: none; }

button { font-family: inherit; cursor: pointer; }

/* ---------- 阅读进度条 ---------- */
#read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.7);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
}
#read-progress.active { opacity: 1; }

/* ---------- 导航栏 ---------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  height: var(--nav-h);
  transition: background 0.35s, box-shadow 0.35s, backdrop-filter 0.35s;
}
.navbar.scrolled {
  background: rgba(7, 11, 22, 0.72);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 1px 0 var(--stroke), 0 12px 40px rgba(0, 0, 0, 0.45);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo { filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.5)); }
.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #fff, #a5d8ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-cats { display: flex; gap: 4px; flex: 1; }
.nav-cats a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-2);
  transition: color 0.25s, background 0.25s;
  white-space: nowrap;
}
.nav-cats a:hover { color: var(--text-1); background: var(--glass-strong); }
.nav-cats a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.22), rgba(124, 58, 237, 0.22));
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.35);
}
.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--text-3);
  transition: border-color 0.25s, box-shadow 0.25s;
  flex-shrink: 0;
}
.nav-search:focus-within {
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
  color: var(--cyan);
}
.nav-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-1);
  font-size: 14px;
  width: 150px;
  font-family: inherit;
}
.nav-search input::placeholder { color: var(--text-3); }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text-1);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* ---------- 主容器与页面过渡 ---------- */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 24px) 24px 80px;
  min-height: 70vh;
  outline: none;
}
.view { animation: viewIn 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  border-radius: 26px;
  overflow: hidden;
  margin-bottom: 40px;
  border: 1px solid var(--stroke);
  background: linear-gradient(160deg, var(--bg-2), var(--bg-1) 70%);
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 64px 32px;
  max-width: 760px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero-eyebrow::before, .hero-eyebrow::after {
  content: "";
  width: 32px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan));
}
.hero-eyebrow::after { background: linear-gradient(90deg, var(--cyan), transparent); }
.hero-title {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 2px;
  background: linear-gradient(100deg, #ffffff 10%, var(--cyan) 45%, var(--violet) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 18px;
}
.hero-sub {
  color: var(--text-2);
  font-size: clamp(14px, 2vw, 17px);
  max-width: 560px;
  margin: 0 auto;
}
.hero-stats {
  margin-top: 28px;
  display: inline-flex;
  gap: 28px;
  font-size: 13px;
  color: var(--text-3);
}
.hero-stats b {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
}

/* ---------- 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.section-title {
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::before {
  content: "";
  width: 4px; height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}
.section-meta { color: var(--text-3); font-size: 13px; }

/* ---------- 卡片网格 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}
.card {
  position: relative;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform-style: preserve-3d;
  transition: box-shadow 0.3s, border-color 0.3s;
  will-change: transform;
  overflow: hidden;
}
.card::before {
  /* 边缘辉光跟随 */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(0, 212, 255, 0.14), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }
.card:hover {
  border-color: rgba(0, 212, 255, 0.35);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 212, 255, 0.08);
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.badge {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid;
}
.badge[data-cat="大模型"]   { color: #7ee7ff; border-color: rgba(0,212,255,.45); background: rgba(0,212,255,.10); }
.badge[data-cat="人工智能"] { color: #c4b5fd; border-color: rgba(124,58,237,.5); background: rgba(124,58,237,.14); }
.badge[data-cat="机器人"]   { color: #f9a8d4; border-color: rgba(236,72,153,.45); background: rgba(236,72,153,.10); }
.badge[data-cat="互联网"]   { color: #fcd34d; border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.10); }
.badge[data-cat="智能科技"] { color: #86efac; border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.10); }
.card-date { font-size: 12px; color: var(--text-3); }
.card-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card a.card-link:hover .card-title { color: var(--cyan); }
.card-summary {
  font-size: 14px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--stroke);
  padding-top: 12px;
}
.card-source { color: var(--text-2); }
.card-words::before { content: "· "; }

/* ---------- 滚动入场 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- 加载更多 ---------- */
.load-more-wrap { text-align: center; margin-top: 40px; }
.btn-load {
  background: linear-gradient(135deg, rgba(0,212,255,.16), rgba(124,58,237,.16));
  border: 1px solid rgba(0, 212, 255, 0.4);
  color: var(--text-1);
  font-size: 15px;
  padding: 12px 40px;
  border-radius: 999px;
  letter-spacing: 2px;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s;
}
.btn-load:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 212, 255, 0.25);
  background: linear-gradient(135deg, rgba(0,212,255,.28), rgba(124,58,237,.28));
}
.btn-load:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

/* ---------- 空态 / 错误态 ---------- */
.empty-state {
  text-align: center;
  padding: 90px 24px;
  color: var(--text-2);
  border: 1px dashed var(--stroke);
  border-radius: var(--radius);
  background: var(--glass);
}
.empty-state .empty-icon { font-size: 44px; margin-bottom: 16px; display: block; }
.empty-state h3 { color: var(--text-1); font-size: 18px; margin-bottom: 8px; }
.empty-state p { font-size: 14px; }
.empty-state .btn-load { margin-top: 22px; }

/* ---------- 骨架屏 ---------- */
.skeleton-card {
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--stroke);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sk {
  border-radius: 8px;
  background: linear-gradient(100deg, rgba(255,255,255,.05) 30%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-badge { width: 72px; height: 22px; border-radius: 999px; }
.sk-title { height: 24px; width: 85%; }
.sk-line { height: 14px; }
.sk-line.w60 { width: 60%; }
.sk-line.w90 { width: 90%; }
.sk-line.w40 { width: 40%; }
.article-skeleton { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; padding-top: 24px; }

/* ---------- 文章详情页 ---------- */
.article-view { max-width: 760px; margin: 0 auto; }
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  color: var(--text-2);
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  margin-bottom: 28px;
  transition: color 0.25s, border-color 0.25s, transform 0.25s;
}
.btn-back:hover { color: var(--cyan); border-color: rgba(0, 212, 255, 0.4); transform: translateX(-3px); }
.article-header { margin-bottom: 32px; }
.article-meta-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.article-date { font-size: 13px; color: var(--text-3); }
.article-title {
  font-size: clamp(26px, 4.5vw, 38px);
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 18px;
}
.article-source-row { font-size: 14px; color: var(--text-3); }
.article-source-row a {
  color: var(--cyan);
  border-bottom: 1px dashed rgba(0, 212, 255, 0.4);
  transition: color 0.25s, border-color 0.25s;
}
.article-source-row a:hover { color: #7ee7ff; border-color: #7ee7ff; }
.article-body {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: clamp(24px, 5vw, 48px);
}
.article-body p {
  font-size: 17px;
  line-height: 1.9;
  color: #d4dcee;
  margin-bottom: 1.4em;
  text-align: justify;
}
.article-body p:last-child { margin-bottom: 0; }
.article-body p:first-of-type::first-letter {
  font-size: 2.4em;
  font-weight: 700;
  float: left;
  line-height: 1;
  margin: 4px 10px 0 0;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.article-footer-nav { margin-top: 40px; text-align: center; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--stroke);
  padding: 36px 24px 44px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.footer-sub { margin-top: 6px; font-size: 12px; opacity: 0.7; }
.footer-icp { margin-top: 10px; font-size: 12px; }
.footer-icp a { color: var(--text-3); text-decoration: none; }
.footer-icp a:hover { color: var(--text-1); text-decoration: underline; }

/* ---------- 搜索结果提示 ---------- */
.search-hint {
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 20px;
}
.search-hint b { color: var(--cyan); }
.search-hint .clear-search {
  margin-left: 12px;
  color: var(--text-3);
  border-bottom: 1px dashed var(--text-3);
  cursor: pointer;
}
.search-hint .clear-search:hover { color: var(--cyan); border-color: var(--cyan); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .nav-inner { gap: 12px; padding: 0 16px; }
  .nav-toggle { display: flex; }
  .nav-cats {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    background: rgba(7, 11, 22, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 16px 18px;
    border-bottom: 1px solid var(--stroke);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
  }
  .navbar.menu-open .nav-cats { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .navbar.menu-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .navbar.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
  .navbar.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav-search input { width: 100px; }
  .brand-name { font-size: 16px; }
  .app { padding-left: 16px; padding-right: 16px; }
  .hero { min-height: 280px; }
  .hero-stats { gap: 18px; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .nav-search { display: none; }
  .navbar .nav-search.mobile-visible {
    display: flex;
    position: fixed;
    top: var(--nav-h);
    left: 12px; right: 12px;
    z-index: 950;
    background: rgba(7, 11, 22, 0.95);
  }
  .navbar .nav-search.mobile-visible input { width: 100%; flex: 1; }
  .hero-content { padding: 44px 20px; }
  .article-body p { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
