/* Hivemind gateway. Colors mirror the control plane's tokens (globals.css) so the
   sign-in pages read as the same product in light and dark mode. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --background: #f3f5f9;
  --foreground: #0d1117;
  --card: rgba(255, 255, 255, 0.82);
  --card-solid: #ffffff;
  --muted: #edf0f6;
  --muted-foreground: #525866;
  --primary: #0074d9;
  --teal: #009296;
  --primary-gradient: linear-gradient(135deg, #0074d9 0%, #009296 100%);
  --border: rgba(0, 0, 0, 0.08);
  --ring: #0074d9;
  --warn: #b45309;
  --shadow: 0 1px 2px rgba(13, 17, 23, 0.04), 0 18px 48px -18px rgba(0, 116, 217, 0.28);
  --glow-a: rgba(0, 116, 217, 0.18);
  --glow-b: rgba(0, 146, 150, 0.16);
  --radius: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #080c17;
    --foreground: #dce8ff;
    --card: rgba(15, 23, 36, 0.78);
    --card-solid: #0f1724;
    --muted: #172036;
    --muted-foreground: #94a8c9;
    --primary: #5bb0ff;
    --border: rgba(100, 160, 255, 0.12);
    --ring: #5bb0ff;
    --warn: #f5b454;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 24px 60px -20px rgba(0, 116, 217, 0.45);
    --glow-a: rgba(0, 116, 217, 0.28);
    --glow-b: rgba(0, 146, 150, 0.22);
  }
}

* { box-sizing: border-box; }

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

body {
  font-family: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.glow {
  position: fixed;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
  animation: float-glow 22s ease-in-out infinite alternate;
}
.glow-a { background: var(--glow-a); top: -25vmax; left: -15vmax; }
.glow-b { background: var(--glow-b); bottom: -30vmax; right: -20vmax; animation-delay: -11s; }

@keyframes float-glow {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(6vmax, 4vmax) scale(1.12); }
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 32px;
}

.topbar { width: 100%; max-width: 640px; display: flex; justify-content: center; padding: 8px 0 28px; }
.brand img { display: block; height: 40px; width: auto; }

.stage { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 16px; flex: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  padding: 32px;
}

.hero, .success { text-align: center; }

.title {
  font-size: clamp(1.6rem, 4.6vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 750;
  margin: 8px 0 12px;
}

.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead { color: var(--muted-foreground); font-size: 1.02rem; line-height: 1.6; margin: 0 auto 26px; max-width: 46ch; }
.muted { color: var(--muted-foreground); line-height: 1.55; margin: 0 0 14px; }

/* --- Hero mascot with orbiting planets (echoes the constellation view) --- */
.orbit-hero { position: relative; width: 168px; height: 168px; margin: 0 auto 8px; }
.orbit-hero .mascot {
  position: absolute; inset: 0; margin: auto; width: 92px; height: auto;
  animation: bob 4.5s ease-in-out infinite;
  filter: drop-shadow(0 10px 18px rgba(0, 116, 217, 0.35));
}
.ring {
  position: absolute; inset: 0; margin: auto; border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--primary) 35%, transparent);
  animation: spin linear infinite;
}
.ring-1 { width: 112px; height: 112px; animation-duration: 9s; }
.ring-2 { width: 140px; height: 140px; animation-duration: 15s; animation-direction: reverse; }
.ring-3 { width: 168px; height: 168px; animation-duration: 24s; }
.planet {
  position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px;
  border-radius: 50%; background: var(--primary-gradient);
  box-shadow: 0 0 10px rgba(0, 146, 150, 0.8);
}
.p3 { top: auto; bottom: -4px; width: 6px; height: 6px; }
.p4 { top: 50%; left: -3px; width: 6px; height: 6px; margin: -3px 0 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* Error page: the mascot drawn sad (mascot-sad.png), swaying gently, with a tear that
   wells up under the eye and falls. Tear origin = lower-right of the eye in the image. */
.sad-octopus { position: relative; width: 137px; margin: 0 auto 10px; animation: sway 4s ease-in-out infinite; transform-origin: 50% 80%; }
.sad-octopus img { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 18px rgba(0, 116, 217, 0.25)); }
.tear {
  position: absolute; left: 60%; top: 45%; width: 9px; height: 9px;
  background: linear-gradient(160deg, #e8f6ff, #7fc4ff);
  border-radius: 0 50% 50% 50%; transform: rotate(45deg) scale(0); opacity: 0;
  box-shadow: 0 0 6px rgba(127, 196, 255, 0.7);
  animation: tear 3.2s ease-in 0.6s infinite;
}
@keyframes tear {
  0% { transform: translateY(0) rotate(45deg) scale(0); opacity: 0; }
  15% { transform: translateY(0) rotate(45deg) scale(1); opacity: 1; }
  35% { transform: translateY(2px) rotate(45deg) scale(1); opacity: 1; }
  85% { transform: translateY(46px) rotate(45deg) scale(0.9); opacity: 0.9; }
  100% { transform: translateY(54px) rotate(45deg) scale(0.6); opacity: 0; }
}
@keyframes sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(4deg); } }

/* --- Buttons --- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 12px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  border: 0; transition: transform 0.15s ease, box-shadow 0.25s ease, background 0.2s ease;
}
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }

.btn-primary {
  padding: 15px 28px; font-size: 1.02rem; color: #fff; background: var(--primary-gradient);
  background-size: 160% 160%; overflow: hidden;
  box-shadow: 0 10px 28px -10px rgba(0, 116, 217, 0.75);
  animation: gradient-drift 6s ease infinite;
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform 0.7s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -10px rgba(0, 116, 217, 0.85); }
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-icon { width: 20px; height: 20px; }

@keyframes gradient-drift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
.btn.is-loading { pointer-events: none; opacity: 0.92; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-icon { display: none; }

.btn-ghost {
  padding: 8px 14px; font-size: 0.88rem; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  flex-shrink: 0;
}
.btn-ghost:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.btn-ghost.is-done { color: #0f9d58; border-color: rgba(15, 157, 88, 0.4); background: rgba(15, 157, 88, 0.1); }

/* --- Steps --- */
.steps {
  list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap;
  justify-content: center; gap: 10px;
}
.steps li {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px;
  border-radius: 999px; background: var(--muted); border: 1px solid var(--border);
  font-size: 0.88rem; color: var(--muted-foreground);
}
.step-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary-gradient); color: #fff; font-size: 0.78rem; font-weight: 700; flex-shrink: 0;
}

.fine {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 22px 0 0;
  font-size: 0.82rem; color: var(--muted-foreground);
}
.fine svg { width: 14px; height: 14px; color: var(--teal); }

/* --- Success page --- */
.check-wrap { position: relative; width: 76px; height: 76px; margin: 0 auto 10px; }
.check { width: 76px; height: 76px; }
.check-circle {
  fill: none; stroke: var(--teal); stroke-width: 3;
  stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 0.7s 0.15s ease-out forwards;
}
.check-mark {
  fill: none; stroke: var(--primary); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.45s 0.75s ease-out forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.burst {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--teal); opacity: 0; animation: burst 1s 0.85s ease-out forwards;
}
@keyframes burst { from { transform: scale(0.8); opacity: 0.7; } to { transform: scale(1.9); opacity: 0; } }

.step-card { padding: 24px 26px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-head h2 { font-size: 1.08rem; margin: 0; letter-spacing: -0.01em; }

.copy-field {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 12px;
  background: var(--muted); border: 1px solid var(--border);
}
.copy-field code, .copy-field pre {
  flex: 1; min-width: 0; margin: 0; font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.84rem; color: var(--foreground);
}
.copy-field code { overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.copy-field.tall { align-items: flex-start; }
.copy-field pre { white-space: pre-wrap; line-height: 1.55; max-height: 190px; overflow: auto; }

.warn {
  display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0;
  font-size: 0.84rem; line-height: 1.5; color: var(--warn);
}
.warn svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

.howto { margin: 0; padding-left: 20px; line-height: 1.9; color: var(--muted-foreground); }
.howto strong, .muted strong, .lead strong { color: var(--foreground); }

/* --- Footer --- */
.footer {
  display: flex; align-items: center; gap: 10px; margin-top: 28px;
  font-size: 0.85rem; color: var(--muted-foreground);
}
.axiom-chip { display: inline-flex; padding: 4px 8px; border-radius: 8px; }
.axiom-chip img { display: block; height: 26px; width: auto; }
@media (prefers-color-scheme: dark) {
  /* The Axiom World wordmark is navy; give it a light chip so it stays legible. */
  .axiom-chip { background: #fff; }
}

/* --- Entrance animation --- */
.rise { opacity: 0; transform: translateY(14px); animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0ms) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (max-width: 520px) {
  .card { padding: 24px 18px; }
  .step-card { padding: 20px 16px; }
  .btn-primary { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .rise { opacity: 1; transform: none; }
}


.note { margin: 12px 0 0; font-size: 0.86rem; }

/* --- Signed-in page: a short bar that fills while we return to Claude --- */
.progress {
  width: 220px; max-width: 80%; height: 4px; margin: 0 auto 22px; border-radius: 999px;
  background: var(--muted); overflow: hidden;
}
.progress span {
  display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary-gradient);
  animation: fill 1.8s 0.2s ease-in-out forwards;
}
@keyframes fill { to { width: 100%; } }

/* --- Zoho logo on the sign-in button --- */
.zoho-badge {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); flex-shrink: 0;
}
.zoho-badge img { display: block; width: 26px; height: 26px; }
.btn.is-loading .zoho-badge { display: none; }

/* Without an intro paragraph under it, the headline needs the breathing room itself. */
.hero .title { margin-bottom: 22px; }
