/* Catflap: the Keycloak sign-in pages.
   The look (colours, fonts, shapes) comes from the theme file the layout links
   first: common/resources/themes/catflap.css (source: design/brand/themes).
   This file only uses its variables. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); font-family: var(--body); font-size: 16px; background: var(--surface); -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4, .h { font-family: var(--head); color: var(--ink); margin: 0; letter-spacing: var(--h-spacing); }
h1 { font-weight: var(--h1-weight); font-size: 28px; line-height: 1.15; }
h2 { font-weight: var(--h1-weight); font-size: 28px; line-height: 1.2; }
h3 { font-weight: var(--h-weight); font-size: 18px; line-height: 1.3; }
p { margin: 0; line-height: 1.6; }
a { color: var(--link); text-decoration-color: var(--link-line); text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
b, strong { font-weight: 700; }
code, kbd, pre { font-family: var(--mono); }
code { font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.eyebrow { font-family: var(--eyebrow-font); font-weight: var(--eyebrow-weight); font-size: var(--eyebrow-size); letter-spacing: var(--eyebrow-spacing); text-transform: uppercase; color: var(--eyebrow-color); }
.lead { font-size: 19px; line-height: 1.6; color: var(--ink-2); }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.small { font-size: 14px; } .tiny { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.ink { color: var(--ink); }
.center { text-align: center; }

/* layout */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.s4 { gap: 4px; } .stack.s8 { gap: 8px; } .stack.s12 { gap: 12px; } .stack.s18 { gap: 18px; } .stack.s24 { gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.top { align-items: flex-start; } .row.between { justify-content: space-between; } .row.nowrap { flex-wrap: nowrap; }
.row.g6 { gap: 6px; } .row.g10 { gap: 10px; } .row.g14 { gap: 14px; }
.grow { flex: 1 1 0; min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border-radius: 8px; border: 1.5px solid transparent; font-family: var(--btn-font); font-weight: 600; font-size: 15px;
  letter-spacing: .01em; text-decoration: none; cursor: pointer; white-space: nowrap; background: none; color: var(--ink); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn.secondary { border-color: var(--primary); color: var(--primary); background: var(--raised); }
.btn.secondary:hover { background: var(--surface); }
.btn.ghost { color: var(--ink); } .btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.lg { min-height: 56px; padding: 0 28px; font-size: 17px; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: default; }
.btn-row { display: flex; gap: 12px; }
.btn-row > .btn { flex: 1 1 0; min-width: 0; }
.btn-row.rev { flex-direction: row-reverse; }
.kc-card.centered > #kc-info, .kc-card.centered > form { align-self: stretch; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 0; background: none; color: var(--ink-2); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.s16 { width: 16px; height: 16px; } .ico.s24 { width: 24px; height: 24px; } .ico.s28 { width: 28px; height: 28px; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; font-size: 14px; align-self: flex-start; }

/* forms */
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field .label-row > label, .field > div > label:not(.check), .label { font-family: var(--head); font-weight: 600; font-size: 14px; color: var(--ink); }
.label { display: block; }
.field .required { color: var(--bad-ink); }
.field .hint { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.field .err, .err { font-size: 13px; color: var(--bad-ink); display: flex; gap: 6px; align-items: flex-start; line-height: 1.5; }
.err .ico { margin-top: 2px; }
.ok-note { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ok-ink); }
.input { display: block; width: 100%; min-height: 44px; padding: 10px 14px; border: 1.5px solid var(--line-2); border-radius: 8px; font: 15px var(--body);
  color: var(--ink); background: var(--raised); }
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.input[aria-invalid="true"], .input.invalid { border-color: var(--danger); }
.input.mono { font-family: var(--mono); font-size: 14px; }
.input[disabled] { background: var(--surface); color: var(--ink-2); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-wrap .icon-btn { position: absolute; right: 4px; top: 4px; }
.pw-wrap .icon-btn .hide-ico { display: none; }
.pw-wrap .icon-btn[aria-pressed="true"] .show-ico { display: none; }
.pw-wrap .icon-btn[aria-pressed="true"] .hide-ico { display: block; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.5; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-meter i { height: 4px; border-radius: 2px; background: var(--line); }
.pw-meter[data-score="1"] i:nth-child(-n+1) { background: var(--bad-dot); }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: var(--wait-dot); }
.pw-meter[data-score="3"] i:nth-child(-n+3), .pw-meter[data-score="4"] i { background: var(--ok-dot); }
.pw-rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; color: var(--ink-2); }
.pw-rules li { display: flex; gap: 6px; align-items: center; }
.pw-rules li .on-ico { display: none; }
.pw-rules li.met { color: var(--ok-ink); }
.pw-rules li.met .on-ico { display: block; } .pw-rules li.met .off-ico { display: none; }
.js-only { display: none; }
.js .js-only { display: flex; }
.js .no-js { display: none; }

/* surfaces */
.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.card.shadow { box-shadow: var(--shadow); border-color: transparent; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); font-size: 14.5px; line-height: 1.55; }
.callout .ico { margin-top: 1px; }
.callout.sm { padding: 10px 12px; font-size: 13px; }
.callout.info { background: var(--info-bg); color: var(--info-ink); }
.callout.warn, .callout.warning { background: var(--wait-bg); color: var(--wait-ink); }
.callout.bad, .callout.error { background: var(--bad-bg); color: var(--bad-ink); }
.callout.ok, .callout.success { background: var(--ok-bg); color: var(--ok-ink); }
.callout b { color: inherit; }
.callout a { color: inherit; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); max-width: 100%; }
.tag > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack > .tag { align-self: flex-start; }
.tag.blue { background: var(--tint-brand-bg); color: var(--tint-brand-ink); }
.code { position: relative; background: var(--code-bg); color: var(--code-ink); border-radius: var(--r); padding: 14px 16px; font: 13.5px/1.6 var(--mono); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.code .k { color: var(--code-key); } .code .s { color: var(--code-str); } .code .p { color: var(--code-prompt); user-select: none; }
.copy-field { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line-2); border-radius: 8px; padding: 4px 4px 4px 12px; background: var(--surface); min-width: 0; min-height: 44px; }
.copy-field code { background: none; padding: 0; flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t td { padding: 6px 0; vertical-align: top; }
table.t td:first-child { color: var(--ink-2); padding-right: 16px; white-space: nowrap; }
details > summary { cursor: pointer; color: var(--ink-2); min-height: 28px; }
details .code, details table { margin-top: 8px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-ink); display: grid; place-items: center; font: 700 18px var(--head); flex: none; text-transform: uppercase; }
.badge-tile { width: 56px; height: 56px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; flex: none; color: var(--brand); }
.round-ok { width: 88px; height: 88px; border-radius: 50%; background: var(--ok-bg); display: grid; place-items: center; box-shadow: 0 0 0 10px color-mix(in srgb, var(--ok-dot) 12%, transparent); color: var(--ok-ink); }
.round-ok .ico { width: 44px; height: 44px; stroke-width: 2.4; }
.tile-wait { width: 64px; height: 64px; border-radius: 16px; background: var(--wait-bg); display: grid; place-items: center; color: var(--wait-ink); }
.tile-bad { width: 64px; height: 64px; border-radius: 16px; background: var(--bad-bg); display: grid; place-items: center; color: var(--bad-ink); }
.tile-wait .ico, .tile-bad .ico { width: 32px; height: 32px; }
/* a page icon in a rounded square */
.page-ico { position: relative; width: 96px; height: 96px; }
.page-ico::before { content: ""; position: absolute; inset: 10px; background: var(--step-bg); border-radius: calc(var(--step-radius) * 2); }
.page-ico > .ico { position: absolute; left: 28px; top: 26px; width: 40px; height: 40px; color: var(--step-ink); stroke-width: 1.6; }

/* steps: numbers in rounded squares; the current one in the done colours */
.step-no { position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center; color: var(--step-ink); font: 700 16px var(--head);
  background: var(--step-bg); border-radius: var(--step-radius); }
.step-no span { position: relative; }
.step-no.current { background: var(--step-done-bg); }
.step-no.current span { color: var(--step-done-ink); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.progress { height: 6px; background: var(--hero-line); border-radius: 3px; overflow: hidden; max-width: 300px; }
.progress i { display: block; height: 100%; background: var(--cta-bg); border-radius: 3px; }

/* OTP */
.otp-input { font: 600 26px var(--mono); letter-spacing: .3em; text-align: center; min-height: 60px; }
.code-input { font: 600 26px var(--mono); letter-spacing: .14em; text-align: center; min-height: 64px; text-transform: uppercase; }
.qr { width: 148px; height: 148px; flex: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; image-rendering: pixelated; }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r); cursor: pointer; }
.radio-item input { accent-color: var(--brand); width: 18px; height: 18px; margin: 0; }

/* lockup */
.lockup { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.lockup img { width: 48px; height: 48px; flex: none; }
.lockup .word { display: block; font: var(--word-weight, 600) 26px/1 var(--head); color: var(--hero-ink); letter-spacing: var(--word-spacing, var(--h-spacing)); text-transform: var(--word-case, none); }

/* split screen: brand panel left, form right */
.kc { display: flex; flex-wrap: wrap; min-height: 100vh; background: var(--surface); }
.kc-brand { position: relative; overflow: hidden; flex: 1 1 420px; background: var(--hero-bg); color: var(--hero-ink); padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; min-height: 320px; }
.kc-brand > * { position: relative; }
.kc-brand h2 { color: var(--hero-ink); font-size: 34px; }
.kc-brand .lead { color: var(--hero-ink-2); font-size: 17px; }
.kc-brand .eyebrow { color: var(--hero-accent); }
.kc-brand .brand-body { max-width: 440px; }
.kc-brand .checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; color: var(--hero-ink-2); }
.kc-brand .checks li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.5; }
.kc-brand .checks .ico { color: var(--hero-accent); margin-top: 2px; }
.kc-brand .note { display: flex; gap: 10px; align-items: center; color: var(--hero-ink-2); font-size: 14px; }
.kc-brand .note .ico { color: var(--hero-accent); }
.kc-brand .code { background: rgba(0,0,0,.25); }
.kc-brand .bsteps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.kc-brand .bsteps li { display: flex; gap: 14px; align-items: flex-start; }
.kc-brand .bsteps b { color: var(--hero-ink); font-family: var(--head); }
.kc-brand .bsteps .small { color: var(--hero-ink-2); }
/* steps still to do on the dark panel: a faint square */
.kc-brand .step-no:not(.current) { background: color-mix(in srgb, var(--step-todo-bg) 14%, transparent); color: var(--hero-ink); }
.kc-brand .foss { font-family: var(--eyebrow-font); font-weight: var(--eyebrow-weight); font-size: var(--eyebrow-size); letter-spacing: var(--eyebrow-spacing);
  text-transform: uppercase; color: var(--hero-ink-2); }
.kc-main { flex: 1 1 560px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; gap: 24px; min-width: 0; position: relative; }
/* the way back to the website, top left of the form side */
.kc-home { position: absolute; top: 24px; left: 32px; color: var(--ink-2); }
.kc-home:hover { color: var(--brand); }
.kc-card { width: 100%; max-width: 460px; background: var(--raised); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 40px; display: flex; flex-direction: column; gap: 22px; }
.kc-card.wide { max-width: 520px; }
.kc-card.wider { max-width: 540px; }
.kc-card.centered { align-items: center; text-align: center; }
.kc-card.centered .callout, .kc-card.centered .self-stretch { align-self: stretch; text-align: left; }
.kc-card h1 { font-size: 28px; }
.kc-card h1.h-sm { font-size: 24px; }
.kc-card > .stack, .kc-card form { width: 100%; }
.kc-below { max-width: 460px; text-align: center; }
.kc-foot { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; font-size: 13px; color: var(--ink-2); }
.kc-foot a { color: var(--ink-2); }
/* "This server is hosted by …" */
.kc-hosted { max-width: 460px; text-align: center; font-size: 13px; color: var(--ink-3); margin-bottom: -12px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; } .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.username-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 8px; background: var(--surface); font-weight: 600; }

/* phones and narrow windows: the brand panel shrinks to a header */
@media (max-width: 760px) {
  .kc { align-content: flex-start; }
  .kc-brand { flex-basis: 100%; min-height: 0; padding: 20px 20px 24px; gap: 16px; }
  .kc-brand h2 { font-size: 22px; }
  .kc-brand .brand-extra, .kc-brand .foss { display: none; }
  .kc-brand .lockup img { width: 40px; height: 40px; }
  .kc-brand .lockup .word { font-size: 22px; }
  .kc-main { flex-basis: 100%; justify-content: flex-start; padding: 16px 16px 32px; }
  .kc-home { position: static; align-self: flex-start; }
  .kc-card { padding: 24px 20px; gap: 20px; border-radius: 12px; }
  .kc-card h1 { font-size: 24px; }
  .pw-rules { grid-template-columns: 1fr; }
  .btn.lg { min-height: 52px; font-size: 16px; padding: 0 18px; }
}
@media (max-width: 380px) {
  .btn-row { flex-direction: column-reverse; }
  .btn-row.rev { flex-direction: column; }
}
