/* ==========================================================================
   Healthy Eating Tips Guide.

   Extends trust.css and uses the same tokens. The page is long-form, so the
   job here is scannability: each tip is a three-part card (try / why /
   caveats) that can be read out of order, and the USDA table scrolls inside
   its own container instead of forcing the page sideways on a phone.
   ========================================================================== */

.guide-page {
  background: var(--bg, #fbfcfb);
}

.guide-body {
  padding: clamp(1.5rem, 3vw, 2.5rem) 0 clamp(3rem, 6vw, 4.5rem);
}

/* Visually distinct but not alarming: this is scope, not a warning label. */
.guide-notice {
  margin: 0 0 2rem;
  padding: 1rem 1.15rem;
  max-width: 76ch;
  border: 1px solid var(--line-2, #cfe0d8);
  border-inline-start: 4px solid var(--accent, #0a8f72);
  border-radius: var(--r-sm, 12px);
  background: var(--surface-2, #f6faf8);
  color: var(--ink-2, #42606f);
  font-size: 0.95rem;
}

/* ------------------------------------------------------------------ toc */

.guide-toc {
  margin: 0 0 2.5rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line, #e1ede7);
  border-radius: var(--r, 16px);
  background: var(--surface, #fff);
  box-shadow: var(--sh-xs, 0 1px 2px rgba(14, 42, 61, .05));
}

.guide-toc h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink, #0e2a3d);
}

.guide-toc ol {
  margin: 0;
  padding-inline-start: 1.25rem;
  columns: 2;
  column-gap: 2rem;
}

.guide-toc li {
  margin: 0.25rem 0;
  break-inside: avoid;
}

.guide-toc a {
  color: var(--brand-ink, #086b4a);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* -------------------------------------------------------------- pillars */

.guide-section {
  margin: 0 0 3rem;
}

.guide-section > h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  line-height: 1.25;
  font-weight: 800;
  color: var(--ink, #0e2a3d);
  scroll-margin-top: calc(var(--nav-h, 72px) + 20px);
}

.pillar__intro {
  margin: 0 0 1.25rem;
  max-width: 68ch;
  color: var(--ink-2, #42606f);
}

/* ------------------------------------------------------------------ tip */

.tip {
  margin: 0 0 1.15rem;
  padding: clamp(1rem, 2.5vw, 1.4rem);
  border: 1px solid var(--line, #e1ede7);
  border-radius: var(--r, 16px);
  background: var(--surface, #fff);
  box-shadow: var(--sh-xs, 0 1px 2px rgba(14, 42, 61, .05));
  scroll-margin-top: calc(var(--nav-h, 72px) + 20px);
}

.tip h3 {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin: 0 0 1rem;
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  line-height: 1.35;
  font-weight: 700;
  color: var(--ink, #0e2a3d);
}

.tip__number {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--brand-soft, #d5f5e7);
  color: var(--brand-ink, #086b4a);
  font-size: 0.85rem;
  font-weight: 800;
}

.tip__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
}

.tip__part {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: var(--r-sm, 12px);
  background: var(--surface-2, #f6faf8);
  border-top: 3px solid var(--line-2, #cfe0d8);
}

.tip__part--try { border-top-color: var(--brand, #0e9e6e); background: #f2fbf7; }
.tip__part--why { border-top-color: var(--c-body-ic, #4a93e8); background: #f3f8fe; }
.tip__part--caveats { border-top-color: var(--c-metabo-ic, #f5883c); background: #fdf6ef; }

.tip__part dt {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2, #42606f);
}

.tip__part dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink-2, #42606f);
}

.tip__source,
.tip__tool {
  margin: 0.9rem 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-3, #7a96a5);
}

.tip__source a,
.tip__tool a {
  color: var(--brand-ink, #086b4a);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------------------------------------------------------------- table */

.guide-table-wrap {
  margin: 1.25rem 0 0.75rem;
  overflow-x: auto;
  border: 1px solid var(--line, #e1ede7);
  border-radius: var(--r, 16px);
  background: var(--surface, #fff);
  box-shadow: var(--sh-xs, 0 1px 2px rgba(14, 42, 61, .05));
}

.guide-table-wrap:focus-visible {
  outline: 3px solid var(--brand-2, #16c08a);
  outline-offset: 2px;
}

.guide-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.guide-table caption {
  padding: 0.9rem 1rem;
  text-align: start;
  font-size: 0.82rem;
  color: var(--ink-3, #7a96a5);
  border-bottom: 1px solid var(--line, #e1ede7);
}

.guide-table th,
.guide-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line, #e1ede7);
  text-align: start;
  vertical-align: top;
}

.guide-table thead th {
  background: var(--surface-3, #eff6f2);
  color: var(--ink, #0e2a3d);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.guide-table tbody th {
  font-weight: 700;
  color: var(--ink, #0e2a3d);
}

.guide-table tbody tr:last-child th,
.guide-table tbody tr:last-child td {
  border-bottom: 0;
}

.guide-table tbody tr:nth-child(even) {
  background: var(--surface-2, #f6faf8);
}

.guide-table .num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.guide-table__en {
  color: var(--ink-3, #7a96a5);
}

.fdc-link {
  font-variant-numeric: tabular-nums;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.guide-table__note {
  margin: 0 0 0.5rem;
  max-width: 80ch;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-3, #7a96a5);
}

/* ---------------------------------------------------------------- tools */

.guide-tools ul {
  margin: 0;
  padding-inline-start: 1.25rem;
}

.guide-tools li {
  margin: 0 0 0.6rem;
  max-width: 78ch;
}

.guide-tools a {
  font-weight: 700;
  color: var(--brand-ink, #086b4a);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tool-pending {
  font-weight: 700;
  color: var(--ink, #0e2a3d);
}

.guide-badge {
  display: inline-block;
  margin-inline-start: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--c-age, #fdf3df);
  color: var(--c-age-ink, #a9741b);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ faq */

.guide-faq__item {
  margin: 0 0 0.6rem;
  border: 1px solid var(--line, #e1ede7);
  border-radius: var(--r-sm, 12px);
  background: var(--surface, #fff);
}

.guide-faq__item summary {
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink, #0e2a3d);
  border-radius: var(--r-sm, 12px);
}

.guide-faq__item summary:focus-visible {
  outline: 3px solid var(--brand-2, #16c08a);
  outline-offset: -3px;
}

.guide-faq__item[open] summary {
  border-bottom: 1px solid var(--line, #e1ede7);
}

.guide-faq__item p {
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  max-width: 76ch;
}

/* -------------------------------------------------------------- sources */

.guide-sources ul {
  margin: 0;
  padding-inline-start: 1.25rem;
}

.guide-sources li {
  margin: 0 0 0.75rem;
  max-width: 82ch;
  font-size: 0.92rem;
}

.guide-sources a {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.guide-accessed {
  display: inline-block;
  margin-inline-start: 0.25rem;
  color: var(--ink-3, #7a96a5);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 820px) {
  .tip__grid {
    grid-template-columns: 1fr;
  }

  .guide-toc ol {
    columns: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tip,
  .guide-faq__item {
    transition: none;
  }
}

@media print {
  .guide-toc,
  .guide-tools,
  .consent,
  .site-head,
  .site-foot {
    display: none !important;
  }

  .tip,
  .guide-table-wrap {
    box-shadow: none;
  }

  .guide-table {
    min-width: 0;
  }
}
