/* Ailoha site — custom layer on Tailwind CDN */

:root {
  --bg: #0A0F1F;
  --bg-2: #0F172A;
  --surface: #111A2E;
  --surface-2: #152138;
  --border: #1E2B45;
  --border-strong: #2A3A5A;
  --fg: #F8FAFC;
  --fg-muted: #94A3B8;
  --fg-dim: #64748B;
  --accent: #22D3A5;
  --accent-2: #7DD3FC;
  --accent-warm: #FBBF24;
  --danger: #EF4444;
}

html { scroll-behavior: smooth; }

/* Mobile safety net: never let any oversized inner content (long terminal
   lines, copy-paste install commands, etc.) make the entire page scroll
   horizontally. Inner scroll containers still scroll within themselves. */
html, body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

code, pre, .mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Background — subtle grid + radial accent glow */
.bg-grid {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(34, 211, 165, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(125, 211, 252, 0.10), transparent 60%),
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
  background-position: 0 0, 0 0, -1px -1px, -1px -1px;
}

.text-gradient {
  background: linear-gradient(120deg, #22D3A5 0%, #7DD3FC 60%, #A78BFA 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  border-radius: 0.6rem;
  font-weight: 500;
  font-size: 0.95rem;
  transition: transform 180ms ease-out, background 180ms ease-out, border-color 180ms ease-out, box-shadow 180ms ease-out;
  cursor: pointer;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--accent);
  color: #042B20;
  box-shadow: 0 0 0 1px rgba(34,211,165,0.4), 0 8px 24px -8px rgba(34,211,165,0.55);
}
.btn-primary:hover { background: #2EE0B0; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.03); }

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: 0.5rem;
  color: #cbd5e1;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: color 160ms ease-out, background 160ms ease-out;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-link::after {
  content: '';
  position: absolute;
  left: 50%; right: 50%;
  bottom: 0.25rem;
  height: 1.5px;
  background: linear-gradient(90deg, var(--accent), #7DD3FC);
  border-radius: 2px;
  opacity: 0;
  transition: left 200ms ease-out, right 200ms ease-out, opacity 200ms ease-out;
}
.nav-link:hover::after { left: 0.85rem; right: 0.85rem; opacity: 1; }
.nav-link-active { color: #fff; background: rgba(34,211,165,0.08); }
.nav-link-active::after { left: 0.85rem; right: 0.85rem; opacity: 1; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0));
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms ease, transform 200ms ease;
}
.card:hover { border-color: var(--border-strong); }
.card .icon-wrap {
  width: 40px; height: 40px;
  border-radius: 0.6rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(34, 211, 165, 0.10);
  color: var(--accent);
  border: 1px solid rgba(34, 211, 165, 0.25);
  margin-bottom: 1rem;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(34, 211, 165, 0.06);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 999px; background: var(--accent);
  box-shadow: 0 0 0 4px rgba(34,211,165,0.18);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 4px rgba(34,211,165,0.18); }
  50%      { opacity: 0.6; box-shadow: 0 0 0 6px rgba(34,211,165,0.05); }
}

/* Terminal panel */
.terminal {
  background: linear-gradient(180deg, #0B1426 0%, #0A1020 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.02) inset;
  overflow: hidden;
}
.terminal-bar {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 0.9rem;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--fg-dim);
}
.terminal-bar .dot { width: 11px; height: 11px; border-radius: 999px; }
.terminal-body {
  padding: 1rem 1.1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  line-height: 1.7;
  color: #CBD5E1;
  min-height: 620px;
  overflow-x: auto;
}
@media (min-width: 1024px) {
  .terminal-body { padding-right: 220px; }
}
.term-prompt { color: var(--accent); }
.term-cmd { color: #F8FAFC; }
.term-comment { color: var(--fg-dim); }
.term-key { color: var(--accent-2); }
.term-str { color: #FCD34D; }
.term-ok { color: var(--accent); }
.term-warn { color: #FBBF24; }
.cursor {
  display: inline-block; width: 8px; height: 1.05em;
  background: var(--accent); vertical-align: -2px;
  margin-left: 2px;
  animation: blink 1.05s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Phone frame */
.phone {
  width: 220px;
  border-radius: 32px;
  background: #0B1426;
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.8);
  padding: 12px;
  position: relative;
}
.phone::before {
  content: '';
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 70px; height: 18px; border-radius: 999px; background: #050810;
}

/* Device runtime chip — sits above the phone, screams "native runtime" */
.device-chip {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(15,23,42,0.95), rgba(11,20,38,0.95));
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 18px -6px rgba(0,0,0,0.6);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  color: var(--fg-muted);
  white-space: nowrap;
  z-index: 2;
}
.device-chip-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,211,165,0.18);
  animation: pulse 2.2s ease-in-out infinite;
}
.device-chip-bundle { color: #E2E8F0; }
.device-chip-sep { color: var(--fg-dim); }
.device-chip-build {
  color: #FBBF24;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6rem;
}

/* "No browser" caption under the phone */
.phone-caption {
  margin: 12px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px dashed rgba(34,211,165,0.35);
  background: rgba(34,211,165,0.04);
  color: #A7F3D0;
  font-size: 0.64rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.01em;
  max-width: 240px;
  white-space: nowrap;
}
.phone-caption svg { color: rgba(34,211,165,0.7); flex: none; }
.phone-screen {
  background: linear-gradient(180deg, #0F172A, #0B1224);
  border-radius: 22px;
  padding: 38px 14px 14px;
  height: 360px;
  overflow: hidden;
  position: relative;
}
.phone-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 8px;
  color: #CBD5E1;
  position: relative;
}
.phone-row.highlight {
  border-color: var(--accent);
  background: rgba(34,211,165,0.10);
  box-shadow: 0 0 0 4px rgba(34,211,165,0.10);
  transition: all 200ms ease;
}

/* Tap ring overlay */
.tap-ring {
  position: absolute;
  width: 40px; height: 40px; border-radius: 999px;
  border: 2px solid var(--accent);
  pointer-events: none;
  opacity: 0;
}
.tap-ring.fire { animation: tap 700ms ease-out forwards; }
@keyframes tap {
  0%   { opacity: 1; transform: scale(0.4); }
  60%  { opacity: 0.6; }
  100% { opacity: 0; transform: scale(1.6); }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* Section headings */
.h-section {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.1;
}

/* Badge / pill */
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  background: rgba(255,255,255,0.02);
}

/* Loop diagram */
.loop-node {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cursor, .eyebrow .dot, .tap-ring.fire { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--accent); color: #04241A; padding: 0.5rem 0.8rem; border-radius: 6px;
  z-index: 100;
}
.skip-link:focus { left: 8px; }

/* ========== Docs pages ========== */

.doc-prose {
  color: #CBD5E1;
  line-height: 1.7;
}
.doc-prose > h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #F8FAFC;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.doc-prose > h2:first-child { margin-top: 0; }
.doc-prose > h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #F1F5F9;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}
.doc-prose p { margin: 0.75rem 0; }
.doc-prose a { color: var(--accent-2); }
.doc-prose a:hover { color: #BAE6FD; text-decoration: underline; }
.doc-prose ul, .doc-prose ol { margin: 0.75rem 0; padding-left: 1.4rem; }
.doc-prose ul { list-style: disc; }
.doc-prose ol { list-style: decimal; }
.doc-prose li { margin: 0.35rem 0; }
.doc-prose li::marker { color: var(--fg-dim); }
.doc-prose code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: rgba(125, 211, 252, 0.08);
  color: #BAE6FD;
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
  border: 1px solid rgba(125, 211, 252, 0.15);
}
.doc-prose pre {
  background: linear-gradient(180deg, #0B1426 0%, #0A1020 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.84rem;
  line-height: 1.65;
}
.doc-prose pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: #CBD5E1;
  font-size: inherit;
}
.doc-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.92rem;
}
.doc-prose th, .doc-prose td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.doc-prose th {
  color: #F1F5F9;
  font-weight: 600;
  background: rgba(255,255,255,0.02);
}
.doc-prose td code { white-space: nowrap; }

.callout {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  margin: 1rem 0;
  font-size: 0.92rem;
  color: #CBD5E1;
}
.callout .callout-icon {
  flex: 0 0 auto;
  width: 22px; height: 22px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
}
.callout-tip   { border-color: rgba(34,211,165,0.25); background: rgba(34,211,165,0.05); }
.callout-tip   .callout-icon { background: rgba(34,211,165,0.15); color: var(--accent); }
.callout-warn  { border-color: rgba(251,191,36,0.25); background: rgba(251,191,36,0.05); }
.callout-warn  .callout-icon { background: rgba(251,191,36,0.15); color: var(--accent-warm); }
.callout-info  { border-color: rgba(125,211,252,0.25); background: rgba(125,211,252,0.05); }
.callout-info  .callout-icon { background: rgba(125,211,252,0.15); color: var(--accent-2); }

/* Slim AI-assist hint shown at the top of each manual setup page */
.ai-hint {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.5rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(167,139,250,0.28);
  background: linear-gradient(135deg, rgba(167,139,250,0.08), rgba(125,211,252,0.06));
  border-radius: 10px;
  color: #e2d9ff;
  font-size: 0.875rem;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.ai-hint:hover {
  border-color: rgba(167,139,250,0.55);
  background: linear-gradient(135deg, rgba(167,139,250,0.14), rgba(125,211,252,0.10));
  text-decoration: none;
}
.ai-hint-spark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(167,139,250,0.18);
  color: #c4b5fd;
  flex-shrink: 0;
}
.ai-hint-arrow {
  margin-left: auto;
  color: #c4b5fd;
  transition: transform .15s ease;
}
.ai-hint:hover .ai-hint-arrow { transform: translateX(2px); }

.doc-toc {
  position: sticky;
  top: 5rem;
  font-size: 0.88rem;
}
.doc-toc .toc-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 0.75rem;
}
.doc-toc a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: 0.4rem;
  color: var(--fg-muted);
  border-left: 2px solid transparent;
}
.doc-toc a:hover { color: #F1F5F9; background: rgba(255,255,255,0.02); }

.crumbs {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--fg-dim);
}
.crumbs a { color: var(--fg-muted); }
.crumbs a:hover { color: #F1F5F9; }
.crumbs .sep { opacity: 0.5; }

.platform-badge {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px;
}
.platform-badge img { width: 100%; height: 100%; object-fit: contain; }

/* ------------------------------------------------------------------ */
/* Command boxes (install steps + modal panes)                         */
/* ------------------------------------------------------------------ */
.cmd-box {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: rgb(15 23 42);
  border: 1px solid rgb(30 43 69);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
}
.cmd-box .cmd-prompt {
  color: var(--accent);
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}
.cmd-box .cmd-text {
  flex: 1;
  min-width: 0;
  color: #F1F5F9;
  /* Wrap long install commands gracefully instead of horizontal-scrolling. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}
.cmd-box .cmd-copy {
  margin-left: auto;
  flex-shrink: 0;
  align-self: flex-start;
  color: var(--fg-muted);
  font-size: 11px;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  border: 1px solid rgb(30 43 69);
  background: transparent;
  transition: color .15s ease;
}
.cmd-box .cmd-copy:hover { color: var(--accent); }

/* ------------------------------------------------------------------ */
/* OS-conditional command blocks                                       */
/* ------------------------------------------------------------------ */
/* Hide both variants by default; JS reveals the one matching the OS. */
.os-only-unix, .os-only-win { display: none; }
html.os-mac   .os-only-unix,
html.os-linux .os-only-unix { display: flex; }
html.os-win   .os-only-win  { display: flex; }
/* Inline text variants (inside the link) use inline display. */
.os-only-unix.inline, .os-only-win.inline { display: none; }
html.os-mac   span.os-only-unix,
html.os-linux span.os-only-unix,
html.os-win   span.os-only-win { display: inline; }

/* ------------------------------------------------------------------ */
/* Modal                                                               */
/* ------------------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.78);
  animation: modal-fade .15s ease-out;
}
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: #182238;
  border: 1px solid var(--border-strong);
  border-radius: 0.75rem;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.02) inset;
  animation: modal-pop .18s cubic-bezier(.2,.8,.2,1);
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop  {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}
.modal-close {
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--fg); background: rgba(255,255,255,0.04); }
.modal-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.modal-tabs button {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.625rem 0.5rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.modal-tabs button:hover { color: var(--fg); }
.modal-tabs button[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.modal-panes { padding: 1rem 1.25rem 0.25rem; }
.modal-pane[hidden] { display: none; }
.modal-pane-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  margin-bottom: 0.375rem;
  font-weight: 500;
}
.modal-pane-label.mt-3 { margin-top: 0.875rem; }
.modal-foot {
  padding: 0.875rem 1.25rem 1.125rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* Disable page scroll when modal is open */
html.modal-open, html.modal-open body { overflow: hidden; }
