/*
 * nutronhealth.com: one stylesheet for every page.
 *
 * Values come from the NUTRON design tokens v3 (brand/tokens/nutron-tokens-v3-current.json).
 * Change a colour there first, then copy it here; never invent one in this file.
 *
 * Type: the design system's voice face is Soleil, an Adobe Fonts typeface that needs a
 * licensed web kit. Until a kit is added, headings fall back to Outfit (the system's own
 * named fallback) and body text uses IBM Plex Sans. Both are the Google Fonts builds,
 * hosted on this site rather than fetched from Google, so a visitor's IP address never
 * reaches a third party (the privacy policy says so). Licences sit beside the files.
 */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/outfit-400.ttf") format("truetype");
}

:root {
  color-scheme: light dark;

  /* Colour: semantic tokens, light theme. */
  --surface-canvas: #f4f0e6;
  --surface-card: #fbf9f3;
  --surface-raised: #ffffff;
  --line-subtle: #e2dccd;
  --text-primary: #0f1b2d;
  --text-secondary: #5e584b;
  --text-accent: #b5381f;
  --action-primary: #0f1b2d;
  --action-on-primary: #f4f0e6;
  --signal-you: #ff5a3c;

  /* Type families (tokens: type.families). */
  --font-voice: soleil, "Outfit", system-ui, sans-serif;
  --font-data: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Spacing steps grow by phi from 4 px (tokens: spacing). */
  --space-1: 4px;
  --space-2: 6px;
  --space-3: 10px;
  --space-4: 16px;
  --space-5: 26px;
  --space-6: 42px;
  --space-7: 68px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --duration-instant: 120ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  --measure: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Colour: semantic tokens, "Night" theme. */
    --surface-canvas: #0b1522;
    --surface-card: #13213a;
    --surface-raised: #1d2b40;
    --line-subtle: #2a3950;
    --text-primary: #f4f0e6;
    --text-secondary: #b9b3a5;
    --text-accent: #ff7a60;
    --action-primary: #f4f0e6;
    --action-on-primary: #0f1b2d;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface-canvas);
  color: var(--text-primary);
  font-family: var(--font-data);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

/* Skip link: hidden until focused, then the first thing a keyboard user reaches. */
.skip {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  padding: var(--space-3) var(--space-4);
  background: var(--action-primary);
  color: var(--action-on-primary);
  border-radius: var(--radius-md);
  z-index: 10;
}
.skip:focus {
  top: var(--space-4);
}

:focus-visible {
  outline: 3px solid var(--text-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ---- header ---- */
.site-header {
  border-bottom: 1px solid var(--line-subtle);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-primary);
}
.brand svg {
  display: block;
  height: 26px;
  width: auto;
}
.brand .dot {
  fill: var(--signal-you);
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-1);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
}
.site-nav a:hover {
  text-decoration: underline;
}
.site-nav a[aria-current="page"] {
  color: var(--text-accent);
  text-decoration: underline;
  text-underline-offset: 6px;
}

/* ---- content ---- */
main {
  display: block;
  padding: var(--space-6) 0 var(--space-7);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-voice);
  font-weight: 400;
  color: var(--text-primary);
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.1rem, 7vw, 3.3rem); /* h1 token is 53 px at desktop width */
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-4);
}
h2 {
  font-size: clamp(1.5rem, 4.5vw, 1.625rem); /* "title" token, 26 px */
  line-height: 1.25;
  margin: var(--space-6) 0 var(--space-3);
  scroll-margin-top: var(--space-4);
}
h3 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: var(--space-5) 0 var(--space-2);
}
h4 {
  font-size: 1.125rem;
  line-height: 1.3;
  margin: 0 0 var(--space-2);
}

p,
ul,
ol,
dl {
  margin: 0 0 var(--space-4);
}
li + li {
  margin-top: var(--space-2);
}
/* Horizontal link rows sit on one baseline. */
.site-nav li + li,
.site-footer li + li {
  margin-top: 0;
}

a {
  color: var(--text-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--duration-instant) var(--ease-standard);
}

.lead {
  font-family: var(--font-voice);
  font-size: 1.25rem; /* "lead" token, 20 px */
  line-height: 1.45;
  color: var(--text-primary);
}

.meta,
.caption {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* The "label" data style: small, spaced capitals above a block. */
.eyebrow {
  display: block;
  margin: 0 0 var(--space-3);
  font-family: var(--font-data);
  font-size: 0.75rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin: 0 0 var(--space-4);
}
.card > :last-child {
  margin-bottom: 0;
}
.card h3,
.card h4 {
  margin-top: 0;
}
@media (min-width: 40rem) {
  .card {
    padding: var(--space-5);
  }
}

/* What / why / legal basis rows inside a card. Stacks naturally, so no table overflows. */
.facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-1) var(--space-4);
}
.facts dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: var(--space-3);
}
.facts dt:first-child {
  margin-top: 0;
}
.facts dd {
  margin: 0;
}
@media (min-width: 40rem) {
  .facts {
    grid-template-columns: 9.5rem 1fr;
  }
  .facts dt,
  .facts dt:first-child {
    margin-top: 0;
    padding-top: 0.2em;
  }
}

/* Simple two-column tables (retention). Cells wrap, so the page never scrolls sideways. */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-4);
  font-size: 0.95rem;
}
caption {
  text-align: left;
  font-weight: 600;
  padding-bottom: var(--space-3);
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-3) var(--space-3) var(--space-3) 0;
  border-bottom: 1px solid var(--line-subtle);
}
thead th {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.toc {
  columns: 1;
  padding-left: 1.5rem;
}
/* Contents links are list items people tap, so each gets a full 44 px row. */
.toc li + li {
  margin-top: 0;
}
.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.toc li {
  break-inside: avoid;
}
@media (min-width: 40rem) {
  .toc {
    columns: 2;
    column-gap: var(--space-6);
  }
}

.steps li::marker {
  font-weight: 600;
}

/* The one place a primary action appears: the support email. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--action-primary);
  color: var(--action-on-primary);
  font-weight: 600;
  text-decoration: none;
}
.button:hover {
  text-decoration: underline;
}

.links {
  list-style: none;
  padding: 0;
}
.links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--line-subtle);
  padding: var(--space-5) 0 var(--space-6);
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
}
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-secondary);
}
.site-footer p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media print {
  .site-header nav,
  .site-footer,
  .skip {
    display: none;
  }
  /* Ink on white whatever the screen theme, so a printed policy is always legible. */
  body {
    background: #ffffff;
    color: #0f1b2d;
  }
  a {
    color: inherit;
  }
}

/* Cross-document transitions between the legal pages and the home page. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
