/* =========================================================
   A quiet navigation page
   Inspired by Claude's chat interface — warm, refined, calm.
   ========================================================= */

:root {
  /* —— 颜色:温暖的米色基调,珊瑚橙作为强调色 —— */
  --bg:            #F5F1E8;   /* 页面背景,温暖的米色 */
  --bg-soft:       #EFEAE0;   /* 略深的衬底 */
  --surface:       #FBF8F2;   /* 卡片表面,几乎是奶油色 */
  --surface-hover: #FFFCF6;   /* 卡片 hover 时更亮一档 */
  --border:        #E5DECF;   /* 极细的暖色边框 */
  --border-strong: #D8CFBC;

  --ink:           #1F1D19;   /* 主文字,暖黑而非纯黑 */
  --ink-soft:      #5C564C;   /* 次级文字 */
  --ink-mute:      #8A8275;   /* 第三级,例如域名 */

  --accent:        #C15F3C;   /* Claude 的珊瑚橙 */
  --accent-soft:   #E8B7A3;
  --accent-tint:   rgba(193, 95, 60, 0.08);

  /* —— 字体 —— */
  --font-display: "Fraunces", "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-body:    "Geist", "PingFang SC", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, sans-serif;

  /* —— 节奏 —— */
  --radius:    14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 0 rgba(31, 29, 25, 0.04),
               0 1px 2px rgba(31, 29, 25, 0.04);
  --shadow-md: 0 1px 0 rgba(31, 29, 25, 0.05),
               0 8px 24px -8px rgba(31, 29, 25, 0.12),
               0 2px 6px -2px rgba(31, 29, 25, 0.08);
}

/* —— Reset —— */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  /* 极淡的纸质纹理:重复 SVG 噪点叠加在底色上,让背景"不死板" */
  background-image:
    radial-gradient(ellipse 1200px 600px at 50% -10%, rgba(193, 95, 60, 0.06), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.12  0 0 0 0 0.11  0 0 0 0 0.1  0 0 0 0.025 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

/* —— 页面容器 —— */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 32px 80px;
}

/* =========================================================
   Header
   ========================================================= */
.masthead {
  margin-bottom: 64px;
}

.masthead__inner {
  margin-bottom: 28px;
}

.masthead__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(40px, 5.5vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--ink);
  /* Fraunces 是可变字体,微调一点 optical size 与 softness */
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 100, "SOFT" 50;
}

.masthead__subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 0 14px;
  letter-spacing: -0.005em;
}

.masthead__meta {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0;
  letter-spacing: 0.01em;
}

.masthead__count {
  color: var(--accent);
  font-weight: 500;
}

/* —— 搜索框 —— */
.search {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 480px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.search:focus-within {
  border-color: var(--accent-soft);
  background-color: var(--surface-hover);
  box-shadow: 0 0 0 4px var(--accent-tint);
}

.search__icon {
  color: var(--ink-mute);
  flex-shrink: 0;
  margin-right: 10px;
}

.search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 0.005em;
}

.search input::placeholder {
  color: var(--ink-mute);
}

.search__kbd {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-mute);
  background-color: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 8px;
  line-height: 1;
}

/* =========================================================
   Sections
   ========================================================= */
.section {
  margin-bottom: 52px;
}

.section__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
}

.section__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  flex-shrink: 0;
}

.section__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border-strong), transparent 90%);
}

.section__count {
  font-size: 12px;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* =========================================================
   Card grid
   ========================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition:
    transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 220ms ease,
    border-color 220ms ease,
    background-color 220ms ease;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
}

/* hover 时左侧出现细窄的珊瑚色高亮条 + 卡片上抬 */
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background-color: var(--accent);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
  z-index: 1;
}

.card:hover {
  transform: translateY(-2px);
  background-color: var(--surface-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card:hover::before {
  transform: scaleY(1);
}

.card:active { transform: translateY(0); }

/* —— 卡片顶部:favicon + 右上角的"外链"小箭头 —— */
.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card__favicon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background-color: var(--bg-soft);
  object-fit: contain;
  padding: 2px;
}

/* favicon 加载失败时使用首字母作为兜底 */
.card__fallback {
  display: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background-color: var(--accent-tint);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.card__arrow {
  color: var(--ink-mute);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: all 220ms ease;
}

.card:hover .card__arrow {
  opacity: 1;
  transform: translate(0, 0);
  color: var(--accent);
}

/* —— 卡片文字 —— */
.card__title {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}

.card__desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 14px;
  flex: 1;
  /* 描述最多两行,超出截断,让卡片高度统一 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__host {
  font-size: 11px;
  color: var(--ink-mute);
  margin: 0;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   Empty state & Footer
   ========================================================= */
.empty {
  text-align: center;
  color: var(--ink-mute);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 18px;
  padding: 60px 0;
}

.section--hidden { display: none; }

.footer {
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.footer code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  background-color: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink-soft);
}

/* =========================================================
   入场动画:首次加载时分类与卡片错位淡入
   ========================================================= */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section {
  animation: rise 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.section:nth-child(1) { animation-delay: 80ms; }
.section:nth-child(2) { animation-delay: 160ms; }
.section:nth-child(3) { animation-delay: 240ms; }
.section:nth-child(4) { animation-delay: 320ms; }
.section:nth-child(5) { animation-delay: 400ms; }
.section:nth-child(6) { animation-delay: 480ms; }

.masthead {
  animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .section, .masthead { animation: none; }
  .card { transition: none; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 640px) {
  .page { padding: 32px 20px 56px; }
  .masthead { margin-bottom: 40px; }
  .section { margin-bottom: 36px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .search__kbd { display: none; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
}
