/* GlycemicWise — 共用样式表 v1.0 */
:root {
  --amber: #e67e22;
  --amber-light: #fde8cd;
  --amber-bg: #fff8f0;
  --amber-dark: #d35400;
  --green: #27ae60;
  --green-light: #d4edda;
  --green-dark: #155724;
  --red: #c0392b;
  --red-light: #f8d7da;
  --red-dark: #721c24;
  --text: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #999;
  --card-bg: #f8f9fa;
  --card-border: #e9ecef;
  --warn-bg: #fff8e1;
  --warn-border: #ffe082;
  --page-bg: #ffffff;
  --link: #2563eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--page-bg); line-height: 1.65; font-size: 16px;
}

/* Skip to content — accessibility */
.skip-link {
  position: absolute; top: -100px; left: 16px; background: var(--amber); color: #fff;
  padding: 8px 16px; border-radius: 0 0 6px 6px; z-index: 1000; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 0; }

/* Site Header */
.site-header {
  background: #fff;
  border-bottom: 2px solid var(--amber-light);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 100;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: nowrap; gap: 12px;
}
.site-logo {
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.2rem;
  white-space: nowrap; flex-shrink: 0;
}
.site-logo:hover { opacity: 0.85; }
.site-nav { display: flex; gap: 14px; white-space: nowrap; flex-shrink: 0; }
.site-nav a {
  text-decoration: none; color: var(--text-secondary); font-size: 0.9rem; font-weight: 500;
}
.site-nav a:hover { color: var(--amber); }

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.text-center { text-align: center; }

/* Breadcrumb */
.breadcrumb {
  padding: 14px 0; font-size: 0.85rem; color: var(--text-secondary);
  border-bottom: 1px solid var(--card-border);
}
.breadcrumb a { color: var(--link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-secondary); }

/* Verdict Banner */
.verdict-banner {
  border-radius: 12px; padding: 36px 28px; margin: 24px 0; text-align: center;
}
.verdict-banner.friendly {
  background: linear-gradient(135deg, #eafaf1, #fff);
  border: 2px solid #b7e4c7;
}
.verdict-banner.moderation {
  background: linear-gradient(135deg, var(--amber-bg), #fff);
  border: 2px solid var(--amber-light);
}
.verdict-banner.limit {
  background: linear-gradient(135deg, #fdf0ef, #fff);
  border: 2px solid #f5c6cb;
}
.verdict-emoji { font-size: 3.5rem; line-height: 1; }
.verdict-h1 { font-size: 2rem; font-weight: 700; margin: 10px 0; color: var(--text); }
.verdict-badge {
  display: inline-block; color: #fff; padding: 6px 20px; border-radius: 20px;
  font-weight: 600; font-size: 0.95rem; margin: 8px 0;
}
.verdict-badge.friendly { background: var(--green); }
.verdict-badge.moderation { background: var(--amber); }
.verdict-badge.limit { background: var(--red); }
.verdict-subtitle {
  color: var(--text-secondary); font-size: 1.05rem; margin-top: 6px;
  max-width: 620px; margin-left: auto; margin-right: auto;
}
.verdict-source {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 10px; font-style: italic;
}
.tier-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem;
  font-weight: 700; background: #fff3cd; color: #856404; border: 1px solid #ffc107;
}
.verdict-evidence-note {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; font-style: italic;
  max-width: 580px; margin-left: auto; margin-right: auto;
}

/* Section Headings */
.section-heading { font-size: 1.35rem; font-weight: 700; margin: 40px 0 18px; color: var(--text); }

/* Data Cards Grid */
.cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 8px; }
.data-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 10px; padding: 20px 16px; text-align: center;
  transition: box-shadow 0.2s;
}
.data-card:hover { box-shadow: var(--shadow-lg); }
.data-card.highlight { border: 2px solid var(--amber); background: var(--amber-bg); }
.data-card.highlight.green { border-color: var(--green); background: #eafaf1; }
.data-card.highlight.red { border-color: var(--red); background: #fdf0ef; }
.data-card .card-icon { font-size: 1.5rem; margin-bottom: 4px; }
.data-card .card-value { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.data-card.highlight .card-value { font-size: 2rem; }
.data-card.highlight.green .card-value { color: var(--green-dark); }
.data-card.highlight.moderation .card-value,
.data-card.highlight .card-value { color: var(--amber-dark); }
.data-card.highlight.red .card-value { color: var(--red-dark); }
.data-card .card-label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 600; }
.data-card .card-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.card-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 0.7rem;
  font-weight: 600; margin-top: 4px;
}
.card-badge.good { background: var(--green-light); color: var(--green-dark); }
.card-badge.warn { background: var(--amber-light); color: var(--amber-dark); }
.card-badge.bad { background: var(--red-light); color: var(--red-dark); }

.footnote-row { display: flex; gap: 20px; justify-content: center; color: var(--text-muted); font-size: 0.82rem; padding: 8px 0; }

/* Warnings */
.warnings-section { margin: 24px 0; }
.warning-item {
  background: var(--warn-bg); border-left: 4px solid var(--warn-border);
  padding: 16px 20px; margin-bottom: 14px; border-radius: 0 8px 8px 0;
  line-height: 1.65;
}
.warning-item .warning-title { font-weight: 700; font-size: 1.02rem; margin-bottom: 6px; }
.warning-item .warning-text { font-size: 0.93rem; color: var(--text-secondary); }
.warning-item .warning-cite { font-size: 0.75rem; color: #aaa; margin-top: 6px; }

/* Practical Tips */
.tips-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tip-card {
  background: #f0f7ff; border: 1px solid #cce5ff; border-radius: 10px;
  padding: 16px 18px; font-size: 0.93rem; line-height: 1.6;
}
.tip-card .tip-title { font-weight: 700; margin-bottom: 4px; color: var(--text); }

/* Portion Table */
.portion-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
}
.portion-table th {
  font-weight: 600; text-align: left; padding: 12px 16px; color: #fff;
}
.portion-table th.friendly { background: var(--green); }
.portion-table th.moderation { background: var(--amber); }
.portion-table th.limit { background: var(--red); }
.portion-table td { padding: 11px 16px; border-bottom: 1px solid var(--card-border); background: #fff; }
.portion-table tr:last-child td { border-bottom: none; }
.portion-table .portion-name { font-weight: 600; }

.portion-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 600;
}
.portion-badge.friendly { background: var(--green-light); color: var(--green-dark); }
.portion-badge.mod { background: var(--amber-light); color: var(--amber-dark); }
.portion-badge.limit { background: var(--red-light); color: var(--red-dark); }

/* Alternatives Grid */
.alt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.alt-card {
  border: 1px solid var(--card-border); border-radius: 10px; padding: 18px;
  background: #fafafa; transition: box-shadow 0.2s;
}
.alt-card:hover { box-shadow: var(--shadow-lg); }
.alt-card .alt-emoji { font-size: 1.5rem; }
.alt-card .alt-name { font-weight: 700; font-size: 1.05rem; display: inline; }
.alt-card .alt-gl { font-size: 1.3rem; font-weight: 700; color: var(--green); margin: 4px 0; }
.alt-card .alt-desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; }
.alt-card .alt-link { font-size: 0.85rem; color: var(--link); text-decoration: none; display: inline-block; margin-top: 6px; }
.alt-card .alt-link:hover { text-decoration: underline; }

/* FAQ */
.faq-list { margin-top: 4px; }
.faq-item { border-bottom: 1px solid var(--card-border); padding: 18px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-q { font-weight: 700; font-size: 1.05rem; color: var(--text); margin-bottom: 8px; }
.faq-a { font-size: 0.93rem; color: var(--text-secondary); line-height: 1.7; }

/* Source Box */
.source-box {
  background: #f8f9fa; border: 1px solid var(--card-border); border-radius: 10px;
  padding: 20px 24px; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.8;
}
.source-box strong { color: var(--text); }
.gl-calc {
  background: #fff; border: 1px dashed #ccc; border-radius: 6px; padding: 12px 16px;
  margin: 12px 0; font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 0.82rem; line-height: 1.8;
}

/* Disclaimer */
.disclaimer-box {
  background: #fefefe; border: 1px solid #e0e0e0; border-left: 4px solid #bbb;
  border-radius: 0 8px 8px 0; padding: 16px 20px; margin: 28px 0;
  font-size: 0.82rem; color: #888; line-height: 1.65;
}

/* ========== HOMEPAGE ========== */

/* Hero */
.home-hero {
  background: linear-gradient(160deg, #0d3b4f 0%, #1a7a6d 50%, #0f5c5c 100%);
  color: #fff; text-align: center; padding: 70px 20px 50px;
}
.hero-inner { max-width: 700px; margin: 0 auto; }
.home-hero h1 {
  font-size: 2.6rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 14px; color: #fff;
}
.hero-sub { font-size: 1.15rem; color: rgba(255,255,255,0.82); max-width: 560px; margin: 0 auto 28px; line-height: 1.65; }
.home-search { max-width: 520px; margin: 0 auto; position: relative; }
.home-search input {
  width: 100%; padding: 15px 24px; font-size: 1.1rem; border: none; border-radius: 30px;
  outline: none; background: rgba(255,255,255,0.95); box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.home-search input::placeholder { color: #999; }

/* Search dropdown */
#search-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.14);
  margin-top: 6px; z-index: 200; overflow: hidden; display: none;
}
#search-results a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; text-decoration: none; color: var(--text);
  border-bottom: 1px solid #f0f0f0; transition: background 0.15s;
}
#search-results a:last-child { border-bottom: none; }
#search-results a:hover { background: #f8fafb; }
.sr-emoji { font-size: 1.1rem; width: 24px; text-align: center; flex-shrink: 0; }
.sr-name { font-weight: 600; font-size: 0.95rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-meta { font-size: 0.78rem; color: #999; flex-shrink: 0; }

.hero-stats { display: flex; justify-content: center; gap: 32px; margin-top: 30px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat strong { display: block; font-size: 1.15rem; color: #fff; }
.hero-stat span { display: block; font-size: 0.78rem; color: rgba(255,255,255,0.6); margin-top: 2px; }

.hero-quick-links { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.hero-link-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 18px; border-radius: 14px; text-decoration: none;
  background: rgba(255,255,255,0.12); backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff; transition: background 0.2s; min-width: 150px;
}
.hero-link-card:hover { background: rgba(255,255,255,0.22); }
.hl-emoji { font-size: 1.5rem; }
.hl-label { font-size: 0.82rem; font-weight: 600; }

/* Home Sections */
.home-section { padding: 50px 20px; max-width: 960px; margin: 0 auto; background: #fff; border-radius: 16px; }
.home-section.alt-bg { background: #f8fafb; }
.home-section-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; color: var(--text); white-space: nowrap; }
.home-section-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.home-section-link { color: var(--link); font-weight: 600; font-size: 0.9rem; text-decoration: none; white-space: nowrap; }
.home-section-link:hover { text-decoration: underline; }

/* Popular Foods Grid */
.popular-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.popular-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--card-border); border-radius: 12px;
  padding: 18px 12px; text-decoration: none; color: var(--text); transition: box-shadow 0.2s;
  text-align: center;
}
.popular-card:hover { box-shadow: var(--shadow-lg); }
.pc-emoji { font-size: 2rem; }
.pc-name { font-weight: 700; font-size: 0.95rem; }
.pc-verdict { font-size: 0.78rem; font-weight: 600; }
.pc-verdict.friendly { color: var(--green); }
.pc-verdict.moderation { color: var(--amber); }
.pc-verdict.limit { color: var(--red); }

/* How It Works */
.how-it-works { text-align: center; }
.hiw-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 24px; }
.hiw-card {
  background: #fff; border: 1px solid var(--card-border); border-radius: 12px;
  padding: 28px 24px; text-align: left; display: flex; gap: 16px; align-items: flex-start;
}
.hiw-icon { font-size: 2.2rem; flex-shrink: 0; line-height: 1; }
.hiw-text h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.hiw-text p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }

/* Blog Preview */
.blog-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.blog-preview-card {
  display: flex; flex-direction: column; gap: 6px;
  background: #fff; border: 1px solid var(--card-border); border-radius: 10px;
  padding: 18px 16px; text-decoration: none; color: var(--text); transition: box-shadow 0.2s;
  min-height: 160px;
}
.blog-preview-card:hover { box-shadow: var(--shadow-lg); }
.bpc-cat {
  font-size: 0.72rem; font-weight: 600; color: var(--amber); text-transform: uppercase; letter-spacing: 0.5px;
}
.bpc-title { font-size: 0.95rem; font-weight: 600; line-height: 1.35; flex: 1; }
.bpc-arrow { font-size: 0.9rem; color: var(--link); margin-top: 4px; }

/* Category Grid (with progress bars) */
.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
.category-card {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--card-border); border-radius: 10px;
  padding: 14px 16px; text-decoration: none; color: var(--text); transition: box-shadow 0.2s;
}
.category-card:hover { box-shadow: var(--shadow-lg); }
.cc-emoji { font-size: 1.5rem; flex-shrink: 0; }
.cc-body { flex: 1; min-width: 0; }
.cc-name { font-weight: 700; font-size: 0.88rem; display: block; }
.cc-count { font-size: 0.75rem; color: var(--text-muted); display: block; margin: 2px 0 4px; }
.cc-bar { display: block; height: 4px; background: #e9ecef; border-radius: 2px; overflow: hidden; }
.cc-fill { display: block; height: 100%; background: var(--green); border-radius: 2px; transition: width 0.4s; }

/* CTA */
.home-cta { text-align: center; padding: 56px 20px; }
.home-cta h2 { font-size: 1.3rem; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.cta-btn {
  display: inline-block; background: var(--amber); color: #fff; padding: 14px 36px;
  border-radius: 30px; text-decoration: none; font-weight: 700; font-size: 1.05rem;
  transition: background 0.2s;
}
.cta-btn:hover { background: var(--amber-dark); }

/* Responsive overrides */
@media (max-width: 900px) {
  .popular-grid { grid-template-columns: repeat(3, 1fr); }
  .hiw-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-preview-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .home-hero h1 { font-size: 1.8rem; }
  .hero-sub { font-size: 1rem; }
  .hero-stats { gap: 16px; }
  .hero-link-card { min-width: 120px; padding: 10px 12px; }
  .popular-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-preview-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .home-section { border-radius: 0; padding: 40px 20px; }
}

/* Tag Page */
.tag-header { text-align: center; padding: 30px 0 20px; }
.tag-header h1 { font-size: 1.8rem; font-weight: 700; }
.tag-header p { color: var(--text-secondary); margin-top: 6px; }
.food-list { margin: 20px 0; }
.food-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--card-border);
}
.food-list-item:last-child { border-bottom: none; }
.food-list-item .food-name a { color: var(--link); text-decoration: none; font-weight: 500; }
.food-list-item .food-name a:hover { text-decoration: underline; }
.food-list-item .food-meta { font-size: 0.82rem; color: var(--text-muted); }

/* Nutrition Reference Page */
.no-verdict-banner {
  background: #f8f9fa; border: 2px solid #dee2e6; border-radius: 12px;
  padding: 28px 24px; margin: 24px 0; text-align: center;
}
.no-verdict-banner .nv-title { font-size: 1.3rem; font-weight: 700; }
.no-verdict-banner .nv-text { color: var(--text-secondary); font-size: 0.93rem; margin-top: 8px; }

/* Footer */
footer {
  border-top: 1px solid var(--card-border); padding: 30px 0; margin-top: 48px;
  text-align: center; font-size: 0.8rem; color: #aaa;
}
footer a { color: var(--link); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* No-Verdict (T5) Styling */
.cards-grid.neutral .data-card.highlight { border-color: #adb5bd; background: #f8f9fa; }
.cards-grid.neutral .data-card.highlight .card-value { color: var(--text); }

/* Responsive */
@media (max-width: 640px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .tips-grid { grid-template-columns: 1fr; }
  .alt-grid { grid-template-columns: 1fr; }
  .verdict-h1 { font-size: 1.5rem; }
  .home-hero h1 { font-size: 1.7rem; }
}
