/**
 * File: public/assets/css/kyn-gateway.css
 * Purpose: Styles the KYN Gateway front door, same-document login panel, and route-hard-cut entry screen.
 *
 * Owns:
 * - Gateway cream entrance.
 * - Huge navy logo state.
 * - Login panel layout after logo tap.
 *
 * Does NOT own:
 * - Workspace shell styling.
 * - FlowOS POS styling.
 */

html,
body {
  min-height: 100%;
}

body.kyn-gateway-body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: #f7efd8;
  color: #061f3f;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.kyn-gateway {
  min-height: 100vh;
  background: #f7efd8;
}

.kyn-gateway-stage {
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(42vh, 1fr) auto minmax(0, auto);
  place-items: center;
  padding: 28px;
  box-sizing: border-box;
}

.kyn-gateway-logo-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #061f3f;
  width: min(58vw, 580px);
  min-width: min(82vw, 300px);
  aspect-ratio: 1 / 1;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  touch-action: manipulation;
}

.kyn-gateway-logo-button:focus-visible {
  outline: 4px solid rgba(6, 31, 63, 0.34);
  outline-offset: 10px;
}

.kyn-gateway-logo-mark {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.kyn-gateway-logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.kyn-gateway-logo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #061f3f;
  font-size: clamp(6rem, 25vw, 18rem);
  line-height: 0.82;
  font-weight: 900;
  letter-spacing: 0;
}

.is-logo-image-loaded .kyn-gateway-logo-fallback {
  display: none;
}

.is-logo-image-failed .kyn-gateway-logo-image {
  display: none;
}

.kyn-gateway-status {
  min-height: 24px;
  margin: 0 0 18px;
  color: #173a5f;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.kyn-gateway-login-panel {
  width: min(420px, calc(100vw - 40px));
  padding: 18px;
  border: 1px solid rgba(6, 31, 63, 0.22);
  border-radius: 8px;
  background: rgba(255, 252, 242, 0.72);
  box-shadow: 0 14px 36px rgba(6, 31, 63, 0.13);
}

.kyn-gateway-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.kyn-gateway-tabs button,
.kyn-gateway-keypad button,
.kyn-gateway-noscript-submit {
  min-height: 48px;
  border: 1px solid rgba(6, 31, 63, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #061f3f;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.kyn-gateway-tabs button.is-active {
  background: #061f3f;
  color: #fffaf0;
}

.kyn-gateway-pin-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 18px;
  margin: 8px 0 12px;
}

.kyn-gateway-pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(6, 31, 63, 0.52);
  background: transparent;
}

.kyn-gateway-pin-dots span.is-filled {
  background: #061f3f;
}

.kyn-gateway-error {
  min-height: 24px;
  margin: 0 0 12px;
  color: #8b1e2d;
  font-size: 0.94rem;
  font-weight: 800;
  text-align: center;
  visibility: hidden;
}

.kyn-gateway-error.is-visible {
  visibility: visible;
}

.kyn-gateway-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kyn-gateway-keypad button {
  font-size: 1.18rem;
}

.kyn-gateway-keypad button:active {
  transform: translateY(1px);
}

.kyn-gateway-keypad-utility {
  font-size: 0.92rem !important;
}

.kyn-gateway-noscript-pin {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  font-weight: 800;
}

.kyn-gateway-noscript-pin input {
  min-height: 44px;
  border: 1px solid rgba(6, 31, 63, 0.24);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.kyn-gateway-noscript-submit {
  width: 100%;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .kyn-gateway-stage {
    grid-template-rows: minmax(34vh, 0.9fr) auto minmax(0, auto);
    padding: 18px;
  }

  .kyn-gateway-logo-button {
    width: min(84vw, 420px);
  }

  .kyn-gateway-login-panel {
    width: calc(100vw - 28px);
    padding: 14px;
  }
}


/* v001B: Once the user taps the front-door logo, the logo entrance is removed.
   The Gateway becomes a focused PIN access screen instead of showing both states. */
.kyn-gateway.is-login-visible .kyn-gateway-stage {
  grid-template-rows: minmax(8vh, 1fr) auto minmax(8vh, 1fr);
  align-content: center;
}

.kyn-gateway.is-login-visible .kyn-gateway-logo-button {
  display: none;
}

.kyn-gateway-login-heading {
  text-align: center;
  margin: 0 0 14px;
}

.kyn-gateway-login-heading small {
  display: block;
  color: rgba(6, 31, 63, 0.66);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.kyn-gateway-login-heading h1 {
  margin: 4px 0 0;
  color: #061f3f;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  line-height: 1;
  font-weight: 900;
}

.kyn-gateway.is-login-visible .kyn-gateway-status {
  margin: 0 0 12px;
}

.kyn-gateway.is-submitting-login .kyn-gateway-login-panel {
  opacity: 0.82;
  pointer-events: none;
}


/* Route Hard Cut 001B: after the logo opens KYN Mode, the logo becomes the door behind the user. */
.kyn-gateway.is-login-visible .kyn-gateway-stage {
  grid-template-rows: 1fr;
  align-content: center;
  justify-items: center;
}

.kyn-gateway.is-login-visible .kyn-gateway-logo-button,
.kyn-gateway.is-login-visible .kyn-gateway-status {
  display: none;
}

.kyn-gateway.is-login-visible .kyn-gateway-login-panel {
  align-self: center;
}

.kyn-gateway-login-header {
  text-align: center;
  margin-bottom: 16px;
}

.kyn-gateway-login-brand {
  color: #061f3f;
  font-size: 1.3rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.kyn-gateway-login-header h1 {
  margin: 0;
  color: #061f3f;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.1;
}

.kyn-gateway-login-header p {
  margin: 6px 0 0;
  color: #315170;
  font-size: 0.96rem;
  font-weight: 700;
}

.kyn-gateway-loading {
  margin-top: 14px;
  color: #061f3f;
  font-size: 0.98rem;
  font-weight: 900;
  text-align: center;
}

.kyn-gateway.is-loading .kyn-gateway-login-form,
.kyn-gateway.is-loading .kyn-gateway-tabs {
  opacity: 0.48;
  pointer-events: none;
}


/* HC001D: small visible build badge for route-by-route testing. */
.kyn-build-badge {
  position: fixed;
  right: 12px;
  bottom: 10px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(6, 31, 63, 0.18);
  border-radius: 999px;
  background: rgba(255, 252, 242, 0.84);
  color: rgba(6, 31, 63, 0.72);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}
