/*
 * Subway Nutrition Pages — Global Design System
 * Extracted from https://www.subway.com/en-au/menunutrition/nutrition
 */

:root {
  /* ─── Brand colors ─────────────────────────────────────────────────────── */
  --color-subway-green: #006230;
  --color-subway-green-dark: #00543d;
  --color-subway-green-light: #028940;
  --color-subway-yellow: #ffc20d;
  --color-subway-green-mid: #008952;

  /* Gold / mustard for promo headlines (e.g. franchise popup) — distinct from banner yellow */
  --color-subway-heading-mustard: #b8972d;
  --color-cta-teal: #0e82af;
  --color-cta-red: #de3804;
  --color-cta-yellow: #ffc20d;
  --color-white: #fff;
  --color-black: #000;
  --color-shadow-green-dark: #012d21;

  /* ─── Semantic colors ──────────────────────────────────────────────────── */
  --background-color: #fff;
  --light-color: #f8f8f8;
  --dark-color: #505050;
  --text-color: #545454;
  --text-color-dark: #353535;
  --link-color: #00543d;
  --link-hover-color: var(--color-subway-green-light);
  --heading-color: var(--color-subway-green-light);
  --heading-color-h3: var(--color-subway-green-light);
  --border-color: #ccc;
  --border-color-strong: #999;
  --color-border-light: #e8e8e8;
  --color-border-soft: #dadada;

  /* ─── UI surface colors ────────────────────────────────────────────────── */
  --color-surface-muted: #e0e0e0;
  --color-text-muted: #666;
  --color-text-strong: #333;
  --color-bg-subtle: #f0f0f0;
  --color-bg-card: #fcfcfc;

  /* fonts — Subway uses Roboto */
  --body-font-family: roboto, roboto-fallback, sans-serif;
  --heading-font-family: roboto, roboto-fallback, sans-serif;

  /* ─── Font sizes ───────────────────────────────────────────────────────── */
  --body-font-size-m: 14px;
  --body-font-size-base: 15px;
  --body-font-size-s: 13px;
  --body-font-size-xs: 11px;
  --body-font-size-2s: 12px;
  --body-font-size-l: 18px;
  --body-font-size-xl: 20px;
  --heading-font-size-sm: 22px;
  --heading-font-size-xxl: 24px;
  --heading-font-size-xl: var(--heading-font-size-xxl);
  --heading-font-size-l: 21px;
  --heading-font-size-m: 14px;
  --heading-font-size-s: 13px;
  --heading-font-size-xs: 11px;

  /* ─── Line heights ─────────────────────────────────────────────────────── */
  --body-line-height: 1.43;
  --heading-line-height: 1.2;
  --para-line-height: 1.35;
  --line-height-relaxed: 1.4;
  --button-line-height: 1.25;

  /* ─── Font weights ─────────────────────────────────────────────────────── */
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* ─── Border ───────────────────────────────────────────────────────────── */
  --border-width: 2px;
  --border-radius-s: 3px;
  --border-radius-base: 4px;
  --border-radius-m: 8px;
  --border-radius-pill: 28px;

  /* ─── Spacing scale (px) ───────────────────────────────────────────────── */
  --spacing-0: 0;
  --spacing-2: 2px;
  --spacing-6: 6px;
  --spacing-xxs: 4px;
  --spacing-5: 5px;
  --spacing-xs: 8px;
  --spacing-10: 10px;
  --spacing-s: 12px;
  --spacing-m: 16px;
  --spacing-l: 20px;
  --spacing-xl: 24px;
  --spacing-25: 25px;
  --spacing-30: 30px;
  --spacing-xxl: 40px;

  /* ─── Spacing — em-based typography rhythm ─────────────────────────────── */
  --spacing-block-top: 0.8em;
  --spacing-block-bottom: 0.25em;

  /* ─── Layout ───────────────────────────────────────────────────────────── */
  --layout-max-width: 1000px;
  --layout-max-width-desktop: 1000px;
  --layout-max-width-tablet: 768px;
  --layout-section-max-width: 1000px;
  --icon-size: 24px;

  /* ─── Component tokens ─────────────────────────────────────────────────── */
  --section-spacing: var(--spacing-l);
  --content-padding: 15px;
  --main-padding-bottom: 35px;
  --nav-height: 72px;

  /* ─── Shared gradients ────────────────────────────────────────────────── */
  --gradient-btn-default: linear-gradient(#e0e2e0, #909290);
  --gradient-btn-hover: linear-gradient(#489180, #0d5f49);

  /* ─── Transitions ──────────────────────────────────────────────────────── */
  --transition-base: 0.2s ease;
}

/* fallback fonts */
@font-face {
  font-family: roboto-fallback;
  size-adjust: 99.529%;
  src: local('Arial');
}

body {
  display: none;
  margin: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--heading-font-family);
  font-size: var(--body-font-size-m);
  font-weight: var(--font-weight-light);
  line-height: var(--body-line-height);
}

body.appear {
  display: block;
}

header {
  background-color: var(--background-color);
  position: relative;
  z-index: 2;
  max-width: var(--layout-max-width);
  margin: 0 auto;
  min-height: var(--nav-height);
}

main {
  margin: 0 auto;
  padding-bottom: var(--main-padding-bottom);
  position: relative;
}

body.boxed header,
body.boxed main {
  border-left: 1px solid var(--border-color-strong);
  border-right: 1px solid var(--border-color-strong);
  box-shadow: 0 -3px 6px var(--text-color-dark);
}

body.boxed main:has(> .marquee-container:first-child),
body.boxed main:has(> .hero-container:first-child .hero picture) {
  border: none;
  box-shadow: none;
}

header .header,
footer .footer {
  visibility: hidden;
}

header .header[data-block-status="loaded"],
footer .footer[data-block-status="loaded"] {
  visibility: visible;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: var(--spacing-0);
  font-family: var(--heading-font-family);
  font-weight: var(--font-weight-bold);
  line-height: var(--heading-line-height);
  scroll-margin: var(--spacing-xxl);
  color: var(--heading-color);
}

h1 { font-size: var(--heading-font-size-xxl); }
h2 { font-size: var(--heading-font-size-xl); }

h3 {
  font-size: var(--heading-font-size-l);
}

h4 { font-size: var(--heading-font-size-m); }
h5 { font-size: var(--heading-font-size-s); }
h6 { font-size: var(--heading-font-size-xs); }

p, dl, ol, ul, pre, blockquote {
  margin-top: var(--spacing-block-top);
  margin-bottom: var(--spacing-block-bottom);
}

p {
  margin: var(--spacing-0);
  padding: var(--spacing-0);
  color: var(--text-color-dark);
  font-weight: var(--font-weight-light);
  line-height: var(--para-line-height);
}

ul, ol {
  margin-top: 0;
  margin-bottom: 10px;
}

li {
  box-sizing: border-box;
}

body.boxed ul {
  margin-bottom: var(--spacing-xxl);
}

body.boxed ul:has(+ ul) {
  margin-bottom: var(--spacing-10);
}

code, pre {
  font-size: var(--body-font-size-s);
}

pre {
  padding: var(--spacing-m);
  border-radius: var(--border-radius-m);
  background-color: var(--light-color);
  overflow-x: auto;
  white-space: pre;
}

main > div {
  margin: var(--spacing-l) auto;
  padding: 0 var(--content-padding);
}

input, textarea, select, button {
  font: inherit;
}

/* links */
a:any-link {
  color: var(--link-color);
  text-decoration: underline;
  overflow-wrap: break-word;
  line-height: 22px;
  background-color: transparent;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

/* buttons */
a.button:any-link, button {
  box-sizing: border-box;
  display: inline-block;
  max-width: 100%;
  margin: var(--spacing-s) 0;
  border: var(--border-width) solid transparent;
  border-radius: 0;
  padding: 10px 20px;
  font-family: var(--heading-font-family);
  font-style: normal;
  font-weight: var(--font-weight-bold);
  font-size: var(--body-font-size-m);
  line-height: var(--button-line-height);
  text-align: center;
  text-decoration: none;
  background-color: var(--color-subway-green-light);
  color: var(--color-white);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color var(--transition-base);
}

a.button:hover, a.button:focus,
button:hover, button:focus {
  background-color: var(--color-subway-green);
  cursor: pointer;
}

button:disabled, button:disabled:hover {
  background-color: var(--light-color);
  cursor: unset;
}

a.button.secondary, button.secondary {
  background-color: unset;
  border: var(--border-width) solid currentcolor;
  color: var(--text-color);
}

.default-content-wrapper li {
  line-height: 22px;
}

main img {
  max-width: 100%;
  width: auto;
  height: auto;
}

.icon img {
  height: 100%;
  width: 100%;
}

/*
 * Homepage column banners use authored raster widths (e.g. 319px). Global width:auto keeps that
 * intrinsic width inside a full-width <picture>, which looks like side gutters — force fluid width.
 */
main .section .columns img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

main .section .columns picture {
  display: block;
  width: 100%;
}

.icon {
  display: inline-block;
  height: var(--icon-size);
  width: var(--icon-size);
}

/* sections */
main > .section {
  margin: 0;
  padding: 0;
}

body.boxed main > .section + .section:not([class*="-container"]) {
  margin-top: 15px;
}

main > .section > div {
  box-sizing: border-box;
  max-width: 100%;
  margin: auto;
  padding: 0 var(--content-padding);
}

/* Hero section — full-width, no padding, no border */
main > .section.hero-container {
  margin: 0;
}

/*
 * Marquee: hero spans full content column width (no horizontal inset on wrapper).
 * Below 992px main is narrow; from 992–1000px layout-max-width matches viewport — section div
 * padding would inset the hero unless we zero it here through --layout-max-width (1000px).
 */
@media (width <= 1000px) {
  main > .section.marquee-container > .marquee-wrapper {
    padding-inline: 0;
  }
}

/* Cards + Teaser section — two-column layout on desktop */
main > .section.cards-container.teaser-container {
  padding: var(--content-padding) 0;
}

/*
 * `main > .section > div` uses margin: auto; on grid/flex items that prevents stretch and
 * centers the item in its track (large equal L/R “margins”). These wrappers must fill the track.
 */
main > .section.cards-container.teaser-container > .teaser-wrapper,
main > .section.cards-container.teaser-container > .cards-wrapper {
  margin-inline: 0;
}

/*
 * Mobile (<768): stack cards then franchise teaser.
 * NL authors teaser first in DOM; legacy site shows cards on top (Bootstrap column order).
 */
@media (width < 768px) {
  main > .section.cards-container.teaser-container {
    display: flex;
    flex-direction: column;
    gap: var(--content-padding);
  }

  main > .section.cards-container.teaser-container.teaser-first > .teaser-wrapper {
    order: 1;
    display: flex;
    justify-content: center;
  }

  main .image-links-wrapper {
    width: 100%;
    order: 1;
  }

  main > .image-links-wrapper img {
    width: 100%;
  }

  /* Same section: teaser+cards+columns — keep app banners after swapped teaser/cards */
  main > .section.cards-container.teaser-container.columns-container.teaser-first > .columns-wrapper {
    order: 3;
  }
}

/*
 * Match legacy Subway homepage grid: col-sm-6 + col-sm-6 (768–991px),
 * then col-md-4 + col-md-8 (992px+) — proportional columns, no fixed teaser width.
 */
@media (width >= 768px) and (width < 992px) {
  main > .section.cards-container.teaser-container {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (width >= 992px) {
  :root {
    --heading-font-size-xxl: 36px;
    --heading-font-size-xl: 32px;
  }
  
  main > .section.cards-container.teaser-container {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }

  main > .section.cards-container.teaser-container.teaser-first {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    padding-top: 25px;
  }
}

@media (width >= 768px) {
  main > .section.cards-container.teaser-container {
    display: grid;
    gap: 20px var(--content-padding);
    padding: var(--content-padding);
    align-items: start;
  }

  main > .section.cards-container.teaser-container > .teaser-wrapper,
  main > .section.cards-container.teaser-container > .cards-wrapper {
    width: 100%;
    min-width: 0;
    padding-inline: 0;
  }

  /* Teaser first in section (e.g. nl-nl); .teaser-first is set in blocks/teaser/teaser.js */
  main > .section.cards-container.teaser-container.teaser-first > .teaser-wrapper {
    grid-column: 1;
  }

  main > .section.cards-container.teaser-container.teaser-first > .cards-wrapper {
    grid-column: 2;
  }

  /* Cards first in section */
  main > .section.cards-container.teaser-container:not(.teaser-first) > .cards-wrapper {
    grid-column: 1;
  }

  main > .section.cards-container.teaser-container:not(.teaser-first) > .teaser-wrapper {
    grid-column: 2;
  }

  /*
   * Same section: teaser + cards + columns (app banners).
   * 768–991: banners full width below teaser+cards row.
   */
  main > .section.cards-container.teaser-container.columns-container {
    gap: var(--content-padding);
  }

  main > .section.cards-container.teaser-container.columns-container:not(.teaser-first) > .cards-wrapper,
  main > .section.cards-container.teaser-container.columns-container:not(.teaser-first) > .teaser-wrapper {
    grid-row: 1;
  }

  main > .section.cards-container.teaser-container.columns-container:not(.teaser-first) > .columns-wrapper {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-inline: 0;
    max-width: none;
    width: 100%;
    min-width: 0;
    padding-inline: 0;
  }

  main > .section.cards-container.teaser-container.columns-container.teaser-first > .teaser-wrapper,
  main > .section.cards-container.teaser-container.columns-container.teaser-first > .cards-wrapper {
    grid-row: 1;
  }
  
  main > .section.cards-container.image-links-container > .image-links-wrapper {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-inline: 0;
    max-width: none;
    width: 100%;
    min-width: 0;
    padding-inline: 0;
  }
}

/*
 * Same section, desktop (>991px): app banners only under the cards column (not under teaser).
 * Row 1 would otherwise get height = max(cards, teaser), leaving a tall empty band under the cards
 * before row 2 — span teaser across both rows so row heights follow cards + banners only.
 */
@media (width >= 992px) {
  main > .section.cards-container.teaser-container.columns-container {
    gap: 0 var(--content-padding);
  }

  main > .section.cards-container.teaser-container.teaser-first > .teaser-wrapper {
    grid-row: 1 / 3;
  }

  main > .section.cards-container.teaser-container.columns-container:not(.teaser-first) > .cards-wrapper {
    grid-column: 1;
    grid-row: 1;
  }

  main > .section.cards-container.teaser-container.columns-container:not(.teaser-first) > .teaser-wrapper {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
  }

  main > .section.cards-container.teaser-container.columns-container:not(.teaser-first) > .columns-wrapper {
    grid-column: 1;
    grid-row: 2;
    margin-inline: 0;
    max-width: none;
    width: 100%;
    min-width: 0;
    padding-inline: 0;
  }

  main > .section.cards-container.teaser-container.columns-container.teaser-first > .teaser-wrapper {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
  }

  main > .section.cards-container.teaser-container.columns-container.teaser-first > .cards-wrapper {
    grid-column: 2;
    grid-row: 1;
  }

  main > .section.cards-container.teaser-container.columns-container.teaser-first > .columns-wrapper {
    grid-column: 2;
    grid-row: 2;
    margin-inline: 0;
    max-width: none;
    width: 100%;
    min-width: 0;
    padding-inline: 0;
  }

    main > .section.cards-container.image-links-container > .image-links-wrapper {
    grid-column: 2;
    grid-row: 2;
    margin-inline: 0;
    max-width: none;
    width: 100%;
    min-width: 0;
    padding-inline: 0;
  }


  /* Columns in the next section: mirror grid so banners align with cards column only */
  main > .section.cards-container.teaser-container + .section.columns-container {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    align-items: start;
    gap: var(--content-padding);
    padding: 10px var(--content-padding) var(--spacing-l);
    box-sizing: border-box;
  }

  main > .section.cards-container.teaser-container + .section.columns-container > .columns-wrapper {
    grid-column: 1;
    margin-inline: 0;
    max-width: none;
    width: 100%;
    min-width: 0;
    padding-inline: 0;
  }

  main > .section.cards-container.teaser-container.teaser-first + .section.columns-container {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }

  main > .section.cards-container.teaser-container.teaser-first + .section.columns-container > .columns-wrapper {
    grid-column: 2;
  }
}

/*
 * Standalone teaser sections (single teaser block, not cards+teaser): add top padding when
 * the section is not first on the page — e.g. commitment teaser after body content.
 * Prefer section "Style" for overrides: flush top, or large top (see models/_section.json).
 */
main > .section.teaser-container:not(.cards-container, :first-child, .spacing-top-none) {
  padding-top: var(--spacing-xl);
}

main > .section.teaser-container:not(.cards-container, :first-child, .spacing-top-none).spacing-top-lg {
  padding-top: var(--spacing-xxl);
}

/* Columns section — app banners */
main > .section.columns-container {
  padding: 10px 0 var(--spacing-l);
}

/*
 * ≤767px: `main > .section` uses padding: 0 (overrides main > div), so horizontal gutters come only from
 * `main > .section > div` (columns-wrapper). Keep that padding — do not zero it, or banners go edge-to-edge.
 */
@media (width <= 767px) {
  main > .section.columns-container > .columns-wrapper,
  main > .section.cards-container.teaser-container.columns-container > .columns-wrapper {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }

  main .section .columns {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  main .section .columns > div > div {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

/* Hide HR section separators — sections handle their own spacing */
main > hr {
  display: none;
}

/* Hide metadata section */
main > .section.metadata-container {
  display: none;
}

/* Content naturally constrained by the layout-max-width container */
@media (width >= 768px) {
  main, header {
    max-width: var(--layout-max-width-tablet);
  }

  main > .section > div {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 var(--content-padding);
  }
}

@media (width >= 992px) {
  main,header {
      max-width: var(--layout-max-width-desktop);
  }

  body.boxed .default-content-wrapper h1,
  body.boxed .default-content-wrapper h2,
  body.boxed .default-content-wrapper h3,
  body.boxed .default-content-wrapper h4,
  body.boxed .default-content-wrapper h5,
  body.boxed .default-content-wrapper h6 {
    margin-bottom: 5px;
  }
}

/* section metadata */
main .section.light,
main .section.highlight {
  background-color: var(--light-color);
  margin: 0;
  padding: var(--spacing-xxl) 0;
}

/* Hide metadata block — it's processed by AEM, not displayed */
main .section .metadata-wrapper {
  display: none;
}

/* Back to Top button — matches live-site .goto-top */
.back-to-top {
  font-family: var(--body-font-family);
  font-weight: var(--font-weight-bold);
  font-size: var(--body-font-size-s);
  margin: var(--spacing-0);
  border: none;
  color: #b1b1b1;
  line-height: 26px;
  text-align: left;
  position: absolute;
  bottom: var(--spacing-0);
  right: 5px;
  cursor: pointer;
  box-sizing: border-box;
  background-color: #dedede;
  padding: var(--spacing-xxs);
  border-radius: 5px 5px 0 0;
  min-width: 60px;
  display: flex;
  align-items: center;
  gap: var(--spacing-s);
}

.back-to-top:hover {
  background-color: var(--color-subway-green-dark);
  color: var(--color-white);
}

.back-to-top-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Hide back-to-top on homepage (pages with marquee or hero-banner as first section) */
body:has(main > .marquee-container:first-child) .back-to-top {
  display: none;
}

body:has(main > .hero-container:first-child .hero picture) .back-to-top {
  display: none;
}
