/* Illustration tokens: stroke #2d3142, round caps, viewBox 0 0 100 100 in SVG files */

:root {
  --color-card: #ffffff;
  --color-card-border: #1e293b;
  --color-text: #0f172a;
  /* 英文：近黑高对比 */
  --color-text-en: #0a0f1a;
  /* 中文：深蓝灰，与英文区分且易读 */
  --color-text-zh: #0d3b66;
  --color-muted: #475569;
  --color-accent: #ea8c12;
  --color-accent-dark: #c2410c;
  --color-nav-bg: rgba(255, 255, 255, 0.97);
  --shadow-card: 4px 6px 0 #1e293b;
  --shadow-card-hover: 6px 8px 0 #1e293b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --font-display: "Nunito", "Noto Sans SC", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "Nunito", system-ui, sans-serif;
  --max-width: 1120px;
  --figure-max: 72px;
  /* 由 JS 根据 .site-header 实测高度写入；无 JS 时的兜底（窄屏副标题多行需更大值） */
  --sticky-header-offset: clamp(5.25rem, 18vw, 6.85rem);
}

@media (max-width: 640px) {
  :root {
    --sticky-header-offset: clamp(8.5rem, 42vw, 12rem);
  }
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: #f1f5f9;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: var(--color-text-en);
  font-weight: 800;
  font-size: 1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-card-border);
}

.skip-link:focus {
  left: 0.5rem;
  outline: 3px solid var(--color-accent-dark);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 1rem 0.75rem;
  background: var(--color-nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--color-card-border);
  box-shadow: 0 4px 0 rgba(45, 49, 66, 0.08);
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 4.2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--color-text-en);
  text-shadow: 1px 1px 0 #fff, 2px 2px 0 rgba(30, 41, 59, 0.25);
}

.site-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: var(--color-muted);
  font-weight: 600;
}

.main-content {
  max-width: none;
  margin: 0;
  padding: 0;
}

.main-content > .app-error {
  max-width: var(--max-width);
  margin: 1.25rem auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.ingredient-section {
  scroll-margin-top: calc(var(--sticky-header-offset) + 0.25rem);
  padding: 1.35rem 0 1.75rem;
  border-bottom: 2px solid rgba(30, 41, 59, 0.12);
}

.ingredient-section:last-of-type {
  border-bottom: none;
}

.ingredient-section__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.ingredient-section--bread {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 45%, #fde68a 100%);
}

.ingredient-section--meat {
  background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 45%, #fecdd3 100%);
}

.ingredient-section--veggies {
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 45%, #a7f3d0 100%);
}

.ingredient-section--sauces {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 45%, #bfdbfe 100%);
}

.ingredient-section__title {
  position: -webkit-sticky;
  position: sticky;
  top: var(--sticky-header-offset);
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  margin: 0 0 1rem;
  padding: 0.65rem 1.1rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.4vw, 1.75rem);
  font-weight: 800;
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  border: 3px solid var(--color-card-border);
  border-radius: var(--radius-md);
  box-shadow: 3px 4px 0 var(--color-card-border);
}

.ingredient-section--bread .ingredient-section__title {
  background: linear-gradient(100deg, #b45309 0%, #d97706 55%, #f59e0b 100%);
}

.ingredient-section--meat .ingredient-section__title {
  background: linear-gradient(100deg, #9f1239 0%, #be123c 55%, #e11d48 100%);
}

.ingredient-section--veggies .ingredient-section__title {
  background: linear-gradient(100deg, #047857 0%, #059669 55%, #10b981 100%);
}

.ingredient-section--sauces .ingredient-section__title {
  background: linear-gradient(100deg, #1e40af 0%, #2563eb 55%, #3b82f6 100%);
}

.ingredient-section__title-en {
  margin: 0;
  color: #fff;
  letter-spacing: 0.02em;
}

.ingredient-section__title-zh {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.92em;
  font-weight: 800;
  color: #ecfdf5;
  letter-spacing: 0.04em;
}

.ingredient-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .ingredient-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .ingredient-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  @media (min-width: 1200px) {
    .ingredient-grid {
      grid-template-columns: repeat(4, 1fr);
    }
  }
}

.ingredient-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.65rem 0.85rem 1.15rem;
  background: var(--color-card);
  border: 3px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}

.ingredient-card:focus {
  outline: none;
}

.ingredient-card:focus-visible {
  outline: 3px solid var(--color-accent-dark);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .ingredient-card {
    transition: none;
  }
}

.ingredient-card:hover {
  transform: translate(-2px, -3px);
  box-shadow: var(--shadow-card-hover);
}

.ingredient-card__figure {
  margin: 0 0 0.45rem;
  width: var(--figure-max);
  height: var(--figure-max);
  max-width: var(--figure-max);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
}

.ingredient-card__figure img {
  width: 62%;
  height: 62%;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
}

.ingredient-card__name-en {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.12rem, 2.8vw, 1.35rem);
  line-height: 1.28;
  color: var(--color-text-en);
  letter-spacing: 0.01em;
}

.ingredient-card__name-zh {
  margin: 0.35rem 0 0;
  font-size: clamp(1.02rem, 2.5vw, 1.2rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text-zh);
}

.ingredient-card__notes {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-muted);
  line-height: 1.4;
}

.app-error {
  padding: 2rem;
  text-align: center;
  background: #fef2f2;
  color: #7f1d1d;
  border: 3px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 1.05rem;
}

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-muted);
  text-align: center;
}

.site-footer p {
  margin: 0;
}
