/* ==========================================================================
   layout.css — 页面骨架：背景、容器、页头、Hero、区块、页脚、响应式
   ========================================================================== */

/* ---------- 1. 背景光晕（mesh gradient） ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(58% 42% at 12% -6%,  var(--mesh-1) 0%, transparent 62%),
    radial-gradient(46% 38% at 92% 4%,   var(--mesh-2) 0%, transparent 60%),
    radial-gradient(60% 48% at 50% 104%, var(--mesh-3) 0%, transparent 64%);
}

/* 细网格纹理，增加「控制台」质感 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .35;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 78%);
}

/* ---------- 2. 容器 ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s-6);
}
.container--narrow { max-width: var(--container-narrow); }

/* ---------- 3. 页头 ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.header.is-stuck {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-md);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  width: 100%;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-md);
  letter-spacing: -.02em;
  white-space: nowrap;
}
.logo__mark {
  width: 32px; height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--brand-grad);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px -4px rgba(255, 106, 26, .7);
}
.logo__mark svg { width: 19px; height: 19px; }
.logo__sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--brand);
  text-transform: uppercase;
  display: block;
  line-height: 1;
  margin-top: 2px;
}

/* 主导航 */
.nav {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  margin-inline-start: auto;
}
.nav__link {
  position: relative;
  padding: 8px 13px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-dim);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.nav__link:hover { color: var(--text); background: var(--surface-2); }
.nav__link.is-active,
.nav__link[aria-current='page'] { color: var(--text); }
.nav__link.is-active::after,
.nav__link[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 13px; right: 13px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand-grad-s);
}

/* 页头右侧动作区 */
.header__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-inline-start: var(--s-3);
}

/* 移动端汉堡按钮 */
.burger {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  place-items: center;
  color: var(--text);
}
.burger:hover { background: var(--surface-2); }

/* 移动端抽屉 */
.mobile-nav {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  z-index: var(--z-menu);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: var(--s-4) var(--s-6) var(--s-6);
  display: grid;
  gap: var(--s-1);
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
}
.mobile-nav.is-open { opacity: 1; transform: none; visibility: visible; }
.mobile-nav a {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-weight: 600;
  color: var(--text-dim);
}
.mobile-nav a:hover { background: var(--surface-2); color: var(--text); }

/* ---------- 4. Hero ---------- */
.hero {
  position: relative;
  padding: var(--s-11) 0 var(--s-9);
  text-align: center;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--surface);
  backdrop-filter: blur(10px);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .01em;
  margin-bottom: var(--s-5);
}
.hero__eyebrow b { color: var(--brand); font-weight: 800; }
.hero__eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--brand-soft); }
  50%      { box-shadow: 0 0 0 7px rgba(255, 106, 26, 0); }
}

.hero h1 {
  max-width: 900px;
  margin-inline: auto;
  margin-bottom: var(--s-5);
}
/* 子页顶部的紧凑版 hero：站点在多页结构下每个子页用它做页头 */
.hero--sub { padding: var(--s-8) 0 var(--s-4); }
.hero--sub h1 { font-size: clamp(28px, 4vw, 40px); }
.hero--sub .hero__lead { max-width: 720px; margin-top: var(--s-4); }
.hero__lead {
  max-width: 620px;
  margin-inline: auto;
  font-size: var(--fs-md);
  color: var(--text-dim);
  margin-bottom: var(--s-7);
}

/* Hero 数据条 */
.hero__stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-3) var(--s-8);
  margin-top: var(--s-8);
}
.stat { text-align: center; }
.stat__num {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -.02em;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.stat__label {
  font-size: var(--fs-xs);
  color: var(--text-mute);
  letter-spacing: .04em;
}

/* ---------- 5. 区块 ---------- */
.section {
  padding: var(--s-10) 0;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.section--tight { padding: var(--s-8) 0; }

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-6);
  margin-bottom: var(--s-7);
  flex-wrap: wrap;
}
.section__title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-2xl);
}
.section__title .icon {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--brand-soft);
  border: 1px solid rgba(255, 106, 26, .28);
  display: grid;
  place-items: center;
  color: var(--brand);
}
.section__title .icon svg { width: 19px; height: 19px; }
.section__desc {
  margin-top: 10px;
  color: var(--text-dim);
  max-width: 640px;
  font-size: var(--fs-base);
}

/* 区块编号水印 */
.section__index {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-mute);
  letter-spacing: .1em;
  margin-bottom: 6px;
}

/* ---------- 6. 通用网格 ---------- */
.grid { display: grid; gap: var(--s-4); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* 结果卡片：自适应列宽，避免小屏挤压 */
.grid--results { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
/* 符号 / 颜文字：更小的单元格 */
.grid--chips  { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.grid--faces  { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
/* 灵感昵称：比结果稍窄，适合短卡片 */
.grid--ideas  { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
/* 英文名卡片：信息量大，需要更宽的列 */
.grid--names  { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* ---------- 7. 页脚 ---------- */
.footer {
  margin-top: var(--s-10);
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: var(--s-9) 0 var(--s-6);
}
.footer__top {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: var(--s-8);
  margin-bottom: var(--s-8);
}
.footer__brand p {
  margin-top: var(--s-4);
  color: var(--text-dim);
  font-size: var(--fs-sm);
  max-width: 320px;
}
.footer__col h4 {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: var(--s-4);
}
.footer__col a {
  display: block;
  padding: 5px 0;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.footer__col a:hover { color: var(--brand); transform: translateX(3px); }
.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  padding-top: var(--s-6);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-mute);
}
.footer__disclaimer {
  margin-top: var(--s-5);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-xs);
  line-height: 1.65;
  color: var(--text-mute);
}

/* ---------- 8. 响应式断点 ---------- */
@media (min-width: 1081px) and (max-width: 1280px) {
  .nav__link { padding: 8px 9px; font-size: 13px; }
  .header__inner { gap: var(--s-4); }
}
@media (max-width: 1080px) {
  .nav { display: none; }
  .burger { display: grid; }
  .header__actions { margin-inline-start: auto; }
}

@media (max-width: 900px) {
  .footer__top { grid-template-columns: 1fr 1fr; gap: var(--s-7); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  :root { --header-h: 60px; }

  .container { padding-inline: var(--s-4); }
  .hero { padding: var(--s-9) 0 var(--s-7); }
  .hero--sub { padding: var(--s-7) 0 var(--s-3); }
  .section { padding: var(--s-9) 0; }

  .section__head { align-items: flex-start; }
  .section__title { font-size: var(--fs-xl); }
  .section__title .icon { width: 32px; height: 32px; border-radius: 9px; }

  .grid { gap: var(--s-3); }
  .grid--2,
  .grid--3,
  .grid--4 { grid-template-columns: 1fr; }
  .grid--results { grid-template-columns: 1fr; }
  .grid--chips { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
  .grid--faces { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

  .hero__stats { gap: var(--s-3) var(--s-6); }
  .footer__top { grid-template-columns: 1fr; gap: var(--s-6); }

  /* 窄屏页头只保留「语言 / 主题 / 菜单」三个图标按钮。
     带文字的 CTA 会把 header__actions 撑到 242px，在 390px 视口下整页
     横向溢出 44px（实测：document.scrollWidth - innerWidth = 44）。
     语言与主题是功能性按钮必须留，CTA 只是回到本页生成器的快捷方式，
     收掉它页面就不再有横向滚动条。 */
  .header__actions .btn--primary { display: none; }
  .header__inner { gap: var(--s-2); }
}

/* 打印：去掉装饰，方便存档 */
@media print {
  body::before, body::after, .header, .mobile-nav, .footer__bottom { display: none; }
  body { background: #fff; color: #000; }
}
