/* Layout: docs site. Sticky header, left sidebar with search and section links, one reading column.
   Each section pairs a screenshot with a labelled list of what is on it.
   Concept: a white sheet that frames the app's dark screenshots, with the app's own blue as the only accent.
   White is the default theme. Dark is a toggle in the header. */
:root {
  --bg: #ffffff;
  --bg2: #f5f7fb;
  --line: #e2e6ef;
  --fg: #11131b;
  --muted: #576074;
  --accent: #2f6df6;
  --accent-ink: #ffffff;
  --glow: rgba(124, 108, 255, 0.12);
  --shadow: 0 24px 60px -30px rgba(24, 30, 70, 0.5);
  --shot-bg: #0c0d11;
  --ok: #17803d;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0c10; --bg2: #12131a; --line: #23252f; --fg: #eceef5; --muted: #9ba2b4;
  --accent: #6ea8ff; --accent-ink: #07142e; --glow: rgba(124, 108, 255, 0.18);
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.85);
  --shot-bg: #0c0d11; --ok: #4ade80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg); color: var(--fg);
  font: 400 1rem/1.7 var(--font-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 40; background: var(--bg); }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
code, pre, kbd { font-family: var(--font-mono); }
code { font-size: .88em; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; }
kbd { font-size: .8rem; background: var(--bg2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: .02rem .4rem; }
img { display: block; max-width: 100%; height: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 76rem; margin: 0 auto; }
.bleed {
  margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 3.75rem; }
.brand { display: flex; align-items: center; gap: .6rem; font: 700 1.25rem var(--font-display); color: var(--fg); text-decoration: none; min-width: 0; }
.brand img { width: 2rem; height: 2rem; flex: none; }
.pill { font: 500 .72rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .55rem; }
.bar-right { display: flex; align-items: center; gap: .75rem; }
.seg { display: inline-flex; padding: .2rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg2); }
.seg button { font: 500 .85rem var(--font-body); color: var(--muted); background: transparent; border: 0; border-radius: 999px; padding: .3rem .85rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .7rem 1.3rem; border-radius: 999px; font: 600 .95rem var(--font-body); text-decoration: none; border: 1px solid var(--line); color: var(--accent); background: var(--bg); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:hover { filter: brightness(1.06); }
.bar .btn { padding: .45rem 1rem; }
.short { display: none; }

/* layout */
.shell { background: radial-gradient(60rem 24rem at 75% 0%, var(--glow), transparent 70%); }
.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 3.5rem; align-items: start; }
.side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 3.75rem); align-self: start; max-height: calc(100vh - 3.75rem - env(safe-area-inset-top, 0px)); overflow-y: auto; padding-block: 2rem; display: flex; flex-direction: column; gap: 1.2rem; min-width: 0; }
.search { position: relative; display: block; }
.search input { width: 100%; font: 400 .93rem var(--font-body); color: var(--fg); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: .6rem 2.2rem .6rem .8rem; }
.search input::placeholder { color: var(--muted); }
.search kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); }
.links { display: flex; flex-direction: column; gap: .1rem; }
.grp { font: 500 .72rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 1rem 0 .3rem .8rem; }
.grp:first-child { margin-top: 0; }
.links a { color: var(--muted); text-decoration: none; padding: .35rem .8rem; border-left: 2px solid var(--line); font-size: .93rem; }
.links a:hover { color: var(--fg); }
.links a.on { color: var(--fg); border-left-color: var(--accent); font-weight: 600; }
.col { min-width: 0; max-width: 50rem; padding-bottom: 3rem; }

/* docs content */
.doc { padding-block: 3rem; border-top: 1px solid var(--line); scroll-margin-top: 4.5rem; display: grid; gap: 1.2rem; }
.doc:first-child { border-top: 0; padding-top: 2.5rem; }
.doc h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); font-weight: 800; }
.doc h2 { font-size: clamp(1.7rem, 3.2vw, 2.2rem); font-weight: 800; }
.doc h3 { font-size: 1.2rem; font-weight: 700; margin-top: 1rem; }
.eyebrow { font: 500 .78rem var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 40rem; }
.cta { display: flex; flex-wrap: wrap; gap: .75rem; }
.fig { margin: .5rem 0; display: grid; gap: .7rem; }
.shot { background: var(--shot-bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.shot img { width: 100%; }
.fig.small .shot { width: fit-content; max-width: 100%; }
.fig.small .shot img { width: auto; }
figcaption { color: var(--muted); font-size: .9rem; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: .5rem; }
.card { display: grid; gap: .25rem; border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.2rem; text-decoration: none; color: var(--fg); background: var(--bg); }
.card:hover { border-color: var(--accent); }
.card b { font: 700 1.08rem var(--font-display); }
.card span { color: var(--muted); font-size: .93rem; }

.parts { display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr); gap: 0; margin: .3rem 0 0; border-top: 1px solid var(--line); }
.parts dt, .parts dd { padding-block: .9rem; border-bottom: 1px solid var(--line); margin: 0; }
.parts dt { font: 700 .98rem var(--font-display); padding-right: 1rem; }
.parts dd { color: var(--fg); }
.tip { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: .8rem 1rem; background: var(--bg2); }

.tablebox { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
table { border-collapse: collapse; width: 100%; min-width: 22rem; font-size: .95rem; }
th, td { text-align: left; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font: 500 .74rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
td.name { font: 700 1rem var(--font-display); white-space: nowrap; }
.tag { display: inline-block; font: 500 .72rem var(--font-mono); padding: .12rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; margin-right: .4rem; }
.tag.free { color: var(--ok); border-color: var(--ok); }
.tag.plus, .tag.pro { color: var(--accent); border-color: var(--accent); }
.after { color: var(--muted); font-size: .93rem; }
.effort { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.effort div { border-top: 2px solid var(--line); padding-top: .8rem; }
.effort div:nth-child(2) { border-top-color: var(--accent); }
.effort b { font: 700 1.05rem var(--font-display); display: block; }
.effort span { color: var(--muted); font-size: .92rem; }

details { border-bottom: 1px solid var(--line); padding-block: 1rem; }
details:first-of-type { border-top: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; }
details p { margin-top: .6rem; color: var(--muted); }
.empty { color: var(--muted); }

footer { border-top: 1px solid var(--line); padding-block: 2rem 6rem; color: var(--muted); font-size: .9rem; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }

/* floating help */
.fab { position: fixed; z-index: 50; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 3.7rem; height: 3.7rem; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); }
.fab img { width: 2.2rem; height: 2.2rem; }
.assist { position: fixed; z-index: 50; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + 4.7rem + env(safe-area-inset-bottom, 0px)); width: min(24rem, calc(100vw - 32px)); height: min(33rem, calc(100vh - 9rem)); display: flex; flex-direction: column; border: 2px solid transparent; border-radius: 22px; background: linear-gradient(var(--bg), var(--bg)) padding-box, linear-gradient(140deg, #4285f4, #34a853, #fbbc04, #ea4335) border-box; box-shadow: var(--shadow); overflow: hidden; }
.a-head { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.a-head img { width: 1.5rem; height: 1.5rem; }
.a-head b { font: 700 1rem var(--font-display); }
.a-head .sp { flex: 1; }
.mini { font: 500 .78rem var(--font-body); color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; cursor: pointer; }
.mini:hover { color: var(--fg); }
.a-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; min-height: 0; }
.msg { max-width: 92%; padding: .65rem .9rem; border-radius: 16px; font-size: .92rem; line-height: 1.55; background: var(--bg2); overflow-wrap: anywhere; }
.msg.stream { white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.sugg { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; }
.sugg button { font: 400 .88rem var(--font-body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .8rem; cursor: pointer; text-align: left; }
.sugg button:hover { border-color: var(--accent); }
.a-form { display: flex; gap: .5rem; padding: .8rem; border-top: 1px solid var(--line); }
.a-form input { flex: 1; min-width: 0; font: 400 .95rem var(--font-body); color: var(--fg); background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: .6rem 1rem; }
.a-form input::placeholder { color: var(--muted); }
.a-form button { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 1.1rem; cursor: pointer; }
.a-form button:disabled { opacity: .5; cursor: default; }

@media (max-width: 56rem) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .side { position: static; max-height: none; overflow: visible; padding-block: 1.2rem 0; gap: .8rem; }
  .links { flex-direction: row; overflow-x: auto; gap: .4rem; padding-bottom: .4rem; }
  .grp { display: none; }
  .links a { border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; padding: .3rem .85rem; }
  .links a.on { border-color: var(--accent); }
  .doc:first-child { padding-top: 1.5rem; }
}
@media (max-width: 40rem) {
  .pill { display: none; }
  .long { display: none; }
  .short { display: inline; }
  .bar-right { gap: .5rem; }
  .doc { padding-block: 2.2rem; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .parts { grid-template-columns: minmax(0, 1fr); }
  .parts dt { border-bottom: 0; padding-bottom: 0; padding-top: .9rem; }
  .parts dd { padding-top: .2rem; }
  .effort { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
