A theme is the layer that decides how content is presented. It does not own the content itself — posts, pages and media live in the database and belong to the site, not to the theme. That separation is the single most important idea in theme development: if switching themes would destroy something, that something is in the wrong place.
The practical consequence is that a theme should never register post types, store business data, or hold functionality a site would miss if it changed its design. Those belong in a plugin. A theme that breaks this rule holds its owner hostage.
Technically, a theme is just a folder in wp-content/themes containing at minimum two files: style.css with a header comment WordPress reads, and index.php as a last-resort template. Everything beyond that is refinement.
