/*
 * Design tokens of "ONVV - MUD Design" (design/tokens.json, Figma file page 134:29262), as custom
 * properties. This is the only stylesheet that holds a colour value or a font size: every other
 * stylesheet reads these properties (a test scans them: M1-DESIGN).
 *
 * Type and line heights are in rem (1rem = 16px) so that the text scales with the browser's text
 * size (WCAG 1.4.4); the pixel value of the design is in the comment beside it. Spacing, radii and
 * border widths are in px: they are the design's own numbers and do not grow with the text.
 *
 * Sections:
 *   1. design/tokens.json, every entry, under its own name
 *   2. what the design draws but tokens.json does not list: sampled from the design pages, or the
 *      value that prototype-v5/dev/04 gives to standardise on (marked)
 *   3. the roles the components use
 */
:root {
  /* ---- 1. design/tokens.json ---- */

  /* Colours */
  --color-background-brand-default-active: var(--color-action-active); /* M5 owner-3: burgundy (the design's MUD blue is superseded) */
  --color-background-brand-secondary: var(--color-background-action-hover); /* M5 owner-3 (the design's MUD blue is superseded) */
  --color-background-base-default: #ffffff;
  --color-background-base-tertiary: #f1f1f1;
  --color-background-base-inverse-default: #ffffff;
  --color-background-base-inverse-on-color: #ffffff;
  --color-background-positive-secondary: #e6f5ee;
  --color-background-danger-secondary: #fee4e2;
  --color-text-base-default: #121212;
  --color-text-base-secondary: #383838;
  --color-text-base-tertiary: #757575;
  --color-text-brand-default: var(--accent); /* M5 owner-3 (the design's MUD blue is superseded) */
  --color-text-brand-on-secondary: var(--accent);
  --color-text-positive-on-secondary: #027948;
  --color-text-danger-on-secondary: #b32318;
  --color-border-base-default: #d9d9d9;
  --color-border-base-tertiary: #444444;
  --color-border-positive-secondary: #9ad6bb;
  --color-border-danger-secondary: #fda19b;
  --color-border-brand-secondary: var(--accent-tint-4); /* M5 owner-3 (the design's MUD blue is superseded) */
  --color-icon-base-default: #121212;
  --color-icon-base-secondary: #444444;
  --color-icon-base-tertiary: #757575;
  --black-1000: #121212;
  /* "Wine of Noldova" in tokens.json (sic): the brand burgundy */
  --wine-of-moldova: #752f43;

  /* Type */
  --font-family-primary: "Onest";
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-size-10: 0.625rem; /* 10px: in tokens.json, not used: no text under 12px */
  --line-height-12: 0.75rem; /* 12px */
  --font-size-12: 0.75rem; /* 12px */
  --line-height-16: 1rem; /* 16px */
  --font-size-14: 0.875rem; /* 14px */
  --line-height-20: 1.25rem; /* 20px */
  --font-size-16: 1rem; /* 16px */
  --line-height-24: 1.5rem; /* 24px */
  --font-size-18: 1.125rem; /* 18px */
  --line-height-26: 1.625rem; /* 26px */
  --font-size-20: 1.25rem; /* 20px */
  --line-height-28: 1.75rem; /* 28px */
  --font-size-24: 1.5rem; /* 24px: large text for WCAG at any weight (LT-14) */
  --font-size-32: 2rem; /* 32px */
  --line-height-40: 2.5rem; /* 40px */
  --font-size-40: 2.5rem; /* 40px */
  --line-height-48: 3rem; /* 48px */
  --font-size-48: 3rem; /* 48px */
  --line-height-56: 3.5rem; /* 56px */

  /* Text styles: "Desktop/Display/Medium": Onest SemiBold 600, 48/56, letterSpacing -2 (percent of the size, as Figma counts it) */
  --letter-spacing-display: -0.02em;
  --letter-spacing-h1: -0.02em;
  --letter-spacing-h2: -0.02em;
  --letter-spacing-h4: -0.01em;
  --letter-spacing-h5: -0.01em;

  /* Shadow: "Drop Shadow/100" */
  --shadow-100: 0 1px 3px #00000029, 0 0 0.5px #0000004d;

  /* Spacing, in px */
  --spacing-0: 0;
  --spacing-2: 2px;
  --spacing-4: 4px;
  --spacing-6: 6px;
  --spacing-8: 8px;
  --spacing-12: 12px;
  --spacing-16: 16px;
  --spacing-20: 20px;
  --spacing-24: 24px;
  --spacing-32: 32px;
  --spacing-40: 40px;
  --spacing-48: 48px;
  --spacing-56: 56px;
  --spacing-64: 64px;

  /* Radii */
  --border-radius-0: 0;
  --border-radius-4: 4px;
  --border-radius-6: 6px;
  --border-radius-8: 8px;
  --border-radius-12: 12px; /* not a Figma variable: dev/04 row 16 and M2-KIT, the radius of the lists' cards */
  --border-radius-16: 16px;
  --border-radius-full: 999px;

  /* Border widths */
  --border-width-1: 1px;
  --border-width-1\.5: 1.5px;
  --border-width-1-5: 1.5px; /* the same as the one above, under a name without a dot */
  --border-width-2: 2px;
  --border-width-3: 3px;

  /* Breakpoints: custom properties cannot be read by a media query, so the stylesheets write them out.
     "breakpoint/desktop": 1920 (design frames); responsive layouts are not drawn. Checked at 320, 390,
     768 and 1440 px: one column under 768, two from 768, three from 1024. */
  --breakpoint-tablet: 768px;
  --breakpoint-desktop: 1024px;
  --design-frame-width: 1920px;

  /* ---- 2. drawn in the design, not in tokens.json ---- */

  /* Sampled from the design pages (design/pages/*.png) */
  --color-background-strip: #284b3d; /* top strip, dark green */
  --color-background-band: #ebece1; /* section bands, filter bars, footer: warm grey */
  --color-background-legal: #1e1e1e; /* the footer's legal bar */
  --color-background-placeholder: #f8f7f4; /* logo and image placeholder of a card */
  --color-border-band: #ddddd6; /* border of a filter bar on the band */
  --color-text-placeholder: #757575; /* LT-14: the name on a logo placeholder, large text: 4.3:1 on --color-background-placeholder, 3:1 needed */
  --color-text-placeholder-caption: #717171; /* LT-14: its 12/16 sub-label: #757575 gives 4.3:1 there, #717171 is the lightest grey that gives 4.5:1 */
  --color-text-on-strip: #ffffff; /* text on the top strip */
  --color-text-on-strip-muted: #d5e0da; /* the languages not chosen: 7:1 on the strip */

  /* Not in the design: standardised by prototype-v5/dev/04 (inconsistency 7 and 8, step 1) */
  --color-border-danger: #d92d20; /* border of a field in error */
  --color-text-warning: #b54708;
  --color-background-warning-secondary: #feefc6;
  --color-border-warning-secondary: #fec84b;
  --color-border-field: #757575; /* UI-07: the MUD #d9d9d9 border gives 1.41:1, under WCAG 1.4.11 */
  --color-border-field-hover: #383838;
  --color-border-card-hover: #b2b2b2; /* FS-4: the border of a clickable card on hover (brief p2) */
  --color-focus-ring: var(--accent); /* the MUD focus ring's shape (2px white + 5px), in the burgundy of M5 owner-3 */
  --color-field-focus: var(--accent); /* dev04's field focus: the 2px edge, in burgundy */
  --color-field-focus-halo: var(--accent-tint-3); /* and the 4px halo outside it, a pale burgundy */

  /* The burgundy accent family (M5 owner-3): #752F43, "Wine of Noldova" of tokens.json, and the tints and shades
     derived from it. The one place an accent colour value is written: every stylesheet and view reads these
     properties or the roles below (a test scans for colour literals). A tint is mixed with white, a shade with black. */
  --accent: var(--wine-of-moldova); /* #752f43 */
  --color-action-hover: #5f2536; /* shade: hover */
  --color-action-active: #4a1c2a; /* shade: active, the admin's link hover */
  --color-background-action-hover: #f7eff1; /* tint: the info surface, a hovered row */
  --color-background-action-active: #eedde2; /* tint: a selected row, an active surface */
  --accent-tint-3: #e0c6ce; /* tint: the halo of a focused field */
  --accent-tint-4: #c79fac; /* tint: the border of an info surface */

  /* Disabled controls: the text keeps 5:1 on its surface */
  --color-text-disabled: #666666;

  /* Motion (M4-MOTION, MO-1): the only place a duration is written. An exit uses the next shorter
     duration (slow to base, base to fast, fast stays fast). Transitions animate opacity, transform,
     color, background-color, border-color or box-shadow only. */
  --motion-duration-fast: 120ms;
  --motion-duration-base: 200ms;
  --motion-duration-slow: 280ms;
  --motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);

  /* ---- 3. roles ---- */

  --color-page: var(--color-background-base-default);
  --color-surface: var(--color-background-base-default);
  --color-surface-muted: var(--color-background-base-tertiary);
  --color-text: var(--color-text-base-default);
  --color-text-secondary: var(--color-text-base-secondary);
  --color-text-muted: var(--color-text-base-tertiary); /* only on white: 4.6:1 */
  --color-action: var(--wine-of-moldova);
  --color-action-text: var(--color-background-base-inverse-on-color);
  --color-link: var(--wine-of-moldova);
  --color-border: var(--color-border-base-default);
  --color-info-text: var(--color-text-brand-on-secondary);
  --color-info-surface: var(--color-background-brand-secondary);
  --color-info-border: var(--color-border-brand-secondary);

  --focus-ring: 0 0 0 var(--border-width-2) var(--color-background-base-inverse-default), 0 0 0 5px var(--color-focus-ring);
  /* A text field keeps its 1px border (no size change): the edge is the border plus a 1px shadow, the halo 4px more */
  --field-focus-ring: 0 0 0 var(--border-width-1) var(--color-field-focus), 0 0 0 5px var(--color-field-focus-halo);

  --container-width: 1200px;
  --gutter: var(--spacing-24);
  --control-height: 3rem; /* 48px: text fields, selects, large buttons */
  --control-padding-block: 0.6875rem; /* 11px: 48px = 24px line + 2 x 11px + 2 x 1px border */
  --control-height-small: 2.5rem; /* 40px: medium buttons, and the fields of the filter bars and the newsletter band (FO-4) */
  --control-padding-block-small: 0.5625rem; /* 9px: 40px = 20px line + 2 x 9px + 2 x 1px border */
  /* CC-4: the select's arrow, the menu's 16 px line chevron: 1.5 px stroke, #121212, in img/select-chevron.svg */
  --select-chevron: url("/img/select-chevron.svg");
  --target-size: 2.5rem; /* 40px: pagination */
  --font-family-serif: Georgia, "Times New Roman", serif; /* the italic tagline of the header, drawn in a serif in the design */
  --font-family-stack: var(--font-family-primary), "Segoe UI", Arial, sans-serif;
}

/* ---- 4. lengths the stylesheets used as literals (R-CSS, tests-17) ----
   No stylesheet but this one writes a length in px, rem or em (a test scans for them: 0, 1px for a hairline and the lengths of
   @media and @container conditions are the only ones left outside). A length that already has a token above is read from it: the
   spacing, border-width, font-size, line-height, control-height and target-size properties. What had no token is named by its
   value here, in rem where the page's width or height follows the text size (a measure, a column, a minimum size) and in px where
   it is a fixed pixel size or a coordinate. */
:root {
  /* Type that tokens.json does not list: the h2 of the pages, 28/36 */
  --font-size-28: 1.75rem; /* 28px */
  --line-height-36: 2.25rem; /* 36px */

  /* Em lengths: they follow the size of the text they are set on */
  --underline-offset: 0.2em; /* the offset of every link's underline */
  --letter-spacing-wide: 0.02em;
  --letter-spacing-wider: 0.04em;
  --icon-baseline-shift: -0.125em; /* an inline icon sits this far under the baseline */
  --size-1em: 1em; /* an inline icon is as wide and as high as the text */

  /* Fixed pixel sizes */
  --offscreen-offset: -10000px; /* a skip link waiting off the screen */
  --size-44px: 44px;
  --size-330px: 330px;
  --size-414px: 414px;
  --breadcrumb-chevron-clip: polygon(6.53px 3.47px, 11.06px 8px, 6.53px 12.53px, 5.47px 11.47px, 8.94px 8px, 5.47px 4.53px); /* LT-1: the 16 px line chevron of the breadcrumb, cut from its box */

  /* Measures, columns and minimum sizes, in rem: they grow with the text size (WCAG 1.4.4) */
  --size-0-0625rem: 0.0625rem;
  --size-0-25rem: 0.25rem;
  --size-0-5rem: 0.5rem;
  --size-0-75rem: 0.75rem;
  --size-1rem: 1rem;
  --size-1-25rem: 1.25rem;
  --size-1-5rem: 1.5rem;
  --size-1-75rem: 1.75rem;
  --size-2rem: 2rem;
  --size-2-25rem: 2.25rem;
  --size-2-75rem: 2.75rem;
  --size-3-25rem: 3.25rem;
  --size-3-5rem: 3.5rem;
  --size-4-5rem: 4.5rem;
  --size-5-5rem: 5.5rem;
  --size-6rem: 6rem;
  --size-7rem: 7rem;
  --size-7-5rem: 7.5rem;
  --size-8rem: 8rem;
  --size-8-5rem: 8.5rem;
  --size-9rem: 9rem;
  --size-10rem: 10rem;
  --size-11rem: 11rem;
  --size-12rem: 12rem;
  --size-12-5rem: 12.5rem;
  --size-13-5rem: 13.5rem;
  --size-14rem: 14rem;
  --size-15rem: 15rem;
  --size-16rem: 16rem;
  --size-16-25rem: 16.25rem;
  --size-20rem: 20rem;
  --size-22rem: 22rem;
  --size-24rem: 24rem;
  --size-25rem: 25rem;
  --size-28rem: 28rem;
  --size-30rem: 30rem;
  --size-30-25rem: 30.25rem;
  --size-32rem: 32rem;
  --size-34rem: 34rem;
  --size-36rem: 36rem;
  --size-40rem: 40rem;
  --size-41rem: 41rem;
  --size-42rem: 42rem;
  --size-42-5rem: 42.5rem;
  --size-44rem: 44rem;
  --size-45rem: 45rem;
  --size-48rem: 48rem;
  --size-52rem: 52rem;
  --size-56rem: 56rem;
  --size-60rem: 60rem;
  --size-72rem: 72rem;
}

@media (max-width: 767.98px) {
  :root {
    --gutter: var(--spacing-16);
  }
}

/* Reduced motion: the three durations resolve to 0 (the global rule of base.css covers the rest) */
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-duration-fast: 0ms;
    --motion-duration-base: 0ms;
    --motion-duration-slow: 0ms;
  }
}
