/*
 * ADB'S BRAND ON AccessMgt's SIGN-IN AND CONSOLE (change edge-adb-colours-and-cleanups, #94).
 *
 * WHAT: redefines the CSS custom properties AccessMgt 1.4.0 compiles into its console's one stylesheet
 *   (Tailwind 4's `theme` layer and @makesensedigital/frontend-ui's `base` layer) with ADB's palette and
 *   fonts, plus four rules for places that write a colour no token reaches. Served by the entry point at
 *   https://plataforma.adbseguros.com.ar/marca-adb/adb-accessmgt.css, and linked into AccessMgt's HTML pages
 *   ONLY by sites/plataforma.caddy (the `replace` in its last `handle`). Nothing in AccessMgt is changed.
 * CHANGE: edge-adb-colours-and-cleanups (the owner, 2026-10-20: «ajustes la implementación de ADB de
 *   AccessMgt y no que se actualice AccessMgt como producto»).
 * WHY NOT HIGHER: AccessMgt has no colour or font setting (L1 — only name, logo and favicon); asking the
 *   product (makesensedigital/accessmgt#158) was withdrawn by the owner's decision; forking it is L5. This
 *   is an L3 extension at the edge, outside the product.
 * UPGRADE EXPOSURE: a release that renames these properties or the CSS-module classes matched below
 *   brings AccessMgt's lime and gray back, SILENTLY — nothing fails. After every AccessMgt upgrade, the
 *   sign-in and one console page are looked at (runbooks/plataforma-ingreso-y-menu.md, «Actualizar
 *   AccessMgt»). Read the console's stylesheet for `--color-brand-primary` and `--font-sans` if they changed.
 *
 * THE SAME MAPPING AS THE FRAME'S (services/platform-frame/src/app/brand.css), so the console and the frame
 * look the same: azul for the menu, the main buttons, titles and links; the rojo as the accent (the active
 * item's mark, the avatar); docs/marca-adb.md is the record of the values.
 *
 * WHY `html:root` AND NO LAYER: AccessMgt defines its tokens inside layers (`theme`, `base`) and three of
 * them on an unlayered `:root`. An unlayered rule beats every layered one, and `html:root` (0,1,1) beats the
 * unlayered `:root` (0,1,0) whatever order the stylesheets end up in — Next.js may add its own later.
 *
 * Contrast (WCAG): azul and blanco 12.1:1; rojo and blanco 6.06:1; tinta on blanco 17.8:1; tinta-suave on
 * blanco 7.0:1. The rojo is never text on azul (2.0:1), and never has dark text on it (2.9:1).
 */
html:root {
  --adb-azul: #183565;
  --adb-rojo: #c21b18;
  --adb-blanco: #ffffff;
  --adb-tinta: #16181d;
  --adb-tinta-suave: #545963;
  --adb-azul-claro: #e8edf5;
  --adb-fondo: #f5f6f8;
  --adb-linea: #d5d9e0;
  --adb-sobre-azul-suave: #c9d3e6;
  --adb-sobre-azul-linea: #8a9bbd;
  --adb-font-titulos: "Antonio", "Arial Narrow", sans-serif;
  --adb-font-etiquetas: "Barlow", "Segoe UI", Arial, sans-serif;
  --adb-font-texto: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Fonts: Tailwind's (--font-sans, --default-font-family) and frontend-ui's (--font-family-base). */
  --font-sans: var(--adb-font-texto);
  --default-font-family: var(--adb-font-texto);
  --font-family-base: var(--adb-font-texto);

  /* The console's own tokens (Tailwind `theme` layer, and the unlayered :root). */
  --background: var(--adb-fondo);
  --foreground: var(--adb-tinta);
  --color-primary: var(--adb-azul);
  --color-primary-foreground: var(--adb-blanco);
  --color-ring: var(--adb-azul);
  --color-accent: var(--adb-azul-claro);
  --color-accent-foreground: var(--adb-tinta);
  --color-text: var(--adb-tinta);
  --color-muted-foreground: var(--adb-tinta-suave);
  --color-border: var(--adb-linea);
  --color-brand-primary-strong: var(--adb-azul);

  /* frontend-ui's shell (`base` layer): the same values the frame gives them. */
  --color-brand-primary: var(--adb-rojo);
  --color-brand-primary-tint-10: rgb(194 27 24 / 0.1);
  --color-brand-primary-tint-15: rgb(194 27 24 / 0.15);
  --color-brand-secondary: var(--adb-azul);
  --color-brand-secondary-dark: var(--adb-azul);
  --color-brand-secondary-light: var(--adb-fondo);
  --color-brand-gray-20: var(--adb-sobre-azul-suave);
  --color-brand-gray-40: var(--adb-sobre-azul-linea);
  --color-brand-lime-100: var(--adb-rojo);
  --color-brand-lime-20: rgb(194 27 24 / 0.15);
  --color-background-sidebar: var(--adb-azul);
  --color-background-main: var(--adb-fondo);
  --color-text-main: var(--adb-tinta);
  --color-text-muted: var(--adb-tinta-suave);
}

/*
 * The user menu's avatar fills with --color-brand-primary and writes --color-text-main on it: dark on rojo
 * is 2.93:1. White on rojo is 6.06:1. No token reaches that text, so the CSS module's class is matched by its
 * stable prefix (the frame does the same).
 */
[class*="UserMenu-module_avatar"] {
  color: var(--adb-blanco);
}

/* Utilities that fill with the rojo (the current page of a list's pagination, counters): white text. */
[class~="bg-brand-primary"] {
  color: var(--adb-blanco);
}

/* The sidebar's icon turns --color-brand-primary when its item is active or hovered: the rojo on the azul
   (1.3:1 to 1.6:1). In the collapsed rail the icon is all the item shows: white instead, in both states
   (adversarial review, finding 10). */
[class*="Sidebar-module_active"] [class*="Sidebar-module_navIcon"],
[class*="Sidebar-module_navItem"]:hover [class*="Sidebar-module_navIcon"] {
  color: var(--adb-blanco);
}

/* The one colour the console writes as a literal (a dark lime green for text), not through a token. */
[class~="text-[#3d5c00]"] {
  color: var(--adb-azul);
}

/* The manual's fonts: Antonio for big titles; Barlow for labels, menus and buttons. */
h1 {
  font-family: var(--adb-font-titulos);
  letter-spacing: 0.01em;
}

button,
label,
legend,
th,
nav a,
nav button {
  font-family: var(--adb-font-etiquetas);
}

/* SIL Open Font License 1.1 — fonts/OFL-*.txt. Latin subset, served by the entry point on this origin. */
@font-face {
  font-family: "Antonio";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/antonio-700.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/barlow-500.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/barlow-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("fonts/ibm-plex-sans.woff2") format("woff2");
}
