:root {
  --food-ink: var(--ink);
  --food-muted: var(--muted);
}

.page-food,
.page-food-detail {
  position: relative;
}

.food-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--food-muted);
  font-size: 0.9rem;
}

.food-breadcrumbs a {
  color: inherit;
}

.food-detail-hero.has-image {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 240px);
  gap: 32px;
  align-items: center;
}

.food-detail-image {
  margin: 0;
}

.food-detail-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.food-detail-image figcaption {
  margin-top: 8px;
  color: var(--food-muted);
  font-size: 0.78rem;
  text-align: center;
}

.food-static-page > .content-card {
  margin-bottom: 18px;
}

.food-detail-hero {
  margin-bottom: 24px;
}

.food-detail-name {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.food-detail-name.is-long {
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  line-height: 1.08;
}

.food-hero-alert {
  margin: 16px 0 0;
  max-width: 60ch;
  color: var(--food-muted);
  font-size: 0.95rem;
}

.food-hero-alert .food-safety-badge {
  margin-right: 6px;
  color: #7e2723;
  background: #f2d3d0;
}

.food-explainer,
.food-next {
  margin: 28px 0;
  max-width: 72ch;
}

.food-next {
  max-width: none;
}

.food-explainer p {
  margin: 0;
  color: var(--food-muted);
  line-height: 1.6;
}

.food-explainer-title {
  margin: 0 0 10px;
  font-family: "Geist", "Segoe UI", sans-serif;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0;
}

.food-safety-heading .food-explainer-title {
  margin: 0;
}

.food-source-note {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.food-source-note p {
  margin: 0 0 6px;
}

/* Food pregnancy guidance card */
.food-guidance-card {
  padding: 24px;
}

.food-guidance-card.is-avoid {
  border-color: rgba(182, 74, 69, 0.28);
  background: #fdf8f6;
}

.food-guidance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.food-guidance-head .food-explainer-title {
  margin: 0;
}

.food-guidance-badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0;
}

.food-guidance-badge.is-recommended {
  color: #1e5631;
  background: #e8f5e9;
}

.food-guidance-badge.is-safe-with-precautions,
.food-guidance-badge.is-safe-with-preparation,
.food-guidance-badge.is-safe-when-cooked {
  color: #1e40af;
  background: #eff6ff;
}

.food-guidance-badge.is-caution {
  color: #6d470d;
  background: #f4e1bd;
}

.food-guidance-badge.is-limit {
  color: #9a3412;
  background: #ffedd5;
}

.food-guidance-badge.is-avoid {
  color: #7e2723;
  background: #f2d3d0;
}

.food-guidance-text {
  margin: 0 0 12px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
  max-width: 78ch;
}

.food-guidance-sources {
  margin: 0;
  font-size: 0.8rem;
  color: var(--food-muted);
}

.food-guidance-sources-label {
  font-weight: 600;
  color: var(--food-muted);
  margin-right: 4px;
}

.food-guidance-sources a {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.food-safety-note {
  scroll-margin-top: 6rem;
}

.food-safety-note.is-avoid {
  border-color: rgba(182, 74, 69, 0.28);
  background: #fdf8f6;
}

.food-safety-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.food-safety-badge {
  padding: 5px 10px;
  border-radius: 999px;
  color: #6d470d;
  background: #f4e1bd;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
}

.food-safety-note.is-avoid .food-safety-badge {
  color: #7e2723;
  background: #f2d3d0;
}

.food-safety-note .content-summary {
  max-width: 80ch;
  margin: 12px 0 0;
  font-size: 0.92rem;
}

.food-safety-note .content-summary + .content-summary {
  margin-top: 8px;
}

/* Nutrient coverage chart */
.food-chart-head .viz-summary {
  margin-top: 4px;
}

.food-chart {
  margin: 22px 0 0;
  padding: 0;
  display: grid;
  list-style: none;
}

.food-chart-row {
  padding: 9px 0;
  display: grid;
  grid-template-columns: minmax(110px, 180px) 88px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(38, 48, 56, 0.07);
}

.food-chart-row:last-child {
  border-bottom: 0;
}

.food-chart-name {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
}

.food-chart-amount {
  color: var(--muted);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.food-chart-note {
  margin-top: 16px;
}

.food-table-details .table-shell {
  margin-top: 12px;
}

.page-food-detail .data-table {
  min-width: 0;
  table-layout: fixed;
}

.page-food-detail .data-table th:first-child,
.page-food-detail .data-table td:first-child {
  width: 42%;
}

.related-food-list,
.food-directory-results,
.food-group-links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-food-list,
.food-directory-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
}

.related-food-list a,
.food-directory-results a,
.food-group-links a {
  color: var(--accent-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.food-directory-form {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.food-directory-input {
  min-width: 0;
  flex: 1;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--food-ink);
  font: inherit;
}

.food-directory-form .easy-autocomplete {
  min-width: 0;
  flex: 1;
}

.food-directory-form .easy-autocomplete .food-directory-input {
  width: 100%;
}

.food-directory-input:focus {
  outline: 3px solid rgba(31, 122, 122, 0.2);
  outline-offset: 1px;
}

.food-directory-input[aria-invalid="true"] {
  border-color: #a34036;
  box-shadow: 0 0 0 2px rgba(163, 64, 54, 0.16);
}

.food-directory-button {
  min-height: 48px;
  padding: 11px 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent-2);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.food-directory-status {
  margin: 18px 0 10px;
  color: var(--food-muted);
  font-weight: 700;
}

.food-directory-results {
  margin-top: 12px;
}

.food-group-directory {
  display: grid;
  gap: 10px;
}

.food-group-details {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.food-group-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 17px;
  color: var(--food-ink);
  font-weight: 850;
  cursor: pointer;
}

.food-group-details summary span {
  color: var(--food-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.food-group-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 24px;
  padding: 4px 17px 18px;
}

@media (max-width: 720px) {
  .food-detail-hero.has-image {
    grid-template-columns: 1fr;
  }

  .food-detail-image {
    width: min(100%, 200px);
    justify-self: center;
  }

  .related-food-list,
  .food-directory-results,
  .food-group-links {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .food-breadcrumbs {
    margin-bottom: 22px;
    font-size: 0.82rem;
  }

  .food-directory-form {
    align-items: stretch;
    flex-direction: column;
  }

  .food-chart-row {
    grid-template-columns: minmax(0, 1fr) auto 52px;
    grid-template-areas:
      "name amount value"
      "bar bar bar";
    gap: 6px 12px;
    padding: 10px 0;
  }

  .food-chart-name { grid-area: name; }
  .food-chart-amount { grid-area: amount; }
  .food-chart-row .viz-bar { grid-area: bar; }
  .food-chart-row .viz-value { grid-area: value; }

  .page-food-detail .table-shell {
    overflow-x: visible;
  }

  .page-food-detail .data-table th,
  .page-food-detail .data-table td {
    padding: 11px 7px;
    overflow-wrap: anywhere;
    font-size: 0.8rem;
  }

  .page-food-detail .data-table thead th {
    font-size: 0.62rem;
    letter-spacing: 0.055em;
  }
}
