/* ChemGuard — plain CSS, no framework. Brand from the old Divi site (navy header, teal→navy→red
   gradient, Avenir Next); typography reworked for reading: one text column, a real type scale,
   hairlines instead of boxes. */
@font-face { font-family: 'Avenir Next'; font-weight: 400; font-display: swap; src: url(/assets/fonts/Avenir-Next-LT-Pro-Regular.woff2) format('woff2'); }
@font-face { font-family: 'Avenir Next'; font-weight: 600; font-display: swap; src: url(/assets/fonts/Avenir-Next-LT-Pro-Demi.woff2) format('woff2'); }
@font-face { font-family: 'Avenir Next'; font-weight: 700; font-display: swap; src: url(/assets/fonts/Avenir-Next-LT-Pro-Bold.woff2) format('woff2'); }
@font-face { font-family: 'Helvetica Neue Md'; font-weight: 500; font-display: swap; src: url(/assets/fonts/HelveticaNeueLTStd-Md.woff2) format('woff2'); }

:root {
  color-scheme: dark;
  --navy: #172542;          /* header, footer: the old site's colour */
  --deep: #111b33;          /* reading background, a step darker than the header */
  --ink: #f4f2ef;           /* headings */
  --text: rgba(244, 242, 239, .86);
  --dim: rgba(244, 242, 239, .62);
  --rule: rgba(255, 255, 255, .12);
  --teal: #5fd0c8;          /* links, bullets: the gradient's teal, lifted for contrast */
  --red: #e0675c;           /* the gradient's red, lifted: notes */
  --header-h: 72px;
  --measure: 40rem;         /* ≈ 70 characters per line */
  --gutter: max(20px, 4vw);
  --sans: 'Avenir Next', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --nav-font: 'Helvetica Neue Md', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  /* the three gradients the old site used as background images */
  --bg-home: linear-gradient(90deg, #0f6466 0%, #154454 9%, #182c45 27%, #172540 50%, #192541 70%, #202540 80%, #32263b 90%, #7b1917 100%);
  --bg-teal: linear-gradient(90deg, #2d304e 0%, #224356 40%, #18545f 75%, #106366 100%);
  --bg-red:  linear-gradient(90deg, #302d4c 0%, #3f2840 30%, #542332 55%, #701c1f 85%, #7b1917 100%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 400 17px/1.7 var(--sans); color: var(--text); background: var(--deep);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; font-kerning: normal;
}
body.home { background: var(--navy) var(--bg-home); }
img { max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 20; padding: 8px 14px; background: #fff; color: var(--navy); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---- header ---- */
.cg-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  height: var(--header-h); padding: 0 var(--gutter);
  background: var(--navy); border-bottom: 1px solid var(--rule);
}
.cg-header__logo { display: block; flex: none; }
.cg-header__logo img { display: block; width: 180px; }
.cg-nav { margin-left: auto; }
.cg-nav ul { display: flex; gap: 30px; margin: 0; padding: 0; list-style: none; }
.cg-nav a {
  position: relative; display: block; padding: 8px 0;
  font: 500 14px/1 var(--nav-font); letter-spacing: .6px; text-decoration: none; color: rgba(255, 255, 255, .78);
  transition: color .2s;
}
.cg-nav a:hover, .cg-nav a[aria-current="page"] { color: #fff; }
.cg-nav a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--teal); transform: scaleX(0); transition: transform .25s; }
.cg-nav a:hover::after, .cg-nav a[aria-current="page"]::after { transform: scaleX(1); }
.cg-nav-toggle, .cg-nav-burger { display: none; }

.cg-main { flex: 1; width: 100%; }
h1, h2, h3 { font-family: var(--sans); color: var(--ink); font-weight: 600; text-wrap: balance; }
p, li { text-wrap: pretty; }
sup { font-size: .6em; line-height: 0; }

/* ---- home ---- */
.cg-hero { max-width: 60rem; margin: 0 auto; padding: clamp(48px, 9vh, 96px) var(--gutter) 24px; text-align: center; }
.cg-hero h1 { margin: 0 0 .55em; font-size: clamp(32px, 4.6vw, 54px); line-height: 1.1; letter-spacing: .01em; }
.cg-hero__intro { max-width: 42rem; margin: 0 auto 1em; font-size: clamp(17px, 1.5vw, 20px); line-height: 1.6; color: rgba(255, 255, 255, .9); }
.cg-hero__outro { margin: 0; font-size: 17px; color: #fff; font-weight: 600; }

.cg-companies {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px clamp(28px, 4vw, 64px);
  max-width: 1320px; margin: 0 auto; padding: 48px var(--gutter) 96px;
}
.cg-company { display: flex; flex-direction: column; }
.cg-company h2 { margin: 24px 0 8px; font-size: 22px; line-height: 1.25; }
.cg-company p { margin: 0 0 16px; font-size: 16px; line-height: 1.65; color: rgba(255, 255, 255, .84); }
.cg-company__link { margin-top: auto; align-self: flex-start; font-weight: 600; font-size: 15px; color: var(--teal); text-decoration: none; }
.cg-company__link span { display: inline-block; transition: transform .2s; }
.cg-company__link:hover span { transform: translateX(4px); }
.cg-company__photo {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px;
  box-shadow: 0 18px 30px -18px rgba(0, 0, 0, .6); background: #2f2c4b;
}
.cg-company__photo > img:first-child { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
/* tinted photo with the company's mark on it (white one-colour versions; Ytteknik's box is its own backdrop); the tint lifts on hover */
.cg-company__photo::after { content: ''; position: absolute; inset: 0; background: rgba(23, 37, 66, .55); transition: background .35s; }
.cg-company__logo { position: absolute; inset: 0; z-index: 1; margin: auto; height: auto; filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .45)); }
.cg-company__logo--mcs { width: 42%; }
.cg-company__logo--scandinovata { width: 61%; }
.cg-company__logo--ytteknik { width: 53%; }
.cg-company:hover .cg-company__photo::after { background: rgba(23, 37, 66, .3); }
.cg-company:hover .cg-company__photo > img:first-child { transform: scale(1.03); }

/* ---- policy pages ---- */
.doc__head { padding: clamp(40px, 7vh, 72px) var(--gutter) clamp(36px, 6vh, 56px); background: var(--navy) var(--bg-teal); }
.bg-red .doc__head { background-image: var(--bg-red); }
/* without a TOC the title and text share one centred column; with one, the column sits right of it */
.doc__headin, .doc__body { max-width: var(--measure); }
.has-toc .doc__headin, .has-toc .doc__body { max-width: calc(var(--measure) + 16rem); }
.doc__headin { margin: 0 auto; }
.has-toc .doc__head h1, .has-toc .doc__head .lead, .has-toc .doc__kicker { margin-left: 16rem; }
.doc__kicker { margin: 0 0 10px; font: 500 12px/1 var(--nav-font); letter-spacing: 2px; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.doc__head h1 { margin: 0; font-size: clamp(34px, 5vw, 52px); line-height: 1.08; letter-spacing: -.005em; }
.doc__head .lead { max-width: var(--measure); margin: 18px 0 0; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.55; color: rgba(255, 255, 255, .88); }
.doc__head .lead a { color: #fff; text-decoration-color: rgba(255, 255, 255, .45); text-underline-offset: 3px; }

.doc__body { margin: 0 auto; padding: 48px var(--gutter) 96px; box-sizing: content-box; }
.has-toc .doc__body { display: grid; grid-template-columns: 13rem minmax(0, var(--measure)); gap: 0 3rem; }
.prose { max-width: var(--measure); }

.toc { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; font-size: 14px; line-height: 1.45; }
.toc__label { margin: 0 0 12px; font: 500 11px/1 var(--nav-font); letter-spacing: 2px; text-transform: uppercase; color: var(--dim); }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--rule); }
.toc a { display: block; padding: 8px 0 8px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--dim); text-decoration: none; }
.toc a:hover { color: var(--ink); border-left-color: var(--teal); }

.prose > :first-child { margin-top: 0; }
.prose > h2:first-child { padding-top: 0; border-top: 0; }
.prose p { margin: 0 0 1.1em; }
.prose h2 {
  margin: 2.2em 0 .7em; padding-top: 1.1em; border-top: 1px solid var(--rule);
  font-size: 28px; line-height: 1.2; letter-spacing: -.005em;
}
.prose h3 { margin: 1.9em 0 .4em; font-size: 19px; line-height: 1.35; }
.prose h2 + h3 { margin-top: 1.1em; }
.prose h2, .prose h3 { position: relative; }
.anchor { position: absolute; left: -1.1em; width: 1em; color: var(--dim); text-decoration: none; opacity: 0; transition: opacity .15s; }
.prose h2 .anchor { top: 1.1em; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose a { color: var(--teal); text-decoration: underline; text-decoration-color: rgba(95, 208, 200, .4); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose strong { color: var(--ink); font-weight: 600; }

.prose ul { margin: 0 0 1.3em; padding: 0; list-style: none; }
.prose li { position: relative; margin: .45em 0; padding-left: 1.4em; }
.prose li::before { content: ''; position: absolute; left: .15em; top: .8em; width: .55em; height: 2px; background: var(--teal); }
.prose li ul { margin: .5em 0 .2em; }
.prose li li::before { width: 5px; height: 5px; border-radius: 50%; top: .7em; background: var(--dim); }

.note { margin: 2em 0 !important; padding: .2em 0 .2em 1.2em; border-left: 3px solid var(--red); color: var(--ink); font-size: 18px; line-height: 1.6; }

/* three logos of very different shapes: same box each, so none dominates */
.logos { display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; justify-items: center; gap: 20px 28px; margin: 0 0 2.4em; padding: 24px 28px; border-radius: 8px; background: #fff; }
.prose .logos a { display: flex; align-items: center; justify-content: center; width: 100%; height: 64px; text-decoration: none; }
.logos img { display: block; width: auto; height: auto; max-width: 100%; max-height: 64px; }

.signoff { margin-top: 3.5em; padding-top: 1.5em; border-top: 1px solid var(--rule); }
.signoff p { margin: 0; }
.signoff p:first-child { color: var(--dim); font-size: 15px; }
.signature { display: block; width: 150px; margin: 18px 0 6px; }

/* ---- footer ---- */
.cg-footer { background: var(--navy); border-top: 1px solid var(--rule); padding: 56px var(--gutter) 28px; font-size: 15px; line-height: 1.6; color: var(--dim); }
.cg-footer__cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 32px 48px; max-width: 1320px; margin: 0 auto; }
.cg-footer img { display: block; width: 150px; margin-bottom: 14px; }
.cg-footer p { margin: 0; max-width: 18rem; }
.cg-footer h2 { margin: 0 0 12px; font: 500 11px/1 var(--nav-font); letter-spacing: 2px; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
.cg-footer ul { margin: 0; padding: 0; list-style: none; }
.cg-footer li { margin: 0; }
.cg-footer a { color: rgba(255, 255, 255, .82); text-decoration: none; }
.cg-footer li a { display: inline-block; padding: 6px 0; }
.cg-footer a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.cg-footer address { font-style: normal; }
.cg-footer__legal { max-width: 1320px !important; margin: 48px auto 0 !important; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 13px; }

/* ---- 404 ---- */
.notfound { max-width: var(--measure); margin: 0 auto; padding: 96px var(--gutter); }
.notfound h1 { font-size: 40px; margin: 0 0 .4em; }
.notfound a { color: var(--teal); }

/* ---- narrower screens ---- */
@media (max-width: 1100px) {
  .has-toc .doc__body, .has-toc .doc__headin { display: block; max-width: var(--measure); }
  .has-toc .doc__head h1, .has-toc .doc__head .lead, .has-toc .doc__kicker { margin-left: 0; }
  .toc { position: static; margin: 0 0 36px; padding: 0 0 20px; border-bottom: 1px solid var(--rule); }
  .toc ol { display: flex; flex-wrap: wrap; gap: 2px 24px; border: 0; }
  .toc a { padding: 8px 0; margin: 0; border: 0; }
  .anchor { display: none; }
}
@media (max-width: 980px) {
  :root { --header-h: 60px; }
  .cg-header__logo img { width: 140px; }
  .cg-nav-burger { display: flex; flex-direction: column; justify-content: center; gap: 5px; margin-left: auto; width: 44px; height: 44px; cursor: pointer; }
  .cg-nav-burger span { display: block; height: 2px; width: 24px; margin: 0 auto; background: #fff; transition: transform .25s, opacity .25s; }
  .cg-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0; margin: 0;
    background: var(--navy); border-bottom: 1px solid var(--rule);
    max-height: 0; overflow: hidden; transition: max-height .3s ease;
  }
  .cg-nav ul { flex-direction: column; gap: 0; padding: 4px 0 12px; }
  .cg-nav a { padding: 15px var(--gutter); font-size: 16px; }
  .cg-nav a::after { display: none; }
  .cg-nav a[aria-current="page"] { background: rgba(255, 255, 255, .06); box-shadow: inset 3px 0 var(--teal); }
  .cg-nav-toggle:checked ~ .cg-nav { max-height: 420px; }
  .cg-nav-toggle:checked + .cg-nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .cg-nav-toggle:checked + .cg-nav-burger span:nth-child(2) { opacity: 0; }
  .cg-nav-toggle:checked + .cg-nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* stacked cards: the three company colours run top to bottom instead of left to right */
  body.home { background: var(--navy); }
  .cg-companies {
    grid-template-columns: 1fr; gap: 40px; max-width: none; padding: 56px max(var(--gutter), calc((100% - 46rem) / 2)) 72px;
    background: linear-gradient(180deg, #172542 0%, #0f6466 14%, #10595f 22%, #172540 46%, #172540 54%, #5e1f22 78%, #7b1917 88%, #7b1917 100%);
  }
  .cg-company { display: grid; grid-template-columns: 240px 1fr; gap: 0 28px; align-items: start; }
  .cg-company__photo { grid-row: 1 / 4; aspect-ratio: 1; }
  .cg-company h2 { margin-top: 4px; }
  .cg-footer__cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .cg-companies { gap: 56px; padding-left: max(var(--gutter), calc((100% - 34rem) / 2)); padding-right: max(var(--gutter), calc((100% - 34rem) / 2)); }
  .cg-company { display: flex; }
  .cg-company__photo { aspect-ratio: 4 / 3; }
  .cg-company h2 { margin-top: 24px; }
}
@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .cg-hero { text-align: left; padding-top: 40px; }
  .doc__body { padding-top: 36px; }
  .prose h2 { font-size: 24px; }
  .logos { padding: 16px; gap: 12px; }
  .prose .logos a { height: 44px; }
  .logos img { max-height: 44px; }
  .note { font-size: 17px; }
  .cg-footer__cols { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::after { transition: none !important; } }

/* ---- print: policies get printed and signed off ---- */
@media print {
  body, .doc__head, body.home { background: #fff !important; color: #000; font-size: 11pt; }
  .cg-header, .cg-footer, .toc, .skip, .anchor { display: none !important; }
  .doc__head { padding: 0 0 12pt; }
  .doc__kicker, .doc__head .lead, .prose, .prose strong, h1, h2, h3, .note, .signoff p:first-child { color: #000 !important; }
  .doc__body { display: block !important; padding: 0; max-width: none; }
  .prose { max-width: none; }
  .prose a { color: #000; }
  .prose h2 { break-after: avoid; border-color: #ccc; }
  .prose li::before { background: #000; }
  .signature { filter: invert(1); }
}
