/* Formulaite base: reset, type, links, buttons, layout helpers, the pill nav,
   the footer. Loaded on every page after tokens.css. Page templates add
   their own sheet on top; the legacy styles.css, where still loaded, comes
   before this file so these rules win for the shared chrome. */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-body);
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-leading);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Image sizing is set per template; a global height:auto would fight the legacy homepage hero. */
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--color-primary-tint-strong); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Type ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  color: inherit; /* dark panels on legacy pages set their own colour; a fixed heading colour broke them */
  line-height: 1.15;
  letter-spacing: -0.005em;
  font-variation-settings: 'opsz' 72;
  /* keep plain letterforms: no discretionary ligatures in headings */
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "dlig" 0, "calt" 0;
}
h1 { font-size: var(--type-h1-size); font-weight: var(--type-h1-weight); letter-spacing: var(--type-h1-spacing); line-height: var(--type-h1-leading); text-wrap: balance; font-variation-settings: 'opsz' 72; }
h2 { font-size: var(--type-h2-size); font-weight: var(--type-h2-weight); letter-spacing: var(--type-h2-spacing); line-height: var(--type-h2-leading); text-wrap: balance; }
h3 { font-size: var(--type-h3-size); font-weight: var(--type-h3-weight); letter-spacing: var(--type-h3-spacing); line-height: var(--type-h3-leading); }
h4 { font-family: var(--font-body); font-size: 17px; font-weight: 600; }
h5, h6 { font-family: var(--font-body); font-size: 15px; font-weight: 600; }
p { max-width: 72ch; }
/* a centred paragraph must centre its own box, or its wrapped lines sit off-axis */
[style*="text-align: center"] p, [style*="text-align:center"] p, .text-center p { margin-left: auto; margin-right: auto; }
a { color: var(--color-primary); text-decoration-thickness: 1.5px; text-underline-offset: 0.15em; transition: color var(--transition-fast); }
a:hover { color: var(--color-trust-hover); }
strong { font-weight: 600; }
small { font-size: var(--type-small-size); }
code, pre { font-family: var(--mono); font-size: var(--type-mono-size); }

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--type-eyebrow-size);
  font-weight: var(--type-eyebrow-weight);
  letter-spacing: var(--type-eyebrow-spacing);
  line-height: var(--type-eyebrow-leading);
  text-transform: uppercase;
  color: var(--color-primary);
}
.lede { font-size: var(--type-lede-size); line-height: 1.5; color: var(--color-text-muted); max-width: 64ch; }
.text-muted { color: var(--color-text-muted); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container-max); margin: 0 auto; padding: 0 var(--gutter); }
.container--narrow { max-width: var(--container-narrow); }
.container--wide { max-width: var(--container-wide); }
.section { padding: var(--section-padding) 0; }
.section--band { background: var(--color-bg-band); }
.section--dark { background: var(--color-bg-dark); color: var(--color-text-light); }
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}

/* ---------- Buttons ---------- */
.btn, .btn-primary, .btn-secondary, .btn-outline, .cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.btn-primary { background: var(--color-action); color: var(--color-action-ink); }
.btn-primary:hover { background: var(--color-action-hover); color: var(--color-action-ink); box-shadow: var(--shadow-md); transform: translateY(-1px); }
/* Outline buttons take the colour of their context, so they stay visible on
   dark panels (legacy solution heroes, closing CTAs) as well as on cream. */
.btn-secondary, .btn-outline { background: transparent; color: inherit; border-color: currentColor; }
.btn-secondary:hover, .btn-outline:hover { background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; border-color: currentColor; }
.btn-large { padding: 18px 36px; font-size: 16px; }
.btn-sm { padding: 10px 20px; font-size: 14px; }
.btn-light { background: var(--color-surface); color: var(--color-primary); }
.btn-light:hover { background: #fff; color: var(--color-primary); box-shadow: var(--shadow-md); }
.btn .fas, .btn .fab { font-size: 0.9em; }

/* ---------- Skip link ---------- */
.skip-link { position: absolute !important; left: -9999px !important; top: auto !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.skip-link:focus {
  left: 16px !important; top: 16px !important; width: auto !important; height: auto !important;
  z-index: 2000; padding: 10px 16px; background: var(--color-surface); color: var(--color-primary);
  border-radius: var(--radius-pill); box-shadow: var(--shadow-md); text-decoration: none; font-weight: 600;
}

/* ---------- Pill nav ---------- */
.navbar {
  position: fixed;
  top: var(--nav-offset);
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none;
  pointer-events: none;
}
.nav-container {
  pointer-events: auto;
  position: relative;
  width: calc(100% - 2 * var(--gutter));
  max-width: 1180px;
  min-height: var(--nav-height);
  margin: 0 auto;
  padding: 6px 8px 6px 18px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(16px, 2.4vw, 32px);
  background: rgba(255, 253, 248, 0.86);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--nav-shadow);
  transition: background var(--transition), box-shadow var(--transition);
}
.navbar--scrolled .nav-container { background: rgba(255, 253, 248, 0.94); box-shadow: 0 10px 36px rgba(30, 28, 24, 0.12); }
.navbar.navbar--overdark .nav-logo span { color: var(--color-primary); }
.navbar.navbar--overdark .nav-link { color: var(--color-text-muted); }
.navbar.navbar--overdark .nav-link:hover { color: var(--color-text); }
.navbar.navbar--overdark .nav-cta-btn { background: var(--color-action); border: 0; color: var(--color-action-ink); }
.navbar.navbar--overdark .nav-toggle .bar { background: var(--color-text); }

.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.nav-logo-img { width: 32px; height: 32px; object-fit: contain; }
.nav-logo span { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; color: var(--color-primary); }

.nav-menu { display: flex; align-items: center; gap: clamp(14px, 1.8vw, 26px); margin-left: auto; list-style: none; }
.nav-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-body); font-size: 14.5px; font-weight: 500;
  color: var(--color-text-muted); text-decoration: none; white-space: nowrap;
  padding: 8px 2px; border-radius: 8px; position: relative;
  transition: color var(--transition-fast);
}
.nav-link::after { content: none; }
.nav-link:hover, .nav-dropdown:hover > .nav-link { color: var(--color-text); }
.nav-chevron, .nav-dropdown > .nav-link i { font-size: 10px; margin-left: 1px; transition: transform var(--transition-fast); }
.nav-dropdown:hover > .nav-link i { transform: rotate(180deg); }
.nav-dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 10px); left: 50%;
  min-width: 232px; padding: 8px; list-style: none;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateX(-50%) translateY(6px);
  transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast);
  z-index: 1100;
}
.dropdown-menu::before { content: ''; position: absolute; top: -12px; left: 0; right: 0; height: 16px; }
.nav-dropdown:hover .dropdown-menu, .nav-dropdown:focus-within .dropdown-menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.dropdown-menu li a {
  display: block; padding: 10px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 500; color: var(--color-text-muted); text-decoration: none; white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.dropdown-menu li a:hover { background: var(--color-primary-tint); color: var(--color-primary); }

.nav-cta-btn, .nav-cta {
  flex-shrink: 0; display: inline-flex; align-items: center;
  padding: 11px 20px; font-size: 14px; font-weight: 600; line-height: 1.2;
  background: var(--color-action); color: var(--color-action-ink) !important;
  border-radius: var(--radius-pill); text-decoration: none; white-space: nowrap;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.nav-cta-btn:hover, .nav-cta:hover { background: var(--color-action-hover) !important; color: var(--color-action-ink) !important; box-shadow: var(--shadow-sm); }
.nav-cta-mobile { display: none; }
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; padding: 10px; margin-left: auto; cursor: pointer; border-radius: var(--radius-pill); }
.nav-toggle:hover { background: var(--color-primary-tint); }
.nav-toggle .bar { width: 22px; height: 2px; background: var(--color-text); border-radius: 2px; transition: transform var(--transition-fast), opacity var(--transition-fast); }
.nav-toggle.active .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active .bar:nth-child(2) { opacity: 0; }
.nav-toggle.active .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (min-width: 1101px) {
  .nav-menu { display: flex; }
  .nav-cta-btn { display: inline-flex; }
}
@media (max-width: 1100px) {
  .nav-container { padding: 6px 6px 6px 14px; }
  /* drawer: fixed under the pill, to the bottom of the screen, scrolls on its own */
  .nav-menu {
    display: none; position: fixed; top: calc(var(--nav-offset) + var(--nav-height) + 8px); left: var(--gutter); right: var(--gutter); bottom: max(12px, env(safe-area-inset-bottom));
    flex-direction: column; align-items: stretch; gap: 0; margin-left: 0; padding: 8px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-card); box-shadow: var(--shadow-lg);
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y;
  }
  .nav-menu.active { display: flex; }
  html.menu-open, html.menu-open body { overflow: hidden; height: 100%; }
  .nav-menu > li > .nav-link { display: flex; width: 100%; padding: 11px 12px; border-radius: 10px; font-size: 15.5px; color: var(--color-text); }
  .nav-menu > li > .nav-link:hover { background: var(--color-primary-tint); }
  .nav-dropdown > .nav-link { justify-content: space-between; }
  .nav-dropdown > .nav-link i { display: inline-block; font-size: 10px; transition: transform var(--transition-fast); }
  .nav-dropdown.open > .nav-link i { transform: rotate(180deg); }
  .dropdown-menu, .nav-dropdown:hover .dropdown-menu, .nav-dropdown:focus-within .dropdown-menu {
    display: none; position: static; opacity: 1; visibility: visible; transform: none; transition: none;
    min-width: 0; padding: 0 0 6px 10px; margin: 0; background: transparent; border: 0; box-shadow: none;
  }
  .dropdown-menu::before { display: none; }
  .nav-dropdown.open .dropdown-menu, .nav-dropdown.open:hover .dropdown-menu, .nav-dropdown.open:focus-within .dropdown-menu { display: block; }
  .dropdown-menu li a { padding: 9px 12px; font-size: 15px; }
  .nav-cta-btn { display: none; }
  .nav-cta-mobile { display: block; margin-top: 8px; }
  .nav-cta-mobile .nav-cta { display: flex; justify-content: center; width: 100%; padding: 13px 20px; font-size: 15px; }
  .nav-toggle { display: flex; }
}

/* ---------- Footer ---------- */
.footer { background: var(--color-bg-dark); color: var(--color-text-light-muted); padding: var(--space-6) var(--gutter) var(--space-4); }
.footer .container { padding: 0; }
.footer-grid { max-width: var(--container-max); margin: 0 auto var(--space-5); display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: var(--space-5) var(--space-4); }
.footer-brand { max-width: 300px; }
.footer-logo { width: 40px; height: 40px; margin-bottom: var(--space-2); }
.footer-brand p { font-size: 15px; line-height: 1.6; color: var(--color-text-light-muted); margin-bottom: var(--space-3); max-width: 36ch; }
.footer-address { font-size: 14px; line-height: 1.7; font-style: normal; color: var(--color-text-light-muted); margin-bottom: var(--space-3); }
.footer-address strong { color: var(--color-text-light); font-weight: 600; }
.footer-address a { color: var(--color-text-light-muted); text-decoration: none; }
.footer-address a:hover { color: #fff; }
.social-links { display: flex; gap: 10px; }
.social-links a {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 253, 248, 0.08); border-radius: var(--radius-pill); color: var(--color-text-light);
  text-decoration: none; transition: background var(--transition-fast), color var(--transition-fast);
}
.social-links a:hover { background: var(--color-primary-light); color: #fff; }
.footer-links h4 { font-family: var(--font-body); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--color-text-light); margin-bottom: var(--space-2); }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { font-size: 15px; color: var(--color-text-light-muted); text-decoration: none; transition: color var(--transition-fast); }
.footer-links a:hover { color: #fff; }
.footer-bottom { max-width: var(--container-max); margin: 0 auto; padding-top: var(--space-3); border-top: 1px solid rgba(255, 253, 248, 0.1); text-align: center; }
.footer-bottom p { font-size: 13px; color: var(--color-text-soft); max-width: none; }
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; max-width: 100%; }
}
@media (max-width: 520px) {
  .footer { padding-top: var(--space-5); }
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-4); }
}
.nav-toggle { background: none; border: 0; }

/* ---------- Legacy dark panels: light text for things the base sheet otherwise colours dark ---------- */
.solutions-hero, .case-study-hero, .value-section.dark, .mega-dark, .cta-section, .hero.dark, body.dark-page .hero { color: var(--color-text-light); }
.solutions-hero .btn-outline, .case-study-hero .btn-outline, .value-section.dark .btn-outline, .cta-section .btn-outline, .hero.dark .btn-outline {
  color: #fff; border-color: rgba(255, 253, 248, 0.55);
}
.solutions-hero .btn-outline:hover, .case-study-hero .btn-outline:hover, .value-section.dark .btn-outline:hover, .cta-section .btn-outline:hover {
  background: rgba(255, 253, 248, 0.12); color: #fff; border-color: #fff;
}
.solutions-hero .section-label, .case-study-hero .section-label, .value-section.dark .section-label, .mega-dark .section-label, .cta-section .section-label, .hero.dark .section-label {
  color: var(--color-accent);
}
.solutions-hero .highlight, .case-study-hero .highlight, .hero.dark .highlight { color: #8fd3b0; }

/* gold used as text on light backgrounds (partners page) */
.partner-rel-label, .partner-case-link, .cert-row-sub, .cert-unit-n { color: var(--color-accent-text) !important; }
