/**
 * @file
 * Variables i estils base. Identitat visual del CRAI de la UB (crai.ub.edu).
 *
 * Contrast (WCAG 2.2 AA) sobre blanc: --color-principal 11,5:1;
 * --color-accent 4,5:1 (només text gran, vores i elements no textuals);
 * --color-gris-fosc 7,6:1. --color-gris-mitja (#939393) és 3:1: només vores.
 */
:root {
  --color-principal: #00404e;
  --color-principal-fosc: #002f3a;
  --color-accent: #247fa6;
  --color-accent-fosc: #1b6687;
  --color-fons: #fff;
  --color-gris-clar: #eaeaea;
  --color-gris-mitja: #939393;
  --color-gris-fosc: #445769;
  --color-text: #00404e;
  --color-text-secundari: #445769;
  --color-error: #a51b1b;
  --color-correcte: #1e6b34;
  --color-avis: #7a5600;
  --color-focus: #247fa6;

  --font-base: Roboto, "Helvetica Neue", Arial, sans-serif;
  --mida-base: 1.0625rem; /* 17px */
  --interlineat: 1.6;

  --espai-1: 0.25rem;
  --espai-2: 0.5rem;
  --espai-3: 1rem;
  --espai-4: 1.5rem;
  --espai-5: 2rem;
  --espai-6: 3rem;

  --amplada-max: 80rem; /* 1280px */
  --radi: 2px;
}

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

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

body {
  margin: 0;
  color: var(--color-text);
  background: var(--color-fons);
  font-family: var(--font-base);
  font-size: var(--mida-base);
  line-height: var(--interlineat);
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--espai-3);
  color: var(--color-principal);
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.375rem;
}

h3 {
  font-size: 1.1875rem;
}

p,
ul,
ol,
dl,
table,
figure {
  margin: 0 0 var(--espai-3);
}

a {
  color: var(--color-principal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--color-accent-fosc);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-gris-clar);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: var(--espai-2) var(--espai-3);
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--color-gris-clar);
}

th {
  font-weight: 700;
}

blockquote {
  margin: 0 0 var(--espai-3);
  padding-inline-start: var(--espai-3);
  border-inline-start: 4px solid var(--color-accent);
}

/* Utilitats de core. */
.visually-hidden {
  position: absolute !important;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px;
  height: 1px;
  word-wrap: normal;
}

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus-within {
  position: static !important;
  overflow: visible;
  clip: auto;
  width: auto;
  height: auto;
}

.hidden {
  display: none;
}

.invisible {
  visibility: hidden;
}

.clearfix::after {
  display: table;
  clear: both;
  content: "";
}

/* Enllaç de salt al contingut. */
.skip-link.focusable:focus {
  position: absolute !important;
  z-index: 100;
  top: var(--espai-2);
  left: var(--espai-2);
  padding: var(--espai-2) var(--espai-3);
  color: #fff;
  background: var(--color-principal);
  font-weight: 700;
  outline: 3px solid #fff;
  box-shadow: 0 0 0 6px var(--color-principal);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Text amb format migrat de D7: cadenes de &nbsp; i mides/fonts en línia
   (CKEditor 4). Es parteixen les línies llargues i s'unifica la tipografia
   (Roboto, cos 17px) perquè el contingut no desbordi en mòbil. */
.text-formatted {
  overflow-wrap: anywhere;
}

.text-formatted [style*="font-size"],
.text-formatted [style*="font-family"] {
  font-family: inherit !important;
  font-size: inherit !important;
}

.text-formatted img {
  max-width: 100%;
  height: auto !important;
}
