/* KIS Connect — customer portal
 *
 * Tokens below are inherited verbatim from keyinformation.ai's own stylesheet,
 * not invented here. The dark ground with a lime primary is the parent brand's
 * established identity, so the portal reads as the same company.
 *
 * Three deliberate departures from the marketing site, all for this page's job
 * — a non-technical caller, mid-problem, who needs one action to be obvious:
 *
 *  1. Base type is 1.0625rem rather than 16px, and the measure is narrow.
 *     Marketing copy gets skimmed; this page gets read under stress.
 *  2. No all-caps pill eyebrow and no arrow glyphs on buttons. Both are
 *     marketing-site furniture that add reading work here.
 *  3. Motion is limited to what answers a click. The parent site's 0.4s
 *     cubic-bezier transition is kept for interactive states only.
 */

:root {
  /* --- inherited from keyinformation.ai --- */
  --color-primary:       #92cc41;
  --color-primary-dark:  #6fa030;
  --color-primary-glow:  rgba(146, 204, 65, 0.2);
  --color-accent:        #00f2fe;
  --color-bg:            #050505;
  --color-surface:       #0f0f0f;
  --color-surface-hover: #161616;
  --color-glass:         rgba(20, 20, 20, 0.6);
  --color-border:        rgba(255, 255, 255, 0.08);
  --color-border-hover:  rgba(146, 204, 65, 0.3);
  --color-text:          #e0e0e0;
  --color-text-muted:    #a0a0a0;
  --color-text-heading:  #ffffff;

  --header-height: 80px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;
  --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);

  /* --- added for this page --- */
  /* The parent palette has no failure colour. This one sits in the same
     family: warm enough to read as a problem, not so hot it alarms. */
  --color-danger:      #ff6b5b;
  --color-danger-bed:  rgba(255, 107, 91, 0.08);
  --color-danger-edge: rgba(255, 107, 91, 0.35);

  --font-display: "Outfit", "Segoe UI Variable Display", system-ui, -apple-system, sans-serif;
  --font-body:    "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", "Cascadia Mono", Consolas, Menlo, monospace;

  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.5rem;

  --measure: 34rem;
}

/* Self-hosted so the page never waits on an external font host during a
 * support call, and so the Content-Security-Policy can stay locked to 'self'.
 * Drop the woff2 files into /static/fonts/. Without them the stacks above fall
 * back cleanly — the layout does not depend on the webfonts loading. */
@font-face {
  font-family: "Outfit";
  src: url("/static/fonts/outfit-variable.woff2") format("woff2-variations");
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-variable.woff2") format("woff2-variations");
  font-weight: 300 800;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--color-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* A single soft primary glow anchored behind the content, echoing the parent
 * site's hero orb. This is the page's one piece of decoration; everything else
 * earns its place. */
body::before {
  content: "";
  position: fixed;
  top: -20vh;
  right: -10vw;
  width: 70vw;
  height: 70vw;
  max-width: 900px;
  max-height: 900px;
  background: radial-gradient(circle, var(--color-primary-glow) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* --- header --------------------------------------------------------- */

.bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-height);
  padding: 0 2rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-glass);
  backdrop-filter: blur(12px);
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--color-text-heading);
}

.phone {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.phone:hover {
  border-color: var(--color-border-hover);
  background: var(--color-surface-hover);
}

.phone[data-phone=""] { display: none; }

/* --- layout --------------------------------------------------------- */

main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem 4.5rem;
}

.panel {
  width: 100%;
  max-width: var(--measure);
}

h1 {
  margin: 0 0 0.625rem;
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--color-text-heading);
}

h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text-heading);
}

.lede {
  margin: 0 0 2.25rem;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--color-text-muted);
}

.help {
  margin: 1rem 0 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

/* --- buttons -------------------------------------------------------- */

.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9375rem 1.75rem;
  transition: var(--transition);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.btn-quiet {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-quiet:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-hover);
}

/* The page's whole reason for existing. Large target, unambiguous label,
 * and the only element carrying a glow. */
.btn-download {
  width: 100%;
  flex-direction: column;
  gap: 0.1875rem;
  padding: 1.75rem;
  min-height: 6.5rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 0 var(--color-primary-glow);
}

.btn-download:hover {
  box-shadow: 0 0 40px 0 var(--color-primary-glow);
}

.btn-line {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.btn-sub {
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(5, 5, 5, 0.68);
}

.btn-inline { padding: 0.9375rem 2rem; }

.linkish {
  margin-top: 1.25rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-hover);
  transition: var(--transition);
}

.linkish:hover { border-bottom-color: var(--color-primary); }

/* Cyan is the parent system's accent. Used here for exactly one thing —
 * the focus ring — where maximum visibility against the dark ground matters. */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* --- code entry ------------------------------------------------------ */

.code-entry {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.code-input {
  flex: 1 1 14ch;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--step-2);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.8125rem 1.125rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-heading);
  transition: var(--transition);
}

.code-input::placeholder {
  color: #5a5a5a;
  letter-spacing: 0.12em;
}

.code-input:focus {
  border-color: var(--color-border-hover);
  background: var(--color-surface-hover);
}

.code-input[aria-invalid="true"] { border-color: var(--color-danger-edge); }

.code-echo {
  margin: 2rem 0 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.code-echo b {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--color-primary);
}

.message {
  margin: 1.125rem 0 0;
  padding: 0.875rem 1.125rem;
  border: 1px solid var(--color-danger-edge);
  border-radius: var(--radius-sm);
  background: var(--color-danger-bed);
  color: var(--color-danger);
  font-weight: 500;
}

/* --- what to do next ------------------------------------------------- */

.after {
  margin: 2.25rem 0 0;
  padding: 1.375rem 1.375rem 1.375rem 2.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

.after li { margin-bottom: 0.5rem; }
.after li:last-child { margin-bottom: 0; }
.after b { color: var(--color-text-heading); font-weight: 600; }

/* --- macOS terminal path --------------------------------------------- */

.terminal-steps { margin-top: 1.75rem; }

.snippet {
  display: block;
  margin: 0.875rem 0;
  padding: 1.125rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

/* --- consent --------------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.sheet {
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.terms {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
  color: var(--color-text-muted);
}

.terms li { margin-bottom: 0.6875rem; }

.fineprint {
  margin: 0 0 1.75rem;
  padding: 1rem 1.125rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--color-text);
}

.sheet-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* --- utility --------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

/* --- responsive ------------------------------------------------------ */

@media (max-width: 30rem) {
  :root { --step-3: 2rem; --step-2: 1.375rem; --step-1: 1.125rem; }
  .bar { padding: 0 1.25rem; min-height: 64px; }
  .wordmark { font-size: 1.0625rem; }
  .phone { white-space: nowrap; padding: 0.4375rem 0.75rem; }
  main { padding: 2.25rem 1.25rem 3rem; }
  .code-entry { flex-direction: column; }
  /* The row layout's `flex: 1 1 14ch` sets a *width* basis. Once the container
   * turns into a column that basis becomes a height, and the field grows to
   * 180px. Reset the basis with the axis. */
  .code-input { flex: 0 0 auto; width: 100%; }
  .btn-inline { width: 100%; }
  .btn-download { padding: 1.5rem; min-height: 5.5rem; }
  .sheet { padding: 1.5rem; }
  .sheet-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .btn-download:hover { box-shadow: none; }
}

/* The parent site is dark-only. Honour a light-mode preference at the edges
 * rather than fighting it, so forced-colours users are not stranded. */
@media (forced-colors: active) {
  .btn-primary, .btn-quiet { border: 1px solid ButtonBorder; }
  body::before { display: none; }
}
