/* ==========================================================================
   Cal Habibi — food pages and calculator

   Loaded after styles.css and landing.css by the pages that
   tool/build_site_pages.mjs generates. Like landing.css it adds only the
   components these pages introduce and reuses the system's tokens; it does
   not restate the palette or the type stack.
   ========================================================================== */

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13.5px; color: var(--ink-3); margin-block-end: 22px; }
.crumbs a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.crumbs a:hover { text-decoration-color: var(--coral); }

.h-sub { font-size: clamp(22px, 2.6vw, 28px); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin-block-end: 22px; }

.source-line { font-size: 12.5px; color: var(--ink-3); margin-block-start: 28px; }
.source-line a { text-decoration: underline; text-underline-offset: 3px; }

/* ===== Food page ========================================================= */
.food-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.food-hero .lede { margin-block-start: 18px; max-width: 560px; }
.food-shot { margin: 0; }
.food-shot img {
  width: clamp(160px, 22vw, 256px);
  height: auto;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-m);
  background: #fff;
}

.kcal-big { display: flex; align-items: baseline; gap: 10px; margin-block-start: 26px; }
.kcal-big b {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 8vw, 88px);
  line-height: .9;
  letter-spacing: -.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.kcal-big span { font-size: 15px; color: var(--ink-3); }
[lang="ar"] .kcal-big b { font-family: var(--font); font-weight: 600; }

.food-facts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
.nutri h2, .food-note h2 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-block-end: 16px; }
.food-note p { color: var(--ink-2); margin-block-end: 12px; }

.portion { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--ink-2); margin-block-end: 16px; }
.portion input { width: 6.5em; }

.calc-form input, .calc-form select, .portion input, .food-filter input {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  min-width: 0;
}
.calc-form input:focus-visible, .calc-form select:focus-visible, .portion input:focus-visible, .food-filter input:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 1px;
}

.nutri-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius-m); overflow: hidden; box-shadow: var(--shadow-s); }
.nutri-table th, .nutri-table td { padding: 12px 18px; text-align: start; border-block-end: 1px solid var(--line); font-size: 15px; }
.nutri-table thead th { font-size: 12.5px; font-weight: 500; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.nutri-table td, .nutri-table thead th:last-child { text-align: end; font-variant-numeric: tabular-nums; }
.nutri-table tbody th { font-weight: 500; color: var(--ink-2); }
.nutri-table tbody tr:first-child th, .nutri-table tbody tr:first-child td { font-weight: 600; color: var(--ink); }
.nutri-table tbody tr:last-child th, .nutri-table tbody tr:last-child td { border-block-end: 0; }

.macro-split { margin-block-start: 22px; }
.macro-split p { font-size: 14.5px; color: var(--ink-2); margin-block-end: 10px; }
.macro-bar { display: flex; height: 10px; border-radius: var(--radius-pill); overflow: hidden; background: var(--line); }
.macro-bar i { display: block; height: 100%; }
.m-p { --m: var(--protein); }
.m-c { --m: var(--carbs); }
.m-f { --m: var(--fat); }
.macro-bar i { background: var(--m); }
.macro-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-block-start: 10px; font-size: 13px; color: var(--ink-3); }
.macro-legend li, .calc-macros li { display: flex; align-items: center; gap: 7px; }
.macro-legend li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--m); }

/* ===== Food cards (index and related) ==================================== */
.food-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.food-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 12px 12px 16px;
  background: #fff;
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-s);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.food-card:hover, .food-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-m); }
.food-card img { width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--radius-s); margin-block-end: 6px; }
.food-card-name { font-weight: 500; font-size: 15px; line-height: 1.3; color: var(--ink); }
.food-card-kcal { font-size: 13px; color: var(--ink-3); }
.food-card-kcal b { color: var(--ink); font-weight: 600; }

.food-filter { display: flex; flex-direction: column; gap: 8px; max-width: 420px; margin-block: 30px 10px; font-size: 14px; color: var(--ink-2); }
.food-empty { color: var(--ink-3); margin-block: 20px; }
.food-group { margin-block-start: 44px; }
[hidden] { display: none !important; }

/* ===== Calculator ======================================================== */
.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
  margin-block-start: 36px;
}
.calc-form { display: flex; flex-direction: column; gap: 18px; }
.calc-form label { display: flex; flex-direction: column; gap: 7px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.calc-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.seg legend { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-block-end: 7px; padding: 0; }
.calc-form .seg-opt { flex-direction: row; }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-opt span {
  display: inline-block;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}
.seg-opt input:checked + span { background: var(--ink); color: #fff; box-shadow: none; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--coral); outline-offset: 2px; }

.calc-result { background: #fff; border-radius: var(--radius-l); box-shadow: var(--shadow-m); padding: clamp(22px, 3vw, 34px); }
.calc-k { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.calc-result .kcal-big { margin-block-start: 8px; }
.calc-macros { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-block: 20px; }
.calc-macros li { flex-direction: column; align-items: flex-start; gap: 2px; font-size: 13px; color: var(--ink-3); padding-inline-start: 12px; border-inline-start: 3px solid var(--m); }
.calc-macros b { font-size: 20px; font-weight: 600; color: var(--ink); }
.calc-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-extra > div { background: var(--band); border-radius: var(--radius-s); padding: 12px 14px; }
.calc-extra dt { font-size: 12.5px; color: var(--ink-3); }
.calc-extra dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.calc-note { font-size: 13.5px; color: var(--ink-2); margin-block-start: 14px; }
.calc-note:empty { display: none; }

.ramadan { border-block-start: 1px solid var(--line); margin-block-start: 26px; padding-block-start: 22px; }
.ramadan .h-sub { font-size: 20px; margin-block-end: 8px; }
.ramadan > p { font-size: 14.5px; color: var(--ink-2); margin-block-end: 14px; }
.range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; color: var(--ink-2); margin-block-end: 14px; }
.range input { flex: 1 1 100%; accent-color: var(--coral); }
.range output { font-weight: 600; color: var(--ink); }

.calc-how { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.calc-how ol { list-style: decimal; padding-inline-start: 1.25em; color: var(--ink-2); }
.calc-how li { margin-block-end: 10px; }
.calc-disclaimer { font-size: 13.5px; color: var(--ink-3); margin-block-start: 16px; }

/* "On your plate" card (pilot on baklava and croissant) */
.plate-cta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
  background: var(--band);
  border-radius: var(--radius-l);
  padding: clamp(24px, 4vw, 44px);
}
.plate-cta p { color: var(--ink-2); margin-block-start: 12px; max-width: 560px; }
.plate-cta .plate-vary { color: var(--ink); font-weight: 500; }
.plate-cta .plate-get { font-weight: 600; color: var(--ink); margin-block-start: 20px; }
.plate-cta .get-stores { justify-content: flex-start; margin-block-start: 12px; }
.plate-shot { margin: 0; }
.plate-shot figcaption { font-size: 12.5px; color: var(--ink-3); text-align: center; margin-block-start: 8px; }
.portions-note { font-size: 13px; color: var(--ink-3); margin-block-start: 10px; }
.plate-shot img { width: clamp(140px, 18vw, 200px); height: auto; display: block; border-radius: var(--radius-m); }

@media (max-width: 760px) {
  .food-hero-grid, .food-facts-grid, .calc-grid, .calc-how, .plate-cta-grid { grid-template-columns: minmax(0, 1fr); }
  .plate-shot { justify-self: center; }
  .food-shot { order: -1; }
  .food-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .calc-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .calc-row label:first-child { grid-column: 1 / -1; }
}

/* ===== Article pages (AI calorie counter) ================================ */
.prose { max-width: 760px; }
.prose > p { color: var(--ink-2); margin-block-end: 14px; }
.prose > p a, .prose-list a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.prose > p a:hover, .prose-list a:hover { text-decoration-color: var(--coral); }
.prose .lede { margin-block: 18px 40px; }
.prose .h-sub { margin-block: 44px 14px; }
.prose-list { padding-inline-start: 1.25em; color: var(--ink-2); }
ul.prose-list { list-style: disc; }
ol.prose-list { list-style: decimal; }
.prose-list li { margin-block-end: 10px; }
.prose-list b { color: var(--ink); font-weight: 600; }

/* Ramadan guide */
.prose .ramadan-table { margin-block: 6px 8px; }
.ramadan-table td { white-space: nowrap; }
.prose .ramadan-table a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.prose .ramadan-table a:hover { text-decoration-color: var(--coral); }
.prose .table-note, .prose .sources { font-size: 13.5px; color: var(--ink-3); }
.prose .sources a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.ramadan > p a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.prose .updated { font-size: 13.5px; color: var(--ink-3); margin-block: 10px 18px; }
.prose .facts { margin-block: 18px 8px; }

/* USDA foods have no photo: a lettered tile in the photo's place. */
.food-card-ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; aspect-ratio: 1; border-radius: var(--radius-s); margin-block-end: 6px; background: radial-gradient(120% 90% at 85% 10%, rgba(255, 138, 92, .22), transparent 60%), linear-gradient(160deg, #fff, var(--paper)); box-shadow: inset 0 0 0 1px var(--line); }
.food-card-ph b { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; font-size: 52px; line-height: 1; color: var(--coral, #F26B4E); font-variant-numeric: tabular-nums; }
.food-card-ph small { font-size: 13px; color: var(--ink-3); }
[dir="rtl"] .food-card-ph b { font-family: inherit; font-weight: 600; font-size: 44px; }
.portions-h { font-size: 15px; font-weight: 600; margin-block: 22px 10px; }
.portions-table td { white-space: nowrap; }

/* Comparison table: scrolls inside its card on a phone, never the page. */
.compare-wrap { overflow-x: auto; margin-block: 6px 8px; border-radius: var(--radius-m); }
.compare-table { min-width: 560px; }
.compare-table thead th:last-child { text-align: start; }
.compare-table td { text-align: start; font-size: 14px; vertical-align: top; }
.compare-table tbody tr:first-child th, .compare-table tbody tr:first-child td:not(.us) { font-weight: 500; color: var(--ink-2); }
.compare-table th.us, .compare-table td.us { background: rgba(255, 94, 98, .06); color: var(--ink); font-weight: 600; }
.calc-row--ftin { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.calc-row--ftin[hidden], .calc-row label[hidden] { display: none; }
@media (max-width: 760px) {
  .calc-row--ftin label:first-child { grid-column: auto; }
  .calc-row label[data-units="us"] { grid-column: 1 / -1; }
}

/* Food page quick answers, the in-page app link, and the "next step" link
   under a calculator result. */
.qa-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-block: 18px 16px; }
.qa { background: #fff; border-radius: var(--radius-s); box-shadow: var(--shadow-m); padding: 18px 20px; }
.qa h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.qa p { font-size: 14.5px; color: var(--ink-2); margin: 0; }
.inline-cta { font-size: 14.5px; color: var(--ink-2); margin-block-start: 18px; }
.inline-cta a, .calc-next a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.calc-next { font-size: 14.5px; margin-block-start: 16px; }
.bmi-extra { grid-template-columns: 1fr; margin-block-start: 16px; }
.calc-form > label[hidden] { display: none; }
@media (max-width: 760px) {
  .qa-list { grid-template-columns: minmax(0, 1fr); }
}

/* Circles page: the hero reuses the landing page's Circles grid and stage;
   the points table reuses the comparison table, with the points column
   tinted and every row at full weight; "sees / never sees" are two cards. */
.circles-copy .lede { margin-block: 18px 28px; }
.points-table tbody tr:first-child th, .points-table tbody tr:first-child td:not(.us) { font-weight: inherit; color: inherit; }
.points-table td.us { white-space: nowrap; }
.points-table { min-width: 0; }
.points-table th, .points-table thead th:last-child { text-align: start; }
.points-table th, .points-table td { vertical-align: top; }
.points-table tbody th { white-space: nowrap; }
.circle-priv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-block: 18px 16px; }
.circle-priv-card { background: #fff; border-radius: var(--radius-s); box-shadow: var(--shadow-m); padding: 18px 20px; border-block-start: 3px solid var(--line-2); }
.circle-priv-card.never { border-block-start-color: var(--coral); }
.circle-priv-card h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.circle-priv-card p { font-size: 14.5px; color: var(--ink-2); margin: 0; }
@media (max-width: 760px) {
  .circle-priv { grid-template-columns: minmax(0, 1fr); }
}
