/* ==========================================================================
 * FODMAP 食物集 · 同款「日常集」暖色仪表盘
 * 设计语言：暖纸感配色、22px 大圆角、克制留白、侧栏 + 概览 + 食物集网格
 * 作用域：全部以 .fc- 前缀隔离，并在 .fc-page 下覆盖主内容区背景
 * ========================================================================== */

.fc-app {
  /* 设计令牌（与「日常集」一致） */
  --fc-paper: #f5f0e8;
  --fc-card: #fffdfa;
  --fc-ink: #29251f;
  --fc-muted: #746d63;
  --fc-line: #ded5c8;
  --fc-plum: #4d3045;
  --fc-plum-soft: #e8dfe5;
  --fc-terra: #b65f42;
  --fc-terra-soft: #f3dfd6;
  --fc-sage: #627a67;
  --fc-sage-soft: #dfe8df;
  --fc-sand: #a57c45;
  --fc-red: #b44d43;
  --fc-green: #477358;
  --fc-green-soft: #dde9e1;
  --fc-shadow: 0 16px 40px rgba(63, 48, 36, .07);
  --fc-radius: 22px;
  --fc-sidebar: 248px;
  --fc-header-h: 73px;

  display: grid;
  grid-template-columns: var(--fc-sidebar) minmax(0, 1fr);
  min-height: calc(100vh - var(--fc-header-h));
  background: var(--fc-paper);
  color: var(--fc-ink);
  font: 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 让食物集页面脱离主题容器宽度限制，铺满暖纸背景 */
.fc-page .site-content.container {
  max-width: none !important;
  padding: 0 !important;
  background: var(--fc-paper) !important;
}

/* ---------- 侧栏 ---------- */
.fc-sidebar {
  position: sticky;
  top: var(--fc-header-h);
  align-self: start;
  height: calc(100vh - var(--fc-header-h));
  overflow-y: auto;
  padding: 28px 20px 22px;
  background: #ede6dc;
  border-right: 1px solid rgba(104, 86, 68, .14);
  display: flex;
  flex-direction: column;
}

.fc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 4px;
}

.fc-brand-mark {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--fc-plum);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 8px 18px rgba(77, 48, 69, .22);
}

.fc-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.fc-brand-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--fc-ink);
}

.fc-brand-sub {
  font-size: 11px;
  color: var(--fc-muted);
  letter-spacing: .04em;
}

.fc-nav-label {
  margin: 22px 13px 8px;
  color: #9a9186;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.fc-side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fc-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 7px 12px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--fc-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.fc-nav-item:hover {
  background: rgba(255, 252, 247, .55);
}

.fc-nav-item.is-active {
  background: var(--fc-card);
  box-shadow: 0 6px 16px rgba(63, 48, 36, .06);
  font-weight: 600;
}

.fc-nav-ico {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--fc-plum-soft);
  color: var(--fc-plum);
  font-size: 11px;
}

.fc-nav-text {
  flex: 1 1 auto;
  font-size: 14px;
}

.fc-nav-count {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--fc-muted);
  background: rgba(255, 252, 247, .7);
  border-radius: 999px;
  padding: 1px 9px;
  min-width: 26px;
  text-align: center;
}

.fc-nav-item.is-active .fc-nav-count {
  color: var(--fc-plum);
}

.fc-side-foot {
  margin-top: auto;
  padding-top: 18px;
}

.fc-side-note {
  margin: 0;
  padding: 14px 15px;
  border: 1px solid var(--fc-line);
  border-radius: 16px;
  background: rgba(255, 252, 247, .58);
  color: var(--fc-muted);
  font-size: 11px;
  line-height: 1.7;
}

/* ---------- 主区 ---------- */
.fc-main {
  padding: 30px clamp(20px, 4vw, 48px) 64px;
  min-width: 0;
}

.fc-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.fc-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--fc-terra);
  font-weight: 700;
}

.fc-title {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--fc-ink);
}

.fc-search {
  position: relative;
  flex: 1 1 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
}

.fc-search-ico {
  position: absolute;
  left: 16px;
  font-size: 18px;
  color: var(--fc-muted);
  pointer-events: none;
}

.fc-search-input {
  width: 100%;
  height: 46px;
  padding: 0 40px 0 42px;
  border: 1px solid var(--fc-line);
  border-radius: 14px;
  background: var(--fc-card);
  color: var(--fc-ink);
  font: inherit;
  box-shadow: var(--fc-shadow);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.fc-search-input:focus {
  outline: none;
  border-color: var(--fc-terra);
  box-shadow: 0 0 0 4px var(--fc-terra-soft);
}

.fc-search-clear {
  position: absolute;
  right: 10px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(116, 109, 99, .12);
  color: var(--fc-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- 概览 stat ---------- */
.fc-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.fc-stat {
  padding: 18px 20px;
  border-radius: var(--fc-radius);
  background: var(--fc-card);
  border: 1px solid var(--fc-line);
  box-shadow: var(--fc-shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fc-stat-label {
  color: var(--fc-muted);
  font-size: 12px;
}

.fc-stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--fc-ink);
  font-variant-numeric: tabular-nums;
}

.fc-stat-foot {
  color: #998f83;
  font-size: 11px;
}

.fc-stat--low .fc-stat-num { color: var(--fc-green); }
.fc-stat--medium .fc-stat-num { color: var(--fc-terra); }
.fc-stat--high .fc-stat-num { color: var(--fc-red); }

.fc-stat--low { border-top: 3px solid var(--fc-green); }
.fc-stat--medium { border-top: 3px solid var(--fc-terra); }
.fc-stat--high { border-top: 3px solid var(--fc-red); }

/* ---------- 等级筛选 chips ---------- */
.fc-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.fc-chip {
  border: 1px solid var(--fc-line);
  background: var(--fc-card);
  color: var(--fc-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
}

.fc-chip:hover { box-shadow: var(--fc-shadow); }

.fc-chip.is-active {
  background: var(--fc-ink);
  color: #fff;
  border-color: var(--fc-ink);
}

.fc-chip--low.is-active { background: var(--fc-green); border-color: var(--fc-green); }
.fc-chip--medium.is-active { background: var(--fc-terra); border-color: var(--fc-terra); }
.fc-chip--high.is-active { background: var(--fc-red); border-color: var(--fc-red); }

/* ---------- 食物集网格 ---------- */
.fc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 16px;
}

.fc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  border-radius: var(--fc-radius);
  background: var(--fc-card);
  border: 1px solid var(--fc-line);
  box-shadow: var(--fc-shadow);
  transition: transform .2s ease, box-shadow .2s ease;
  animation: fc-rise .42s cubic-bezier(.22, .61, .36, 1) both;
}

.fc-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 48px rgba(63, 48, 36, .12);
}

@keyframes fc-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fc-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.fc-card-name {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--fc-ink);
  line-height: 1.25;
}

.fc-card-en {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--fc-muted);
  letter-spacing: .02em;
}

.fc-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.fc-badge--low { color: var(--fc-green); background: var(--fc-green-soft); }
.fc-badge--medium { color: var(--fc-terra); background: var(--fc-terra-soft); }
.fc-badge--high { color: #fff; background: var(--fc-red); }

.fc-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.fc-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--fc-plum);
  background: var(--fc-plum-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.fc-serving {
  font-size: 12px;
  color: var(--fc-muted);
}

/* 四种发漫亚型的迷你指示 */
.fc-subtypes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.fc-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fc-muted);
  background: rgba(116, 109, 99, .07);
  border-radius: 999px;
  padding: 3px 9px 3px 7px;
}

.fc-sub-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.fc-sub-dot--0 { background: var(--fc-green); }
.fc-sub-dot--1 { background: var(--fc-sand); }
.fc-sub-dot--2 { background: var(--fc-red); }

.fc-card-notes {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--fc-muted);
}

/* 骨架屏 */
.fc-card--skeleton {
  min-height: 150px;
  background: linear-gradient(100deg, #f3ede3 30%, #fbf7f0 50%, #f3ede3 70%);
  background-size: 200% 100%;
  animation: fc-shimmer 1.3s infinite linear;
  border-color: transparent;
  box-shadow: none;
}

@keyframes fc-shimmer {
  to { background-position: -200% 0; }
}

.fc-empty,
.fc-error {
  margin: 28px 0 0;
  padding: 22px;
  text-align: center;
  border-radius: var(--fc-radius);
  background: var(--fc-card);
  border: 1px dashed var(--fc-line);
  color: var(--fc-muted);
  font-size: 14px;
}

.fc-error {
  border-color: var(--fc-red);
  color: var(--fc-red);
}

/* ---------- 移动端底栏 ---------- */
.fc-mobile-nav {
  display: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .fc-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .fc-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .fc-sidebar {
    display: none;
  }

  .fc-main {
    padding: 22px 18px 96px;
  }

  .fc-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .fc-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    display: flex;
    gap: 4px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 253, 250, .96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--fc-line);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fc-mobile-nav button {
    flex: 1 1 0;
    min-width: 56px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #847a70;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10px;
    font-family: inherit;
    padding: 8px 4px;
    cursor: pointer;
  }

  .fc-mobile-nav button.is-active {
    background: var(--fc-plum);
    color: #fff;
  }

  .fc-mobile-nav .fc-mnav-count {
    font-size: 10px;
    opacity: .8;
  }
}

@media (max-width: 520px) {
  .fc-topbar { flex-direction: column; align-items: stretch; }
  .fc-search { max-width: none; }
  .fc-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .fc-card,
  .fc-card--skeleton { animation: none; }
}
