/* ==========================================================================
   Base – reset, typography roles, layout primitives
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-graphite);
  font-family: var(--font-text);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--color-medfit-blue); outline-offset: 3px; border-radius: 2px; }
.on-dark :focus-visible, .on-dark:focus-visible { outline-color: var(--color-white); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-16); top: -100px; z-index: 100;
  background: var(--color-graphite); color: var(--color-white);
  padding: var(--space-8) var(--space-16); border-radius: var(--radius-pill);
  font-weight: 600;
}
.skip-link:focus { top: var(--space-8); }

/* --------------------------------------------------------------------------
   Typography roles – one class per Figma text style.
   Visual style is separate from heading level (h1–h4 are chosen for document
   outline/SEO, the class decides the look).
   -------------------------------------------------------------------------- */
.t-h1, .t-h2 { font-family: var(--font-display); font-weight: 800; }
.t-h1 { font-size: var(--h1-size); line-height: var(--h1-lh); letter-spacing: var(--h1-ls); }
.t-h2 { font-size: var(--h2-size); line-height: var(--h2-lh); letter-spacing: var(--h2-ls); }
.t-h3 { font-size: var(--h3-size); line-height: var(--h3-lh); letter-spacing: var(--h3-ls); font-weight: 600; }
.t-h4 { font-size: var(--h4-size); line-height: var(--h4-lh); letter-spacing: var(--h4-ls); font-weight: 600; }
.t-ingress { font-size: var(--ingress-size); line-height: var(--ingress-lh); letter-spacing: var(--ingress-ls); font-weight: 500; }
.t-body { font-size: var(--body-size); line-height: var(--body-lh); font-weight: 400; }
.t-small { font-size: var(--small-size); line-height: var(--small-lh); font-weight: 400; }
.t-meta { font-size: var(--meta-size); line-height: var(--meta-lh); font-weight: 500; }
.t-label { font-size: var(--label-size); line-height: var(--label-lh); letter-spacing: var(--label-ls); font-weight: 500; }
.t-label-caps { font-size: 12px; line-height: 1.2; letter-spacing: 0.02em; font-weight: 500; text-transform: uppercase; }
.t-link { font-size: var(--small-size); line-height: var(--small-lh); font-weight: 400; text-decoration: underline; text-underline-offset: 2px; }
.t-voice { font-family: var(--font-voice); font-weight: 600; font-size: var(--voice-size); line-height: var(--voice-lh); letter-spacing: var(--voice-ls); }
.t-number { font-size: var(--number-size); line-height: var(--number-lh); letter-spacing: var(--number-ls); font-weight: 500; }

.c-graphite { color: var(--color-graphite); }
.c-muted { color: var(--color-muted); }
.c-blue { color: var(--color-medfit-blue); }
.c-white { color: var(--color-white); }
.c-tone { color: var(--color-tone); }

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Page section: 24/24 on mobile, 48/48 on desktop; last section before the
   footer gets 48 (mobile) / 128 (desktop) at the bottom. */
.section { padding-block: var(--section-pad); }
.section--last { padding-bottom: var(--section-pad-last); }
.section--flush-bottom { padding-bottom: 0; }

.stack { display: flex; flex-direction: column; }
.stack > * { min-width: 0; }
.gap-4 { gap: var(--space-4); }
.gap-8 { gap: var(--space-8); }
.gap-12 { gap: var(--space-12); }
.gap-16 { gap: var(--space-16); }
.gap-24 { gap: var(--space-24); }
.gap-32 { gap: var(--space-32); }
.gap-48 { gap: var(--space-48); }

.row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-8); }

/* Rail layout: heading in the left rail (384), content in the column (776).
   Mobile: stacked with 16 between. */
.rail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-16);
}
@media (min-width: 1024px) {
  .rail { grid-template-columns: minmax(0, var(--rail)) minmax(0, var(--column)); gap: var(--space-24); }
  .rail__content { grid-column: 2; }
}

/* Divider under the intro block (Intro/Inledning on desktop) */
@media (min-width: 1024px) {
  .divider-bottom { border-bottom: 1px solid var(--color-line); padding-bottom: var(--space-48); }
}

/* Visibility helpers */
@media (max-width: 1023.98px) { .only-desktop { display: none !important; } }
@media (min-width: 1024px) { .only-mobile { display: none !important; } }

@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; }
}
