/* Standalone integration on the owner's original R66 design.
 * Keep the supplied palette, layout, images and original CSS unchanged.
 * The old v61 layer forced system/Georgia fonts after the R66 local font faces;
 * these overrides apply the supplied brand families to their existing roles.
 */
html body{font-family:"Figtree",system-ui,sans-serif!important}
html body h1,html body h2,html body h3,html body h4,html body .brand,html body .rez-titel,
html body .swf-shopping-cta-copy strong{font-family:"Fraunces",Georgia,serif!important}
html body button,html body input,html body select,html body textarea,
html body nav.links a,html body .lang-switch,html body .nav-cta,html body .mobile-menu a,
html body .breadcrumb,html body .kcard-kicker,html body .rez-kat,html body .eyebrow,
html body .more,html body .rez-open,html body .metabar,html body .btn,
html body .page-numbers,html body .swf-filter-chip{font-family:"Plus Jakarta Sans","Figtree",sans-serif!important}
html body code,html body pre,html body kbd,html body samp{font-family:"JetBrains Mono",monospace!important}

/* The original macro calculator's grid item kept its intrinsic input width at
 * 320px, clipping the fields at the card edge. Let the existing column shrink. */
html body .swf-tools-page .tool-grid > *{min-width:0}

/* Original methodology fragment: use the existing editorial reading width.
 * Preserve the four-column table and scroll it locally on narrow viewports. */
html body.page #hauptinhalt > .wrap.swf-methodology-page{max-width:760px!important;min-width:0;margin-block:32px}
html body .swf-methodology-page .swf-page-table-scroll{max-width:100%;overflow-x:auto;margin:1.5rem 0}
html body .swf-methodology-page .swf-page-table-scroll:focus-visible{outline:3px solid var(--green,#2aa860);outline-offset:3px}
html body .swf-methodology-page table.data{width:100%}

/* Original standalone tool pages: keep intrinsic form widths in their grid
 * column. The meal table's absolute screen-reader label must be contained by
 * its existing local scroller instead of extending the entire page. */
html body .swf-protein .pr-feld{min-width:0}
html body .swf-protein .pr-feld input,
html body .swf-protein .pr-feld select{box-sizing:border-box;min-width:0;max-width:100%;width:100%}
html body .swf-mahlzeit .mz-tabelle-wrap{position:relative;max-width:100%}
html body .swf-mahlzeit .mz-tabelle-wrap:focus-visible{outline:3px solid var(--green,#2aa860);outline-offset:3px}

/* A source article's medical-note footer is part of the reading surface.
 * The original site's generic footer rule must not give it the site footer's
 * dark background. Keep the original note typography, spacing and content. */
html body .swf-article-document footer{background:transparent!important;color:#53685C!important}
html body .swf-article-document footer a{color:#17663D!important}
html body .swf-article-document :is(.swf-table-scroll,.tabelle-scroll,.tabelle-rollbar):focus-visible{outline:3px solid var(--green,#2aa860);outline-offset:3px}

/* R62 already exposes the full mobile navigation when JavaScript is absent.
 * Keep that fallback in document flow so it cannot cover the page's links. */
html.no-js body header.nav{position:static!important}

/* The introductory original tool cards and personal-record heading use the
 * same existing site width; the calculator section keeps its full background. */
html body.page #hauptinhalt > :is(.swf-tools-heading,.swf-standalone-tools-intro,.swf-personal-workspace){width:calc(100% - 48px)!important;max-width:1180px!important;min-width:0;margin-inline:auto}
html body .swf-personal-workspace{margin-block:40px}
@media(max-width:720px){html body.page #hauptinhalt > :is(.swf-tools-heading,.swf-standalone-tools-intro,.swf-personal-workspace){width:calc(100% - 28px)!important}}

/* Catalog-bound original artwork: preserve its complete motif and intrinsic
 * ratio. Existing in-article measurements retain their separate zoom controls. */
html body .swf-article-document figure.swf-source-hero{max-width:100%;box-sizing:border-box}
html body .swf-article-document figure.swf-source-hero img[data-swf-source-cover-image]{display:block;width:100%;max-width:100%;height:auto!important;max-height:none!important;object-fit:contain}
html body .swf-article-document figure.swf-source-hero figcaption{color:#53685C;font-size:.875rem;line-height:1.5}

/* The owner's card-grid rule: at most three columns, using the collection's
 * actual available width. 280px cards + 24px gaps yield 2 columns from 584px
 * and 3 from 888px; narrow parents remain one column without overflow.
 * Match only established card collections, never hero splits or form grids. */
html body #hauptinhalt :is(
  .card-grid:has(> :is(.pcard,.kcard)),
  .wissen-grid:has(> .wissen-card),
  .rez-grid:has(> .rez-card),
  .swf-blog-grid:has(> .swf-blog-card),
  .swf-news-grid:has(> .news-card),
  .tool-picker-grid:has(> .tool-tile),
  .swf-einkauf-liste:has(> .ek-rezept-card),
  .swf-account-recipes:has(> .swf-account-recipe)
){
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,max(280px,calc((100% - 48px)/3))),1fr))!important;
  gap:24px!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0;
  box-sizing:border-box;
}
html body #hauptinhalt :is(
  .card-grid:has(> :is(.pcard,.kcard)),
  .wissen-grid:has(> .wissen-card),
  .rez-grid:has(> .rez-card),
  .swf-blog-grid:has(> .swf-blog-card),
  .swf-news-grid:has(> .news-card),
  .tool-picker-grid:has(> .tool-tile),
  .swf-einkauf-liste:has(> .ek-rezept-card),
  .swf-account-recipes:has(> .swf-account-recipe)
) > *{min-width:0}

/* Keep the original 44px portion controls inside narrow shopping cards.
 * Anchor the existing image label to its image, including during card hover. */
html body #swfEinkauf .ek-rezept-fuss{flex-wrap:wrap}
html body #swfEinkauf .ek-rezept-bild{position:relative}

/* Standalone planners use the same original site axis as their heading.
 * Their shortcode fragments have no page container; without this boundary
 * they stretch to the viewport edges. The original full-background tools
 * overview and the shopping planner's own container remain untouched. */
html body.page #hauptinhalt > :is(.swf-standalone-tool-heading,#swfMahlzeit,#swfProtein,#swfNP){width:calc(100% - 48px)!important;max-width:1180px!important;min-width:0;margin-inline:auto;box-sizing:border-box}
html body.page #hauptinhalt > :is(#swfMahlzeit,#swfProtein,#swfNP){margin-bottom:40px}
html body .swf-standalone-tool-heading header.art{padding:32px 0 8px!important}
html body .swf-standalone-tool-heading header.art h1{font-size:clamp(2rem,3vw,2.75rem)!important;overflow-wrap:break-word}
@media(max-width:720px){html body.page #hauptinhalt > :is(.swf-standalone-tool-heading,#swfMahlzeit,#swfProtein,#swfNP){width:calc(100% - 28px)!important}}

/* Five nutrition results must fit their labels, not reserve empty grid tracks.
 * Keep the supplied cards and values; the table retains all columns locally. */
html body #swfMahlzeit .mz-werte{grid-template-columns:repeat(auto-fit,minmax(min(100%,max(180px,calc((100% - 44px)/5))),1fr))}
html body #swfMahlzeit .mz-kachel{min-width:0}
html body #swfMahlzeit .mz-kl{overflow-wrap:anywhere}
html body #swfMahlzeit .mz-g{width:6rem;min-width:6rem;box-sizing:border-box}
html body #swfMahlzeit .swf-tool-scroll-hint{display:none}
@media(max-width:720px){html body #swfMahlzeit .swf-tool-scroll-hint{display:block;font-size:.85rem;color:var(--ink-soft);margin:0 0 10px}}
