/* =========================================================================
   CypherBound / tezmfo — Keycloak v26 login theme
   Adapted from .sim-tmp/design/Auth.html. Self-contained: fonts are
   self-hosted via @font-face (NO Google Fonts CDN), icons are inlined
   SVG in the templates (NO Phosphor/unpkg CDN). Strict-CSP friendly.
   ========================================================================= */

/* ── Self-hosted fonts ──────────────────────────────────────────────────
   True WOFF2 (variable-weight) self-hosted in ../fonts/ — see
   ../fonts/README.md for provenance + licences (all OFL-1.1). System-font
   fallbacks keep the theme legible if a font file is missing.
   font-display:swap avoids invisible text. Latin + Cyrillic subsets are
   split by unicode-range so the RU / uz-Cyrl UI gets real glyphs. Space
   Grotesk is a Latin-only display face (used for the wordmark + headline);
   its Cyrillic falls back to Inter Tight via the --font-wm stack. */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/space-grotesk-variable.woff2') format('woff2');
}
/* Inter Tight — Latin */
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-tight-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Inter Tight — Cyrillic */
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-tight-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* JetBrains Mono — Latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* JetBrains Mono — Cyrillic */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --lime: #D8FF3E;  --lime-deep: #B8DC1F;
  --ink: #0A0A0A;   --ink90: #16161A;  --ink80: #26262A; --ink70: #34343A;
  --ink60: #4A4A52; --ink40: #7E7E88;  --ink24: #B7B7BF; --ink16: #CFCFD6;
  --ink10: #E2E2E7; --ink06: #ECECEF;  --ink04: #F3F3F5;
  --surface: #F6F7F2; --white: #fff;
  --green: #1F8A5B;  --red: #C4221F;   --redSoft: #FBECEC;
  --greenSoft: #E9F7F0; --blue: #1F4E8C; --blueSoft: #EAF0F8;

  --font-ui:   'Inter Tight', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-wm:   'Space Grotesk', 'Inter Tight', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

.cb-body {
  font-family: var(--font-ui);
  background: var(--surface);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}
.mono { font-family: var(--font-mono); }
.wm {
  font-family: var(--font-wm);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.cb-eyebrow {
  font: 600 10px/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink40);
}
.cb-eyebrow--ink  { color: var(--ink); }
.cb-eyebrow--lime { color: var(--lime); }
.cb-eyebrow--dim  { color: var(--ink40); }
.cb-eyebrow--center { text-align: center; }

button { font-family: inherit; }
input  { font-family: inherit; }

/* ── tezmfo wordmark with lime bar under "tez" ── */
.cb-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.16em;
  font-family: var(--font-wm);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  text-decoration: none;
}
.cb-logo--light { font-size: 24px; color: var(--surface); }
.cb-logo--ink   { font-size: 22px; color: var(--ink); }
.cb-logo-bar { position: relative; display: inline-block; }
.cb-logo-bar::after {
  content: '';
  position: absolute;
  left: -3%; right: -4%; bottom: -0.05em;
  height: 0.16em;
  background: var(--lime);
  border-radius: 0.04em;
}

/* ── Stage layout: left showcase + right form ── */
.cb-stage {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}
@media (max-width: 920px) {
  .cb-stage { grid-template-columns: 1fr; }
  .cb-showcase { display: none; }
}

/* ── LEFT · showcase (ink) ── */
.cb-showcase {
  position: relative;
  background: var(--ink);
  color: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 44px 52px;
}
.cb-grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 54px 54px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 30%, #000 20%, transparent 72%);
          mask-image: radial-gradient(ellipse 80% 70% at 30% 30%, #000 20%, transparent 72%);
  animation: cb-drift 30s linear infinite;
}
@keyframes cb-drift { to { background-position: 54px 54px, 54px 54px; } }
.cb-chev { position: absolute; right: -90px; bottom: -70px; opacity: 0.09; }

.cb-showcase-top {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 14px;
}
.cb-sep { width: 1px; height: 22px; background: #ffffff22; }
.cb-badge {
  display: inline-flex; align-items: center; gap: 9px;
  margin-left: auto;
  padding: 6px 13px 6px 7px;
  border-radius: 999px;
  background: #FFFFFF0A;
  border: 1px solid #FFFFFF18;
}
.cb-badge-txt { font-size: 10px; color: var(--surface); }
.cb-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--lime); }
.cb-pulse { animation: cb-pulse 1.8s ease-in-out infinite; }
@keyframes cb-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.cb-showcase-body { position: relative; z-index: 1; margin-top: auto; }
.cb-headline {
  font-size: 50px; line-height: 0.98; letter-spacing: -0.035em;
  color: var(--surface); margin: 18px 0 0;
}
.cb-hl {
  background: var(--lime); color: var(--ink);
  padding: 0 14px; border-radius: 12px;
  display: inline-block; line-height: 1;
}
.cb-lede {
  font-size: 15px; line-height: 1.6; color: var(--ink24);
  max-width: 430px; margin: 20px 0 0;
}
.cb-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-top: 32px; max-width: 480px;
}
.cb-metric {
  padding: 16px 18px; border-radius: 12px;
  background: #FFFFFF06; border: 1px solid #FFFFFF12;
}
.cb-metric-val {
  font-size: 24px; font-weight: 600; color: var(--surface);
  margin-top: 8px; letter-spacing: -0.02em;
}
.cb-metric-val--lime { color: var(--lime); }
.cb-metric-unit { font-size: 12px; color: var(--ink40); margin-left: 3px; }

.cb-showcase-foot {
  position: relative; z-index: 1; margin-top: 36px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.cb-trust {
  font-size: 10.5px; color: var(--ink40);
  display: inline-flex; align-items: center; gap: 6px;
}
.cb-ico { flex-shrink: 0; }

/* ── RIGHT · form pane ── */
.cb-pane {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.cb-formcard { width: 100%; max-width: 404px; }

.cb-form-top {
  display: flex; align-items: center; gap: 12px; margin-bottom: 28px;
}

/* language selector segmented control */
.cb-seg {
  display: inline-flex; margin-left: auto;
  padding: 2px; border-radius: 8px;
  border: 1px solid var(--ink10); background: var(--white);
}
.cb-seg-btn {
  border: 0; background: transparent; cursor: pointer;
  font: 600 10px/1 var(--font-mono);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink40); padding: 6px 9px; border-radius: 6px;
  text-decoration: none;
}
.cb-seg-btn.on { background: var(--ink); color: var(--lime); }

.cb-view { animation: cb-view-in .28s cubic-bezier(.16,1,.3,1); }
.cb-view--center { text-align: center; padding-top: 8px; }
@keyframes cb-view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.cb-title { font-size: 27px; margin: 9px 0 6px; color: var(--ink); }
.cb-title--sm { font-size: 25px; }
.cb-title--center { text-align: center; }
.cb-sub {
  font-size: 13px; color: var(--ink60); margin: 0 0 22px; line-height: 1.5;
}
.cb-sub--center { text-align: center; max-width: 320px; margin-inline: auto; margin-bottom: 24px; }

/* ── Alert banner ── */
.cb-alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; border-radius: 10px;
  margin-bottom: 16px;
  background: var(--redSoft); border: 1px solid rgba(196,34,31,0.22);
}
.cb-alert--success { background: var(--greenSoft); border-color: rgba(31,138,91,0.22); }
.cb-alert--info, .cb-alert--warning { background: var(--blueSoft); border-color: rgba(31,78,140,0.22); }
.cb-alert-ico { flex-shrink: 0; margin-top: 1px; }
.cb-alert-txt { font-size: 12.5px; color: var(--ink80); line-height: 1.45; }

/* ── Fields ── */
.cb-form { display: block; }
.cb-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.cb-label { display: flex; align-items: baseline; gap: 8px; }
.cb-inp {
  display: flex; align-items: center; height: 46px; padding: 0 13px;
  border-radius: 10px; background: var(--white); border: 1px solid var(--ink16);
  transition: border-color .12s, box-shadow .12s;
}
.cb-inp:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10,10,10,0.06); }
.cb-inp.err { border-color: var(--red); box-shadow: 0 0 0 3px rgba(196,34,31,0.12); }
.cb-inp-el {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  font-size: 14px; color: var(--ink);
}
.cb-inp-lead { color: var(--ink40); margin-right: 9px; flex-shrink: 0; }
.cb-iconbtn {
  border: 0; background: transparent; color: var(--ink40); cursor: pointer;
  display: inline-flex; padding: 4px; border-radius: 6px;
}
.cb-iconbtn:hover { color: var(--ink60); }

/* ── Remember-me checkbox ── */
.cb-remember {
  display: flex; align-items: center; gap: 9px;
  margin: 4px 0 20px; cursor: pointer;
}
.cb-check-input { position: absolute; opacity: 0; width: 0; height: 0; }
.cb-check-box {
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--ink16); background: var(--white);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .12s, border-color .12s;
}
.cb-check-box svg { opacity: 0; }
.cb-check-input:checked + .cb-check-box { background: var(--ink); border-color: var(--ink); }
.cb-check-input:checked + .cb-check-box svg { opacity: 1; }
.cb-check-input:focus-visible + .cb-check-box {
  outline: 3px solid rgba(216,255,62,0.6); outline-offset: 2px;
}
.cb-check-label { font-size: 12.5px; color: var(--ink70); }

/* ── Buttons ── */
.cb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; width: 100%;
  border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none;
  transition: transform .1s, background .12s, opacity .12s;
}
.cb-btn:active { transform: translateY(1px); }
.cb-btn--primary { background: var(--lime); color: var(--ink); }
.cb-btn--primary:hover { background: var(--lime-deep); }
.cb-btn--ghost {
  background: var(--white); color: var(--ink);
  border-color: var(--ink16); height: 44px;
}
.cb-btn--ghost:hover { background: var(--surface); }
.cb-btn--center { margin-inline: auto; max-width: 280px; margin-top: 8px; }
.cb-btn[disabled], .cb-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.cb-btn-ico { flex-shrink: 0; }

/* spinner shown while submitting */
.cb-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: cb-spin .7s linear infinite; flex-shrink: 0;
}
@keyframes cb-spin { to { transform: rotate(360deg); } }

/* ── Divider + social ── */
.cb-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; }
.cb-divider span { flex: 1; height: 1px; background: var(--ink10); }
.cb-divider em {
  font: 600 9.5px/1 var(--font-mono);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink40); font-style: normal;
}
.cb-social { display: flex; flex-direction: column; gap: 10px; }

/* ── Links ── */
.cb-link {
  color: var(--ink); font-weight: 600; text-decoration: none;
  font-size: 12.5px; border-bottom: 1px solid var(--ink24); padding-bottom: 1px;
}
.cb-link:hover { border-color: var(--ink); }
.cb-link--muted { margin-left: auto; font-size: 11.5px; border: 0; color: var(--ink60); }

/* ── Help footer block ── */
.cb-help {
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--ink06);
  display: flex; align-items: center; gap: 8px;
}
.cb-help-ico { color: var(--ink40); flex-shrink: 0; }
.cb-help-txt { font-size: 12px; color: var(--ink60); }

/* ── OTP / MFA ── */
.cb-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 14px -4px; padding: 4px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 12.5px; color: var(--ink60); text-decoration: none;
  border-radius: 6px;
}
.cb-back:hover { color: var(--ink); }
.cb-otp-mark {
  width: 52px; height: 52px; border-radius: 13px;
  background: var(--ink); color: var(--lime);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.cb-otp-input {
  width: 100%; height: 56px; text-align: center;
  border-radius: 11px; border: 1px solid var(--ink16); background: var(--white);
  font-size: 28px; font-weight: 600; letter-spacing: 0.5em; text-indent: 0.5em;
  color: var(--ink); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.cb-otp-input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10,10,10,0.06); }
.cb-otp-input.err { border-color: var(--red); box-shadow: 0 0 0 3px rgba(196,34,31,0.12); }
.cb-otp-input::placeholder { color: var(--ink24); letter-spacing: 0.4em; }
.cb-otp-creds { display: flex; flex-direction: column; gap: 8px; }
.cb-otp-cred {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--ink10); cursor: pointer; font-size: 13px;
}
.cb-otp-foot {
  margin-top: 18px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.cb-otp-hint {
  font-size: 12px; color: var(--ink60);
  display: inline-flex; align-items: center; gap: 6px;
}

/* ── Status pages (error / info) ── */
.cb-status-mark {
  width: 78px; height: 78px; border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.cb-status-mark--error { background: var(--redSoft); }
.cb-status-mark--info  { background: var(--lime); }

/* ── Footer ── */
.cb-foot {
  margin-top: 28px; display: flex; align-items: center;
  gap: 12px; justify-content: center;
}
.cb-foot-build { font-size: 9.5px; color: var(--ink24); }
.cb-foot-dot { width: 3px; height: 3px; border-radius: 999px; background: var(--ink16); }
.cb-foot-link { font-size: 10px; color: var(--ink40); text-decoration: none; }
.cb-foot-link:hover { color: var(--ink60); text-decoration: underline; }

/* ── Focus rings (WCAG 2.1 AA) ── */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(216,255,62,0.6);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
