/* ---------------------------------------------------------------------------
 * UTP (Universidad Tecnológica del Perú) branding for Inji Verify.
 *
 * Loaded after the app's own stylesheet (the Dockerfile injects a <link> at the
 * end of <head>). Inji Verify drives every colour through --iv-* custom
 * properties declared on [class="default_theme"], so re-skinning it 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
 *   secondary      #1f1b1c   (the black "T" tile)
 *   ink            #1f1b1c   heading       #222221   body  #3d3839
 *   muted          #6b6466   page bg       #faf9f9   surface #ffffff
 * ------------------------------------------------------------------------- */

:root,
[class="default_theme"],
html[class="default_theme"],
body[class="default_theme"] {
  /* Brand */
  --iv-primary-color: #b50d30 !important;
  --iv-logo-start-color: #1f1b1c !important;

  /* Surfaces */
  --iv-background-color: #ffffff !important;
  --iv-page-background-color: #faf9f9 !important;
  --iv-header-background-color: #fbecef !important;
  --iv-verificationMethodTabs-bg-color: #ffffff !important;
  --iv-arrow-background: #fbecef !important;
  --iv-stepper-background: #faf9f9 !important;

  /* Type */
  --iv-white-text: #ffffff !important;
  --iv-header-label-text: #222221 !important;
  --iv-header-description-text: #3d3839 !important;
  --iv-offline-label-text: #222221 !important;
  --iv-offline-description-text: #6b6466 !important;
  --iv-stepper-label: #6b6466 !important;
  --iv-stepper-description: #3d3839 !important;
  --iv-camera-denied-label-color: #222221 !important;
  --iv-camera-denied-description-color: #6b6466 !important;
  --iv-upload-description: #6b6466 !important;
  --iv-selector-pannel-title: #222221 !important;
  --iv-selector-pannel-sub-title: #6b6466 !important;
  --iv-sortBy-text: #3d3839 !important;
  --iv-copyrights-text: #6b6466 !important;

  /* Lines and borders */
  --iv-horizontal-line: #b50d30 !important;
  --iv-copyrights-border: #6b6466 !important;
  --iv-selector-border: #e8e3e4 !important;
  --iv-sortBy-border: #dad4d5 !important;

  /* Tabs */
  --iv-active-tab-text: #ffffff !important;
  --iv-active-tab-background: #b50d30 !important;
  --iv-inactive-tab-text: #3d3839 !important;
  --iv-inactive-tab-background: #ffffff !important;
  --iv-disabledTab-bg: #f3eff0 !important;
  --iv-disabledTab-text: #9a9294 !important;

  /* Controls */
  --iv-document-icon: #b50d30 !important;
  --iv-disabled-button-bg: #cdc6c8 !important;
  --iv-qr-code-timer: #b50d30 !important;

  /* The scanning line sweeping the QR viewfinder: UTP crimson -> black,
     echoing the red / black / red tiles of the logo. */
  --iv-gradient-scanning-line: linear-gradient(
    90deg,
    #b50d30 0%,
    #1f1b1c 50%,
    #b50d30 100%
  ) !important;

  /*
   * Verification verdict colours are deliberately NOT re-skinned. Green/red/
   * amber carry the meaning of the result; recolouring them to the brand
   * palette would make a valid credential and an invalid one look alike. Only
   * the neutral chrome above follows the brand.
   */
}

/* ---------------------------------------------------------------------------
 * Type hierarchy
 *
 * The app only exposes one font variable (--iv-font-base, set from
 * DEFAULT_FONT_FAMILY and applied as an inline style, hence !important here),
 * so the heading face is layered on top.
 * ------------------------------------------------------------------------- */
h1, h2, h3, h4,
.text-lgBoldTextSize,
.text-boldTextSize,
.text-lgMediumTextSize {
  font-family: "Plus Jakarta Sans", var(--iv-font-base), system-ui, sans-serif !important;
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------------------------
 * Gradients
 *
 * These are Tailwind utilities baked into the build (tailwind.config.js
 * safelist), not custom properties, so they have to be overridden by class.
 * The stock ones are MOSIP's orange -> purple sweep; UTP gets a crimson that
 * deepens slightly toward the right, so primary buttons read as solid brand red.
 * ------------------------------------------------------------------------- */
.bg-default_theme-gradient,
.hover\:bg-default_theme-gradient:hover {
  background-image: linear-gradient(90deg, #b50d30 0%, #8c0a25 100%) !important;
}

.bg-default_theme-lighter-gradient {
  background-image: linear-gradient(83.99deg, #fdf5f6 38.27%, #f6f3f3 93.3%) !important;
}

/* ---------------------------------------------------------------------------
 * Navbar logo
 *
 * The navbar renders Inji's wordmark as an inline <svg>. Hide it and show the
 * full UTP lockup (U-T-P tiles + "Universidad Tecnológica del Perú") instead.
 * The asset's viewBox is cropped to the artwork, so its aspect ratio is ~4.56:1.
 * ------------------------------------------------------------------------- */
nav a[href="/"],
nav a[href="#/"] {
  display: inline-flex !important;
  align-items: center;
  text-decoration: none;
}

nav a[href="/"] > svg,
nav a[href="#/"] > svg {
  display: none !important;
}

nav a[href="/"]::before,
nav a[href="#/"]::before {
  content: "";
  display: block;
  width: 182px;
  height: 40px;
  flex: none;
  background: url("/assets/utp-logo.svg") left center / contain no-repeat;
}

/* On narrow screens keep just the U-T-P tiles so the navbar doesn't wrap. */
@media (max-width: 400px) {
  nav a[href="/"]::before,
  nav a[href="#/"]::before {
    width: 108px;
    height: 36px;
    background-image: url("/assets/utp-mark.svg");
  }
}

/* ---------------------------------------------------------------------------
 * Small refinements: softer corners and a lifted shadow on primary buttons,
 * tinted with the brand crimson.
 * ------------------------------------------------------------------------- */
button:not([id="hamburger"]):not([aria-label]),
.rounded-md {
  border-radius: 0.75rem;
}

button.bg-primary,
button.bg-default_theme-gradient {
  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;
}
