:root {
  color-scheme: light dark;
  --bg: #f6f6f8;
  --paper: rgba(255, 255, 255, .84);
  --ink: #161617;
  --muted: #707075;
  --line: rgba(22, 22, 23, .12);
  --blue: #ff4f7a;
  --mint: #00a887;
  --rose: #ff4f7b;
  --gold: #bf7a00;
  --code: #0b0d12;
  --shadow: 0 28px 90px rgba(0, 0, 0, .11);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #050506;
    --paper: rgba(28, 28, 30, .78);
    --ink: #f5f5f7;
    --muted: #a1a1a6;
    --line: rgba(255, 255, 255, .16);
    --code: #05070b;
    --shadow: 0 28px 90px rgba(0, 0, 0, .48);
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(112deg, transparent 0 34%, rgba(22,22,23,.04) 34% 34.35%, transparent 34.35%),
    linear-gradient(180deg, #fff 0, var(--bg) 36rem, #ededf0 100%);
  font: 16px/1.68 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  body {
    background:
      linear-gradient(112deg, transparent 0 34%, rgba(255,255,255,.05) 34% 34.35%, transparent 34.35%),
      linear-gradient(180deg, #17171b 0, #050506 36rem, #000 100%);
  }
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.doc-figure {
  margin: 1.7rem 0 2.1rem;
}
.doc-figure img {
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  border-radius: 8px;
  box-shadow: 0 18px 64px rgba(0, 0, 0, .08);
  display: block;
  width: min(100%, 900px);
}
.doc-svg svg {
  display: block;
  height: auto;
  max-width: 100%;
}

.site-topbar {
  align-items: center;
  backdrop-filter: saturate(180%) blur(24px);
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  min-height: 64px;
  padding: 0 max(1rem, calc((100vw - 1320px) / 2 + 1.5rem));
  position: sticky;
  top: 0;
  z-index: 5;
}
@media (prefers-color-scheme: dark) { .site-topbar { background: rgba(18,18,20,.72); } }
.brand { align-items: center; color: var(--ink); display: inline-flex; font-weight: 760; gap: .56rem; margin-right: auto; }
.brand img { height: 28px; width: 28px; }
.site-topbar nav { align-items: center; display: flex; gap: .25rem; }
.site-topbar nav a {
  border-radius: 999px;
  color: var(--ink);
  font-size: .9rem;
  padding: .44rem .72rem;
}
.site-topbar nav a:hover { background: rgba(120,120,128,.13); text-decoration: none; }

.site-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1320px;
}
.sidebar {
  align-self: start;
  border-right: 1px solid var(--line);
  max-height: calc(100vh - 64px);
  min-height: calc(100vh - 64px);
  overflow: auto;
  padding: 1.1rem 1rem 2rem 1.45rem;
  position: sticky;
  top: 64px;
}
.nav-title { cursor: default; font-weight: 760; margin-bottom: 1rem; }
.sidebar h3 {
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .08em;
  margin: 1.2rem 0 .48rem;
  text-transform: uppercase;
}
.sidebar a {
  border-radius: 8px;
  color: var(--ink);
  display: block;
  font-size: .92rem;
  padding: .36rem .55rem;
}
.sidebar a:hover, .sidebar a.active {
  background: rgba(0,113,227,.12);
  color: var(--blue);
  text-decoration: none;
}

.content {
  min-width: 0;
  padding: 2.6rem clamp(1.2rem, 4.2vw, 4.1rem) 4.8rem;
}
.doc { max-width: 1040px; }
.home, .playground { max-width: 1120px; }
.eyebrow {
  color: var(--mint);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  margin: 0 0 .8rem;
  text-transform: uppercase;
}
.lede { color: var(--muted); font-size: clamp(1.08rem, 2vw, 1.34rem); line-height: 1.52; max-width: 46rem; }
h1 { font-size: clamp(2.65rem, 8vw, 6.3rem); font-weight: 790; letter-spacing: 0; line-height: .96; margin: 0 0 .85rem; }
h2 { border-top: 1px solid var(--line); font-size: 1.55rem; margin-top: 2.25rem; padding-top: 1.25rem; }
h3 { font-size: 1.12rem; margin-top: 1.7rem; }
p, li { color: color-mix(in srgb, var(--ink) 84%, var(--muted)); }
ul, ol { padding-left: 1.25rem; }
li + li { margin-top: .35rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

pre {
  background: var(--code);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), var(--shadow);
  color: #f5f5f7;
  overflow: auto;
  padding: 1rem;
}
.code-block { line-height: 1.68; }
code { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: .92em; }
p code, li code { background: rgba(120,120,128,.14); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); padding: .08rem .28rem; }
.tok-kw { color: #ff7ab2; }
.tok-type { color: #00d29e; }
.tok-str { color: #f4d35e; }
.tok-num { color: #b5cea8; }
.tok-comment { color: #8b98a8; font-style: italic; }
.tok-op { color: #c79bff; }

.pill {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  justify-content: center;
  margin: .35rem .45rem .35rem 0;
  min-height: 2.65rem;
  padding: 0 1.05rem;
}
.pill.primary { background: var(--blue); border-color: var(--blue); color: white; }
.pill:hover { filter: brightness(.98); text-decoration: none; }

.hero-copy { max-width: 680px; position: relative; z-index: 1; }
.hero-copy h1 { font-size: clamp(4rem, 11vw, 8.5rem); }
.hero-copy .lede { color: rgba(255,255,255,.78); }
.home-strip {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 1rem;
}
.home-strip div { background: var(--paper); border: 1px solid var(--line); padding: 1.1rem; }
.home-strip b, .home-strip span { display: block; }
.home-strip span { color: var(--muted); font-size: .92rem; margin-top: .35rem; }

.studio-page { display: grid; gap: 1.2rem; }
.studio-intro h1 { font-size: clamp(2.7rem, 6vw, 5.1rem); max-width: 12ch; }
.studio-frame {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 1px;
  grid-template-columns: 196px minmax(320px, 1fr) 260px;
  grid-template-rows: 52px 430px 60px;
  overflow: hidden;
}
.studio-frame header, .studio-frame footer { align-items: center; background: rgba(255,255,255,.68); display: flex; gap: .5rem; justify-content: space-between; padding: 0 1rem; }
.studio-frame header { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
.studio-frame header nav, .studio-frame footer { gap: .5rem; }
.studio-frame header span, .studio-frame footer span, .studio-files span, .studio-files button { border: 1px solid var(--line); border-radius: 999px; padding: .48rem .72rem; }
.studio-files { border-right: 1px solid var(--line); display: grid; gap: .68rem; grid-auto-rows: max-content; padding: 1rem; }
.studio-files .active { background: var(--blue); color: white; }
.studio-files button { background: transparent; color: var(--ink); }
.studio-editor { background: #080a0f; color: white; display: grid; grid-template-rows: 50px 34px 1fr; min-width: 0; }
.transport { align-items: center; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; gap: .95rem; padding: 0 1.15rem; }
.transport button { background: var(--blue); border: 0; color: white; min-height: 2rem; padding: 0 .82rem; }
.transport i { background: linear-gradient(90deg, var(--mint), var(--rose), var(--gold)); border-radius: 999px; flex: 1; height: 5px; }
.ruler { border-bottom: 1px solid rgba(255,255,255,.1); display: grid; grid-template-columns: repeat(8,1fr); padding: 0 1rem; }
.ruler i { border-left: 1px solid rgba(255,255,255,.2); }
.studio-editor pre { border: 0; border-radius: 0; box-shadow: none; margin: 0; }
.studio-inspector { border-left: 1px solid var(--line); display: grid; gap: .8rem; grid-auto-rows: max-content; padding: .9rem; }
.studio-inspector b { display: block; margin-bottom: .45rem; }
.mini-staff, .mini-roll { background: #10141c; border-radius: 8px; height: 104px; overflow: hidden; position: relative; }
.mini-staff i { background: #3b4552; display: block; height: 1px; margin: 16px 0; }
.mini-staff em { background: var(--mint); border-radius: 999px; height: 12px; left: 20%; position: absolute; top: 48%; width: 58%; }
.mini-roll i { background: var(--rose); border-radius: 6px; height: 16px; position: absolute; }
.mini-roll i:nth-child(1) { left: 8%; top: 20px; width: 36%; }
.mini-roll i:nth-child(2) { left: 25%; top: 48px; width: 52%; background: var(--blue); }
.mini-roll i:nth-child(3) { left: 44%; top: 76px; width: 34%; background: var(--mint); }
.mini-roll i:nth-child(4) { left: 70%; top: 34px; width: 22%; background: var(--gold); }
.studio-frame footer { grid-column: 1 / -1; border-top: 1px solid var(--line); justify-content: flex-start; }

@media (max-width: 980px) {
  .site-shell, .home-strip, .studio-frame { grid-template-columns: 1fr; }
  .sidebar { border-bottom: 1px solid var(--line); border-right: 0; max-height: none; min-height: 0; padding: 1rem; position: relative; top: 0; }
  .content { padding-top: 2rem; }
  .site-topbar { padding: 0 1rem; }
  .site-topbar nav a { padding: .35rem .45rem; }
  .studio-frame { grid-template-rows: auto; }
  .studio-frame header, .studio-frame footer { min-height: 52px; }
  .studio-files, .studio-inspector { border: 0; }
}
