/* ═══════════════════════════════════════════════════════════
   FD-Go · main.css
   设计语言移植自 portfolio 项目
   ═══════════════════════════════════════════════════════════ */

@import url('./nav.css');

:root {
  --bg: #f5f4f0;
  --white: #fdfcf9;
  --text: #222;
  --text-sub: #555;
  --text-muted: #999;
  --text-faint: rgba(0,0,0,.45);
  --border: rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.12);
  --accent: #bfab90;
  --accent-warm: #c89a6e;
  --accent-deep: #6b5344;
  --nav-blur: rgba(245,244,240,0.75);
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.08);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  min-width: 360px;
  background: var(--bg);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-width: 360px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

* { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; -webkit-user-drag: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* Remove grey tap flash on all interactive elements */

/* Re-allow text selection on readable content */
p, h1, h2, h3, h4, h5, h6, li, span, td, th { user-select: text; -webkit-user-select: text; }

/* ═══════════════════════════════════════════════════════════
   NAV · 磨砂玻璃
   ═══════════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4.4rem;
  padding: 0 3rem;
  background: var(--nav-blur);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid transparent;
  transition: border-color .4s;
}
/* 让出 topbar 高度(topbar fixed 后脱离文档流) */
body { padding-top: 4.4rem; }
.topbar.scrolled { border-bottom-color: var(--border); }

/* === 开发者子页 topbar 着色变体(用于 admin / api-docs / mcp-playground) === */
/* 三个开发者页面统一使用深灰色背景 + 白字导航,通过 brand-mark 颜色区分模块 */
.topbar.topbar-admin,
.topbar.topbar-api,
.topbar.topbar-mcp,
.topbar.topbar-agent {
  background: rgba(62, 62, 62, 0.96);   /* 深灰 #3e3e3e */
  border-bottom-color: rgba(255,255,255,0.08);
}
.topbar.topbar-admin .brand,
.topbar.topbar-api .brand,
.topbar.topbar-mcp .brand,
.topbar.topbar-agent .brand { color: #e8e8e8; }
.topbar.topbar-admin .nav-link,
.topbar.topbar-api .nav-link,
.topbar.topbar-mcp .nav-link,
.topbar.topbar-agent .nav-link { color: rgba(255,255,255,0.7); }
.topbar.topbar-admin .nav-link:hover,
.topbar.topbar-admin .nav-link.active,
.topbar.topbar-api .nav-link:hover,
.topbar.topbar-api .nav-link.active,
.topbar.topbar-mcp .nav-link:hover,
.topbar.topbar-mcp .nav-link.active,
.topbar.topbar-agent .nav-link:hover,
.topbar.topbar-agent .nav-link.active,
.topbar.topbar-admin .nav-item.has-dropdown:hover > .nav-link,
.topbar.topbar-admin .nav-item.has-dropdown:focus-within > .nav-link,
.topbar.topbar-api .nav-item.has-dropdown:hover > .nav-link,
.topbar.topbar-api .nav-item.has-dropdown:focus-within > .nav-link,
.topbar.topbar-mcp .nav-item.has-dropdown:hover > .nav-link,
.topbar.topbar-mcp .nav-item.has-dropdown:focus-within > .nav-link { color: #fff; }
.topbar.topbar-agent .nav-item.has-dropdown:hover > .nav-link,
.topbar.topbar-agent .nav-item.has-dropdown:focus-within > .nav-link { color: #fff; }
.topbar.topbar-admin .nav-link::after,
.topbar.topbar-api .nav-link::after,
.topbar.topbar-mcp .nav-link::after,
.topbar.topbar-agent .nav-link::after { background: #fff; }
.topbar.topbar-admin .nav-burger,
.topbar.topbar-api .nav-burger,
.topbar.topbar-mcp .nav-burger,
.topbar.topbar-agent .nav-burger { color: #fff; }
.topbar.topbar-admin .nav-burger:hover,
.topbar.topbar-api .nav-burger:hover,
.topbar.topbar-mcp .nav-burger:hover { background: rgba(255,255,255,.08); }
.topbar.topbar-agent .nav-burger:hover { background: rgba(255,255,255,.08); }

/* brand-mark 用模块色区分:Admin 青 / API 粉 / MCP 绿 */
.topbar.topbar-admin .brand-mark { background: #2a8c9b; color: #fff; }
.topbar.topbar-api .brand-mark { background: #c25a7a; color: #fff; }
.topbar.topbar-mcp .brand-mark { background: #2e8b57; color: #fff; }
.topbar.topbar-agent .brand-mark { background: #1f7257; color: #fff; }

.brand {
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-sub);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 0;
}
/* 整站 header 左侧 logo 图片
 * 浅色 4 页面用 fg_logo_blue(64x64),深色 4 页面用 fg_logo_line(58x50) */
.brand-logo {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  /* 浅色页面蓝色方块 logo:固定 32x32 圆角矩形 */
  width: 32px;
  height: 32px;
  border-radius: 7px;
}
/* 深色页面白色线稿 logo:按图片比例自适应,带轻微圆角 */
.topbar.topbar-agent .brand-logo,
.topbar.topbar-admin .brand-logo,
.topbar.topbar-api .brand-logo,
.topbar.topbar-mcp .brand-logo {
  width: auto;
  height: 24px;
  border-radius: 5px;
}

/* ═══════════════════════════════════════════════════════════
   CONTAINER
   ═══════════════════════════════════════════════════════════ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 3rem 4rem;
}

.section-head {
  text-align: center;
  margin-bottom: 3.5rem;
}
.section-eyebrow {
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.section-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -.03em;
  margin-bottom: .75rem;
  color: var(--text);
}
.section-desc {
  font-size: 1.05rem;
  color: var(--text-sub);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════
   HERO · 首页
   ═══════════════════════════════════════════════════════════ */
.hero {
  padding: 8rem 3rem 6rem;
  text-align: center;
  position: relative;
}
.home-agent-section {
  padding: 9rem 3rem 3rem;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .35rem .85rem;
  border-radius: 5px;
  background: var(--text);
  color: var(--bg);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}
.home-agent-module {
  width: min(100%, 860px);
  margin: 0 auto;
}
.home-agent-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--text);
}
.home-agent-heading h2 {
  margin: 0;
  color: inherit;
  font-size: 1.4rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: 0;
}
.home-agent-logo {
  display: inline-block;
  width: auto;
  height: 1em;
  margin-right: .35em;
  vertical-align: -.15em;
}
.home-agent-composer {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 1.45rem;
  background: rgba(253, 252, 249, .86);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .8);
  transition: box-shadow .2s, border-color .2s, background .2s;
}
.home-agent-composer:hover,
.home-agent-composer:focus-within { border-color: rgba(34, 34, 34, .2); }
.home-agent-composer:focus-within { box-shadow: 0 12px 40px rgba(0, 0, 0, .1), inset 0 1px 0 rgba(255, 255, 255, .9); }
.home-agent-composer textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 5.3rem;
  max-height: 18rem;
  padding: 1.25rem 1.35rem .25rem;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
}
.home-agent-composer textarea::placeholder { color: var(--text-muted); }
.home-agent-composer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 3.4rem;
  padding: .35rem .75rem .75rem 1.1rem;
}
.home-agent-run-button {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  transition: transform .2s, background .2s;
}
.home-agent-run-button:hover { background: var(--accent-deep); transform: translateY(-1px); }
.home-agent-composer.is-empty .home-agent-run-button {
  background: transparent;
  color: #9b9da5;
}
.home-agent-composer.is-empty .home-agent-run-button:hover {
  background: transparent;
  color: #7f8188;
  transform: none;
}
.home-agent-run-button::before { content: '↑'; transform: translateY(-1px); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hero-title {
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -.02em;
  margin-bottom: 1.8rem;
  color: var(--text);
}
.hero-sub {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.78;
  letter-spacing: -.005em;
  color: var(--text-sub);
  max-width: 60ch;
  margin: 0 auto 2.5rem;
}
.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: .85rem 1.6rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  transition: all .25s;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--text);
  color: var(--white);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
.btn-secondary {
  background: var(--white);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: #f0eee8; }
.btn-ghost {
  background: var(--white);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: rgba(0,0,0,.25);
}

/* ═══════════════════════════════════════════════════════════
   GRID · 三段叙事
   ═══════════════════════════════════════════════════════════ */
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--white);
}
.three-col-item {
  padding: 2rem 2.2rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.three-col-item:last-child { border-right: none; }
.three-col-num {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  padding: .2rem .56rem;
  border-radius: 5px;
  background: var(--text);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  line-height: 1;
}
.three-col-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}
.three-col-desc {
  font-size: .9rem;
  color: var(--text-sub);
  line-height: 1.7;
}
.three-col-link {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  margin-top: auto;
  padding-top: .5rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.three-col-link::after {
  content: '→';
  transition: transform .25s;
}
.three-col-link:hover::after { transform: translateX(3px); }

/* ═══════════════════════════════════════════════════════════
   CASE TILES (首页预览)
   ═══════════════════════════════════════════════════════════ */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.tile-card {
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  transition: all .3s;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.tile-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0,0,0,.12);
}
/* Cover thumbnail — uses the case's real image when available, gradient
   fallback otherwise. */
.tile-cover {
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: center;
  position: relative;
  flex-shrink: 0;
}
.tile-cover.has-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.25));
  pointer-events: none;
}
.tile-cover-num {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: rgba(255,255,255,.92);
  background: rgba(0,0,0,.35);
  padding: 3px 8px;
  border-radius: 100px;
  z-index: 1;
}
.tile-body {
  padding: 1rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  flex: 1;
}
.tile-tag {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tile-title {
  font-size: 1.32rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.018em;
  line-height: 1.32;
  margin: .15rem 0 .15rem;
}
.tile-desc {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  padding-bottom: 0.6rem;
}
.tile-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .7rem;
  color: var(--text-muted);
  letter-spacing: .02em;
}
.tile-meta strong {
  color: var(--accent-deep);
  font-weight: 600;
  font-size: .72rem;
}

.center-cta { text-align: center; margin-top: 3rem; }

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 3rem 2rem;
  margin-top: 4rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: 1rem;
}
.footer-copy {
  font-size: .75rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .three-col { grid-template-columns: 1fr; }
  .three-col-item { border-right: none; border-bottom: 1px solid var(--border); }
  .three-col-item:last-child { border-bottom: none; }
}
@media (max-width: 768px) {
  .topbar { padding: 0 1.5rem; }
  .container, .hero, .home-agent-section { padding-left: 1.5rem; padding-right: 1.5rem; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 6.5rem 1.5rem 3rem; }
  .home-agent-section { padding-top: 5rem; padding-bottom: 2rem; }
  .home-agent-composer textarea { min-height: 5.3rem; font-size: .9rem; }
}
@media (max-width: 480px) {
  .topbar { padding: 0 1.2rem; height: 3.8rem; }
}
