:root,
[data-syntax-theme="github"] {
  color-scheme: light;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --bg-color: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --text-color: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --accent-color: #0ea5e9;
  --code-bg: #f1f5f9;
  --code-color: #0f172a;
  --syntax-background: var(--code-bg);
  --syntax-foreground: var(--code-color);
  --card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --card-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  padding: 0;
  margin: 0;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Container */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/* Header */
header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.title-group h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.title-tag {
  font-family: var(--font-mono);
  color: var(--primary-color);
}

.description {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 840px;
  line-height: 1.6;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.github-btn,
.npm-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-color);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

.github-btn:hover,
.npm-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--primary-color);
  color: var(--primary-color);
  text-decoration: none;
}

.github-btn svg,
.npm-btn svg {
  flex-shrink: 0;
}

/* API Banner */
.api-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  border: 1px solid transparent;
}

.api-banner.supported {
  background-color: oklch(0.96 0.05 145);
  border-color: oklch(0.85 0.1 145);
  color: oklch(0.28 0.12 145);
}

.api-banner.fallback,
.api-banner.warning {
  background-color: oklch(0.96 0.05 60);
  border-color: oklch(0.85 0.1 60);
  color: oklch(0.3 0.1 60);
}

.api-banner.unsupported,
.api-banner.danger {
  background-color: oklch(0.96 0.04 25);
  border-color: oklch(0.85 0.12 25);
  color: oklch(0.35 0.15 25);
}

.api-banner-badge {
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.08);
  white-space: nowrap;
}

/* Page Layout & Sidenav (Scrollspy) */
.page-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

@media (max-width: 800px) {
  .page-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
}

.sidebar {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding-right: 0.5rem;
}

@media (max-width: 800px) {
  .sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
  }
}

.sidenav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidenav-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 0.75rem 0.25rem;
}

.sidenav-list {
  scroll-target-group: auto;
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidenav-list li {
  list-style: none;
}

.sidenav-list a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidenav-list a:hover {
  color: var(--text-color);
  background: var(--bg-surface-elevated);
  text-decoration: none;
}

.sidenav-list a:target-current,
.sidenav-list a.is-active {
  color: var(--primary-color);
  font-weight: 600;
  border-left-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
}

.sidenav-divider {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.25rem;
  border-top: 1px solid var(--border-color);
  margin-top: 0.5rem;
}

.main-content {
  min-width: 0;
}

/* Badges */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.badge-primary {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
  border-color: rgba(37, 99, 235, 0.2);
}

.badge-accent {
  background-color: rgba(14, 165, 233, 0.1);
  color: var(--accent-color);
  border-color: rgba(14, 165, 233, 0.2);
}

/* Sections & Cards */
section {
  margin-bottom: 3.5rem;
}

section:last-child {
  margin-bottom: 0;
}

section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

section > h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

section > p,
section p.section-desc {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

section > p:last-of-type {
  margin-bottom: 1.25rem;
}

section ul,
section ol {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
  color: var(--text-muted);
}

section li + li {
  margin-top: 0.35rem;
}

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--card-shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Video Showcase inside Card */
.showcase-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  display: block;
  background: #f0f8ff;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.feature-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
}

.feature-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feature-item p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Code Snippets & micro-lighter */
pre, code {
  font-family: var(--font-mono);
}

code {
  background-color: var(--code-bg);
  color: var(--code-color);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.875em;
}

pre {
  background-color: var(--code-bg);
  color: var(--code-color);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid var(--border-color);
  margin-top: 0.75rem;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

micro-lighter {
  display: grid;
  position: relative;
  margin-top: 0.75rem;
}

micro-lighter > pre {
  margin: 0;
  padding-right: 3rem;
}

micro-lighter::part(copy-button) {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  margin: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

micro-lighter::part(copy-button):hover {
  color: var(--text-color);
  border-color: var(--primary-color);
  background-color: var(--bg-surface-elevated);
}

/* Callout Box */
.callout {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: 6px;
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.callout h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.callout p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Data Table */
.data-table-wrapper {
  overflow-x: auto;
  margin: 0.5rem 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.data-table th {
  background-color: var(--bg-surface-elevated);
  padding: 0.625rem 0.75rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: rgba(0, 0, 0, 0.02);
}

.effect-preview {
  display: block;
  width: 96px;
  height: 54px;
  min-width: 96px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  object-fit: cover;
  background-color: var(--bg-surface-elevated);
  filter: grayscale(1);
  transition: filter 0.3s ease;
}

.data-table tr:hover .effect-preview,
.data-table tr:focus-within .effect-preview {
  filter: grayscale(0);
}

/* Preset / Action Buttons */
.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--primary-color);
  color: var(--primary-color);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

/* Browser UI Shell around Demo Iframes (from view-transitions-toolkit) */
.shell-frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 680px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-surface);
  overflow: hidden;
  box-shadow: var(--card-shadow-lg);
}

.shell-nav-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid var(--border-color);
}

.shell-nav-bar button,
.shell-nav-bar .shell-open-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-color);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.shell-nav-bar button:hover:not(:disabled),
.shell-nav-bar .shell-open-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--primary-color);
  color: var(--primary-color);
  text-decoration: none;
}

.shell-nav-bar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.shell-url-bar {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  display: flex;
  align-items: center;
  color: var(--text-color);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.shell-frame iframe {
  width: 100%;
  flex: 1;
  border: none;
  background: #f0f8ff;
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
