/* The public clinic verification gate.
   A card over the site for visitors who have not signed in yet. The prototype is
   docs/design/prototypes/kaltera-portal/index.html, view #gate.

   Every class here starts with kgate, and the tokens live on .kgate, so the site's own
   variables and its existing .gate block classes are untouched. */

.kgate {
  --kgate-scrim: rgb(16 29 33 / 0.42);
  --kgate-card: #F4F7F6;
  --kgate-paper: #F6F9F8;
  --kgate-white: #FFFFFF;
  --kgate-porcelain: #EAF0EE;
  --kgate-teal: #12707E;
  --kgate-teal-deep: #0E5D69;
  --kgate-teal-wash: rgb(18 112 126 / 0.08);
  --kgate-navy: #16262B;
  --kgate-ink: #16262B;
  --kgate-ink-muted: rgb(22 38 43 / 0.66);
  --kgate-ink-faint: rgb(22 38 43 / 0.45);
  --kgate-rule: rgb(22 38 43 / 0.14);
  --kgate-rule-strong: rgb(22 38 43 / 0.28);
  --kgate-bad: #A23B3B;
  --kgate-bad-wash: #F4DEDE;
  --kgate-f-display: "Jost", "Futura", "Century Gothic", sans-serif;
  --kgate-f-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --kgate-f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 40px 16px 80px;
  background: var(--kgate-scrim);
  /* The page behind the door is blurred past reading: its colours show that a site
     is there, and none of its copy can be read before the door is answered. */
  backdrop-filter: blur(24px) saturate(0.9);
  -webkit-backdrop-filter: blur(24px) saturate(0.9);
  color: var(--kgate-ink);
  font-family: var(--kgate-f-body);
  font-size: 15px;
  line-height: 1.55;
}

/* The site sets this on its own elements, so the gate does it for itself. */
.kgate,
.kgate *,
.kgate *::before,
.kgate *::after {
  box-sizing: border-box;
}

.kgate[hidden] {
  display: none;
}

/* The page waits for the gate decision, so a reader who has to pass the gate never
   sees the site sharply first. */
.kgate-lock body > *:not(.kgate) {
  visibility: hidden;
}

/* While the door is shut the page behind it does not scroll, by wheel, key or touch.
   The door keeps its own scroll, so a short phone screen can still reach the whole card. */
html.kgate-open,
html.kgate-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

.kgate {
  overscroll-behavior: contain;
}

.kgate__panel {
  position: relative;
  width: min(460px, 100%);
}

.kgate__card {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 22px 24px 18px;
  border-radius: 16px;
  background: var(--kgate-card);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.55);
}

.kgate__card[hidden] {
  display: none;
}

.kgate__mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--kgate-teal);
}

.kgate__mark svg {
  width: 20px;
  height: 29px;
}

.kgate__word {
  font-family: var(--kgate-f-display);
  font-weight: 300;
  font-size: 16px;
  letter-spacing: 0.42em;
  padding-left: 0.42em;
  color: var(--kgate-navy);
}

.kgate__title {
  margin: 0;
  font-family: var(--kgate-f-display);
  font-weight: 300;
  font-size: 28px;
  line-height: 1.12;
  color: var(--kgate-navy);
  text-align: center;
  text-wrap: balance;
}

.kgate__title em {
  font-style: normal;
  color: var(--kgate-teal);
}

.kgate__lede {
  margin: -2px auto 4px;
  color: var(--kgate-ink-muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  text-wrap: pretty;
}

.kgate__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.kgate__field {
  display: grid;
  gap: 6px;
}

/* The field's placeholder is its label, said once with a star for required. The words
   are still there for a screen reader. */
.kgate__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.kgate__inp {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--kgate-rule-strong);
  border-radius: 10px;
  background: var(--kgate-white);
  font-family: var(--kgate-f-body);
  font-size: 15px;
  color: var(--kgate-ink);
}

.kgate__inp:focus {
  outline: none;
  border-color: var(--kgate-teal);
  box-shadow: 0 0 0 3px var(--kgate-teal-wash);
}

.kgate__inp::placeholder {
  color: var(--kgate-ink-muted);
}

.kgate__inp.is-bad {
  border-color: var(--kgate-bad);
}

/* The practice list: a styled listbox, not the browser's native menu. */
.kgate__sel {
  position: relative;
}

.kgate__sel-btn {
  display: flex;
  align-items: center;
  text-align: left;
  cursor: pointer;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%2316262B' stroke-opacity='.55' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.kgate__sel-btn[aria-expanded="true"] {
  border-color: var(--kgate-teal);
  box-shadow: 0 0 0 3px var(--kgate-teal-wash);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 6.5 6 1.5l5 5' fill='none' stroke='%2312707E' stroke-width='1.5'/%3E%3C/svg%3E");
}

.kgate__sel-val {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kgate__sel-val.is-placeholder {
  color: var(--kgate-ink-muted);
}

.kgate__sel-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  max-height: 320px;
  margin: 0;
  padding: 6px;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--kgate-rule-strong);
  border-radius: 10px;
  background: var(--kgate-white);
  box-shadow: 0 22px 48px -20px rgb(22 38 43 / 0.4);
}

.kgate__sel-list[hidden] {
  display: none;
}

.kgate__sel-list:focus {
  outline: none;
}

.kgate__sel-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  color: var(--kgate-ink);
}

.kgate__sel-list li.is-active {
  background: var(--kgate-teal-wash);
}

.kgate__sel-list li[aria-selected="true"] {
  color: var(--kgate-teal);
  font-weight: 500;
}

.kgate__sel-list li[aria-selected="true"]::after {
  content: "";
  width: 10px;
  height: 5px;
  flex: none;
  border: 2px solid var(--kgate-teal);
  border-top: 0;
  border-right: 0;
  transform: translateY(-2px) rotate(-45deg);
}

.kgate__checks {
  display: grid;
  gap: 5px;
}

.kgate__chk {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 12px;
  border: 1px solid var(--kgate-rule-strong);
  border-radius: 10px;
  background: var(--kgate-white);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
}

.kgate__chk:hover {
  border-color: var(--kgate-teal);
}

.kgate__chk input {
  appearance: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid var(--kgate-teal);
  border-radius: 50%;
  background: var(--kgate-white);
  cursor: pointer;
}

.kgate__chk input:checked {
  background: var(--kgate-teal);
}

.kgate__chk input:checked::after {
  content: "";
  width: 9px;
  height: 5px;
  border: 2px solid var(--kgate-white);
  border-top: 0;
  border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}

.kgate__chk input:focus-visible {
  outline: 2px solid var(--kgate-teal);
  outline-offset: 2px;
}

.kgate__chk b {
  font-weight: 700;
  color: #000;
}

.kgate__chk a {
  color: var(--kgate-teal);
}

.kgate__chk.is-bad {
  border-color: var(--kgate-bad);
  background: var(--kgate-bad-wash);
}

.kgate__err {
  margin: 0;
  color: var(--kgate-bad);
  font-size: 13px;
  text-align: center;
}
.kgate__err:focus {
  outline: 2px solid var(--kgate-bad);
  outline-offset: 3px;
}

/* The message under a field that is wrong. */
.kgate__ferr {
  margin: 0;
  color: var(--kgate-bad);
  font-size: 12px;
  line-height: 1.4;
}
.kgate__ferr[hidden] {
  display: none;
}

.kgate__err[hidden] {
  display: none;
}

.kgate__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--kgate-teal);
  color: var(--kgate-porcelain);
  cursor: pointer;
  font-family: var(--kgate-f-display);
  font-size: 12px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  transition: background 200ms ease;
}

.kgate__btn:hover {
  background: var(--kgate-teal-deep);
}

.kgate__btn .icon {
  width: 16px;
  height: 16px;
}

.kgate__btn[disabled] {
  background: var(--kgate-paper);
  color: var(--kgate-ink-muted);
  cursor: not-allowed;
}

.kgate__fine {
  margin: 0;
  color: var(--kgate-ink-muted);
  font-size: 11.5px;
  line-height: 1.45;
  text-align: center;
}

.kgate__alt {
  margin: 0;
  font-size: 14px;
  text-align: center;
}

.kgate__fine a,
.kgate__alt a,
.kgate__linkish {
  color: var(--kgate-teal);
  font-weight: 500;
  text-underline-offset: 3px;
}

.kgate__linkish {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
}

.kgate__exit-link {
  margin: 0;
  color: var(--kgate-ink-muted);
  font-size: 13px;
  text-align: center;
}

.kgate__exit .kgate__alt {
  margin-top: 4px;
}

@media (max-width: 560px) {
  .kgate {
    align-items: start;
    padding: 16px 16px 64px;
  }
  .kgate__card {
    gap: 16px;
    padding: 22px 16px 18px;
    border-radius: 14px;
  }
  .kgate__title {
    font-size: 24px;
  }
  .kgate__grid {
    grid-template-columns: 1fr;
  }
  /* iOS zooms the page when a field under 16px takes focus. */
  .kgate__inp {
    font-size: 16px;
  }
}
