/* ---------------------------------------------------------------------------
 * UTP (Universidad Tecnológica del Perú) branding for Inji Web.
 *
 * Same palette, type and logo treatment as Inji Verify's
 * ../../inji_verify/inji-verify-ui/utp.css, mapped onto Inji Web's variables.
 *
 * Loaded after the app's own stylesheet (the Dockerfile injects a <link> at the
 * end of <head>). Inji Web drives its colours through --iw-color-* custom
 * properties on :root (and on a body class picked by DEFAULT_THEME), so
 * re-skinning needs no rebuild of the React app - only these overrides.
 *
 * !important is used on the custom properties on purpose: this is an overlay on
 * a third-party build whose stylesheet order is not ours to control.
 *
 * Palette from the UTP logo (Utplogonuevo.svg): crimson #B50D30 and near-black
 * #1F1B1C / #222221. The tints and neutrals below are derived from those two:
 *   primary        #b50d30   primary-dark  #8c0a25   primary-soft #fbecef
 *   ink            #1f1b1c   heading       #222221   body  #3d3839
 *   muted          #6b6466   page bg       #faf9f9   surface #ffffff
 * ------------------------------------------------------------------------- */

/* Inji Web's index.html only links Inter, and its DEFAULT_FONT_URL setting
   never reaches the <link> (theme.config.js writes it to innerHTML), so the
   heading face is loaded here. Must stay the first rule in the file. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=Plus+Jakarta+Sans:wght@400;600;700;800&display=swap");

:root,
body,
body[class] {
  /* Type */
  --iw-font-base: "Inter", system-ui, sans-serif !important;
  --iw-font-montserrat: "Plus Jakarta Sans", "Inter", system-ui, sans-serif !important;

  /* Brand. Primary -> secondary is the gradient on every primary button and
     banner (from-iw-primary to-iw-secondary), so secondary is the deeper
     crimson: buttons read as solid brand red, exactly like Inji Verify's. */
  --iw-color-primary: #b50d30 !important;
  --iw-color-secondary: #8c0a25 !important;
  --iw-color-tertiary: #b50d30 !important;
  --iw-color-lightPrimary: #fbecef !important;
  --iw-color-lightSecondary: #f6f3f3 !important;
  --iw-color-deepVioletIndigo: #8c0a25 !important;
  --iw-color-paleViolet: #fdf5f6 !important;
  --iw-color-pink50: #fbecef !important;

  /* Surfaces */
  --iw-color-background: #ffffff !important;
  --iw-color-footer: #ffffff !important;
  --iw-color-tileBackground: #ffffff !important;
  --iw-color-navigationBar: #fbecef !important;
  --iw-color-paleGray: #faf9f9 !important;
  --iw-color-dropdown-active-bg: #fbecef !important;

  /* Text */
  --iw-color-header: #1f1b1c !important;
  --iw-color-title: #222221 !important;
  --iw-color-subTitle: #6b6466 !important;
  --iw-color-searchTitle: #3d3839 !important;
  --iw-color-textSecondary: #3d3839 !important;
  --iw-color-textTertiary: #6b6466 !important;
  --iw-color-dropdown-text: #1f1b1c !important;
  --iw-color-avatarText: #1f1b1c !important;
  --iw-color-darkGrayishBlue: #1f1b1c !important;
  --iw-color-dashboardSideBarMenuIconActive: #b50d30 !important;

  /* Icons, loaders, focus/hover tints */
  --iw-color-spinningLoaderPrimary: #b50d30 !important;
  --iw-color-spinningLoaderSecondary: #1f1b1c !important;
  --iw-color-languageGlobeIcon: #b50d30 !important;
  --iw-color-languageArrowIcon: #6b6466 !important;
  --iw-color-languageCheckIcon: #b50d30 !important;
  --iw-color-shieldLoadingIcon: #b50d30 !important;
  --iw-color-shieldLoadingShadow: #fbecef !important;
  --iw-color-shadow: rgb(181 13 48 / 0.16) !important;
  --iw-color-shadow-with-opacity: rgb(181 13 48 / 0.06) !important;
  --iw-color-selected-shadow: rgb(181 13 48 / 0.25) !important;
  --iw-color-arrowDown: rgb(181 13 48 / 0.25) !important;
  --iw-color-hoverBackGround: rgb(181 13 48 / 0.12) !important;

  /* Lines */
  --iw-color-borderLight: #e8e3e4 !important;
  --iw-color-borderDark: #6b6466 !important;
  --iw-color-faqAccordionHover: #f3eff0 !important;
  --iw-color-disabled: #cdc6c8 !important;

  /*
   * Success / error colours (shieldSuccess*, shieldError*, red, darkRed,
   * darkGreen, disclaimer*) are deliberately NOT re-skinned. They carry the
   * meaning of a result; recolouring them to the brand palette would make a
   * valid credential and a failed download look alike. Only the neutral chrome
   * above follows the brand - the same rule Inji Verify's theme follows.
   */
}

/* ---------------------------------------------------------------------------
 * Type hierarchy: Inter for body text, Plus Jakarta Sans for headings (both
 * loaded through DEFAULT_FONT_URL, see cloudrun-service.yaml.tmpl).
 * ------------------------------------------------------------------------- */
body {
  font-family: var(--iw-font-base) !important;
}

h1, h2, h3, h4,
.font-montserrat,
.font-bold,
.font-semibold {
  font-family: "Plus Jakarta Sans", var(--iw-font-base) !important;
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------------------------
 * Logo
 *
 * The header and the login page render Inji's wordmark as
 * <img alt="Inji Web Logo">. `content` swaps the image itself, so the app's
 * own sizing and click handler are kept. The asset's viewBox is cropped to the
 * artwork (U-T-P tiles + "Universidad Tecnológica del Perú"), ~4.56:1.
 * ------------------------------------------------------------------------- */
img[alt="Inji Web Logo"] {
  content: url("/assets/utp-logo.svg");
  width: auto !important;
  height: 40px !important;
  max-width: 182px;
  object-fit: contain;
}

/* On narrow screens keep just the U-T-P tiles so the header doesn't wrap. */
@media (max-width: 400px) {
  img[alt="Inji Web Logo"] {
    content: url("/assets/utp-mark.svg");
    height: 36px !important;
  }
}

/* Footer badge: show the UTP tiles instead of MOSIP's mark. (The footer is
   rotated 180deg as a whole and each child rotated back, so the image's own
   rotate-180 must stay.) */
img[alt="a square mosip logo"] {
  content: url("/assets/utp-mark.svg");
  width: auto !important;
  height: 28px !important;
}

/* ---------------------------------------------------------------------------
 * Home banner
 *
 * A baked-in PNG (MOSIP's orange -> purple), not a variable, so it is replaced
 * by class: UTP crimson deepening into the logo's black, echoing the
 * red / black tiles. White banner text keeps its contrast throughout.
 * ------------------------------------------------------------------------- */
.bg-home-banner {
  background-image:
    radial-gradient(120% 90% at 15% 10%, rgb(255 255 255 / 0.10) 0%, rgb(255 255 255 / 0) 55%),
    linear-gradient(135deg, #b50d30 0%, #8c0a25 55%, #1f1b1c 100%) !important;
  background-size: cover !important;
}

/* ---------------------------------------------------------------------------
 * Small refinements, as in Inji Verify: softer corners and a lifted shadow on
 * primary (gradient) buttons, tinted with the brand crimson.
 * ------------------------------------------------------------------------- */
button.bg-gradient-to-r,
a.bg-gradient-to-r {
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px -10px rgb(181 13 48 / 0.5);
}

/* Focus ring in brand crimson rather than the browser default. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #b50d30;
  outline-offset: 2px;
}
