/* NutriScan API section (/api/, /api/pricing, /api/docs/*).
   Loaded per page through frontmatter head, like home.css. Every class starts
   with api-. Colors come from the site tokens in theme/custom.css, so light and
   dark both follow the app palette. Surfaces are told apart by fill, never by an
   outline (brand rule). The landing page (/api/) adds pageClass api-landing; its
   rules live in the "Landing" block below. Everything above it is shared. */

:root {
  --api-radius: 16px;
  --api-radius-lg: 28px;
  --api-radius-sm: 10px;
  --api-lime: #D5EE6E;
  --api-grade-a: #038141;
  --api-grade-b: #85BB2F;
  --api-grade-c: #FECB02;
  --api-grade-d: #EE8100;
  --api-grade-e: #E63E11;
  --api-code-bg: #1B1915;
  --api-code-text: #EFEFF0;
  --api-code-dim: #AFAFB4;
  /* Landing fills: tone-1 is the raised surface, tone-2 a quieter band. */
  --api-tone-1: var(--vp-c-bg-soft);
  --api-tone-2: #E9E3D9;
  --api-macro-c: #B9B09F;
  --api-macro-f: #7A7264;
  --api-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.dark {
  --api-code-bg: #1C1C1E;
  --api-tone-2: #151517;
  --api-macro-c: #6E6E76;
  --api-macro-f: #46464C;
}

/* ---------- Page frame (shared) ---------- */

/* Selectors start with :root .VPContent so they outrank custom.css
   (:root:not(.dark) .VPContent h2/p/li ... !important). */

/* The consumer app download bar does not belong on developer pages. */
body:has(.api-page) .mobile-download-cta {
  display: none !important;
}

.api-page .vp-doc h2 {
  margin-top: 56px;
  border-top: none;
  padding-top: 0;
  letter-spacing: -0.01em;
}

.api-page .vp-doc .api-kicker {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ns-accent-ink) !important;
}

.api-page .vp-doc .api-lede {
  margin: 0 0 28px;
  font-size: 19px;
  line-height: 1.55;
  color: var(--vp-c-text-2) !important;
  max-width: 34em;
}

.api-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 28px;
}

.api-actions--center {
  justify-content: center;
  margin: 0;
}

:root .VPContent .vp-doc a.api-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s var(--api-ease);
}

:root .VPContent .vp-doc a.api-btn:active {
  transform: scale(0.98);
}

:root .VPContent .vp-doc a.api-btn:focus-visible {
  outline: 2px solid var(--vp-c-text-1);
  outline-offset: 3px;
}

:root .VPContent .vp-doc a.api-btn--primary {
  background: var(--ns-cta-bg);
  color: var(--ns-cta-text);
}

:root .VPContent .vp-doc a.api-btn--primary:hover {
  background: var(--ns-cta-hover-bg);
}

:root .VPContent .vp-doc a.api-btn--ghost {
  background: var(--vp-c-bg-mute);
  color: var(--vp-c-text-1);
}

:root .VPContent .vp-doc a.api-btn--ghost:hover {
  background: var(--vp-c-default-3);
}

/* ---------- Card grids (pricing packs) ---------- */

.api-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.api-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.api-card {
  padding: 22px;
  border-radius: var(--api-radius);
  background: var(--vp-c-bg-soft);
  box-shadow: var(--ns-card-shadow);
}

:root .VPContent .vp-doc .api-card h3 {
  margin: 10px 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

:root .VPContent .vp-doc .api-card p:not([class]) {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--vp-c-text-2) !important;
}

:root .VPContent .vp-doc .api-card code {
  font-size: 12px;
}

.api-pack {
  display: flex;
  flex-direction: column;
}

.api-pack--featured {
  background: var(--ns-accent-subtle);
}

:root .VPContent .vp-doc .api-pack-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--vp-c-text-2) !important;
}

:root .VPContent .vp-doc .api-pack-price {
  margin: 6px 0 2px;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--vp-c-text-1) !important;
}

:root .VPContent .vp-doc .api-pack-credits {
  margin: 0 0 16px !important;
  color: var(--vp-c-text-1) !important;
  font-weight: 600;
}

:root .VPContent .vp-doc ul.api-pack-list {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  flex: 1;
}

:root .VPContent .vp-doc ul.api-pack-list li {
  margin: 0;
  padding: 4px 0;
  font-size: 14px;
  color: var(--vp-c-text-2) !important;
}

.api-pack .api-btn {
  width: 100%;
}

/* ---------- Closing call to action (shared) ---------- */

.api-cta {
  margin: 64px 0 24px;
  padding: 40px 32px;
  border-radius: var(--api-radius);
  background: var(--ns-inverse-surface);
  text-align: center;
}

:root .VPContent .vp-doc .api-cta h2 {
  margin: 0 0 10px;
  color: var(--ns-text-inverse) !important;
}

:root .VPContent .vp-doc .api-cta p {
  margin: 0 auto 24px;
  max-width: 32em;
  color: var(--ns-text-inverse) !important;
  opacity: 0.8;
}

:root .VPContent .vp-doc .api-cta a.api-btn--primary {
  background: var(--ns-text-inverse);
  color: var(--ns-inverse-surface);
}

/* ---------- Docs pages ---------- */

:root .VPContent .vp-doc .api-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 16px 0;
  padding: 14px 18px;
  border-radius: var(--api-radius-sm);
  background: var(--vp-c-bg-soft);
  font-size: 14px;
}

:root .VPContent .vp-doc .api-base code {
  font-size: 14px;
  word-break: break-all;
}

/* ---------- Shared small screens ---------- */

@media (max-width: 640px) {
  .api-grid,
  .api-grid--2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-page .vp-doc .api-lede {
    font-size: 17px;
  }

  .api-actions .api-btn {
    flex: 1 1 100%;
  }

  .api-cta {
    padding: 32px 20px;
  }
}

/* =====================================================================
   Landing (/api/, pageClass api-landing)
   Every rule is scoped to .api-landing so pricing and docs never change.
   ===================================================================== */

/* Wide product layout instead of the 688px reading column. */
.api-landing .VPDoc .content,
.api-landing .VPDoc .content-container {
  max-width: 1200px !important;
}

.api-landing .VPDoc .content-container {
  margin: 0 auto;
}

.api-landing .vp-doc .api-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--vp-c-text-2);
  text-wrap: pretty;
}

.api-landing .vp-doc h2 {
  margin: 0 0 16px;
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.api-landing .vp-doc h3 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.api-landing .vp-doc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.api-landing .vp-doc li + li {
  margin-top: 0;
}

.api-landing .vp-doc a.api-link {
  font-weight: 600;
  color: var(--vp-c-text-1);
  text-decoration: underline;
  text-decoration-color: var(--api-lime);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.api-landing .vp-doc a.api-link::after {
  content: " \2192";
}

.api-sec {
  margin-top: 136px;
}

.api-sec-head {
  max-width: 640px;
  margin-bottom: 48px;
}

.api-landing .vp-doc .api-sec-head .api-text {
  font-size: 19px;
}

/* ---------- Hero ---------- */

.api-landing .api-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 64px;
  align-items: center;
  padding-top: 16px;
}

.api-landing .vp-doc .api-hero h1 {
  margin: 0 0 20px;
  font-size: clamp(36px, 4.6vw, 60px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.api-landing .vp-doc .api-lede {
  max-width: 31em;
  margin-bottom: 32px;
}

.api-landing .vp-doc .api-hero-note {
  margin: 0;
  font-size: 14px;
  color: var(--vp-c-text-3);
}

.api-hero-visual {
  position: relative;
  margin: 0;
  padding-left: 56px;
}

.api-landing .vp-doc .api-hero-photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 62% 50%;
  margin: 0;
  border-radius: var(--api-radius-lg);
}

.api-hero-visual figcaption {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--vp-c-text-3);
}

/* The result card as an end user would see it, floating over the photo. */
.api-result {
  position: absolute;
  left: 0;
  bottom: 64px;
  width: min(340px, 72%);
  padding: 20px;
  border-radius: 22px;
  background: var(--vp-c-bg-soft);
  box-shadow: 0 28px 56px -20px rgba(46, 38, 23, 0.38);
}

.dark .api-result {
  box-shadow: 0 28px 56px -20px rgba(0, 0, 0, 0.8);
}

.api-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.api-landing .vp-doc .api-result-label {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ns-accent-ink);
}

.api-landing .vp-doc .api-result-dish {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc .api-result-reason {
  margin: 12px 0 0;
  padding-top: 12px;
  box-shadow: 0 -1px 0 var(--vp-c-divider);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--vp-c-text-2);
}

.api-grade {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 19px;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--api-grade-b);
}

.api-grade--a { background: var(--api-grade-a); }
.api-grade--b { background: var(--api-grade-b); color: #1B1915; }
.api-grade--c { background: var(--api-grade-c); color: #1B1915; }
.api-grade--d { background: var(--api-grade-d); }
.api-grade--e { background: var(--api-grade-e); }

.api-landing .vp-doc .api-result-kcal {
  margin: 14px 0 10px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--vp-c-text-1);
  font-variant-numeric: tabular-nums;
}

.api-result-kcal small {
  margin-left: 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--vp-c-text-2);
}

/* Calorie split of the example: protein 228, carbs 182, fat 84 kcal. */
.api-split {
  display: flex;
  gap: 3px;
  height: 8px;
  margin-bottom: 10px;
}

.api-split span {
  border-radius: 4px;
}

.api-split-p { flex: 46; background: var(--api-lime); }
.api-split-c { flex: 37; background: var(--api-macro-c); }
.api-split-f { flex: 17; background: var(--api-macro-f); }

.api-macros {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.api-macro {
  font-size: 12px;
  line-height: 1.3;
  color: var(--vp-c-text-2);
}

.api-macro b {
  display: block;
  font-size: 15px;
  color: var(--vp-c-text-1);
  font-variant-numeric: tabular-nums;
}

.api-landing .vp-doc ul.api-items li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1px 12px;
  margin: 0;
  padding: 7px 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc ul.api-items li + li {
  box-shadow: 0 -1px 0 var(--vp-c-divider);
}

.api-items .api-item-portion {
  grid-column: 1;
  font-size: 12px;
  color: var(--vp-c-text-3);
}

.api-items .api-item-kcal {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Proof strip ---------- */

.api-proof {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.3fr;
  margin-top: 88px;
  border-radius: var(--api-radius-lg);
  background: var(--api-tone-1);
  overflow: hidden;
}

.api-proof-item {
  padding: 28px 28px 30px;
}

.api-proof-item + .api-proof-item {
  box-shadow: inset 1px 0 0 var(--vp-c-divider);
}

.api-proof-item--lead {
  background: var(--ns-accent-subtle);
}

.api-landing .vp-doc .api-proof-num {
  margin: 0 0 6px;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--vp-c-text-1);
  font-variant-numeric: tabular-nums;
}

.api-landing .vp-doc .api-proof-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--vp-c-text-2);
}

/* ---------- App screen gallery: native scroll-snap rail ---------- */

.api-gallery-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.api-gallery-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 48px;
}

.api-landing .vp-doc .api-gallery-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--api-tone-1);
  color: var(--vp-c-text-1);
  box-shadow: var(--ns-card-shadow);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s var(--api-ease);
}

.api-landing .vp-doc .api-gallery-btn:hover {
  background: var(--vp-c-bg-mute);
}

.api-landing .vp-doc .api-gallery-btn:active {
  transform: scale(0.95);
}

.api-landing .vp-doc .api-gallery-btn:focus-visible,
.api-gallery-rail:focus-visible {
  outline: 2px solid var(--vp-c-text-1);
  outline-offset: 3px;
}

/* One warm panel holds the phones, like a product shelf. Five phones never fit
   the 1200px column, so the last is cut off at the edge, which says "scroll". */
.api-gallery-rail {
  display: flex;
  gap: 28px;
  padding: 44px 44px 36px;
  border-radius: var(--api-radius-lg);
  background: var(--api-tone-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 44px;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.api-gallery-rail::-webkit-scrollbar {
  display: none;
}

.api-phone {
  flex: 0 0 236px;
  margin: 0;
  scroll-snap-align: start;
}

.api-landing .vp-doc .api-phone img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1530 / 3036;
  margin: 0;
  filter: drop-shadow(0 24px 28px rgba(46, 38, 23, 0.22));
}

.dark .api-landing .vp-doc .api-phone img {
  filter: drop-shadow(0 24px 28px rgba(0, 0, 0, 0.6));
}

.api-phone figcaption {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--vp-c-text-1);
}

/* ---------- Inputs: alternating rows ---------- */

.api-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 72px;
  align-items: center;
}

.api-row + .api-row {
  margin-top: 72px;
}

.api-row--flip .api-vis {
  order: 2;
}

.api-row-copy {
  max-width: 460px;
}

.api-landing .vp-doc .api-row-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ns-accent-ink);
}

.api-ico {
  flex: none;
}

.api-landing .vp-doc .api-row-copy h3 {
  font-size: clamp(26px, 2.6vw, 32px);
  letter-spacing: -0.025em;
}

.api-vis {
  position: relative;
  min-height: 360px;
  border-radius: var(--api-radius-lg);
  background: var(--api-tone-2);
  overflow: hidden;
}

.api-landing .vp-doc .api-vis--meal img {
  display: block;
  width: 100%;
  height: 380px;
  object-fit: cover;
  object-position: 30% 45%;
  margin: 0;
}

/* Camera frame: four corner marks, each drawn as two background bars. */
.api-vis-frame {
  --c: rgba(255, 255, 255, 0.92);
  position: absolute;
  inset: 32px;
  background:
    linear-gradient(var(--c), var(--c)) top left / 28px 3px,
    linear-gradient(var(--c), var(--c)) top left / 3px 28px,
    linear-gradient(var(--c), var(--c)) top right / 28px 3px,
    linear-gradient(var(--c), var(--c)) top right / 3px 28px,
    linear-gradient(var(--c), var(--c)) bottom left / 28px 3px,
    linear-gradient(var(--c), var(--c)) bottom left / 3px 28px,
    linear-gradient(var(--c), var(--c)) bottom right / 28px 3px,
    linear-gradient(var(--c), var(--c)) bottom right / 3px 28px;
  background-repeat: no-repeat;
  pointer-events: none;
}

.api-vis-pill {
  position: absolute;
  left: 50%;
  bottom: 52px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(27, 25, 21, 0.88);
  color: #EFEFF0;
  font-size: 14px;
  white-space: nowrap;
}

.api-vis-pill b {
  margin-right: 4px;
  color: var(--api-lime);
}

.api-vis--label {
  display: grid;
  place-items: center;
  padding: 40px 32px 96px;
}

/* The food the label belongs to, behind the label. */
.api-landing .vp-doc .api-vis-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}

.api-vis-pill--label {
  bottom: 32px;
}

/* A printed pack label stays white on paper in both themes. */
.api-label {
  position: relative;
  width: min(300px, 100%);
  padding: 18px 20px 12px;
  border-radius: 6px;
  background: #FFFFFF;
  box-shadow: 0 18px 36px -18px rgba(46, 38, 23, 0.4);
  transform: rotate(-2deg);
}

.api-landing .vp-doc .api-label-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #1B1915;
}

.api-landing .vp-doc .api-label-sub {
  margin: 0 0 6px;
  padding-bottom: 8px;
  box-shadow: 0 4px 0 -1px #1B1915;
  font-size: 13px;
  color: #4A453C;
}

.api-landing .vp-doc .api-label-line {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 5px 0;
  font-size: 14px;
  line-height: 1.4;
  color: #1B1915;
  font-variant-numeric: tabular-nums;
}

.api-landing .vp-doc .api-label-line + .api-label-line {
  box-shadow: 0 -1px 0 #DDD7CB;
}

.api-landing .vp-doc .api-label-line--sub {
  padding-left: 14px;
  color: #4A453C;
}

.api-vis--text {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 40px;
}

.api-landing .vp-doc .api-bubble {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 14px 14px 14px 22px;
  border-radius: 20px;
  background: var(--vp-c-bg-soft);
  color: var(--vp-c-text-1);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: 0 14px 28px -18px rgba(46, 38, 23, 0.45);
}

/* Microphone: Phosphor icon on a lime disc (lime = the active input). */
.api-bubble-mic {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--api-lime);
  color: #1B1915;
}

.api-parsed {
  margin-left: 40px;
  padding: 4px 20px;
  border-radius: 16px;
  background: var(--vp-c-bg-soft);
}

.api-landing .vp-doc .api-parsed-line {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 12px 0;
  font-size: 15px;
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc .api-parsed-line + .api-parsed-line {
  box-shadow: 0 -1px 0 var(--vp-c-divider);
}

.api-parsed-line span + span {
  color: var(--vp-c-text-3);
}

.api-landing .vp-doc .api-sec-foot {
  max-width: 720px;
  margin-top: 72px;
  font-size: 19px;
  color: var(--vp-c-text-1);
}

/* ---------- Use cases: one wide lead tile, three photo tiles ---------- */

.api-uses {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.api-use {
  padding: 12px 28px 28px;
  border-radius: var(--api-radius-lg);
  background: var(--api-tone-1);
}

.api-landing .vp-doc .api-use-photo {
  display: block;
  width: calc(100% + 32px);
  max-width: none;
  height: auto;
  aspect-ratio: 3 / 2;
  margin: 0 -16px 22px;
  border-radius: 18px;
  object-fit: cover;
}

/* Icon chip: tone fill, never lime (lime is for data and selection). */
.api-use-ico {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--vp-c-bg-mute);
  color: var(--vp-c-text-1);
}

.api-use--lead {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  padding: 40px;
  background: var(--ns-accent-subtle);
}

.api-use--lead .api-use-ico {
  background: var(--vp-c-bg-soft);
}

.api-landing .vp-doc .api-use h3 {
  margin-bottom: 6px;
  font-size: 19px;
}

.api-landing .vp-doc .api-use .api-text {
  font-size: 15.5px;
}

.api-landing .vp-doc .api-use.api-use--lead h3 {
  margin: 0 0 12px;
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.api-landing .vp-doc .api-use.api-use--lead .api-text {
  max-width: 30em;
  font-size: 17px;
}

/* A coach's view of one client day, built from result fields. */
.api-day {
  padding: 6px 20px;
  border-radius: var(--api-radius);
  background: var(--vp-c-bg-soft);
  box-shadow: 0 18px 36px -24px rgba(46, 38, 23, 0.45);
}

.api-landing .vp-doc .api-day-head,
.api-landing .vp-doc .api-day-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 13px 0;
  font-size: 15px;
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc .api-day-head {
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--vp-c-text-3);
}

.api-landing .vp-doc .api-day-row {
  box-shadow: 0 -1px 0 var(--vp-c-divider);
}

.api-day-meal {
  flex: none;
  width: 84px;
  font-size: 13px;
  color: var(--vp-c-text-3);
}

.api-day-dish {
  flex: 1;
  min-width: 0;
}

.api-grade--sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 14px;
}

/* ---------- Build or buy ---------- */

.api-bob {
  border-radius: var(--api-radius-lg);
  background: var(--api-tone-1);
  overflow: hidden;
}

.api-bob-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) minmax(0, 1fr);
  font-size: 16.5px;
  line-height: 1.5;
}

.api-bob-row > span {
  padding: 20px 28px;
}

.api-bob-row + .api-bob-row > span {
  box-shadow: inset 0 1px 0 var(--vp-c-divider);
}

.api-bob-row > span:first-child {
  font-weight: 600;
  color: var(--vp-c-text-1);
}

.api-bob-row > span:nth-child(2) {
  color: var(--vp-c-text-2);
}

.api-bob-row > span:nth-child(3) {
  background: var(--ns-accent-subtle);
  color: var(--vp-c-text-1);
}

.api-bob-row--head > span {
  padding-top: 22px;
  padding-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
}

.api-bob-row--head > span:first-child,
.api-bob-row--head > span:nth-child(2) {
  color: var(--vp-c-text-3);
}

.api-bob-row--head > span:nth-child(3) {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 18px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--vp-c-text-1);
}

/* the app mark, so the column reads as ours at a glance */
.api-bob-row--head > span:nth-child(3)::before {
  content: "";
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: url("/images/nutriscan-logo.webp") center / cover no-repeat;
}

/* a check in front of each thing the API already does (Phosphor check, MIT) */
.api-bob-row:not(.api-bob-row--head) > span:nth-child(3) {
  position: relative;
  padding-left: 62px;
  font-weight: 500;
}

.api-bob-row:not(.api-bob-row--head) > span:nth-child(3)::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 21px;
  width: 20px;
  height: 20px;
  background: var(--ns-accent-ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Cost ---------- */

.api-cost {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 72px;
  align-items: start;
}

.api-landing .vp-doc .api-cost-big {
  margin: 0;
  font-size: clamp(64px, 8vw, 104px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: var(--vp-c-text-1);
  font-variant-numeric: tabular-nums;
}

.api-landing .vp-doc .api-cost-big-label {
  margin: 12px 0 24px;
  font-size: 18px;
  font-weight: 600;
  color: var(--ns-accent-ink);
}

.api-estimate {
  margin-top: 32px;
  padding: 24px 26px;
  border-radius: var(--api-radius);
  background: var(--ns-accent-subtle);
}

.api-landing .vp-doc .api-estimate-num {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--vp-c-text-1);
}

.api-estimate-num small {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--vp-c-text-2);
}

.api-landing .vp-doc .api-estimate .api-text {
  font-size: 15px;
}

/* Small table: undo the site's scroll-table treatment, it fits at every width. */
.api-landing .vp-doc table.api-vol {
  display: table;
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  animation: none;
  -webkit-mask-image: none;
  mask-image: none;
  font-variant-numeric: tabular-nums;
}

.api-landing .vp-doc .api-vol tr {
  border: none;
  background: transparent;
}

.api-landing .vp-doc .api-vol th,
.api-landing .vp-doc .api-vol td {
  padding: 14px 0;
  border: none;
  background: transparent;
  font-size: 16px;
  text-align: right;
}

.api-landing .vp-doc .api-vol th:first-child,
.api-landing .vp-doc .api-vol td:first-child {
  text-align: left;
}

.api-landing .vp-doc .api-vol th {
  padding-top: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--vp-c-text-3);
}

.api-landing .vp-doc .api-vol tbody td {
  box-shadow: inset 0 1px 0 var(--vp-c-divider);
  color: var(--vp-c-text-2);
}

.api-landing .vp-doc .api-vol tbody td:first-child,
.api-landing .vp-doc .api-vol tbody td:last-child {
  font-weight: 600;
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc .api-vol-note {
  margin: 8px 0 32px;
  font-size: 13px;
  color: var(--vp-c-text-3);
}

.api-landing .vp-doc ul.api-packs {
  padding: 4px 22px;
  border-radius: var(--api-radius);
  background: var(--api-tone-1);
}

.api-landing .vp-doc .api-packs li {
  display: grid;
  grid-template-columns: 84px 64px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  padding: 14px 0;
  font-size: 15px;
}

.api-landing .vp-doc .api-packs li + li {
  box-shadow: 0 -1px 0 var(--vp-c-divider);
}

.api-packs-name {
  font-weight: 600;
  color: var(--vp-c-text-1);
}

.api-packs-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--vp-c-text-1);
  font-variant-numeric: tabular-nums;
}

.api-packs-detail {
  color: var(--vp-c-text-2);
}

.api-landing .vp-doc .api-cost-terms {
  margin: 20px 0 16px;
  font-size: 15px;
  color: var(--vp-c-text-1);
}

/* ---------- Low risk ---------- */

.api-risk {
  padding: 64px;
  border-radius: var(--api-radius-lg);
  background: var(--api-tone-2);
}

.api-risk-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: 64px;
  align-items: center;
  margin-bottom: 56px;
}

.api-risk .api-sec-head {
  margin-bottom: 0;
}

.api-risk-sample {
  margin: 0;
}

.api-result--static {
  position: static;
  width: auto;
  animation: none;
}

.api-risk-sample figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--vp-c-text-3);
}

.api-risk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 36px 40px;
}

.api-risk-item .api-use-ico {
  background: var(--api-tone-1);
}

.api-landing .vp-doc .api-risk-item h3 {
  margin-bottom: 6px;
  font-size: 19px;
}

.api-landing .vp-doc .api-risk-item .api-text {
  font-size: 16px;
}

.api-landing .vp-doc .api-risk-terms {
  margin: 40px 0 0;
  font-size: 14px;
  color: var(--vp-c-text-3);
}

/* ---------- Global ---------- */

.api-global {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 72px;
  align-items: center;
}

.api-landing .vp-doc .api-global-copy .api-text + .api-text {
  margin-top: 16px;
}

.api-examples {
  display: grid;
  gap: 10px;
  max-width: 440px;
  margin-top: 28px;
}

.api-landing .vp-doc .api-bubble--sm {
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--api-tone-1);
  font-size: 16px;
  box-shadow: none;
}

.api-landing .vp-doc .api-bubble--sm .api-flag {
  margin-right: -4px;
}

/* Flags: one size everywhere, rounded, cropped to 7:5 whatever the source ratio. */
.api-landing .vp-doc img.api-flag {
  flex: none;
  display: inline-block;
  width: 28px;
  height: 20px;
  margin: 0;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(27, 25, 21, 0.06);
  vertical-align: middle;
}

.api-bubble-code {
  flex: none;
  min-width: 30px;
  padding: 2px 0;
  border-radius: 6px;
  background: var(--vp-c-bg-mute);
  font-family: var(--vp-font-family-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: var(--vp-c-text-2);
}

.api-langs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.api-landing .vp-doc .api-langs li {
  padding: 18px 18px 16px;
  border-radius: 14px;
  background: var(--api-tone-1);
  font-size: 15px;
}

.api-landing .vp-doc .api-langs li:nth-child(-n+3) {
  background: var(--ns-accent-subtle);
}

.api-landing .vp-doc .api-langs img.api-flag {
  display: block;
  margin-bottom: 12px;
}

.api-langs b {
  display: block;
  margin-bottom: 2px;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--vp-c-text-1);
}

/* ---------- Developer strip ---------- */

.api-dev {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 48px;
  align-items: center;
  margin-top: 136px;
  padding: 40px;
  border-radius: var(--api-radius-lg);
  background: var(--api-tone-1);
}

.api-landing .vp-doc .api-dev h2 {
  margin-bottom: 10px;
  font-size: 28px;
}

.api-landing .vp-doc .api-dev .api-text {
  font-size: 16px;
}

.api-landing .vp-doc ul.api-dev-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.api-landing .vp-doc .api-dev-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--vp-c-bg-mute);
  color: var(--vp-c-text-1);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.api-landing .vp-doc .api-dev-links a:hover {
  background: var(--vp-c-default-3);
}

.api-landing .vp-doc pre.api-code {
  margin: 0;
  padding: 22px 24px;
  border-radius: var(--api-radius);
  background: var(--api-code-bg);
  color: var(--api-code-text);
  font-family: var(--vp-font-family-mono);
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
}

/* ---------- FAQ ---------- */

.api-faq {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 64px;
  margin-top: 136px;
}

.api-faq-head {
  position: sticky;
  top: 96px;
  align-self: start;
}

.api-landing .vp-doc .api-faq-head a {
  font-weight: 600;
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc .api-faq-list details summary {
  gap: 16px;
  padding: 22px 0;
  font-size: 18px;
  font-weight: 600;
}

.api-landing .vp-doc .api-faq-list details > :not(summary) {
  padding: 0 40px 22px 0;
}

.api-landing .vp-doc .api-faq-list details p {
  font-size: 16px;
}

/* ---------- Vitamins and minerals ---------- */

.api-nutri {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 72px;
  align-items: center;
}

.api-landing .vp-doc .api-nutri-copy .api-text {
  font-size: 19px;
}

.api-landing .vp-doc ul.api-nutri-uses {
  display: grid;
  gap: 20px;
  margin-top: 36px;
}

.api-landing .vp-doc .api-nutri-uses li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  font-size: 16px;
  line-height: 1.55;
  color: var(--vp-c-text-2);
}

.api-nutri-uses b {
  color: var(--vp-c-text-1);
}

.api-nutri-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--api-tone-1);
  color: var(--vp-c-text-1);
}

.api-nutri-panel {
  margin: 0;
  padding: 28px;
  border-radius: var(--api-radius-lg);
  background: var(--api-tone-2);
}

.api-nutri-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 6px;
}

.api-landing .vp-doc .api-nutri-dish {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc .api-nutri-meta {
  margin: 0;
  font-size: 13px;
  color: var(--vp-c-text-3);
}

.api-landing .vp-doc .api-nutri-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--vp-c-text-1);
}

/* Group count: a small data mark. */
.api-nutri-group span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--api-lime);
  color: #1B1915;
  font-size: 12px;
  font-weight: 700;
}

.api-landing .vp-doc ul.api-nutri-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.api-landing .vp-doc .api-nutri-grid li {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--vp-c-bg-soft);
  font-size: 13px;
  line-height: 1.3;
  color: var(--vp-c-text-2);
}

.api-nutri-grid b {
  display: block;
  margin-bottom: 2px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--vp-c-text-1);
  font-variant-numeric: tabular-nums;
}

.api-nutri-grid small {
  margin-left: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--vp-c-text-3);
}

.api-nutri-panel figcaption {
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--vp-c-text-3);
}

/* ---------- Dishes band (inside Global) ---------- */

.api-dishes {
  grid-column: 1 / -1;
  margin-top: 16px;
}

.api-landing .vp-doc ul.api-dish-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.api-landing .vp-doc .api-dish {
  padding: 8px 8px 16px;
  border-radius: 20px;
  background: var(--api-tone-1);
}

.api-landing .vp-doc .api-dish > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0 0 12px;
  border-radius: 14px;
  object-fit: cover;
}

.api-landing .vp-doc .api-dish p {
  margin: 0 8px;
}

.api-landing .vp-doc .api-dish-where {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--vp-font-family-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--vp-c-text-3);
}

.api-landing .vp-doc .api-dish-where img.api-flag {
  width: 21px;
  height: 15px;
  border-radius: 3px;
}

.api-landing .vp-doc .api-dish-name {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc .api-dish-kcal {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--vp-c-text-2);
}

.api-dish-kcal span {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--vp-c-text-1);
  font-variant-numeric: tabular-nums;
}

.api-landing .vp-doc .api-dish-note {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--vp-c-text-3);
}

/* ---------- Phosphor icons in links and FAQ ---------- */

.api-landing .vp-doc a.api-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.api-landing .vp-doc a.api-link::after {
  content: none;
}

/* FAQ chevron: Phosphor caret-down (regular) as a mask, so it takes the text color. */
.api-landing .vp-doc .api-faq-list details summary::after {
  background: var(--vp-c-text-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Examples gallery: the first gallery's rail, a lighter shelf of landscape cards ---------- */

.api-gallery-rail.api-ex-rail {
  gap: 16px;
  padding: 28px;
  scroll-padding-left: 28px;
  background: var(--ns-accent-subtle);
}

.api-ex {
  flex: 0 0 316px;
  padding: 10px 10px 22px;
  border-radius: 24px;
  background: var(--vp-c-bg-soft);
  scroll-snap-align: start;
}

.api-ex-vis {
  position: relative;
  aspect-ratio: 4 / 3;
  margin-bottom: 18px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--vp-c-bg-mute);
}

.api-landing .vp-doc .api-ex-vis > img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}

/* App screen: the top of the framed phone, cut by the card edge. */
.api-landing .vp-doc .api-ex-vis--app img {
  width: 58%;
  height: auto;
  margin: 20px auto 0;
  filter: drop-shadow(0 16px 20px rgba(46, 38, 23, 0.2));
}

.api-ex-chip {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--vp-c-bg-soft);
  box-shadow: 0 10px 24px -12px rgba(46, 38, 23, 0.4);
}

.dark .api-ex-chip {
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.8);
}

.api-landing .vp-doc .api-ex-chip p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--vp-c-text-2);
}

.api-landing .vp-doc .api-ex-chip .api-ex-chip-label {
  margin-bottom: 2px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ns-accent-ink);
}

.api-landing .vp-doc .api-ex-chip .api-ex-chip-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  color: var(--vp-c-text-1);
  font-variant-numeric: tabular-nums;
}

.api-landing .vp-doc .api-ex-chip .api-ex-chip-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

.api-ex-chip-line span:first-child {
  font-weight: 600;
  color: var(--vp-c-text-1);
}

.api-ex-chip-line span:last-child::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--vp-c-text-3);
  vertical-align: 1px;
}

/* Lime dot = a data mark for "on track". */
.api-ex-chip-line--ok span:last-child::before {
  background: var(--api-lime);
}

.api-ex-chip .api-split {
  height: 6px;
  margin: 6px 0;
}

.api-landing .vp-doc .api-ex-chip .api-ex-chip-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--ns-cta-bg);
  color: var(--ns-cta-text);
  font-weight: 600;
}

.api-landing .vp-doc .api-ex h3 {
  margin: 0 10px 6px;
  font-size: 18px;
  line-height: 1.3;
}

.api-landing .vp-doc .api-ex p.api-ex-user,
.api-landing .vp-doc .api-ex p.api-ex-biz {
  margin: 0 10px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--vp-c-text-2);
}

.api-landing .vp-doc .api-ex p.api-ex-biz {
  margin-top: 10px;
  padding-top: 10px;
  box-shadow: 0 -1px 0 var(--vp-c-divider);
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc .api-ex-note {
  margin: 16px 0 0;
  max-width: 52em;
  font-size: 14px;
  line-height: 1.5;
  color: var(--vp-c-text-3);
}

.api-landing .vp-doc .api-gallery-btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

/* ---------- Closing block: app light palette (dark tokens in dark mode) ---------- */

.api-close {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 56px;
  align-items: center;
  margin: 200px 0 24px;
  padding: 72px 64px;
  border-radius: var(--api-radius-lg);
  background: var(--vp-c-bg-soft);
  box-shadow: var(--ns-card-shadow);
}

:root .api-page .VPContent .vp-doc .api-close h2 {
  margin: 0 0 16px;
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

:root .api-page .VPContent .vp-doc .api-close-copy > .api-text {
  margin: 0 0 32px;
  line-height: 1.6;
  color: var(--vp-c-text-2);
  text-wrap: pretty;
  max-width: 28em;
  font-size: 19px;
}

:root .api-page .VPContent .vp-doc ul.api-close-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

:root .api-page .VPContent .vp-doc .api-close-facts li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: var(--vp-c-bg);
  font-size: 14px;
  font-weight: 600;
  color: var(--vp-c-text-1);
}

.api-close-vis {
  position: relative;
  height: 440px;
}

.api-close-food {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 66%;
  margin: 0;
}

:root .api-page .VPContent .vp-doc .api-close-food img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  margin: 0;
  border-radius: 22px;
  object-fit: cover;
}

.api-close-chip {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--vp-c-bg-soft);
  box-shadow: 0 14px 28px -14px rgba(46, 38, 23, 0.45);
  font-size: 13px;
  color: var(--vp-c-text-2);
}

.dark .api-close-chip {
  box-shadow: 0 14px 28px -14px rgba(0, 0, 0, 0.8);
}

.api-close-chip > b {
  font-size: 15px;
  color: var(--vp-c-text-1);
}

.api-close-chip > span:last-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.api-close-chip > span:last-child b {
  color: var(--vp-c-text-1);
  font-variant-numeric: tabular-nums;
}

.api-close-chip-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ns-accent-ink);
}

/* In the 720px article column (pricing): copy over the picture, phone inside the panel. */
.api-close--stack {
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
  margin-top: 96px;
}

@media (min-width: 641px) {
  .api-close--stack {
    padding: 56px 40px;
  }
}

@media (min-width: 641px) {
  .api-close--stack .api-close-vis {
    height: 480px;
  }

  :root .api-page .VPContent .vp-doc .api-close--stack .api-close-food img {
    aspect-ratio: 1;
  }
}

/* The phone rises out of the panel's top edge on desktop. */
.api-close-phone {
  position: absolute;
  right: 0;
  top: -150px;
  width: 236px;
}

.api-close--stack .api-close-phone {
  top: 0;
}

:root .api-page .VPContent .vp-doc .api-close-phone img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  filter: drop-shadow(0 28px 32px rgba(46, 38, 23, 0.28));
}

:root.dark .api-page .VPContent .vp-doc .api-close-phone img {
  filter: drop-shadow(0 28px 32px rgba(0, 0, 0, 0.7));
}

/* ---------- Motion: CSS does the work; the page script only starts it ---------- */

.api-hero-frame {
  border-radius: var(--api-radius-lg);
  overflow: hidden;
}

.api-landing .vp-doc a:not(.api-btn):focus-visible,
.api-langs li:focus-visible {
  outline: 2px solid var(--vp-c-text-1);
  outline-offset: 3px;
  border-radius: 4px;
}

.api-landing .vp-doc a.api-link:hover {
  color: var(--vp-c-text-1);
}

.api-landing .vp-doc a.api-link:active svg {
  transform: translateX(2px);
}

@keyframes api-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes api-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes api-grow {
  from { transform: scaleX(0); }
  to { transform: none; }
}

@keyframes api-pop {
  0% { opacity: 0; transform: scale(0.6); }
  70% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: none; }
}

@keyframes api-type {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes api-pulse {
  0%, 100% { transform: none; }
  50% { transform: scale(1.12); }
}

@media (prefers-reduced-motion: no-preference) {
  /* Hero result arriving: card, kcal, macro bar, grade, items, reason (about 1.2 s). */
  .api-result.api-play {
    animation: api-rise 0.4s var(--api-ease) 0.05s both;
  }

  .api-result.api-play .api-split span {
    transform-origin: left center;
    animation: api-grow 0.35s ease-out both;
  }

  .api-result.api-play .api-split-p { animation-delay: 0.4s; }
  .api-result.api-play .api-split-c { animation-delay: 0.52s; }
  .api-result.api-play .api-split-f { animation-delay: 0.64s; }

  .api-result.api-play .api-grade {
    animation: api-pop 0.3s ease-out 0.5s both;
  }

  .api-result.api-play .api-macro,
  .api-result.api-play .api-items li,
  .api-result.api-play .api-result-reason {
    animation: api-fade 0.3s ease-out both;
  }

  .api-result.api-play .api-macro { animation-delay: 0.6s; }
  .api-result.api-play .api-items li:nth-child(1) { animation-delay: 0.75s; }
  .api-result.api-play .api-items li:nth-child(2) { animation-delay: 0.85s; }
  .api-result.api-play .api-items li:nth-child(3) { animation-delay: 0.95s; }
  .api-result.api-play .api-result-reason { animation-delay: 1.05s; }

  .api-landing .vp-doc .api-hero-photo {
    transition: transform 0.3s ease-out;
  }

  .api-hero-frame:hover .api-hero-photo {
    transform: scale(1.03);
  }

  /* Sections below the fold rise once; the script adds api-pending only to
     sections it is about to watch, so nothing is hidden without it. */
  .api-landing :is(.api-proof, .api-sec, .api-dev, .api-faq, .api-close) {
    transition: opacity 0.5s ease-out, transform 0.5s var(--api-ease);
  }

  html.api-motion .api-landing :is(.api-proof, .api-sec, .api-dev, .api-faq, .api-close).api-pending {
    opacity: 0;
    transform: translateY(20px);
  }

  /* Grids arrive one child after another (--i is set by ApiMotion.vue).
     Fill is backwards only, so hover transforms work once it ends. */
  .api-proof.is-in > *,
  .is-in :is(.api-uses, .api-nutri-uses, .api-nutri-grid, .api-bob, .api-packs, .api-risk-grid, .api-langs, .api-dish-grid, .api-dev-links, .api-close-facts, .api-gallery-rail, .api-faq-list) > * {
    animation: api-fade 0.4s ease-out backwards;
    animation-delay: min(calc(0.15s + var(--i, 0) * 50ms), 0.7s);
  }

  /* Pack label: values read out row by row. */
  .api-vis--label.is-in .api-label > * {
    animation: api-fade 0.3s ease-out backwards;
    animation-delay: calc(0.2s + var(--i, 0) * 90ms);
  }

  /* Text bubble: words type in, then the two parsed rows appear. */
  .api-vis--text.is-in .api-word {
    animation: api-type 0.15s ease-out backwards;
    animation-delay: calc(0.2s + var(--i, 0) * 110ms);
  }

  .api-vis--text.is-in .api-parsed > * {
    animation: api-fade 0.3s ease-out backwards;
    animation-delay: calc(1.05s + var(--i, 0) * 150ms);
  }

  .api-vis--text.is-in .api-bubble-mic {
    animation: api-pulse 0.4s ease-out 0.85s 1;
  }

  /* Hover and press: 150 to 300 ms, ease-out, transform and opacity only. */
  .api-phone img,
  .api-ex,
  .api-use,
  .api-dish,
  .api-langs li,
  .api-packs li,
  .api-close-facts li,
  .api-landing .vp-doc .api-link svg,
  .api-landing .vp-doc ul.api-items li {
    transition: transform 0.2s ease-out, background-color 0.2s ease-out;
  }

  .api-phone:hover img,
  .api-ex:hover,
  .api-dish:hover,
  .api-use:hover,
  .api-packs li:hover {
    transform: translateY(-3px);
  }

  .api-ex:active,
  .api-dish:active,
  .api-use:active,
  .api-packs li:active,
  .api-langs li:active,
  .api-close-facts li:active {
    transform: scale(0.98);
  }

  .api-landing .vp-doc .api-bubble--sm {
    transition: opacity 0.2s ease-out;
  }

  .api-landing .vp-doc a.api-link:hover svg {
    transform: translateX(3px);
  }

  /* FAQ answers open with height and fade where the browser supports it. */
  .api-landing .vp-doc .api-faq-list details {
    interpolate-size: allow-keywords;
  }

  .api-landing .vp-doc .api-faq-list details::details-content {
    height: 0;
    opacity: 0;
    overflow: clip;
    transition: height 0.25s ease-out, opacity 0.25s ease-out, content-visibility 0.25s allow-discrete;
  }

  .api-landing .vp-doc .api-faq-list details[open]::details-content {
    height: auto;
    opacity: 1;
  }
}

.api-landing .vp-doc .api-hero ul.api-items li {
  margin: 0 -8px;
  padding: 7px 8px;
  border-radius: 8px;
}

.api-landing .vp-doc .api-packs li:hover,
.api-landing .vp-doc .api-hero ul.api-items li:hover {
  background: var(--vp-c-bg-mute);
}

.api-landing .vp-doc .api-langs li:hover,
.api-landing .vp-doc .api-dish:hover,
.api-use:not(.api-use--lead):hover {
  background: var(--vp-c-bg-mute);
}

/* en, de and fr have real example lines: hovering their tile brings that line forward. */

.api-global:has(.api-langs li:nth-child(1):hover) .api-examples .api-bubble--sm:not(:nth-child(1)),
.api-global:has(.api-langs li:nth-child(2):hover) .api-examples .api-bubble--sm:not(:nth-child(2)),
.api-global:has(.api-langs li:nth-child(3):hover) .api-examples .api-bubble--sm:not(:nth-child(3)) {
  opacity: 0.4;
}

.api-count {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ---------- Landing: tablet and phone ---------- */

@media (max-width: 960px) {
  .api-landing .api-hero,
  .api-row,
  .api-cost,
  .api-global,
  .api-dev,
  .api-faq {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .api-hero-visual {
    padding-left: 40px;
  }

  .api-row--flip .api-vis {
    order: 0;
  }

  .api-proof {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .api-proof-item--lead {
    grid-column: 1 / -1;
  }

  .api-proof-item + .api-proof-item {
    box-shadow: inset 0 1px 0 var(--vp-c-divider);
  }

  .api-proof-item:nth-child(3) {
    box-shadow: inset 0 1px 0 var(--vp-c-divider), inset 1px 0 0 var(--vp-c-divider);
  }

  .api-proof-item:nth-child(4) {
    grid-column: 1 / -1;
  }

  .api-use--lead {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .api-use--lead .api-day {
    order: 2;
  }

  .api-nutri {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .api-risk-top {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .api-risk-sample {
    max-width: 420px;
  }

  .api-risk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .api-landing .vp-doc ul.api-dish-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .api-close {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
    padding: 56px 40px;
  }

  .api-close-vis {
    height: 400px;
  }

  .api-close-phone {
    top: 0;
  }

  .api-faq-head {
    position: static;
  }
}

@media (max-width: 640px) {
  .api-sec,
  .api-dev,
  .api-faq,
  .api-close {
    margin-top: 88px;
  }

  .api-sec-head {
    margin-bottom: 32px;
  }

  .api-landing .vp-doc .api-sec-head .api-text,
  .api-landing .vp-doc .api-sec-foot {
    font-size: 17px;
  }

  .api-hero-visual {
    padding-left: 0;
  }

  .api-landing .vp-doc .api-hero-photo {
    aspect-ratio: 4 / 3;
  }

  .api-result {
    position: relative;
    left: auto;
    bottom: auto;
    width: auto;
    margin: -72px 14px 0;
  }

  /* Only the hero card overlaps its photo; a static card sits in the flow. */
  .api-result--static {
    margin: 0;
  }

  .api-proof {
    margin-top: 56px;
  }

  .api-proof-item {
    padding: 22px 20px;
  }

  .api-landing .vp-doc .api-proof-num {
    font-size: 32px;
  }

  .api-row {
    gap: 24px;
  }

  .api-row + .api-row {
    margin-top: 56px;
  }

  .api-gallery-nav {
    display: none;
  }

  .api-gallery-rail {
    gap: 16px;
    padding: 28px 20px 24px;
    scroll-padding-left: 20px;
  }

  .api-phone {
    flex-basis: 200px;
  }

  .api-vis {
    min-height: 0;
  }

  .api-landing .vp-doc .api-vis--meal img {
    height: 280px;
  }

  .api-vis-frame {
    inset: 20px;
  }

  .api-vis-pill {
    bottom: 36px;
    font-size: 13px;
  }

  .api-vis--label {
    padding: 32px 24px 84px;
  }

  .api-vis-pill--label {
    bottom: 24px;
  }

  .api-vis--text {
    padding: 28px 18px;
  }

  .api-landing .vp-doc .api-bubble {
    font-size: 17px;
  }

  .api-parsed {
    margin-left: 20px;
  }

  .api-uses {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-use--lead {
    padding: 24px;
  }

  .api-use {
    padding: 10px 22px 24px;
  }

  .api-landing .vp-doc .api-use-photo {
    width: calc(100% + 24px);
    margin: 0 -12px 18px;
  }

  .api-landing .vp-doc .api-nutri-copy .api-text {
    font-size: 17px;
  }

  .api-nutri-panel {
    padding: 20px 14px;
  }

  .api-landing .vp-doc ul.api-nutri-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .api-landing .vp-doc .api-nutri-grid li {
    padding: 10px;
  }

  .api-nutri-grid b {
    font-size: 17px;
  }

  .api-landing .vp-doc ul.api-dish-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .api-bob-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .api-bob-row > span {
    padding: 12px 16px 16px;
    font-size: 14.5px;
  }

  .api-bob-row > span:first-child {
    grid-column: 1 / -1;
    padding: 16px 16px 4px;
  }

  .api-bob-row + .api-bob-row > span:nth-child(2),
  .api-bob-row + .api-bob-row > span:nth-child(3) {
    box-shadow: none;
  }

  .api-bob-row--head > span:first-child {
    display: none;
  }

  .api-bob-row--head > span {
    padding-top: 16px;
  }

  .api-bob-row--head > span:nth-child(3) {
    font-size: 15px;
    gap: 8px;
  }

  .api-bob-row--head > span:nth-child(3)::before {
    width: 22px;
    height: 22px;
    border-radius: 6px;
  }

  .api-bob-row:not(.api-bob-row--head) > span:nth-child(3) {
    padding-left: 40px;
  }

  .api-bob-row:not(.api-bob-row--head) > span:nth-child(3)::before {
    left: 14px;
    top: 14px;
    width: 18px;
    height: 18px;
  }

  .api-cost {
    gap: 48px;
  }

  .api-landing .vp-doc .api-vol th,
  .api-landing .vp-doc .api-vol td {
    font-size: 15px;
  }

  .api-landing .vp-doc .api-packs li {
    grid-template-columns: 64px 52px minmax(0, 1fr);
    gap: 8px;
    font-size: 14px;
  }

  .api-risk {
    padding: 32px 22px;
  }

  .api-risk-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .api-risk-top {
    margin-bottom: 40px;
  }

  .api-langs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .api-dev {
    padding: 24px 20px;
  }

  .api-landing .vp-doc pre.api-code {
    font-size: 12px;
  }

  .api-close {
    padding: 40px 20px 24px;
  }

  /* ponytail: one image on phones; the photo with its result chip carries it. */
  .api-close-vis {
    height: auto;
  }

  .api-close-food {
    position: static;
    width: 100%;
  }

  :root .api-page .VPContent .vp-doc .api-close-food img {
    aspect-ratio: 4 / 3;
  }

  .api-close-phone {
    display: none;
  }

  .api-ex {
    flex-basis: 272px;
  }
}

/* Docs sidebar: same tone as the page, so it does not read as a panel cutting through the
   nav line, and the footer slides over it at the end of the page. */
@media (min-width: 960px) {
  .Layout.ns-api > .VPSidebar { background-color: var(--vp-c-bg); }
  .Layout.ns-api > .VPSidebar .curtain { display: none; }
  /* the footer is a sibling of .Layout; 26 is above the sidebar (25) and below the nav */
  .ns-api ~ .site-footer { position: relative; z-index: 26; }
}

/* VitePress places the "#" 24px down for its own h2 top padding, which /api pages remove. */
.api-page .vp-doc h2 .header-anchor,
.api-landing .vp-doc h2 .header-anchor { top: 0; }

/* Client marks (Claude Code, Claude, Codex, MCP): a one-colour label before a client's name.
   Usage: <span class="api-client api-client--claude-code">Claude Code</span>, on a link or heading too.
   Rule for use: agents/SEO/api-platform/mcp.md, last paragraph. */
.api-client::before {
  content: "";
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  margin-right: 0.45em;
  vertical-align: -0.16em;
  background: currentColor;
  -webkit-mask: var(--api-client-mark) center / contain no-repeat;
  mask: var(--api-client-mark) center / contain no-repeat;
}
.api-client--claude-code { --api-client-mark: url("/images/api/clients/claude-code.svg"); }
.api-client--claude { --api-client-mark: url("/images/api/clients/claude.svg"); }
.api-client--codex { --api-client-mark: url("/images/api/clients/openai.svg"); }
.api-client--mcp { --api-client-mark: url("/images/api/clients/mcp.svg"); }

/* landing MCP section: command block and link under the four points */
:root .VPContent .vp-doc .api-risk-grid + pre.api-code { margin: 48px 0 0; max-width: 760px; }
:root .VPContent .vp-doc pre.api-code + .api-link { margin-top: 28px; }
