/* ==========================================================================
   InceptionDB — shared stylesheet (public site + console shell)
   Theme: automatic light/dark via prefers-color-scheme
   Console UI: Tailwind classes + theme.css (body.theme-dark/theme-light)
   ========================================================================== */

html, body {
  font-family: sans-serif;
  margin: 0;
}

html {
  color-scheme: light;
  scrollbar-color: silver transparent;
  scroll-behavior: smooth;
}

@media (prefers-color-scheme: dark) {
  html {
    color-scheme: dark;
    scrollbar-color: #33415c transparent;
  }
}

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

strong {
  color: black;
}

body.embed strong {
  color: dodgerblue;
}

body.embed {
  color: white;
  background-color: #1e1e1e;
}

body.embed input,
body.embed textarea {
  color: white;
}

body.embed .no-embed {
  display: none;
}

/* ==========================================================================
   Design tokens — light theme (default), overridden in dark theme below
   ========================================================================== */

:root {
  --c-bg: #ffffff;
  --c-bg-soft: #f5f8fc;
  --c-card: #ffffff;
  --c-text: #101828;
  --c-heading: #0b1526;
  --c-muted: #5b6b84;
  --c-border: #e3e9f2;
  --c-border-strong: #c9d5e4;
  --c-brand: #1e90ff;
  --c-brand-strong: #1574d4;
  --c-brand-soft: rgba(30, 144, 255, 0.10);
  --c-accent: #6d28d9;
  --c-code-bg: #0d1526;
  --c-code-bar: rgba(255, 255, 255, 0.05);
  --c-code-border: rgba(255, 255, 255, 0.09);
  --c-code-text: #d7e2f4;
  --c-nav-bg: rgba(255, 255, 255, 0.82);
  --c-glow: rgba(30, 144, 255, 0.16);
  --c-grid: rgba(16, 24, 40, 0.05);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06), 0 10px 28px -14px rgba(16, 24, 40, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #0a0f1c;
    --c-bg-soft: #0f1626;
    --c-card: #0e1524;
    --c-text: #dbe4f0;
    --c-heading: #f2f6fc;
    --c-muted: #8ca0ba;
    --c-border: #1c2940;
    --c-border-strong: #2b3a58;
    --c-brand: #3da9ff;
    --c-brand-strong: #6abaff;
    --c-brand-soft: rgba(61, 169, 255, 0.13);
    --c-accent: #a78bfa;
    --c-code-bg: #0b1120;
    --c-code-bar: rgba(255, 255, 255, 0.04);
    --c-code-border: rgba(255, 255, 255, 0.08);
    --c-code-text: #d7e2f4;
    --c-nav-bg: rgba(10, 15, 28, 0.82);
    --c-glow: rgba(61, 169, 255, 0.14);
    --c-grid: rgba(148, 163, 184, 0.07);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 36px -18px rgba(0, 0, 0, 0.65);
  }
}

/* Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--c-text);
  background-color: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  text-decoration: none;
}

::selection {
  background-color: var(--c-brand);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
}

/* ==========================================================================
   Top bar (navbar) — shared by public site and console
   ========================================================================== */

.top-frame {
  position: relative;
  z-index: 50;
  background-color: var(--c-nav-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
}

/* Sticky on the public site and on the console. The console shell reserves
   the space below it with calc(100vh - 65px). */
body:has(.public) .top-frame,
body:has(.console) .top-frame {
  position: sticky;
  top: 0;
}

.top {
  max-width: 1120px;
  margin: 0 auto;
  height: 64px;
  padding: 0 20px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.top .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--c-heading);
}

.top .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: #0b1220;
  border: 1px solid var(--c-border-strong);
  box-shadow: 0 2px 10px rgba(30, 144, 255, 0.25);
  font-size: 17px;
  line-height: 1;
}

.top .brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.top .brand-name span {
  color: var(--c-brand);
}

.top .top-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.top .top-links a {
  color: var(--c-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.top .top-links a:hover {
  color: var(--c-heading);
  background-color: var(--c-bg-soft);
}

.top .right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex: none;
}

.top .top-links + .right {
  margin-left: 0;
}

.top #user_picture {
  height: 30px;
  width: 30px;
  vertical-align: top;
  border-radius: 50%;
  border: 1px solid var(--c-border);
}

.top #user_nick {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-heading);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top .top-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-bg-soft);
  font-size: 12px;
  font-weight: 600;
  color: var(--c-muted);
  white-space: nowrap;
}

.top .top-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--c-muted);
  flex: none;
}

.top .top-status.is-online .top-status-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.top .top-status.is-degraded .top-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.top .top-status.is-offline .top-status-dot {
  background: #f43f5e;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.18);
}

@media (max-width: 560px) {
  .top .top-status-label {
    display: none;
  }
}

.top .button {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 8px;
}

.top .button:hover {
  box-shadow: none;
}

.top .button.button-noborder {
  border: 1px solid var(--c-border-strong);
  color: var(--c-heading);
  background-color: transparent;
}

.top .button.button-noborder:hover {
  background-color: var(--c-bg-soft);
}

.top .button.button-action {
  border: 1px solid transparent;
  color: #fff;
  background-color: var(--c-brand);
  box-shadow: 0 2px 10px rgba(30, 144, 255, 0.35);
}

.top .button.button-action:hover {
  background-color: var(--c-brand-strong);
}

@media (max-width: 760px) {
  .top .top-links {
    display: none;
  }
  .top #user_nick {
    display: none;
  }
}

/* ==========================================================================
   Shared button primitives (top bar + public page)
   ========================================================================== */

.button {
  display: inline-block;
  color: inherit;
  background-color: transparent;
  border: solid 1px;
  padding: 8px 32px;
  margin: 0;
  font-weight: bold;
  border-radius: 8px;
  text-decoration: none;
}

.button:hover {
  cursor: pointer;
}

.button-noborder {
  border: 0;
}

.button-action {
  color: white;
  background-color: var(--c-brand);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(30, 144, 255, 0.35);
}

.button-action:hover {
  background-color: var(--c-brand-strong);
}

.button-ghost {
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
  background-color: transparent;
}

.button-ghost:hover {
  background-color: var(--c-bg-soft);
}

.public .button {
  font-weight: 600;
}

.public .button-lg {
  padding: 12px 24px;
  font-size: 16px;
}

/* ==========================================================================
   Public home page
   ========================================================================== */

.public {
  background-color: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  overflow-x: clip;
}

.public .container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.public section {
  scroll-margin-top: 76px;
}

.public h2 {
  color: var(--c-heading);
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin-bottom: 16px;
}

.public p {
  color: var(--c-muted);
  font-size: 17px;
  line-height: 1.65;
}

/* Hero ---------------------------------------------------------------- */

.public .hero {
  position: relative;
  padding: 88px 0 56px;
}

.public .hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 440px at 14% -10%, var(--c-glow), transparent 62%),
    radial-gradient(680px 400px at 96% 4%, rgba(109, 40, 217, 0.10), transparent 62%);
}

.public .hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--c-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--c-grid) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 95% 75% at 50% 0%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 95% 75% at 50% 0%, #000 25%, transparent 78%);
}

.public .hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}

.public .hero-copy,
.public .hero-visual {
  min-width: 0;
}

.public .hero-visual .code-window {
  width: 100%;
}

.public .hero-copy {
  animation: rise 0.6s ease both;
}

.public .hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  background-color: var(--c-bg-soft);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-muted);
  margin-bottom: 24px;
}

.public .hero-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  animation: pulse 2.2s ease infinite;
}

.public .hero h1 {
  color: var(--c-heading);
  font-size: clamp(2.15rem, 4.6vw, 3.35rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin-bottom: 22px;
}

.public .hero h1 .grad {
  background: linear-gradient(92deg, var(--c-brand) 10%, var(--c-accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.public .hero p {
  font-size: 18px;
  margin-bottom: 32px;
  max-width: 520px;
}

.public .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.public .hero-note {
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--c-muted);
}

.public .hero-visual {
  animation: rise 0.6s 0.12s ease both;
}

/* Code window --------------------------------------------------------- */

.public .code-window {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--c-code-border);
  background-color: var(--c-code-bg);
  box-shadow: var(--shadow-card), 0 28px 64px -28px rgba(30, 144, 255, 0.4);
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
}

.public .code-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 16px;
  background-color: var(--c-code-bar);
  border-bottom: 1px solid var(--c-code-border);
}

.public .code-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.public .code-dot.red    { background-color: #ff5f57; }
.public .code-dot.yellow { background-color: #febc2e; }
.public .code-dot.green  { background-color: #28c840; }

.public .code-title {
  margin-left: 10px;
  color: #7d8db0;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.public .code-body {
  padding: 20px 22px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--c-code-text);
  overflow-x: auto;
  white-space: pre;
}

.public .code-body .c-dir { color: #7d8db0; }
.public .code-body .c-str { color: #86efac; }
.public .code-body .c-out { color: #9fb3cc; }

.public .code-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--c-code-border);
  color: #7d8db0;
  font-size: 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* Stats --------------------------------------------------------------- */

.public .stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  margin-top: 72px;
  padding-top: 44px;
  border-top: 1px solid var(--c-border);
}

.public .stat-value {
  color: var(--c-heading);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.public .stat-label {
  margin-top: 6px;
  font-size: 14px;
  color: var(--c-muted);
}

/* Sections ------------------------------------------------------------ */

.public .section {
  padding: 96px 0;
}

.public .section-alt {
  background-color: var(--c-bg-soft);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}

.public .section-head {
  max-width: 640px;
  margin: 0 auto 56px;
  text-align: center;
}

.public .section-kicker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-brand);
  margin-bottom: 12px;
}

.public .section-head p {
  font-size: 17px;
}

/* Feature cards -------------------------------------------------------- */

.public .grid {
  display: grid;
  gap: 20px;
}

.public .features {
  grid-template-columns: repeat(3, 1fr);
}

.public .card {
  background-color: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 28px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.public .card:hover {
  transform: translateY(-3px);
  border-color: var(--c-brand);
  box-shadow: var(--shadow-card);
}

.public .card-icon {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--c-brand-soft);
  color: var(--c-brand);
  margin-bottom: 18px;
}

.public .card-icon svg {
  width: 22px;
  height: 22px;
}

.public .card h3 {
  color: var(--c-heading);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.public .card p {
  font-size: 14.5px;
  line-height: 1.65;
}

/* Steps ---------------------------------------------------------------- */

.public .steps {
  grid-template-columns: repeat(3, 1fr);
  gap: 36px;
}

.public .step {
  text-align: center;
  padding: 8px;
}

.public .step-num {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-brand), var(--c-accent));
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px -8px rgba(30, 144, 255, 0.55);
}

.public .step h3 {
  color: var(--c-heading);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.public .step p {
  font-size: 15px;
}

/* Split (open source) --------------------------------------------------- */

.public .split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.public .checklist ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.public .checklist li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 0;
  font-size: 15px;
  color: var(--c-text);
}

.public .checklist li + li {
  border-top: 1px solid var(--c-border);
}

.public .checklist li strong {
  color: var(--c-heading);
}

.public .checklist .check {
  color: #22c55e;
  flex: none;
  margin-top: 3px;
}

/* CTA ------------------------------------------------------------------ */

.public .cta-panel {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--c-border);
  background:
    linear-gradient(135deg, rgba(30, 144, 255, 0.14), rgba(109, 40, 217, 0.12)),
    var(--c-bg-soft);
  padding: 72px 32px;
  text-align: center;
}

.public .cta-panel .hero-bg {
  background:
    radial-gradient(520px 320px at 50% -20%, var(--c-glow), transparent 70%);
}

.public .cta-inner {
  position: relative;
}

.public .cta-inner h2 {
  margin-bottom: 12px;
}

.public .cta-inner p {
  margin-bottom: 30px;
}

/* Footer ---------------------------------------------------------------- */

.public footer {
  background-color: var(--c-bg-soft);
  border-top: 1px solid var(--c-border);
  padding: 64px 0 36px;
  color: var(--c-muted);
}

.public .footer-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1fr;
  gap: 40px;
}

.public .footer-brand .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.public .footer-brand p {
  font-size: 14.5px;
  max-width: 300px;
}

.public .footer-brand a {
  color: var(--c-brand);
}

.public .footer-brand .brand-name {
  color: var(--c-heading);
}

.public .footer-brand .brand-name span {
  color: var(--c-brand);
}

.public footer h4 {
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-heading);
  margin-bottom: 14px;
}

.public footer .footer-col a {
  display: block;
  padding: 5px 0;
  color: var(--c-muted);
  font-size: 14px;
  transition: color 0.15s ease;
}

.public footer .footer-col a:hover {
  color: var(--c-brand);
}

.public .footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--c-border);
  font-size: 13px;
}

/* Responsive ------------------------------------------------------------ */

@media (max-width: 960px) {
  .public .hero-inner {
    grid-template-columns: 1fr;
    gap: 44px;
  }
  .public .features {
    grid-template-columns: repeat(2, 1fr);
  }
  .public .split {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .public .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

@media (max-width: 800px) {
  .public .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (max-width: 640px) {
  .public .hero {
    padding: 56px 0 40px;
  }
  .public .section {
    padding: 64px 0;
  }
  .public .features,
  .public .steps {
    grid-template-columns: 1fr;
  }
  .public .footer-grid {
    grid-template-columns: 1fr;
  }
  .public .cta-panel {
    padding: 48px 20px;
  }
  .public .hero-actions .button {
    width: 100%;
    text-align: center;
  }
}

/* Animations ------------------------------------------------------------ */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.08);
  }
}

/* ==========================================================================
   Console shell
   ========================================================================== */

.console {
  background-color: transparent;
}

.console-shell {
  height: calc(100vh - 65px);
  min-height: 480px;
}

body.embed .console-shell {
  height: 100vh;
}

/* Activity log markers (request history) */
@keyframes activity-marker-enter {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  60% {
    opacity: 1;
    transform: scale(1.18);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.activity-marker {
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  background-color: var(--activity-marker-color, #38bdf8);
  box-shadow: 0 0 0 2px var(--activity-marker-glow, rgba(56, 189, 248, 0.35));
  animation: activity-marker-enter 220ms cubic-bezier(0.26, 0.65, 0.39, 1);
}

.activity-marker-selected {
  box-shadow:
    0 0 0 2px var(--activity-marker-glow, rgba(56, 189, 248, 0.35)),
    0 0 12px var(--activity-marker-glow, rgba(56, 189, 248, 0.55));
}

.activity-marker--pending {
  --activity-marker-color: #38bdf8;
  --activity-marker-glow: rgba(56, 189, 248, 0.35);
}

.activity-marker--success {
  --activity-marker-color: #34d399;
  --activity-marker-glow: rgba(52, 211, 153, 0.35);
}

.activity-marker--error {
  --activity-marker-color: #f87171;
  --activity-marker-glow: rgba(248, 113, 113, 0.35);
}

#activity-modal::backdrop {
  background-color: rgba(15, 23, 42, 0.75);
}

/* ==========================================================================
   Dark theme (system preference) — shell
   ========================================================================== */

@media (prefers-color-scheme: dark) {

  strong {
    color: white;
  }

  .top-frame {
    color: white;
  }

}
