/*
 * The look of mywant-gui, without Tailwind: the same greys (Tailwind gray/slate),
 * the same system font stack, the same header cells (icon over a tiny uppercase
 * label), cards and right-hand detail sidebar. Values carry their Tailwind name
 * in a comment so the two can be kept in step.
 */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
          "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Motion and shape tokens: web/src/styles/index.css */
  --motion-fast: 180ms;
  --motion-base: 280ms;
  --ease-settle: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --r-control: 6px;
  --r-card: 8px;

  --bg: #f3f4f6;            /* gray-100 — Layout */
  --header-bg: #f1f5f9;     /* slate-100 — Header */
  --surface: #ffffff;       /* white — .card */
  --surface-2: #f9fafb;     /* gray-50 */
  --tile: #f3f4f6;          /* gray-100 — icon tile */
  --border: #e5e7eb;        /* gray-200 */
  --border-strong: #d1d5db; /* gray-300 */
  --ink: #111827;           /* gray-900 */
  --ink-2: #4b5563;         /* gray-600 */
  --ink-3: #6b7280;         /* gray-500 */
  --hover: #e5e7eb;         /* gray-200 on slate-100 */
  --code-bg: #1f2937;       /* gray-800 */
  --code-ink: #f3f4f6;
  --inline-code-bg: #e5e7eb;
  --ring: #9ca3af;          /* gray-400 */
  --note-bg: #f9fafb;
  --scrim: rgba(17, 24, 39, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #030712;            /* gray-950 */
    --header-bg: #111827;     /* gray-900 */
    --surface: #1f2937;       /* gray-800 */
    --surface-2: #111827;
    --tile: #374151;          /* gray-700 */
    --border: #374151;        /* gray-700 */
    --border-strong: #4b5563;
    --ink: #f3f4f6;           /* gray-100 */
    --ink-2: #d1d5db;         /* gray-300 */
    --ink-3: #9ca3af;         /* gray-400 */
    --hover: #1f2937;         /* gray-800 */
    --code-bg: #030712;
    --code-ink: #e5e7eb;
    --inline-code-bg: #374151;
    --ring: #6b7280;
    --note-bg: #111827;
    --scrim: rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --bg: #030712;
  --header-bg: #111827;
  --surface: #1f2937;
  --surface-2: #111827;
  --tile: #374151;
  --border: #374151;
  --border-strong: #4b5563;
  --ink: #f3f4f6;
  --ink-2: #d1d5db;
  --ink-3: #9ca3af;
  --hover: #1f2937;
  --code-bg: #030712;
  --code-ink: #e5e7eb;
  --inline-code-bg: #374151;
  --ring: #6b7280;
  --note-bg: #111827;
  --scrim: rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html { font-family: var(--font); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.6;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
svg.lucide { width: 1em; height: 1em; flex-shrink: 0; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: 64px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
}
@media (min-width: 640px) { .header { height: 80px; padding: 0 24px; } }

.header-left, .header-right { display: flex; align-items: stretch; min-width: 0; }
.header-left { gap: 8px; }

/* A header cell: the icon over a 9px uppercase label (Header.tsx). */
.cell, .tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 56px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms, color 150ms;
}
.cell svg.lucide { font-size: 24px; }
@media (min-width: 640px) {
  .cell { min-width: 64px; padding: 0 12px; }
  .cell svg.lucide { font-size: 32px; }
}
.cell:hover, .cell[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.cell:focus-visible, .tab:focus-visible, .card:focus-visible, .sb-close:focus-visible, .menu-item:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}
.cell-label {
  display: none;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.05em;
}
@media (min-width: 640px) { .cell-label { display: block; } }

.title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  align-self: center;
  text-decoration: none;
  min-width: 0;
}
.title h1 { margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; }
.title .count { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
@media (min-width: 640px) { .title h1 { font-size: 20px; } .title .count { font-size: 14px; } }
@media (max-width: 520px) { .title .count { display: none; } }

/* ── Menu: the hamburger's panel of section cards ─────────────────────────── */
.menu-wrap { position: relative; display: flex; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, calc(100vw - 24px));
  padding: 8px;
  background: var(--header-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  animation: slideIn 220ms var(--ease-settle);
}
.menu-heading {
  margin: 4px 4px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color var(--motion-fast);
}
.menu-item svg.lucide { font-size: 24px; }
.menu-item:hover { border-color: var(--border-strong); color: var(--ink); }

/* ── Main: sections of card grids ─────────────────────────────────────────── */
.main {
  padding: calc(64px + env(safe-area-inset-top) + 16px) 16px 48px;
  max-width: 1200px;
  margin: 0 auto;
  transition: padding-right var(--motion-base) var(--ease-settle);
}
@media (min-width: 640px) { .main { padding-top: calc(80px + 24px); padding-left: 24px; padding-right: 24px; } }
@media (min-width: 1024px) { body.sb-open .main { padding-right: calc(460px + 24px); max-width: none; } }

.hero { margin: 8px 0 28px; }
.hero-lead { margin: 0 0 6px; font-size: 20px; font-weight: 700; line-height: 1.5; text-wrap: pretty; }
.hero-sub { margin: 0; font-size: 14px; color: var(--ink-3); text-wrap: pretty; }
@media (min-width: 640px) { .hero-lead { font-size: 24px; } }

.section { margin-bottom: 32px; scroll-margin-top: 100px; }
.section-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px 2px;
}
.section-heading h2 {
  margin: 0;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.section-heading p { margin: 0; font-size: 13px; color: var(--ink-3); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

/* A card: the agent/want-type card shape — an icon tile, then the name. */
.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  text-align: left;
  cursor: pointer;
  animation: cardEnter 280ms var(--ease-pop) both;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.card::after {
  /* The hover ring (.mw-hover-ring): lit inward from the edge, never reflows. */
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  box-shadow: inset 0 0 4px var(--accent-ring), inset 0 0 14px var(--accent-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-fast) ease-out, inset var(--motion-fast) var(--ease-settle);
}
@media (hover: hover) { .card:hover::after { opacity: 1; inset: 0; } }
.card[aria-current="true"] { border-color: var(--ring); }
.card[aria-current="true"]::after { opacity: 1; inset: 0; }

.tile {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--r-card);
  background: var(--tile);
  color: var(--accent);
}
.tile svg.lucide { font-size: 28px; }
.card-text { min-width: 0; }
.card-step {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.card-title { display: block; font-size: 17px; font-weight: 700; line-height: 1.35; }
.card-sub { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* ── Right sidebar (RightSidebar.tsx) ─────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: var(--scrim);
  animation: fadeIn 180ms ease-out;
}
@media (min-width: 1024px) { .scrim { display: none; } }

.sidebar {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,.08);
  /* Desktop: a column under the header, on the right. */
  top: calc(80px + env(safe-area-inset-top));
  right: 0;
  bottom: 0;
  width: 460px;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--motion-base) var(--ease-settle), visibility 0s linear var(--motion-base);
}
.sidebar.open {
  transform: none;
  visibility: visible;
  transition: transform var(--motion-base) var(--ease-settle), visibility 0s;
}
.sb-grip { display: none; }

/* Phone and tablet: a bottom sheet. */
@media (max-width: 1023px) {
  .sidebar {
    top: auto;
    left: 0;
    width: auto;
    height: 86vh;
    height: 86dvh;
    border-left: 0;
    border-top: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sb-grip { display: flex; justify-content: center; padding: 10px 0 4px; cursor: pointer; }
  .sb-grip span { width: 48px; height: 6px; border-radius: 9999px; background: var(--border-strong); }
}
@media (min-width: 640px) and (max-width: 1023px) { .sidebar { left: auto; width: min(560px, 100vw); right: 0; } }

.sb-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--border);
}
.sb-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}
.sb-head h2 svg.lucide { font-size: 18px; color: var(--accent); }
#sb-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-close {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--ink-3);
  cursor: pointer;
}
.sb-close svg.lucide { font-size: 20px; }
.sb-close:hover { background: var(--hover); color: var(--ink); }

.sb-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 20px 32px;
}
.sb-body.swap { animation: pageEnterRight 220ms var(--ease-settle); }
.sb-body.swap-back { animation: pageEnterLeft 220ms var(--ease-settle); }

.sb-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.sb-hero .tile { width: 60px; height: 60px; }
.sb-hero .tile svg.lucide { font-size: 32px; }
.sb-hero h3 { margin: 0; font-size: 22px; line-height: 1.3; }
.sb-hero p { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }

/* Readable body copy inside the sidebar. */
.doc { font-size: 15px; color: var(--ink-2); }
.doc > * + * { margin-top: 12px; }
.doc p, .doc ul, .doc ol { margin-bottom: 0; }
.doc h4 {
  margin: 24px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.doc strong { color: var(--ink); }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li + li { margin-top: 4px; }
.doc a { color: var(--ink); text-underline-offset: 3px; }
.doc code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--inline-code-bg);
  color: var(--ink);
}

/* A panel inside the sidebar: the "Basic Information" box. */
.box {
  padding: 12px 14px;
  background: var(--note-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}
.box-title {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 4px;
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.box-title svg.lucide { font-size: 15px; color: var(--ink-3); }
.box p { margin: 0; font-size: 14px; }

/* A pair of words and what they mean — the "Name: / Type:" rows. */
.terms { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.terms dt { font-weight: 600; color: var(--ink); }
.terms dd { margin: 0; }

.steps { list-style: none; padding: 0 !important; counter-reset: step; }
.steps > li {
  position: relative;
  padding-left: 34px;
  counter-increment: step;
}
.steps > li + li { margin-top: 14px; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 9999px;
  background: var(--tile);
  color: var(--ink);
  font-size: 12px; font-weight: 700;
}
.steps > li > .code { margin-top: 8px; }

.code {
  position: relative;
  border-radius: var(--r-card);
  background: var(--code-bg);
  color: var(--code-ink);
}
.code pre {
  margin: 0;
  color-scheme: dark;
  padding: 12px 44px 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  /* Wrapped, not scrolled: a beginner should see the whole command at once. */
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.code .c { color: #9ca3af; }
.copy {
  position: absolute; top: 6px; right: 6px;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 0; border-radius: var(--r-control);
  background: transparent; color: #9ca3af;
  cursor: pointer;
}
.copy svg.lucide { font-size: 15px; }
.copy:hover { background: rgba(255,255,255,.08); color: #f3f4f6; }
.copy.done { color: #34d399; }

/* The tab bar along the sidebar's foot (Overview / Capabilities / …). */
.sb-tabs {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: 52px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.tab { min-width: 0; color: var(--ink-3); }
.tab svg.lucide { font-size: 18px; }
.tab .cell-label { display: block; }
.tab:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.tab:disabled { opacity: .35; cursor: default; }

/* ── Keyframes (tailwind.config.js) ───────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes cardEnter { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pageEnterRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes pageEnterLeft { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }

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

/* ── Screenshots ──────────────────────────────────────────────────────────── */
/* shot() in site.js writes these into a topic; each opens full size. */
.hero-shot { display: block; margin-top: 20px; }
.hero-shot img, .shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  background: var(--surface-2);
}
.hero-shot img { max-height: 420px; object-fit: cover; object-position: top left; }
.doc .shot { margin: 16px 0 0; }
.doc .shot a { display: block; }
.shot figcaption { margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.shot-phone img { width: auto; max-width: 100%; max-height: 520px; margin: 0 auto; }
.shot-phone figcaption { text-align: center; }

/* ── Links to the other guides ────────────────────────────────────────────── */
.card-link { text-decoration: none; color: inherit; }
.card-go { margin-left: auto; align-self: flex-start; font-size: 16px; color: var(--ink-3); }
.menu-item { text-decoration: none; text-align: center; }
.menu-item-here { border-color: var(--ring); color: var(--ink); cursor: default; }
