/* score.kingsidegroup.com — Kingside-branded AI Assessment self-serve app.
   Kingside design tokens + dark-only theme.
   Google Fonts (Poppins + Raleway) loaded in index.html. */

:root {
  /* Kingside tokens */
  --carbon:       #111111;
  --electric:     #20A4F3;
  --teal:         #0E7490;
  --slate:        #71717A;
  --platinum:     #E4E4E7;

  /* Surface system */
  --bg:           #0B0C0E;
  --bg-raised:    #14161A;
  --bg-card:      #101216;
  --border:       #21262E;
  --border-hover: #38424f;

  /* Text */
  --fg:           #ECEEF0;
  --fg-muted:     #98A2AE;
  --fg-dim:       #5B6670;

  /* Type */
  --font-head: 'Poppins', system-ui, sans-serif;
  --font-body: 'Raleway', system-ui, sans-serif;

  /* Chat bubbles */
  --bubble-bot:   #101216;
  --bubble-user:  #0d1f30;

  /* Radius */
  --r-sm: 6px;
  --r:    10px;
  --r-md: 14px;
  --r-lg: 20px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

a { color: var(--electric); text-underline-offset: 3px; }

button { cursor: pointer; font: inherit; }

:focus-visible {
  outline: 2px solid var(--electric);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ── Site header ──────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 12, 14, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.header-logo-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.header-logo-wordmark {
  height: 18px;
  width: auto;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

/* ── Landing ─────────────────────────────────────────────────────────────── */

.landing {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 64px);
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5rem 1.5rem 4rem;
  gap: 1.5rem;
}

.hero-mark {
  width: 72px;
  height: 72px;
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--electric);
}

.hero-headline {
  font-family: var(--font-head);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 22ch;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--fg-muted);
  max-width: 44ch;
  line-height: 1.65;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Primary CTA */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--electric);
  color: #0B0C0E;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--r-md);
  border: none;
  text-decoration: none;
  transition: opacity 150ms, transform 150ms;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

/* Outline CTA */
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border-hover);
  text-decoration: none;
  transition: border-color 150ms, background 150ms;
}
.btn-outline:hover { border-color: var(--fg-muted); background: rgba(255,255,255,0.04); }

/* Three-up explainer */
.explainer {
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem;
}

.explainer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

@media (max-width: 640px) {
  .explainer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
}

.explainer-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.explainer-num {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--electric);
}

.explainer-label {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
}

.explainer-body {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* ── Chat overlay ────────────────────────────────────────────────────────── */

#chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  /* Hidden by default; JS removes 'hidden' class */
}

#chat-overlay.hidden { display: none; }

/* Chat panel header */
#chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.chat-identity {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.chat-name {
  font-family: var(--font-head);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-sub {
  font-size: 0.72rem;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
}

/* Progress bar */
.progress-wrap {
  height: 3px;
  background: var(--border);
  flex-shrink: 0;
}

#progress-fill {
  height: 100%;
  background: var(--electric);
  width: 0%;
  transition: width 400ms ease;
}

/* Message stream */
#chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Message bubbles */
.bubble {
  max-width: 82%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--r-md);
  font-size: 0.97rem;
  line-height: 1.55;
  word-break: break-word;
}

.bubble--bot {
  background: var(--bubble-bot);
  color: var(--fg);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--r-sm);
  align-self: flex-start;
}

.bubble--user {
  background: var(--bubble-user);
  color: var(--fg);
  border: 1px solid rgba(32, 164, 243, 0.25);
  border-bottom-right-radius: var(--r-sm);
  align-self: flex-end;
}

.bubble a {
  color: var(--electric);
  word-break: break-all;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.65rem 0.9rem;
  background: var(--bubble-bot);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  border-bottom-left-radius: var(--r-sm);
  width: 56px;
  align-self: flex-start;
}

.typing-indicator span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-dim);
  animation: blink 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-3px); }
}

/* Chat input area */
#chat-input {
  padding: 0.75rem 1rem 1rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Chip inputs ─────────────────────────────────────────────────────────── */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  font-family: var(--font-body);
  transition: background 120ms, border-color 120ms, color 120ms;
  white-space: nowrap;
}

.chip:hover {
  background: rgba(32, 164, 243, 0.1);
  border-color: var(--electric);
  color: var(--fg);
}

.chip--selected {
  background: rgba(32, 164, 243, 0.18);
  border-color: var(--electric);
  color: var(--electric);
}

.chip--ranked {
  background: rgba(32, 164, 243, 0.15);
  border-color: var(--electric);
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--electric);
  color: #0B0C0E;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 0.25rem;
}

.btn-done {
  background: var(--electric);
  color: #0B0C0E;
  border: none;
  border-radius: var(--r);
  padding: 0.55rem 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: var(--font-head);
  transition: opacity 150ms;
  align-self: flex-start;
}
.btn-done:hover { opacity: 0.88; }

/* ── Text input ──────────────────────────────────────────────────────────── */

.text-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.text-inp {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border-hover);
  border-radius: var(--r);
  color: var(--fg);
  font-size: 0.95rem;
  font-family: var(--font-body);
  padding: 0.65rem 0.875rem;
  outline: none;
  transition: border-color 150ms;
  min-width: 0;
}

.text-inp::placeholder { color: var(--fg-dim); }
.text-inp:focus { border-color: var(--electric); }

.btn-send {
  background: var(--electric);
  color: #0B0C0E;
  border: none;
  border-radius: var(--r);
  padding: 0 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  transition: opacity 150ms;
  flex-shrink: 0;
}
.btn-send:hover { opacity: 0.85; }

.btn-skip {
  background: transparent;
  color: var(--fg-muted);
  border: none;
  font-size: 0.8rem;
  padding: 0.25rem 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  align-self: flex-start;
}
.btn-skip:hover { color: var(--fg); }

/* ── Booking widget ──────────────────────────────────────────────────────── */

.bk-step {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.bk-label {
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-head);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bk-label--mt { margin-top: 0.5rem; }

.bk-loading {
  color: var(--fg-muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.bk-error {
  color: #f87171;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}
.bk-error--hidden { display: none; }

.bk-hint {
  color: var(--fg-dim);
  font-size: 0.85rem;
}

.bk-date-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.bk-date-strip::-webkit-scrollbar { height: 4px; }
.bk-date-strip::-webkit-scrollbar-track { background: transparent; }
.bk-date-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.bk-date-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.5rem 0.75rem;
  min-width: 52px;
  flex-shrink: 0;
  transition: border-color 120ms, background 120ms;
}
.bk-date-btn:hover { border-color: var(--electric); background: rgba(32,164,243,0.07); }
.bk-date-btn--active { border-color: var(--electric); background: rgba(32,164,243,0.12); }

.bk-date-abbr {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.bk-date-btn--active .bk-date-abbr { color: var(--electric); }

.bk-date-num {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
}

.bk-slot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bk-slot { font-size: 0.85rem; padding: 0.4rem 0.8rem; }

.bk-confirm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.bk-confirm-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fg);
}

.bk-confirm-sub {
  font-size: 0.82rem;
  color: var(--fg-muted);
}

.bk-confirm-who {
  font-size: 0.82rem;
  color: var(--fg-dim);
}

.bk-turnstile {
  margin: 0.25rem 0;
}

.btn-confirm {
  background: var(--electric);
  color: #0B0C0E;
  border: none;
  border-radius: var(--r);
  padding: 0.7rem 1.5rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  transition: opacity 150ms;
  align-self: flex-start;
}
.btn-confirm:hover { opacity: 0.88; }
.btn-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Closing ──────────────────────────────────────────────────────────────── */

.restart-hint {
  font-size: 0.8rem;
  color: var(--fg-dim);
  padding-top: 0.5rem;
}

/* ── Animations ──────────────────────────────────────────────────────────── */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.shake { animation: shake 0.45s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Desktop layout ──────────────────────────────────────────────────────── */

@media (min-width: 640px) {
  .hero { padding: 6rem 2rem 5rem; }
  .hero-mark { width: 88px; height: 88px; }
  .hero-headline { font-size: 3rem; }
  #chat-stream { padding: 1.75rem 1.5rem; }
  #chat-input { padding: 1rem 1.5rem 1.5rem; }
  .bubble { font-size: 1rem; }
}

@media (min-width: 900px) {
  /* Constrain chat to a readable width, centred */
  #chat-panel {
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
  }
  #chat-overlay {
    align-items: center;
    justify-content: center;
    background: rgba(11, 12, 14, 0.96);
  }
  #chat-panel {
    height: 100%;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
