/* The sign-in pages of Keycloak in the look of the web app (ADR-026). tokens.css is apps/web/src/styles/tokens.css
   as it is (a test keeps the two equal); the rules below follow base.css and public.css of the web app, plus the form
   controls of the keycloak.v2 templates, whose classes are set in theme.properties. */

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301,
    U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-vietnamese-500-normal.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301,
    U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-vietnamese-600-normal.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301,
    U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-vietnamese-700-normal.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301,
    U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* The brand mark only: the slice of Zen Kaku Gothic New that holds 日. */
@font-face {
  font-family: "Zen Kaku Gothic New";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/zen-kaku-gothic-new-118-700-normal.woff2") format("woff2");
  unicode-range: U+65E5;
}

/* What next/font sets on <html> in the web app; tokens.css builds --font-ui and --font-jp from them. */
:root {
  --font-be-vietnam: "Be Vietnam Pro";
  --font-zen-kaku: "Zen Kaku Gothic New";
  --font-jetbrains: ui-monospace;
  /* A control's edge keeps 3:1 against its background in every theme (WCAG 1.4.11). */
  --edge: color-mix(in oklab, var(--ink) 48%, var(--surface));
}

/* Base, as base.css */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
h1,
h2,
p,
ul,
ol {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
a {
  color: inherit;
}
[hidden] {
  display: none !important;
}
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
[tabindex="-1"]:focus-visible {
  outline: none;
}
.skiplink {
  position: fixed;
  z-index: 90;
  top: 8px;
  left: 8px;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--act);
  color: var(--on-act);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transform: translateY(calc(-100% - 12px));
  transition: transform 0.15s;
}
.skiplink:focus-visible {
  transform: none;
}

/* Frame, as public.css: top bar, two columns, footer */
.pub {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.pub-top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.pub-in {
  max-width: 1180px;
  margin: 0 auto;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.pub-top-in {
  display: flex;
  align-items: center;
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  border-radius: 6px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--act);
  color: var(--on-act);
  font: 700 14px/1 var(--font-jp);
}
.pub-main {
  flex: 1;
}
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  align-items: start;
  gap: 64px;
  padding-block: clamp(40px, 9vh, 96px) 72px;
}
.auth h1 {
  max-width: 14em;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  text-wrap: balance;
}
.auth-lead {
  max-width: 32em;
  margin-top: 14px;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.login {
  padding: 24px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--surface);
}
.pub-foot {
  border-top: 1px solid var(--line);
}
.pub-foot .pub-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  min-height: 56px;
  padding-top: 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  font-size: 12.5px;
  color: var(--ink-3);
}

/* Buttons and links, as base.css */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.btn:hover {
  border-color: var(--ink-3);
  background: var(--surface-2);
}
.btn-primary {
  background: var(--act);
  border-color: var(--act);
  color: var(--on-act);
}
.btn-primary:hover {
  background: var(--act-hover);
  border-color: var(--act-hover);
}
.btn-lg {
  height: 46px;
  padding: 0 18px;
  font-size: 15px;
  border-radius: 10px;
}
.btn-block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.link-btn {
  padding: 6px 2px;
  border-radius: 4px;
  color: var(--ink);
  font-weight: 500;
  font-size: 13.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-2);
  white-space: nowrap;
}
.link-btn:hover {
  text-decoration-color: currentColor;
}
.login a:not(.btn, .link-btn) {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-2);
}
.login a:not(.btn, .link-btn):hover {
  text-decoration-color: currentColor;
}

/* Theme switch of the footer, as base.css */
.seg {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 34px;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface-2);
}
.seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition:
    background-color 0.15s,
    color 0.15s;
}
.seg button:hover {
  color: var(--ink);
}
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow:
    0 0 0 1px var(--line-2),
    var(--shadow-xs);
}
.tdot {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--ink-3) 65%, transparent);
}
.tdot-light {
  background: #ffffff;
}
.tdot-warm {
  background: #e9d6ae;
}
.tdot-dark {
  background: #1a1b1e;
}

/* Icons, drawn like those of the web app (stroke 1.75, round ends) and coloured by the text around them */
.ng-i {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--ng-i) center / contain no-repeat;
  mask: var(--ng-i) center / contain no-repeat;
}
.ng-i-eye {
  --ng-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}
.ng-i-eye-off {
  --ng-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 3.5l17 17'/%3E%3Cpath d='M10.2 5.7A9.6 9.6 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a16 16 0 0 1-2.6 3.4M6.5 6.9C3.9 8.6 2.5 12 2.5 12S6 18.5 12 18.5a9 9 0 0 0 4.6-1.3'/%3E%3Cpath d='M9.9 9.9a3 3 0 0 0 4.2 4.2'/%3E%3C/svg%3E");
}
.ng-i-error {
  --ng-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.01'/%3E%3C/svg%3E");
}
.ng-i-warning {
  --ng-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 4.2 2.6 17.6A2 2 0 0 0 4.3 20.6h15.4a2 2 0 0 0 1.7-3L13.7 4.2a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9.5v4M12 17v.01'/%3E%3C/svg%3E");
}
.ng-i-success {
  --ng-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.2 12.4 2.6 2.6 5-5.2'/%3E%3C/svg%3E");
}
.ng-i-info {
  --ng-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5.5M12 7.5v.01'/%3E%3C/svg%3E");
}
.ng-i-copy {
  --ng-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8.5' y='8.5' width='12' height='12' rx='2'/%3E%3Cpath d='M15.5 8.5v-3a2 2 0 0 0-2-2h-8a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h3'/%3E%3C/svg%3E");
}

/* Messages above the form, as .login-err of public.css, one hue per kind */
.ng-alert {
  --tone: var(--n4);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid color-mix(in oklab, var(--tone) 40%, transparent);
  border-radius: 9px;
  background: color-mix(in oklab, var(--tone) 7%, var(--surface));
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.5;
}
.ng-alert > .ng-i {
  margin-top: 1px;
  color: var(--tone);
}
.ng-alert-error {
  --tone: var(--n1);
}
.ng-alert-warning {
  --tone: var(--n3);
}
.ng-alert-success {
  --tone: var(--n5);
}

/* Forms of keycloak.v2 (field.ftl, buttons.ftl), with the classes of theme.properties */
.ng-form {
  display: grid;
  gap: 16px;
}
.ng-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.ng-label {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.ng-required {
  color: var(--n1);
  font-weight: 600;
}
.ng-required-note {
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
}
span.ng-control,
div.ng-control {
  position: relative;
  display: block;
  min-width: 0;
}
.ng-control input,
input.ng-control,
.ng-control select,
.ng-control textarea,
.ng-attempted-value {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.ng-control textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
}
.ng-control input:hover,
.ng-control select:hover,
.ng-control textarea:hover {
  border-color: var(--ink-3);
}
.ng-control input:focus,
.ng-control select:focus,
.ng-control textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
  outline: none;
}
.ng-control input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--ink);
}
.ng-control input:-webkit-autofill:focus {
  box-shadow:
    0 0 0 1000px var(--surface) inset,
    0 0 0 1px var(--ink);
}
.ng-control.ng-error input,
.ng-control input[aria-invalid="true"] {
  border-color: var(--n1);
}
.ng-control.ng-error input:focus,
.ng-control input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 1px var(--n1);
}
.ng-control input:disabled,
.ng-readonly input {
  background: var(--surface-2);
  color: var(--ink-2);
}
/* The error text under the field says it already. */
.ng-control-util {
  display: none;
}

/* Password: the eye button sits inside the field, on its right */
.ng-input-group {
  position: relative;
  display: flex;
  min-width: 0;
}
.ng-input-group-item.ng-fill {
  flex: 1;
  min-width: 0;
}
.ng-input-group .ng-control input {
  padding-right: 48px;
}
.ng-input-group > .ng-input-group-item:not(.ng-fill) {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 44px;
}
.ng-control-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--ink-3);
  transition:
    background-color 0.15s,
    color 0.15s;
}
.ng-control-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

/* Under a field: its error, then remember me and the way to reset the password. The containers keycloak.v2 prints
   empty would still take a gap of the grid. */
.ng-field > [id^="input-error-container-"]:not(:has(*)),
.ng-field > .ng-help:not(:has(.ng-help-item, .ng-check, li)) {
  display: none;
}
.ng-help {
  font-size: 13px;
  line-height: 1.45;
}
.ng-help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.ng-help-text {
  color: var(--ink-3);
  font-size: 13px;
}
.ng-help-item a,
.ng-help-text a {
  font-size: 13.5px;
}
.ng-error-text,
.ng-help-item.ng-error {
  color: var(--n1);
}
ul.ng-error-text {
  margin: 0;
  padding-left: 18px;
}
.ng-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--ink-2);
  font-size: 13.5px;
  cursor: pointer;
}
.ng-check-input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--act);
  cursor: pointer;
}

/* The email already typed, on the pages after it (template.ftl) */
.ng-shown-username {
  margin-bottom: 16px;
}
.ng-attempted {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ng-attempted-value {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  color: var(--ink-2);
}

/* Buttons at the end of a form (buttons.ftl): stacked, or side by side when the template asks for it */
.ng-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.ng-field > .ng-actions {
  margin-top: 0;
}
.ng-actions.pf-v5-u-flex-nowrap {
  flex-direction: row;
}
.ng-actions.pf-v5-u-flex-nowrap > .btn {
  flex: 1 1 0;
  min-width: 0;
}
.ng-mt {
  margin-top: 12px;
}
.ng-options {
  font-size: 13.5px;
}

/* What comes under the form: "no account yet", the way back to sign-in, instructions */
.login-info,
.login .pf-v5-c-login__main-footer-band {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}
.login .pf-v5-c-login__main-footer-band {
  display: block;
}
.login .instruction,
#kc-info-message p,
#kc-error-message p {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.6;
}
#kc-info-message p + p,
#kc-error-message p + p {
  margin-top: 14px;
}
#kc-verify-email-form,
#kc-logout-confirm form {
  margin-top: 18px;
}
/* "Chưa thấy thư…? Bạn bấm vào đây để gửi lại." reads as one sentence (messages_vi.properties). */
.login-info .instruction br {
  display: none;
}
.ng-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--ink-3);
  font-size: 12.5px;
}
.ng-divider::before,
.ng-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--line);
}
.ng-list {
  padding-left: 20px;
  color: var(--ink-2);
}

@media (max-width: 1023.98px) {
  .pub-in {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .pub-top-in {
    min-height: 56px;
  }
  .auth {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-block: 28px 40px;
  }
  .btn {
    min-height: 44px;
  }
  .link-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
  }
  /* 16px keeps the phone from zooming into the field. */
  .ng-control input,
  input.ng-control,
  .ng-control select,
  .ng-control textarea,
  .ng-attempted-value {
    height: 48px;
    font-size: 16px;
  }
  .ng-control-btn {
    width: 44px;
    height: 44px;
  }
  .ng-input-group > .ng-input-group-item:not(.ng-fill) {
    width: 48px;
  }
  .ng-check {
    min-height: 44px;
  }
}
@media (max-width: 599.98px) {
  .login {
    padding: 18px 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
