:root {
  --bg: #fff; --fg: #1d1d1f; --muted: #5f6368; --line: #e3e3e6; --tint: #f5f5f7;
  --accent: #1f5fd6; --accent-fg: #fff; --code-bg: #f1f1f4;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1c1e; --fg: #f2f2f4; --muted: #a1a1a8; --line: #38383b; --tint: #252528;
    --accent: #7aa7ff; --accent-fg: #0b1b3a; --code-bg: #2a2a2d;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1c1e; --fg: #f2f2f4; --muted: #a1a1a8; --line: #38383b; --tint: #252528;
  --accent: #7aa7ff; --accent-fg: #0b1b3a; --code-bg: #2a2a2d;
}
* { box-sizing: border-box; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.6 var(--font); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: 16px; top: -48px; background: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { top: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }

header.site { border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 20px; padding-top: 14px; padding-bottom: 14px; }
.brand { color: var(--fg); font-weight: 650; text-decoration: none; font-size: 18px; }
nav a { color: var(--muted); text-decoration: none; margin-right: 18px; font-size: 15px; }
nav a:last-child { margin-right: 0; }
nav a:hover { color: var(--fg); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-fg); text-decoration: none; font-weight: 600; padding: 10px 20px; border-radius: 9px; }
.btn:hover { filter: brightness(1.08); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }

code { font: 0.9em var(--mono); background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.latest { list-style: none; padding: 0; margin: 0 0 12px; }
.latest li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.latest a { font-weight: 600; display: block; }
.latest span { color: var(--muted); font-size: 15px; }
.news { color: var(--muted); }

/* ---------- Home ---------- */
html { scroll-behavior: smooth; accent-color: var(--accent); scrollbar-color: var(--line) transparent; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.wrap.wide { max-width: 1080px; }

.hero { padding: 80px 0 0; }
.hero h1 { font-size: clamp(36px, 6.6vw, 68px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 700; margin: 0 0 22px; max-width: 14em; text-wrap: balance; }
.hero h1 span { display: block; }
.hero .sub { font-size: clamp(18px, 2.3vw, 21px); line-height: 1.5; color: var(--muted); max-width: 33em; margin: 0 0 30px; text-wrap: pretty; }
.link { font-weight: 500; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 48px 0 14px; }
.tabs button { font: inherit; font-size: 15px; line-height: 1.4; background: none; color: var(--muted); border: 1px solid transparent; border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { background: var(--tint); border-color: var(--line); color: var(--fg); font-weight: 600; }
.reveal { margin: 0; }
.stage { position: relative; aspect-ratio: 1400 / 900; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--tint); box-shadow: 0 12px 40px rgba(0, 0, 0, .10); user-select: none; -webkit-user-select: none; }
.layer { position: absolute; inset: 0; display: block; }
.layer img { width: 100%; height: 100%; object-fit: cover; display: block; }
.layer.plain { clip-path: inset(0 calc(100% - var(--p, 50%)) 0 0); }
.handle { position: absolute; top: 0; bottom: 0; left: var(--p, 50%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .28); pointer-events: none; }
.grip { position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: #fff; color: #1d1d1f; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, .30), 0 0 0 1px rgba(0, 0, 0, .12); }
.stage:focus-within .grip { outline: 2px solid var(--accent); outline-offset: 3px; }
.stage input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; }
.tag { position: absolute; bottom: 14px; padding: 4px 11px; font-size: 13px; font-weight: 600; line-height: 1.4; border-radius: 999px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); pointer-events: none; }
.tag-before { left: 14px; }
.tag-after { right: 14px; }
.reveal figcaption { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.facts { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px 28px; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }

.theme { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.theme button { font: inherit; font-size: 14px; line-height: 1.4; background: none; color: var(--muted); border: 0; padding: 4px 12px; cursor: pointer; }
.theme button + button { border-left: 1px solid var(--line); }
.theme button:hover { color: var(--fg); }
.theme button[aria-pressed="true"] { background: var(--tint); color: var(--fg); font-weight: 600; }
.theme button:focus-visible { outline-offset: -2px; }

.rows { padding-top: 104px; }
.row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 64px; align-items: center; padding: 64px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row.flip .copy { order: 2; }
.row h2 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 14px; text-wrap: balance; }
.row p { color: var(--muted); max-width: 30em; margin: 0 0 14px; }
.row p:last-child { margin-bottom: 0; }
.demo { position: relative; background: var(--tint); border-radius: 14px; padding: 28px 28px 34px; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 260px; }
.demo small { position: absolute; right: 16px; bottom: 10px; font-size: 12px; color: var(--muted); }
.field { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 16px; }
.field svg { color: var(--muted); flex: none; }
.hits { list-style: none; margin: 0; padding: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.hits li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; padding: 11px 14px; font-size: 14px; }
.hits li + li { border-top: 1px solid var(--line); }
.hits b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hits time { color: var(--muted); white-space: nowrap; }
.hits span { grid-column: 1 / -1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
mark { background: color-mix(in srgb, var(--accent) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.toast { display: inline-flex; align-items: center; gap: 18px; align-self: flex-start; margin: 0; background: #1d1d1f; color: #fff; border-radius: 999px; padding: 10px 20px; font-size: 15px; font-weight: 600; border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 4px 14px rgba(0, 0, 0, .22); }
.toast .undo { color: #9dbfff; }
.found { list-style: none; margin: 0; padding: 0; }
.found li { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; font-size: 15px; }
.found li + li { border-top: 1px solid var(--line); }
.found span { color: var(--muted); }
.found code { background: none; padding: 0; font-size: 14px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.tree > li { display: grid; grid-template-columns: 18px 1fr; gap: 4px 10px; align-items: start; font-weight: 600; }
.tree > li + li { margin-top: 14px; }
.tree svg { margin-top: 3px; color: var(--muted); }
.tree ul { grid-column: 2; font-weight: 400; color: var(--muted); }
.tree ul li { padding: 2px 0; }
.demo pre { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; font: 14px/1.6 var(--mono); overflow-x: auto; }
.demo pre code { background: none; padding: 0; font: inherit; }
.alsoh { margin: 0; padding-top: 36px; border-top: 1px solid var(--line); font-size: 20px; letter-spacing: -0.01em; }
.also { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 40px; max-width: 44em; }
.also li { display: flex; align-items: center; gap: 12px; }
.also svg { flex: none; color: var(--muted); }

.private { background: var(--tint); margin-top: 104px; padding: 72px 0; }
.private h2 { font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -0.02em; margin: 0 0 28px; text-wrap: balance; }
.private ul { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px 40px; }
.private li { color: var(--muted); }
.private strong { display: block; color: var(--fg); margin-bottom: 2px; }
.private p { margin: 0; }
.dlbox { padding: 88px 16px 112px; }
.dlbox h2 { font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -0.02em; margin: 0 0 14px; text-wrap: balance; }
.dlbox p { max-width: 34em; color: var(--muted); margin: 0; }

@media (max-width: 760px) {
  .hero { padding-top: 48px; }
  .tabs { margin-top: 36px; }
  .also { grid-template-columns: minmax(0, 1fr); }
  .stage { border-radius: 10px; }
  .rows { padding-top: 64px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 44px 0; }
  .row.flip .copy { order: 0; }
  .demo { padding: 20px 18px 30px; min-height: 0; }
  .private { margin-top: 64px; padding: 52px 0; }
  .dlbox { padding: 64px 16px 80px; }
}

.prose { max-width: 700px; margin: 0 auto; padding: 40px 16px 72px; }
.prose h1 { font-size: clamp(28px, 5vw, 38px); margin: 8px 0 12px; }
.prose h2 { font-size: 24px; margin: 2em 0 0.5em; }
.prose h3 { font-size: 19px; margin: 1.6em 0 0.4em; }
.prose .lede { font-size: 19px; color: var(--muted); margin-bottom: 1.6em; }
.prose p, .prose li { overflow-wrap: break-word; }
.prose li { margin: 0.3em 0; }
.prose ul ul, .prose ol ul, .prose ul ol { margin: 0.2em 0; }
.prose pre { background: var(--code-bg); padding: 14px 16px; border-radius: 10px; overflow-x: auto; font: 14px/1.5 var(--mono); }
.prose pre code { background: none; padding: 0; font: inherit; }
.prose blockquote { margin: 1.2em 0; padding: 0 0 0 16px; border-left: 3px solid var(--line); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.table { overflow-x: auto; margin: 1.2em 0; }
table { border-collapse: collapse; font-size: 15px; min-width: 100%; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; white-space: nowrap; }
.back, .after { font-size: 15px; margin: 0; }
.after { margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--line); }
.cta { margin: 2.4em 0 0; }
.posts { list-style: none; padding: 0; margin: 1.5em 0 2em; }
.posts li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.posts h2 { font-size: 20px; margin: 0 0 4px; }
.posts p { margin: 0; color: var(--muted); }

footer.site { border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
footer.site .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 24px; padding-bottom: 32px; }
footer.site p { margin: 0; }
@media (prefers-reduced-motion: no-preference) { .btn { transition: filter .15s ease-out; } }
@media (max-width: 480px) { body { font-size: 16px; } nav a { margin-right: 14px; } }
