/* Refresh Pilot Docs — GitBook-style static shell + animated mockup kit.
   Theme tokens mirror the extension/dashboard so everything reads as one
   product. No build step; every doc page links this one file. */

:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f3f4f6;
  --border: #e5e7eb;
  --text: #333333;
  --muted: #6b7280;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --link: #2563eb;
  --success: #059669;
  --danger: #ef4444;
  --warning: #d97706;
  --pro: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111827; --panel: #1f2937; --panel-2: #2b3648; --border: #374151;
    --text: #f9fafb; --muted: #9ca3af; --link: #60a5fa; --success: #34d399;
    --danger: #f87171; --warning: #fbbf24; --pro: #fbbf24;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111827; --panel: #1f2937; --panel-2: #2b3648; --border: #374151;
  --text: #f9fafb; --muted: #9ca3af; --link: #60a5fa; --success: #34d399;
  --danger: #f87171; --warning: #fbbf24; --pro: #fbbf24;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ================= Layout ================= */

.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr) 200px; min-height: 100vh; }

#sidebar {
  border-right: 1px solid var(--border);
  background: var(--panel);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 14px 12px 18px;
  display: flex; flex-direction: column;
}
.sb-brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none;
  padding: 4px 8px 12px;
}
.sb-brand img { width: 26px; height: 26px; }
.sb-search {
  margin: 0 6px 10px;
  padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; font-size: 13px;
}
.sb-nav { flex: 1; }
.sb-section {
  margin: 14px 8px 4px;
  font-size: 12.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: #404041;
}
/* #404041 is near-invisible on the dark panel — lift it in dark mode. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sb-section { color: #c9c9cb; }
}
:root[data-theme="dark"] .sb-section { color: #c9c9cb; }
.sb-link {
  display: block;
  padding: 5px 10px; margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-size: 13.5px;
}
.sb-link:hover { background: var(--panel-2); }
.sb-link.active { background: rgba(59, 130, 246, 0.1); color: var(--accent); font-weight: 600; }
.sb-foot { padding: 10px 8px 0; }
.sb-theme {
  border: 1px solid var(--border); background: none; color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12px; cursor: pointer;
}
.sb-theme:hover { color: var(--text); }

main { padding: 34px 48px 60px; max-width: 800px; width: 100%; justify-self: start; }

#toc {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 40px 16px 20px 0; font-size: 12.5px;
}
.toc-title { font-weight: 700; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.toc-link { display: block; color: var(--muted); text-decoration: none; padding: 3px 0 3px 10px; border-left: 2px solid var(--border); }
.toc-link:hover { color: var(--accent); border-left-color: var(--accent); }

.topbar { display: none; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 268px minmax(0, 1fr); }
  #toc { display: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50;
    transform: translateX(-100%); transition: transform 0.18s ease-out;
  }
  body.nav-open #sidebar { transform: none; box-shadow: var(--shadow); }
  #navScrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 40; }
  body.nav-open #navScrim { display: block; }
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 30;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 10px 16px; font-weight: 600;
  }
  .topbar button { border: none; background: none; font-size: 20px; color: var(--text); cursor: pointer; }
  main { padding: 22px 18px 50px; }
}

/* ================= Prose ================= */

article.doc h1 { font-size: 30px; line-height: 1.25; letter-spacing: -0.02em; margin-bottom: 8px; }
article.doc .lead { color: var(--muted); font-size: 16.5px; margin-bottom: 26px; }
article.doc h2 { font-size: 21px; margin: 38px 0 10px; padding-top: 8px; letter-spacing: -0.01em; }
article.doc h3 { font-size: 16px; margin: 24px 0 8px; }
article.doc p { margin: 10px 0; }
article.doc ul, article.doc ol { margin: 10px 0 10px 24px; }
article.doc li { margin: 5px 0; }
article.doc a { color: var(--link); text-decoration: none; }
article.doc a:hover { text-decoration: underline; }
article.doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--panel-2);
  border-radius: 5px;
  padding: 2px 6px;
}
article.doc pre {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; margin: 12px 0;
}
article.doc pre code { background: none; padding: 0; }
article.doc kbd {
  font-family: inherit; font-size: 0.85em; font-weight: 600;
  background: var(--panel); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 7px;
}
article.doc table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13.5px; }
article.doc th, article.doc td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
article.doc th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
article.doc td.yes { color: var(--success); }
article.doc td.no { color: var(--muted); }

.badge {
  display: inline-block; vertical-align: middle;
  padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
}
.badge-pro { background: rgba(217, 119, 6, 0.14); color: var(--pro); }
.badge-free { background: rgba(5, 150, 105, 0.12); color: var(--success); }

.callout {
  display: flex; gap: 10px;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--panel); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 14px 0; font-size: 14px;
}
.callout.warn { border-left-color: var(--warning); }
.callout.tip { border-left-color: var(--success); }
.callout .ico { flex: none; }

.steps { counter-reset: step; list-style: none; margin: 14px 0 !important; }
.steps > li {
  counter-increment: step;
  position: relative; padding: 0 0 14px 40px; margin: 0 !important;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps > li:not(:last-child)::after {
  content: ""; position: absolute; left: 12.5px; top: 28px; bottom: 0;
  width: 1px; background: var(--border);
}

#prevnext {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--border);
}
.pn { text-decoration: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 16px; max-width: 46%; }
.pn:hover { border-color: var(--accent); }
.pn-label { display: block; font-size: 11.5px; color: var(--muted); }
.pn-title { display: block; font-weight: 600; color: var(--text); font-size: 14px; }
.pn-next { text-align: right; margin-left: auto; }

/* ================= Animated mockup kit =================
   Every demo sits in a .mockup stage. All motion loops forever and is
   disabled wholesale under prefers-reduced-motion (bottom of file). */

.mockup {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 26px;
  margin: 18px 0;
  display: flex; align-items: center; justify-content: center; gap: 26px;
  overflow: hidden;
  min-height: 150px;
  flex-wrap: wrap;
}
.mockup .mk-caption {
  width: 100%; text-align: center;
  font-size: 12.5px; color: var(--muted); margin-top: -6px;
}

/* ---- Mini browser window ---- */
.mk-browser {
  width: 300px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden; flex: none;
  position: relative;
}
.mk-browser .mk-chrome {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 10px; border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.mk-browser .mk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.mk-browser .mk-dot:nth-child(1) { background: #f87171; }
.mk-browser .mk-dot:nth-child(2) { background: #fbbf24; }
.mk-browser .mk-dot:nth-child(3) { background: #34d399; }
.mk-browser .mk-url {
  flex: 1; margin-left: 6px;
  background: var(--bg); border-radius: 999px;
  font-size: 9.5px; color: var(--muted);
  padding: 2px 10px; white-space: nowrap; overflow: hidden;
}
.mk-browser .mk-view { padding: 14px; min-height: 110px; position: relative; }

/* Skeleton page content that "reloads" on a loop */
.mk-line { height: 8px; border-radius: 4px; background: var(--border); margin: 8px 0; }
.mk-line.w60 { width: 60%; } .mk-line.w80 { width: 80%; } .mk-line.w40 { width: 40%; }
.mk-refresh-loop .mk-view > * { animation: mk-reload 5s infinite; }
@keyframes mk-reload {
  0%, 78% { opacity: 1; transform: none; }
  82% { opacity: 0; transform: translateY(4px); }
  88% { opacity: 0; transform: translateY(-4px); }
  94%, 100% { opacity: 1; transform: none; }
}
/* Spinner in the browser chrome that spins during the reload window */
.mk-spinner {
  width: 11px; height: 11px; flex: none;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: mk-spin-window 5s infinite;
}
@keyframes mk-spin-window {
  0%, 78% { opacity: 0; transform: rotate(0); }
  80%, 92% { opacity: 1; }
  94%, 100% { opacity: 0; }
  100% { transform: rotate(720deg); }
}

/* ---- Countdown ring (pairs with .mk-count ticking via docs.js) ---- */
.mk-ring { position: relative; width: 64px; height: 64px; flex: none; }
.mk-ring svg { transform: rotate(-90deg); }
.mk-ring circle { fill: none; stroke-width: 5; }
.mk-ring .bgc { stroke: var(--border); }
.mk-ring .fgc {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 163.4;              /* 2πr, r=26 */
  animation: mk-ring-drain 5s linear infinite;
}
@keyframes mk-ring-drain { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 163.4; } }
.mk-ring .mk-count {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px;
}

/* ---- On-page overlay bubble (corner countdown) ---- */
.mk-overlay {
  position: absolute; right: 8px; bottom: 8px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(17, 24, 39, 0.85); color: #fff;
  border-radius: 999px; padding: 4px 10px 4px 6px;
  font-size: 11px; font-weight: 600;
}
.mk-overlay .mk-ring { width: 18px; height: 18px; }
.mk-overlay .mk-ring .mk-count { font-size: 9px; color: #fff; }
.mk-overlay .mk-ring circle { stroke-width: 8; }
.mk-overlay .mk-ring .fgc { stroke: #60a5fa; }

/* ---- Toolbar icon + badge ---- */
.mk-toolbar {
  display: flex; align-items: center; gap: 8px; flex: none;
}
.mk-ticon {
  position: relative; width: 46px; height: 46px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.mk-ticon img { width: 30px; height: 30px; }
.mk-badge {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700; border-radius: 4px; padding: 0 4px;
  white-space: nowrap;
}

/* ---- Toggle that flips on a loop ---- */
.mk-toggle {
  width: 44px; height: 24px; border-radius: 12px; flex: none;
  background: var(--border); position: relative;
  animation: mk-toggle-bg 4s infinite;
}
.mk-toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  animation: mk-toggle-knob 4s infinite;
}
@keyframes mk-toggle-bg { 0%, 40% { background: var(--border); } 50%, 90% { background: var(--success); } 100% { background: var(--border); } }
@keyframes mk-toggle-knob { 0%, 40% { transform: none; } 50%, 90% { transform: translateX(20px); } 100% { transform: none; } }

/* ---- Keyword found: text highlight + toast ---- */
.mk-hl { background: transparent; border-radius: 3px; padding: 0 2px; animation: mk-hl 6s infinite; font-weight: 600; }
@keyframes mk-hl {
  0%, 45% { background: transparent; color: inherit; }
  55%, 90% { background: rgba(251, 191, 36, 0.45); }
  100% { background: transparent; }
}
.mk-appear { animation: mk-appear 6s infinite; }
@keyframes mk-appear {
  0%, 45% { opacity: 0; }
  55%, 100% { opacity: 1; }
}
.mk-toast {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 7px; align-items: center;
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--success);
  border-radius: 8px; box-shadow: var(--shadow);
  font-size: 10px; padding: 6px 10px; max-width: 85%;
  opacity: 0; transform: translateX(12px);
  animation: mk-toast 6s infinite;
}
@keyframes mk-toast {
  0%, 55% { opacity: 0; transform: translateX(12px); }
  62%, 92% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

/* ---- Keyboard keys pressed in sequence ---- */
.mk-keys { display: flex; gap: 6px; flex: none; align-items: center; }
.mk-key {
  border: 1px solid var(--border); border-bottom-width: 3px; border-radius: 7px;
  background: var(--panel); font-size: 13px; font-weight: 600;
  padding: 6px 12px;
  animation: mk-key 3s infinite;
}
.mk-key:nth-child(2) { animation-delay: 0.08s; }
.mk-key:nth-child(3) { animation-delay: 0.16s; }
@keyframes mk-key {
  0%, 35% { transform: none; border-bottom-width: 3px; }
  40%, 55% { transform: translateY(2px); border-bottom-width: 1px; background: rgba(59,130,246,0.12); }
  60%, 100% { transform: none; border-bottom-width: 3px; }
}

/* ---- Cursor that moves and clicks ---- */
.mk-cursor {
  position: absolute; width: 14px; height: 14px; z-index: 5;
  pointer-events: none;
}
.mk-cursor::before {
  content: "➤"; display: block; transform: rotate(-100deg); color: var(--text);
  font-size: 13px; text-shadow: 0 0 2px var(--bg);
}
.mk-cursor::after {
  content: ""; position: absolute; inset: -7px;
  border: 2px solid var(--accent); border-radius: 50%;
  opacity: 0; transform: scale(0.4);
}
.mk-click-demo .mk-cursor { animation: mk-cursor-path 5s infinite; }
.mk-click-demo .mk-cursor::after { animation: mk-click-pulse 5s infinite; }
@keyframes mk-cursor-path {
  0% { top: 85%; left: 80%; }
  35%, 70% { top: var(--target-y, 50%); left: var(--target-x, 50%); }
  100% { top: 85%; left: 80%; }
}
@keyframes mk-click-pulse {
  0%, 38% { opacity: 0; transform: scale(0.4); }
  44% { opacity: 1; transform: scale(1); }
  52%, 100% { opacity: 0; transform: scale(1.3); }
}
.mk-click-demo .mk-target { animation: mk-target-press 5s infinite; }
@keyframes mk-target-press {
  0%, 40% { transform: none; }
  45%, 50% { transform: scale(0.94); filter: brightness(0.92); }
  55%, 100% { transform: none; }
}

/* ---- Two devices syncing through a cloud ---- */
.mk-sync { display: flex; align-items: center; gap: 4px; flex: none; position: relative; }
.mk-device {
  width: 74px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
  padding: 8px 8px 6px; text-align: center; font-size: 9.5px; color: var(--muted);
}
.mk-device .mk-line { margin: 4px 0; }
.mk-wire { position: relative; width: 58px; height: 2px; background: var(--border); }
.mk-pulse {
  position: absolute; top: -3px; left: 0;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: mk-pulse-l2r 3s infinite;
}
.mk-pulse.rtl { animation-name: mk-pulse-r2l; animation-delay: 1.5s; background: var(--success); }
@keyframes mk-pulse-l2r { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 45% { left: calc(100% - 8px); opacity: 1; } 55%, 100% { opacity: 0; } }
@keyframes mk-pulse-r2l { 0% { left: calc(100% - 8px); opacity: 0; } 15% { opacity: 1; } 45% { left: 0; opacity: 1; } 55%, 100% { opacity: 0; } }
.mk-cloud { font-size: 22px; flex: none; }

/* ---- Mini popup with sliding tab underline ---- */
.mk-popup {
  width: 250px; flex: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden;
}
.mk-popup .mk-phead {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700;
}
.mk-popup .mk-phead img { width: 16px; height: 16px; }
.mk-ptabs { display: flex; position: relative; border-bottom: 1px solid var(--border); }
.mk-ptab { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); padding: 7px 0; }
.mk-ptabs::after {
  content: ""; position: absolute; bottom: -1px; left: 0;
  width: 25%; height: 2px; background: var(--accent);
  animation: mk-tab-slide 8s infinite;
}
@keyframes mk-tab-slide {
  0%, 22% { left: 0; } 25%, 47% { left: 25%; }
  50%, 72% { left: 50%; } 75%, 97% { left: 75%; } 100% { left: 0; }
}
.mk-pbody { padding: 12px; min-height: 70px; }
.mk-pill-btn {
  display: block; margin: 10px auto 2px; width: 85%;
  background: var(--accent); color: #fff; text-align: center;
  border-radius: 8px; font-size: 11px; font-weight: 700; padding: 6px 0;
}

/* ---- Week schedule chips + clock ---- */
.mk-week { display: flex; gap: 4px; flex: none; }
.mk-day {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; color: var(--muted);
}
.mk-day.on { animation: mk-day-on 6s infinite; }
@keyframes mk-day-on {
  0%, 20% { background: transparent; color: var(--muted); border-color: var(--border); }
  30%, 90% { background: var(--accent); color: #fff; border-color: var(--accent); }
  100% { background: transparent; }
}

/* ---- Generic labeled arrow flow ---- */
.mk-flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.mk-node {
  border: 1px solid var(--border); background: var(--panel);
  border-radius: 10px; padding: 8px 14px; font-size: 12px; font-weight: 600;
}
.mk-arrow { color: var(--muted); font-size: 16px; animation: mk-arrow-nudge 2s infinite; }
@keyframes mk-arrow-nudge { 0%, 100% { transform: none; opacity: 0.6; } 50% { transform: translateX(4px); opacity: 1; } }

/* ---- Reduced motion: freeze everything ---- */
@media (prefers-reduced-motion: reduce) {
  .mockup *, .mockup *::before, .mockup *::after { animation: none !important; }
  .mk-toast { opacity: 1; transform: none; }
  .mk-appear { opacity: 1; }
  .mk-hl { background: rgba(251, 191, 36, 0.45); }
}
