/* r11 Nutrition totals dashboard (CSS only, self-hosted). Layout from Boss's prototype (design only).
   Identity hues live ONLY in the screen + forced-colors:none block below, as custom properties:
   to swap in fallback B, set the four --nt-id-* nutrient values to #62d736 (one place). Colour names a nutrient,
   never an amount or status. Patterns (solid / stripes / dots), swatches, names and the text list carry identity. */

/* ---------- layout (screen) ---------- */
@media screen {
  .nt-step1, .nt-app > section, .nt-split, .nt-other, .nt-bars, .nt-tableview { border-radius: 16px; }
  .nt-app > section { padding: 4px 20px 16px; border: 1px solid #6e6e6e; margin: 16px 0; }
  .nt-app > section > h2 { font-size: 24px; margin: 16px 0 12px; }
  .nt-tot > h2 { margin-top: 8px; }
  .nt-cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 16px 0; }
  .nt-card { border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; }
  .nt-card-name { font-size: 14px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
  .nt-card-val { font-size: 34px; font-weight: 700; line-height: 1.15; margin: 6px 0 8px; font-variant-numeric: tabular-nums; }
  .nt-cards > .nt-calctl { grid-column: 1 / -1; margin: 0; }
  .nt-split, .nt-other, .nt-bars, .nt-tableview { border: 1px solid #6e6e6e; padding: 4px 20px 16px; margin: 16px 0; }
  .nt-col-a > :first-child { margin-top: 16px; }
  .nt-split > h3, .nt-other > h3, .nt-bars > h3 { font-size: 22px; }
  .nt-split-svg { height: 44px; box-sizing: border-box; border: 2px solid #ececec; border-radius: 6px; }
  .nt-split-list li { display: inline-flex; align-items: center; gap: 10px; }
  .nt-swatch { flex: 0 0 auto; width: 34px; height: 22px; box-sizing: border-box; border: 2px solid #ececec; border-radius: 4px; display: block; }
  .nt-list-table .nt-btn { white-space: nowrap; overflow-wrap: normal; }
  .nt-details > table { width: calc(100% - 28px); }   /* r9b/r10 table ran 14 px past the drawer edge */
  .nt-amdr2024 { display: block; margin-top: 8px; font-weight: 400; }
}
@media print {
  .nt-split-list li { display: inline-flex; align-items: center; gap: 10px; }
  .nt-swatch { flex: 0 0 auto; width: 34px; height: 22px; box-sizing: border-box; border: 2px solid #18293d; border-radius: 4px; display: block; }
}
@media screen and (min-width: 1000px) {
  main { width: min(1180px, calc(100% - 48px)); }
  .js .nt-app { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: 24px; grid-auto-flow: row dense; align-items: start; }
  .js .nt-app > * { grid-column: 1 / -1; }
  .js .nt-app > .nt-step1 { grid-column: 2; grid-row: span 2; }
  .js .nt-app > .nt-step2 { grid-column: 1; }
  .js .nt-app > .nt-showrow { grid-column: 1; }
  .nt-tot { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 24px; align-items: start; }
  .nt-tot > * { grid-column: 1 / -1; }
  .nt-tot > .nt-col-a { grid-column: 1; }
  .nt-tot > .nt-bars { grid-column: 2; }
  .nt-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media screen and (max-width: 720px) {
  .nt-app > section, .nt-split, .nt-other, .nt-bars, .nt-tableview { padding: 2px 14px 14px; }
  .nt-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .nt-card { padding: 12px 12px; }
  .nt-card-name { font-size: 13px; letter-spacing: .03em; }
  .nt-card-val { font-size: 26px; }
}
@media screen and (max-width: 359px) {
  .nt-cards { grid-template-columns: minmax(0, 1fr); }
  .nt-app > section, .nt-split, .nt-other, .nt-bars, .nt-tableview { padding: 2px 10px 12px; }
  .nt-details > :not(summary) { margin-left: 8px; margin-right: 8px; }
  .nt-details > table { width: calc(100% - 16px); }
  .nt-amdr th, .nt-amdr td { padding: 8px 6px; }
}

/* ---------- colours (screen, normal colours only) ---------- */
@media screen and (forced-colors: none) {
  :root {
    --nt-id-protein: #c4b5fd;  /* A2 */
    --nt-id-carb:    #99f6e4;
    --nt-id-fat:     #38bdf8;
    --nt-id-fiber:   #e879f9;
    --nt-id-cal:     #ececec;  /* neutral, never a nutrient hue */
    --nt-id-mark:    #000000;  /* pattern marks and separators */
    --nt-id-edge:    #ececec;  /* bar outline */
  }
  html .nt-card { border: 2px solid #8a8a8a; border-top: 2px solid #8a8a8a; background: #000; }
  html .nt-card .nt-card-name { color: #c8c8c8; }
  html .nt-card-protein .nt-card-val { color: var(--nt-id-protein); }
  html .nt-card-carb .nt-card-val { color: var(--nt-id-carb); }
  html .nt-card-fat .nt-card-val { color: var(--nt-id-fat); }
  html .nt-card-fiber .nt-card-val { color: var(--nt-id-fiber); }
  html .nt-card-energy .nt-card-val { color: var(--nt-id-cal); }
  html .nt-split-svg { border-color: var(--nt-id-edge); }
  html .nt-swatch { border-color: var(--nt-id-edge); }
  html .nt-split-svg .nt-seg, html .nt-swatch .nt-seg { stroke: none; }
  html .nt-split-svg .nt-seg-p, html .nt-swatch .nt-seg-p { fill: var(--nt-id-protein); }
  html .nt-split-svg .nt-pc-bg, html .nt-pc-bg { fill: var(--nt-id-carb); }
  html .nt-split-svg .nt-pf-bg, html .nt-pf-bg { fill: var(--nt-id-fat); }
  html .nt-split-svg .nt-pc-mk, html .nt-pc-mk, html .nt-split-svg .nt-pf-mk, html .nt-pf-mk { fill: var(--nt-id-mark); }
  html .nt-split-svg .nt-sep { stroke: var(--nt-id-mark); }
}

/* ---------- forced colours: hues drop away; names, patterns, swatches and the list carry identity ---------- */
@media (forced-colors: active) {
  .nt-split-svg, .nt-swatch { forced-color-adjust: none; border: 2px solid CanvasText; background: Canvas; }
  .nt-split-svg .nt-seg, .nt-swatch .nt-seg { stroke: none; }
  .nt-seg-p { fill: CanvasText; }
  .nt-pc-bg, .nt-pf-bg { fill: Canvas; }
  .nt-pc-mk, .nt-pf-mk { fill: CanvasText; }
  .nt-split-svg .nt-sep { stroke: CanvasText; }
  .nt-card { border: 1px solid CanvasText; }
}
