/*
 * Clover Blog — "The Green" donor-aligned design system (clover.com).
 * Tokens from DESIGN.json (stardust migration, 2026-07-14).
 *
 * FONT LICENSING NOTE: Altform and Graphik Cy-Gr are Clover's licensed brand
 * faces, loaded from Clover's own CDNs (cloverstatic.com / blog.clover.com).
 * They are not redistributed in this repo. See styles/fonts.css.
 */

/*
 * Metric-compatible fallbacks for the brand faces (measured against the
 * woff2 metrics + canvas width ratio vs Arial) so the swap from the system
 * fallback to Altform/Graphik doesn't reflow (font CLS).
 */
@font-face {
  font-family: altform-fallback;
  src: local('Arial');
  size-adjust: 99.13%;
  ascent-override: 96.84%;
  descent-override: 25.22%;
  line-gap-override: 0%;
}

@font-face {
  font-family: graphik-fallback;
  src: local('Arial');
  size-adjust: 107.97%;
  ascent-override: 90.86%;
  descent-override: 18.06%;
  line-gap-override: 0%;
}

:root {
  /* donor palette */
  --color-bg: #fff; /* Paper */
  --color-fg: #000; /* Ink — reserved: nav links, on-Lime button text */
  --color-charcoal: #333; /* donor heading text (h1–h4 on light grounds) */
  --color-graphite: #4b4b4b; /* donor body prose */
  --color-accent: #b6fb6f; /* Lime — the donor action color */
  --color-accent-hover: #a5ef5a;
  --color-forest: #040;
  --color-pine: #012906;
  --color-module: #f8f8f8;
  --color-silver: #ededed;
  --color-hairline: #d5d5d5; /* donor's rendered hairline */
  --color-slate: #5d5d5d;

  /* legacy chrome greens (verbatim chrome only) */
  --chrome-green: #280;
  --chrome-green-hover: #276a16;
  --chrome-green-band: #257d1c;
  --chrome-hairline: #e5e5e5;

  /* type */
  --heading-font-family: altform, altform-fallback, -apple-system, blinkmacsystemfont, 'Segoe UI', 'Helvetica Neue', arial, sans-serif;
  --body-font-family: graphik, graphik-fallback, -apple-system, blinkmacsystemfont, 'Segoe UI', 'Helvetica Neue', arial, sans-serif;
  --heading-xxl: 56px;
  --heading-xl: 32px;
  --heading-lg: 24px;
  --heading-md: 18px;
  --body: 16px;
  --body-sm: 14px;
  --line-height-heading: 1.2;
  --line-height-body: 1.65;

  /* layout */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 48px;
  --spacing-2xl: 64px;
  --section-padding: 64px;
  --max-width: 1280px;
  --radius: 8px;
  --radius-lg: 16px;

  /* chrome */
  --header-height: 129px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  display: none;
  margin: 0;
  font-family: var(--body-font-family);
  font-size: var(--body);
  line-height: var(--line-height-body);
  color: var(--color-graphite);
  background: var(--color-bg);
}

body.appear {
  display: block;
}

/* reserve the chrome's height before the header block lands (CLS) */
header {
  min-height: var(--header-height);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

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

/* ---- content typography ---- */
main h1,
main h2,
main h3,
main h4 {
  color: var(--color-charcoal);
  font-family: var(--heading-font-family);
  line-height: var(--line-height-heading);
  margin: 0;
  scroll-margin: 145px;
}

main h1 {
  font-family: formula-black, formula-black-fallback, 'Arial Narrow', sans-serif;
  font-size: var(--heading-xxl);
  font-weight: 900;
  letter-spacing: normal;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--color-charcoal);
}

main h2 {
  font-family: formula-black, formula-black-fallback, 'Arial Narrow', sans-serif;
  font-size: var(--heading-xl);
  font-weight: 900;
  letter-spacing: normal;
  line-height: 1.1;
  text-transform: uppercase;
  margin-bottom: var(--spacing-lg);
}

main h3 {
  font-size: var(--heading-lg);
  font-weight: 400;
  line-height: 1.42;
}

main h4 {
  font-size: var(--heading-md);
  font-weight: 600;
  line-height: 1.3;
}

main p {
  margin: 0;
}

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

main a {
  color: var(--color-forest);
  transition: color 0.12s ease-out, background-color 0.12s ease-out;
}

main a:focus-visible,
main button:focus-visible,
main input:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: 2px;
}

main .section.pine a:focus-visible,
main .section.pine .button:focus-visible {
  outline-color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  main a,
  main a.button {
    transition: none;
  }
}

/* ---- sections: full-width bands, contained content (donor band system) ---- */
main > .section {
  padding: var(--section-padding) 0;
}

/* a section left empty (e.g. by the consumed metadata block) must not add
   band padding between the chrome and the first content band */
main > .section:not(:has(*)) {
  display: none;
}

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

main > .section > div + div {
  margin-top: var(--spacing-lg);
}

/* donor band grounds */
main .section.module {
  background: var(--color-module);
}

main .section.pine {
  background: var(--color-pine);
  color: #fff;
}

main .section.pine h2,
main .section.pine h3,
main .section.pine p {
  color: #fff;
}

/* page-title band lede (paragraph following the h1) */
main .section h1 + p {
  margin-top: var(--spacing-md);
  max-width: 70ch;
  font-size: var(--body);
  font-weight: 400;
  line-height: var(--line-height-body);
  color: var(--color-slate);
}

main .section h1 + p + p {
  margin-top: var(--spacing-lg);
  max-width: 70ch;
  color: var(--color-fg);
}

/* full-bleed photo hero sections */
main .section.hero-container {
  padding: 0;
}

main .section.hero-container > div {
  max-width: none;
  padding: 0;
  margin: 0;
}

/* ---- buttons (donor: Lime acts, Forest structures) ---- */
main a.button,
main button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 14px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--body-font-family);
  font-size: 15px;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out;
}

main a.button,
main a.button.primary,
main button.button,
main button.button.primary {
  background: var(--color-accent);
  color: #000;
}

main a.button:hover,
main a.button.primary:hover,
main button.button:hover,
main button.button.primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-forest);
}

main a.button.secondary {
  background: transparent;
  color: var(--color-forest);
  border-color: var(--color-forest);
}

main a.button.secondary:hover {
  background: var(--color-module);
}

main .section.pine a.button.secondary {
  color: #fff;
  border-color: #fff;
  background: transparent;
}

main .section.pine a.button.secondary:hover {
  background: #fff;
  color: var(--color-forest);
}

/* a lone CTA under a grid centers (donor .section-cta) */
main .section:not(.guides, .article) > .default-content-wrapper > p.button-wrapper {
  text-align: center;
  margin-top: var(--spacing-xl);
}

/* ---- guides band (copy left, button right) ---- */
main .section.guides > .default-content-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--spacing-xl);
}

main .section.guides > .default-content-wrapper > :not(.button-wrapper) {
  grid-column: 1;
  max-width: 70ch;
}

main .section.guides > .default-content-wrapper > h3 {
  margin: var(--spacing-md) 0;
}

main .section.guides > .default-content-wrapper > p {
  font-size: var(--body-sm);
  font-weight: 400;
  line-height: 1.7;
}

main .section.guides > .default-content-wrapper > p.button-wrapper {
  grid-column: 2;
  grid-row: 1 / span 3;
  margin: 0;
}

/* ---- article layout: 70ch prose + right rail ---- */
main .section.article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto auto 1fr;
  column-gap: var(--spacing-2xl);
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--section-padding) var(--spacing-lg);
}

main .section.article > div {
  max-width: none;
  margin: 0;
  padding: 0;
  grid-column: 1;
}

main .section.article > div + div {
  margin-top: var(--spacing-xl);
}

main .section.article > .sidebar-wrapper {
  grid-column: 2;
  grid-row: 1 / span 3;
  margin-top: 0;
}

main .section.article > .default-content-wrapper {
  max-width: 70ch;
}

main .section.article .default-content-wrapper > p {
  margin: 0 0 20px;
}

main .section.article .default-content-wrapper > h2 {
  margin: var(--spacing-xl) 0 var(--spacing-md);
}

main .section.article .default-content-wrapper > h3 {
  margin: 32px 0 12px;
}

main .section.article .default-content-wrapper ul {
  margin: 0 0 20px;
  padding-left: 22px;
}

main .section.article .default-content-wrapper li {
  margin-bottom: var(--spacing-sm);
}

main .section.article .default-content-wrapper li::marker {
  color: var(--color-forest);
}

main .section.article .default-content-wrapper a {
  color: var(--color-forest);
  text-decoration: underline;
  text-underline-offset: 2px;
}

main .section.article .default-content-wrapper a:hover {
  color: var(--color-pine);
}

/* the article's lead image */
main .section.article .default-content-wrapper > p:first-child picture img {
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-hairline);
  width: 100%;
}

/* ---- article header band (kicker + h1 + byline as default content) ---- */
main .section.article-header p > a:only-child {
  display: inline-block;
  padding: 4px 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.525px;
  text-transform: uppercase;
  color: var(--color-forest);
  text-decoration: none;
}

main .section.article-header p > a:only-child:hover {
  text-decoration: underline;
}

main .section.article-header h1 {
  margin-top: var(--spacing-md);
  max-width: 22ch;
  text-wrap: balance;
}

/* Byline row: identified by the avatar picture rather than `h1 + p`
   adjacency, so it also matches in the WYSIWYG editor where each block is
   wrapped in .prosemirror-editor > .ProseMirror and the h1/p are no longer
   siblings. */
main .section.article-header p:has(picture) {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: var(--spacing-lg);
  max-width: none;
  font-size: var(--body-sm);
  font-weight: 300;
  color: var(--color-slate);
}

main .section.article-header p:has(picture) picture img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-hairline);
}

main .section.article-header p:has(picture) a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0;
  font-size: var(--body-sm);
  font-weight: 300;
  letter-spacing: 0;
  text-transform: none;
  color: inherit;
  text-decoration: underline;
}

main .section.article-header p:has(picture) a:hover {
  color: var(--color-forest);
}

/* ---- article breadcrumb (Home › Category › Topic, above the kicker) ---- */
main .section.article-header .breadcrumb {
  display: flex;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

main .section.article-header .breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

main .section.article-header .breadcrumb li {
  display: inline-flex;
  align-items: center;
}

main .section.article-header .breadcrumb a {
  font-size: 13px;
  line-height: 1.25;
  color: var(--color-slate);
  text-decoration: none;
}

main .section.article-header .breadcrumb a:hover {
  color: var(--chrome-green);
  text-decoration: underline;
}

/* HOME leads, bold + uppercase + green, like the donor theme */
main .section.article-header .breadcrumb li:first-child a {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--chrome-green);
}

main .section.article-header .breadcrumb-sep {
  display: inline-flex;
  align-items: center;
  margin: 0 8px;
  color: var(--chrome-green);
}

/* EN | FR switch (original CA chrome: right of the breadcrumb on articles,
   right-aligned intro row on the locale home pages) */
main .lang-toggle {
  font-size: 13px;
  line-height: 1.25;
  color: var(--color-slate);
  white-space: nowrap;
}

main .section.article-header .breadcrumb .lang-toggle {
  margin-left: auto;
  padding-left: 16px;
}

main .lang-toggle a {
  font-weight: 700;
  color: var(--chrome-green);
  text-decoration: none;
}

main .lang-toggle a:hover {
  text-decoration: underline;
}

main .lang-toggle .lang-current {
  font-weight: 700;
}

main .lang-toggle .lang-toggle-ada {
  position: absolute;
  left: -9999px;
}

main .lang-toggle-row {
  text-align: right;
  margin-bottom: 8px;
}

/* ---- shared donor card voice (used by cards, article-list, search, sidebar) ---- */
main .kicker {
  display: block;
  font-family: var(--body-font-family);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.525px;
  text-transform: uppercase;
  color: var(--color-forest);
}

/* clickable kicker (chip → taxonomy archive, as the original cards) */
main .kicker a {
  color: inherit;
  text-decoration: none;
}

main .kicker a:hover,
main .kicker a:focus-visible {
  color: var(--chrome-green);
  text-decoration: underline;
}

main .title-link {
  display: inline-block;
  padding: 1px 0;
  color: inherit;
  text-decoration: none;
}

main .title-link:hover {
  color: var(--color-forest);
  text-decoration: underline;
}

main .read-more {
  margin-top: auto;
  align-self: flex-start;
  font-family: var(--body-font-family);
  font-size: 15px;
  font-weight: 400;
  color: var(--color-forest);
  text-decoration: none;
}

main .read-more:hover,
main .read-more:focus-visible {
  text-decoration: underline;
}

main .tag-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 14px;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius);
  font-size: var(--body-sm);
  color: var(--color-forest);
  text-decoration: none;
}

main .tag-link:hover {
  background: var(--color-module);
  text-decoration: underline;
}

/* ---- responsive ---- */
@media (width <= 1024px) {
  :root {
    --section-padding: 48px;
  }

  main .section.article {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  main .section.article > .sidebar-wrapper {
    grid-column: 1;
    grid-row: auto;
    margin-top: var(--spacing-xl);
  }
}

@media (width <= 640px) {
  :root {
    --section-padding: 32px;
  }

  main h1 {
    font-size: 36px;
  }

  main h2 {
    font-size: 26px;
  }

  main h3 {
    font-size: 22px;
  }

  main > .section > div {
    padding: 0 var(--spacing-md);
  }

  main .section.guides > .default-content-wrapper {
    display: block;
  }

  main .section.guides > .default-content-wrapper > p.button-wrapper {
    margin-top: var(--spacing-lg);
  }
}
