`). |
+| **Shadow Tree** | The hidden DOM subtree that lives inside the Shadow Host. This contains the component's internal structure and styles. |
+| **Shadow Boundary** | The border between the Shadow Tree and the regular DOM. This boundary enforces encapsulation. |
+| **Shadow Root** | The root node of the Shadow Tree. This is created by calling `attachShadow()`. |
+
+### The Power of Isolation
+
+When CSS is placed inside the Shadow Tree:
+
+1. **Styles inside the Shadow Tree** apply only to elements within that tree.
+2. **External styles** from the main document (the Light DOM) stop at the Shadow Boundary and do not affect the elements inside the Shadow Tree.
+
+## 2. Creating a Shadow Root (JavaScript)
+
+The Shadow DOM is typically created and managed via JavaScript using the `attachShadow()` method on a DOM element (the Shadow Host).
+
+### Mode: `open` vs. `closed`
+
+The `attachShadow()` method requires a configuration object with a `mode` property:
+
+| Mode | Accessibility | Description |
+| :--- | :--- | :--- |
+| **`open`** | **Accessible** | The Shadow Root can be accessed from outside the component using JavaScript (e.g., `element.shadowRoot`). This is generally preferred for debugging and flexibility. |
+| **`closed`** | **Inaccessible** | The Shadow Root cannot be accessed directly from the outside. Styles and structure are fully hidden. |
+
+```javascript title="shadow-dom-setup.js"
+// Get the host element (a custom element)
+const host = document.querySelector('my-component');
+
+// Create the Shadow Root, making it accessible (open)
+const shadowRoot = host.attachShadow({ mode: 'open' });
+
+// Add content and styles to the Shadow Tree
+shadowRoot.innerHTML = `
+
+ Hello from the Shadow DOM!
+`;
+```
+
+
+
+
+## 3. Styling Across the Boundary (The Exceptions)
+
+While the Shadow DOM provides strong isolation, there are mechanisms to allow limited styling customization from the Light DOM.
+
+### 3.1. Targeting the Host (`:host()`)
+
+The `:host` pseudo-class allows you to style the Shadow Host element itself from *inside* the Shadow Tree.
+
+```css title="shadow-dom-styles.css"
+/* Inside the Shadow DOM's