/* CPGM Extruded Confectionery — component styles. Loads after tokens.css; every color, radius and space is a token. */

.cpgm-root, .cpgm { font-family: var(--font-sans); color: var(--ink); -webkit-font-smoothing: antialiased; }
.cpgm * { box-sizing: border-box; }
.cpgm-root a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: text-decoration-color var(--duration-fast, 120ms); }
.cpgm-root a:hover { text-decoration-color: var(--brand-orange); }
.cpgm-root :focus-visible, .cpgm :focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .cpgm-root *, .cpgm * { transition-duration: 0ms !important; animation: none !important; } }

/* ---------- Button ---------- */
.cpgm-btn {
  font-family: var(--font-sans); font-size: 15px; font-weight: 500; line-height: 1; letter-spacing: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 48px; padding: 0 var(--space-5); border-radius: var(--radius-pill); border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap; min-width: 44px;
  transition: background-color var(--duration-base, 200ms) cubic-bezier(.2,.7,.2,1), border-color var(--duration-fast, 120ms), color var(--duration-fast, 120ms);
}
.cpgm-btn--sm { height: 40px; padding: 0 var(--space-4); font-size: 14px; }
.cpgm-btn--primary { background: var(--button-primary-bg); color: var(--button-primary-fg); border-color: var(--button-primary-bg); }
.cpgm-btn--primary:hover, .cpgm-btn--primary:active { background: var(--button-primary-hover); border-color: var(--button-primary-hover); }
.cpgm-btn--secondary { background: transparent; color: var(--button-secondary-fg); border-color: var(--button-secondary-fg); }
.cpgm-btn--secondary:hover { background: var(--surface-raised); }
.cpgm-btn--ghost { background: transparent; color: var(--ink); padding: 0 var(--space-3); border-color: transparent; }
.cpgm-btn--ghost:hover { text-decoration: underline; text-decoration-color: var(--brand-orange); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.cpgm-btn--on-accent { background: var(--button-on-accent-bg); color: #000000; border-color: var(--button-on-accent-bg); }
.cpgm-btn--on-accent:hover { background: #ffffff; border-color: #ffffff; }
.cpgm-btn--on-ink { background: var(--brand-orange); color: #000000; border-color: var(--brand-orange); }
.cpgm-btn--on-ink:hover { background: var(--button-primary-hover); border-color: var(--button-primary-hover); }
.cpgm-btn:disabled, .cpgm-btn[aria-disabled="true"] { background: var(--button-disabled-bg); color: var(--ink-subtle); border-color: var(--button-disabled-bg); cursor: not-allowed; }
.cpgm-btn--loading { color: transparent !important; position: relative; }
.cpgm-btn--loading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: currentColor; color: var(--button-primary-fg); box-shadow: -12px 0 0 currentColor, 12px 0 0 currentColor; animation: cpgm-dots 1s infinite ease-in-out; }
.cpgm-btn--secondary.cpgm-btn--loading::after { color: var(--button-secondary-fg); }
@keyframes cpgm-dots { 0%,100% { opacity: .35 } 50% { opacity: 1 } }
.cpgm-btn .cpgm-btn__icon { width: 18px; height: 18px; flex: none; }

/* ---------- TextField ---------- */
.cpgm-field { display: flex; flex-direction: column; gap: var(--space-2); font-family: var(--font-sans); color: var(--ink); max-width: 100%; }
.cpgm-field__label { font-size: 15px; font-weight: 500; line-height: 1.3; letter-spacing: -0.01em; }
.cpgm-field__label small { font-weight: 400; color: var(--ink-muted); }
.cpgm-field__control { width: 100%; height: 48px; padding: 0 var(--space-4); font: inherit; font-size: 17px; letter-spacing: -0.01em;
  color: var(--ink); background: var(--surface-raised); border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color var(--duration-fast, 120ms); appearance: none; -webkit-appearance: none; }
.cpgm-field__control::placeholder { color: var(--ink-subtle); }
.cpgm-field__control:hover { border-color: var(--ink); }
.cpgm-field__control:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
textarea.cpgm-field__control { height: auto; min-height: 136px; padding: var(--space-3) var(--space-4); line-height: 1.5; resize: vertical; }
.cpgm-field__select { position: relative; }
.cpgm-field__select::after { content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg); pointer-events: none; }
.cpgm-field__select .cpgm-field__control { padding-right: 44px; }
.cpgm-field__help { font-size: 13px; line-height: 1.4; color: var(--ink-muted); }
.cpgm-field--error .cpgm-field__control { border-color: var(--state-error); }
.cpgm-field--error .cpgm-field__help { color: var(--state-error); font-weight: 500; }
.cpgm-field--disabled .cpgm-field__control { background: var(--button-disabled-bg); border-color: transparent; color: var(--ink-subtle); cursor: not-allowed; }
.cpgm-field--disabled .cpgm-field__label { color: var(--ink-subtle); }

/* ---------- Checkbox ---------- */
.cpgm-check { display: inline-grid; grid-template-columns: 22px 1fr; gap: var(--space-3); align-items: start; font-family: var(--font-sans); color: var(--ink); cursor: pointer; font-size: 15px; line-height: 1.5; }
.cpgm-check input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.cpgm-check__box { width: 22px; height: 22px; margin-top: 0; border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--surface-raised); position: relative; transition: background-color var(--duration-fast, 120ms), border-color var(--duration-fast, 120ms); }
.cpgm-check input:checked + .cpgm-check__box { background: var(--ink); border-color: var(--ink); }
.cpgm-check input:checked + .cpgm-check__box::after { content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px; border-right: 2px solid var(--surface); border-bottom: 2px solid var(--surface); transform: rotate(45deg); }
.cpgm-check input:focus-visible + .cpgm-check__box { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.cpgm-check input:disabled + .cpgm-check__box { background: var(--button-disabled-bg); border-color: transparent; }
.cpgm-check input:disabled ~ .cpgm-check__text { color: var(--ink-subtle); }
.cpgm-check__text small { display: block; color: var(--ink-muted); font-size: 13px; }

/* ---------- Card ---------- */
.cpgm-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); background: var(--surface-raised); border-radius: var(--radius-md); box-shadow: var(--shadow-card); font-family: var(--font-sans); color: var(--ink); position: relative; }
.cpgm-card__media { margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-2); aspect-ratio: 3 / 2; border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--surface-alt); overflow: hidden; display: grid; place-items: center; }
.cpgm-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cpgm-card__media--placeholder img { width: 25%; height: auto; opacity: 1; }
.cpgm-card__eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.cpgm-card__title { font-size: 32px; font-weight: 500; line-height: 1.1; letter-spacing: -0.03em; margin: 0; }
.cpgm-card__body { font-size: 15px; line-height: 1.5; margin: 0; color: var(--ink); }
.cpgm-card__link { margin-top: auto; padding-top: var(--space-2); font-size: 15px; font-weight: 500; color: var(--link); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.cpgm-card__link:hover { text-decoration-color: var(--brand-orange); }
.cpgm-card--ink { background: var(--surface-ink); color: var(--on-ink); box-shadow: none; }
.cpgm-card--ink .cpgm-card__eyebrow { color: var(--on-ink-muted); }
.cpgm-card--ink .cpgm-card__body { color: var(--on-ink); }
.cpgm-card--ink .cpgm-card__link { color: var(--on-ink); }
.cpgm-card--ink .cpgm-card__media { background: var(--gray-carbon); }
.cpgm-card--accent { background: var(--surface-accent); color: var(--on-accent-body); box-shadow: none; }
.cpgm-card--accent .cpgm-card__title { color: var(--on-accent); }
.cpgm-card--accent .cpgm-card__eyebrow, .cpgm-card--accent .cpgm-card__body, .cpgm-card--accent .cpgm-card__link { color: var(--on-accent-body); }
.cpgm-card--accent .cpgm-card__link:hover { text-decoration-color: var(--on-accent); }
.cpgm-card--outline { background: transparent; box-shadow: none; border: 1px solid var(--border); }
.cpgm-card--step .cpgm-card__marker { width: 28px; height: 26px; display: block; }

/* ---------- CertBadge ---------- */
.cpgm-badge { display: inline-flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-4) 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--ink); font-family: var(--font-sans); font-size: 14px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.cpgm-badge__code { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); font-weight: 400; }
.cpgm-badge__mark { width: 14px; height: 13px; display: block; }
.cpgm-badge--filled { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.cpgm-badge--filled .cpgm-badge__code { color: var(--surface); opacity: .75; }
.cpgm-badge--on-ink { background: transparent; color: var(--on-ink); border-color: var(--on-ink-muted); }
.cpgm-badge--on-ink .cpgm-badge__code { color: var(--on-ink-muted); }
.cpgm-badge--pending { border-style: dashed; color: var(--ink-muted); }
.cpgm-badge-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- Stat ---------- */
.cpgm-stat { display: flex; flex-direction: column; gap: var(--space-2); font-family: var(--font-sans); color: var(--ink); min-width: 0; }
.cpgm-stat__value { font-size: 64px; font-weight: 500; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cpgm-stat__value sup, .cpgm-stat__value small { font-size: .45em; font-weight: 500; vertical-align: top; letter-spacing: -0.02em; margin-left: 2px; }
.cpgm-stat__label { font-size: 15px; line-height: 1.4; color: var(--ink-muted); max-width: 22ch; }
.cpgm-stat--on-ink { color: var(--on-ink); }
.cpgm-stat--on-ink .cpgm-stat__value { color: var(--brand-orange); }
.cpgm-stat--on-ink .cpgm-stat__label { color: var(--on-ink-muted); }
.cpgm-stat--on-accent { color: var(--on-accent); }
.cpgm-stat--on-accent .cpgm-stat__label { color: var(--on-accent-body); }
.cpgm-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-6); }
.cpgm-stat-row--rules .cpgm-stat { border-top: 1px solid var(--border); padding-top: var(--space-4); }
.cpgm-stat--on-ink + .cpgm-stat--on-ink, .cpgm-stat-row--rules .cpgm-stat--on-ink { border-color: var(--gray-charcoal); }

/* ---------- SectionHeader ---------- */
.cpgm-section-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-6); align-items: end; font-family: var(--font-sans); color: var(--ink); }
.cpgm-section-header__eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 var(--space-3); display: flex; align-items: center; gap: var(--space-2); }
.cpgm-section-header__eyebrow img { width: 14px; height: 13px; }
.cpgm-section-header__title { font-size: 44px; font-weight: 500; line-height: 1.05; letter-spacing: -0.03em; margin: 0; }
.cpgm-section-header__title .muted { color: var(--ink-muted); display: block; }
.cpgm-section-header__lede { font-size: 17px; line-height: 1.55; letter-spacing: -0.01em; color: var(--ink); margin: 0; max-width: 52ch; }
.cpgm-section-header--stack { grid-template-columns: 1fr; gap: var(--space-4); }
.cpgm-section-header--on-ink { color: var(--on-ink); }
.cpgm-section-header--on-ink .cpgm-section-header__eyebrow, .cpgm-section-header--on-ink .cpgm-section-header__title .muted { color: var(--on-ink-muted); }
.cpgm-section-header--on-ink .cpgm-section-header__lede { color: var(--on-ink); }
.cpgm-section-header--on-accent { color: var(--on-accent); }
.cpgm-section-header--on-accent .cpgm-section-header__eyebrow, .cpgm-section-header--on-accent .cpgm-section-header__title .muted, .cpgm-section-header--on-accent .cpgm-section-header__lede { color: var(--on-accent-body); }
@media (max-width: 767px) { .cpgm-section-header { grid-template-columns: 1fr; gap: var(--space-4); } .cpgm-section-header__title { font-size: 30px; } }

/* ---------- Navbar ---------- */
.cpgm-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); height: 80px; padding: 0 var(--space-7); background: var(--surface); color: var(--ink); font-family: var(--font-sans); transition: background-color var(--duration-base, 200ms), box-shadow var(--duration-base, 200ms); }
.cpgm-nav--scrolled { background: var(--surface-raised); box-shadow: var(--shadow-float); }
.cpgm-nav__brand img { height: 20px; width: auto; display: block; }
.cpgm-nav__links { display: flex; align-items: center; gap: var(--space-6); list-style: none; margin: 0; padding: 0; }
.cpgm-nav__links a { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; padding: var(--space-2) 0; border-bottom: 1.5px solid transparent; }
.cpgm-nav__links a:hover, .cpgm-nav__links a[aria-current="page"] { border-bottom-color: var(--brand-orange); }
.cpgm-nav__menu { display: none; }
.cpgm-nav--ink { background: var(--surface-ink); color: var(--on-ink); }
.cpgm-nav--ink .cpgm-nav__links a { color: var(--on-ink); }
.cpgm-nav--compact { height: 64px; padding: 0 var(--space-4); }
.cpgm-nav--compact .cpgm-nav__links, .cpgm-nav--compact .cpgm-nav__cta { display: none; }
.cpgm-nav--compact .cpgm-nav__menu { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; color: inherit; }
.cpgm-nav--compact .cpgm-nav__brand img { height: 26px; }

/* ---------- Footer ---------- */
.cpgm-footer { background: var(--surface-ink); color: var(--on-ink); font-family: var(--font-sans); padding: var(--space-8) var(--space-7) var(--space-6); }
.cpgm-footer__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-6); }
.cpgm-footer__col h4 { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 var(--space-3); color: var(--on-ink); }
.cpgm-footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.cpgm-footer__col a { color: var(--on-ink-muted); text-decoration: none; font-size: 15px; }
.cpgm-footer__col a:hover { color: var(--on-ink); text-decoration: underline; text-decoration-color: var(--brand-orange); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.cpgm-footer__spec { font-family: var(--font-mono); font-size: 14px; line-height: 1.6; color: var(--on-ink-muted); }
.cpgm-footer__brand { margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px solid var(--gray-charcoal); display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.cpgm-footer__brand img { height: 22px; width: auto; }
.cpgm-footer__legal { font-size: 13px; color: var(--on-ink-muted); }
@media (max-width: 767px) { .cpgm-footer { padding: var(--space-8) var(--space-4); } .cpgm-footer__grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Hero ---------- */
.cpgm-hero { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-7); align-items: center; padding: var(--space-9) var(--space-7); background: var(--surface); color: var(--ink); font-family: var(--font-sans); }
.cpgm-hero__eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 var(--space-4); }
.cpgm-hero__title { font-size: 80px; font-weight: 500; line-height: .95; letter-spacing: -0.03em; margin: 0 0 var(--space-5); text-wrap: balance; }
.cpgm-hero__lede { font-size: 22px; line-height: 1.4; letter-spacing: -0.02em; margin: 0 0 var(--space-6); max-width: 30em; }
.cpgm-hero__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.cpgm-hero__media { border-radius: var(--radius-lg); background: var(--surface-alt); aspect-ratio: 4 / 5; overflow: hidden; display: grid; place-items: center; }
.cpgm-hero__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cpgm-hero__media--placeholder img { width: 25%; height: auto; }
.cpgm-hero--slab { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; padding: 0; background: var(--surface-accent); color: var(--on-accent-body); }
.cpgm-hero--slab .cpgm-hero__copy { padding: var(--space-9) var(--space-7); }
.cpgm-hero--slab .cpgm-hero__eyebrow, .cpgm-hero--slab .cpgm-hero__lede { color: var(--on-accent-body); }
.cpgm-hero--slab .cpgm-hero__title { color: var(--on-accent); font-size: 64px; line-height: 1; }
.cpgm-hero--slab .cpgm-hero__media { border-radius: 0; aspect-ratio: auto; min-height: 100%; }
.cpgm-hero--plain { grid-template-columns: minmax(0, 1fr); }
.cpgm-hero--plain .cpgm-hero__title { font-size: 64px; line-height: 1; }
.cpgm-hero--ink { background: var(--surface-ink); color: var(--on-ink); }
.cpgm-hero--ink .cpgm-hero__eyebrow { color: var(--on-ink-muted); }
.cpgm-hero--ink .cpgm-hero__media { background: var(--gray-carbon); }
@media (max-width: 1023px) { .cpgm-hero { grid-template-columns: 1fr; padding: var(--space-8) var(--space-4); } .cpgm-hero__title { font-size: 44px; } .cpgm-hero--slab .cpgm-hero__title, .cpgm-hero--plain .cpgm-hero__title { font-size: 36px; } .cpgm-hero__media { aspect-ratio: 3 / 2; } }

/* ---------- Crescent (graphic element) ---------- */
.cpgm-crescent { position: relative; overflow: hidden; background: var(--surface-accent); border-radius: var(--radius-md); }
.cpgm-crescent img { position: absolute; display: block; width: auto; }
.cpgm-crescent--tile { background-image: var(--cpgm-crescent-tile); background-size: 96px 96px; }
.cpgm-crescent--ink { background: var(--surface-ink); }
.cpgm-crescent--light { background: var(--surface); }

/* ---------- Dark theme adjustments: black panels invert so they stay visible on the black ground ---------- */
[data-theme="dark"] .cpgm-card--ink { background: var(--brand-antique-white); color: #000000; }
[data-theme="dark"] .cpgm-card--ink .cpgm-card__eyebrow { color: var(--gray-charcoal); }
[data-theme="dark"] .cpgm-card--ink .cpgm-card__body, [data-theme="dark"] .cpgm-card--ink .cpgm-card__link { color: #000000; }
[data-theme="dark"] .cpgm-card--ink .cpgm-card__media { background: var(--gray-cloud); }
[data-theme="dark"] .cpgm-card--outline { border-color: var(--gray-charcoal); }
[data-theme="dark"] .cpgm-footer { border-top: 1px solid var(--gray-charcoal); }
[data-theme="dark"] .cpgm-nav--ink { border-bottom: 1px solid var(--gray-charcoal); }
[data-theme="dark"] .cpgm-badge--filled { background: var(--brand-antique-white); color: #000000; border-color: var(--brand-antique-white); }
[data-theme="dark"] .cpgm-badge--filled .cpgm-badge__code { color: var(--gray-charcoal); opacity: 1; }

/* ---------- Navbar below 1024px: collapses to emblem + menu button (the compact variant) ---------- */
@media (max-width: 1023px) {
  .cpgm-nav { height: 64px; padding: 0 var(--space-4); }
  .cpgm-nav .cpgm-nav__links, .cpgm-nav .cpgm-nav__cta { display: none; }
  .cpgm-nav .cpgm-nav__menu { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; color: inherit; }
  .cpgm-nav__brand img { height: 18px; }
}
