/* ============================================================
 * Custom Widgets - Marketing Components
 * ============================================================
 * Uses unified design tokens from design-tokens.css (loaded first).
 * This file ONLY contains component classes - NO raw token definitions.
 * Tokens are defined once in design-tokens.css and shared with the SPA.
 *
 * Token mapping (legacy → unified):
 *   --ink              → --cw-color-bg-body
 *   --surface          → --cw-color-bg-card
 *   --surface-2        → --cw-color-bg-raised
 *   --line             → --cw-color-line
 *   --line-strong      → --cw-color-line-strong
 *   --fg               → --cw-color-text-primary
 *   --fg-2             → --cw-color-text-secondary
 *   --fg-muted         → --cw-color-text-muted
 *   --brand            → --cw-color-brand
 *   --brand-ink        → --cw-color-brand-ink
 *   --brand-light      → --cw-color-brand-light
 *   --brand-dark       → --cw-color-brand-dark
 *   --header-bg        → --cw-color-header-bg
 *   --footer-bg        → --cw-color-footer-bg
 *   --radius-control   → --cw-radius-control
 *   --radius-card      → --cw-radius-card (16px, unified)
 *   --danger           → --cw-color-error
 *   --warn             → --cw-color-warning
 *   --overlay          → --cw-color-overlay
 * ============================================================ */

/* Base styles (use unified tokens) */
body {
  background: var(--cw-color-bg-body) !important;
  color: var(--cw-color-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Components (used by redesigned pages) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border-radius: var(--cw-radius-control);
  padding: .7rem 1.1rem;
  font-size: .9rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary {
  background: var(--cw-color-brand);
  color: var(--cw-color-brand-ink);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--cw-color-brand-light);
}
.btn-ghost {
  background: transparent;
  color: var(--cw-color-text-secondary);
  border: 1px solid var(--cw-color-line-strong);
}
.btn-ghost:hover {
  color: var(--cw-color-text-primary);
  border-color: var(--cw-color-text-muted);
}
.btn-danger {
  background: var(--cw-color-error);
  color: var(--cw-color-text-primary);
  font-weight: 600;
}
.btn-danger:hover {
  background: var(--cw-color-error);
  filter: brightness(0.92);
}
.btn-danger:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.notice {
  border-radius: var(--cw-radius-control);
  padding: 8px 16px;
  font-size: 14px;
}
.notice-success {
  background: color-mix(in srgb, var(--cw-color-brand) 12%, transparent);
  color: var(--cw-color-brand-text);
}
.notice-error {
  background: color-mix(in srgb, var(--cw-color-error) 12%, transparent);
  color: var(--cw-color-error);
}
.notice-warn {
  background: color-mix(in srgb, var(--cw-color-warning) 12%, transparent);
  color: var(--cw-color-warning);
}

.card {
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line);
  border-radius: var(--cw-radius-card);
}
.card-featured {
  border-color: color-mix(in srgb, var(--cw-color-brand) 40%, transparent);
}

/* Video thumbnail play badge (tutorial cards). */
.cw-play-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--cw-color-overlay);
  color: var(--cw-color-brand-text);
  transition: filter .15s ease;
}
.group:hover .cw-play-badge {
  filter: brightness(1.15);
}

.keycap {
  font-family: var(--cw-font-mono);
  font-size: .85rem;
  background: var(--cw-color-bg-raised);
  border: 1px solid var(--cw-color-line);
  border-radius: var(--cw-radius-control);
  padding: .7rem 1rem;
  color: var(--cw-color-text-primary);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.keycap .prompt {
  color: var(--cw-color-brand-text);
  user-select: none;
}

.section-title {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--cw-color-text-primary);
}

/* ---- Shared marketing components ---- */
.cw-badge {
  font-family: var(--cw-font-mono);
  font-size: 11px;
  color: var(--cw-color-text-muted);
  border: 1px solid var(--cw-color-line-strong);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}
.cw-badge-accent {
  color: var(--cw-color-brand-text);
  border-color: color-mix(in srgb, var(--cw-color-brand) 30%, transparent);
}
.cw-link {
  color: var(--cw-color-brand-text);
  text-decoration: none;
  font-weight: 500;
}
.cw-link:hover {
  text-decoration: underline;
}
.cw-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--cw-color-bg-raised);
  color: var(--cw-color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-check {
  color: var(--cw-color-brand-text);
  flex-shrink: 0;
  margin-top: 2px;
}
.cw-arrow {
  color: var(--cw-color-brand-text);
}
.cw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--cw-color-bg-card);
}
.cw-table th,
.cw-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--cw-color-line);
}
.cw-table th {
  text-align: left;
  font-weight: 600;
  color: var(--cw-color-text-primary);
  white-space: nowrap;
}
.cw-table td {
  color: var(--cw-color-text-secondary);
}
.cw-table th.c,
.cw-table td.c {
  text-align: center;
}
.cw-table tr:last-child td {
  border-bottom: 0;
}
.cw-table .lead-col {
  color: var(--cw-color-text-secondary);
}
.cw-table .mark {
  color: var(--cw-color-text-muted);
}
.cw-table .is-featured {
  background: color-mix(in srgb, var(--cw-color-brand) 5%, transparent);
}
.cw-code {
  font-family: var(--cw-font-mono);
  font-size: .85rem;
  background: var(--cw-color-bg-raised);
  border: 1px solid var(--cw-color-line);
  border-radius: var(--cw-radius-control);
  padding: .7rem 1rem;
  color: var(--cw-color-text-primary);
  overflow-x: auto;
}
.cw-code .prompt {
  color: var(--cw-color-brand-text);
  user-select: none;
}

/* ---- Site header (shared by marketing + portal, every hostname) ---- */
.cw-header {
  position: sticky;
  top: 0;
  z-index: var(--cw-z-header);
  background: var(--cw-color-header-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--cw-color-line);
}
.cw-header .cw-inner {
  max-width: 1152px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px;
  gap: 16px;
}
.cw-header .cw-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--cw-color-text-primary);
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
}
.cw-header .cw-brand img {
  display: block;
}
.cw-header .cw-brand b {
  color: var(--cw-color-brand-text);
  font-weight: 600;
}
.cw-header .cw-nav-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cw-header .cw-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  min-width: 0;
}
.cw-header .cw-nav a {
  color: var(--cw-color-text-secondary);
  text-decoration: none;
  transition: color .15s, background .15s;
}
.cw-header .cw-nav a:hover {
  color: var(--cw-color-text-primary);
  background: var(--cw-color-bg-raised);
}
.cw-header .cw-nav a[aria-current="page"] {
  color: var(--cw-color-brand-text);
  background: color-mix(in srgb, var(--cw-color-brand) 14%, transparent);
}
.cw-header .cw-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--cw-radius-control);
  white-space: nowrap;
}
.cw-header .cw-nav-link svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.cw-header .cw-more {
  position: relative;
}
.cw-header .cw-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--cw-color-line-strong);
  background: transparent;
  color: var(--cw-color-text-secondary);
  border-radius: var(--cw-radius-control);
  padding: 6px 10px;
  font-size: 13.5px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.cw-header .cw-more-btn:hover {
  color: var(--cw-color-text-primary);
  border-color: var(--cw-color-brand-text);
}
.cw-header .cw-more-btn svg {
  width: 16px;
  height: 16px;
}
.cw-header .cw-more-menu {
  width: 200px;
}
.cw-header .cw-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cw-header [hidden] {
  display: none !important;
}
.cw-header .cw-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--cw-color-line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--cw-color-text-secondary);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.cw-header .cw-theme-toggle:hover {
  color: var(--cw-color-text-primary);
  border-color: var(--cw-color-brand-text);
}
.cw-header .cw-theme-toggle svg {
  width: 17px;
  height: 17px;
}
.cw-header .cw-theme-icon-light { display: none; }
:root[data-theme="light"] .cw-header .cw-theme-icon-dark { display: none; }
:root[data-theme="light"] .cw-header .cw-theme-icon-light { display: inline; }
.cw-header .cw-login {
  color: var(--cw-color-text-secondary);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  transition: color .15s;
}
.cw-header .cw-login:hover {
  color: var(--cw-color-text-primary);
}

/* Portal-only actions (shown only on the app routes). */
.cw-header .cw-actions-portal {
  display: none;
}
.cw-header .cw-account {
  position: relative;
}
.cw-header .cw-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--cw-color-line-strong);
  background: transparent;
  color: var(--cw-color-text-primary);
  border-radius: var(--cw-radius-control);
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}
.cw-header .cw-account-btn:hover {
  border-color: var(--cw-color-brand-text);
}
.cw-header .cw-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.cw-header .cw-menu {
  position: absolute;
  right: 0;
  margin-top: 8px;
  width: 208px;
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line-strong);
  border-radius: var(--cw-radius-card);
  padding: 6px;
  box-shadow: var(--cw-shadow-float);
}
.cw-header .cw-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--cw-color-text-secondary);
  text-decoration: none;
  font-size: 14px;
}
.cw-header .cw-menu a svg {
  width: 16px;
  height: 16px;
  flex: none;
  opacity: .85;
}
.cw-header .cw-menu a:hover {
  color: var(--cw-color-text-primary);
  background: var(--cw-color-bg-raised);
}
.cw-header .cw-menu hr {
  border: 0;
  border-top: 1px solid var(--cw-color-line);
  margin: 6px 0;
}
.cw-header .cw-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--cw-color-text-secondary);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.cw-header .cw-menu button:hover {
  color: var(--cw-color-text-primary);
  background: var(--cw-color-bg-raised);
}

/* Context switch: app routes swap the actions (login vs account). */
html.cw-portal .cw-header .cw-actions-marketing {
  display: none;
}
html.cw-portal .cw-header .cw-actions-portal {
  display: flex;
}

/* The SPA draws its own top navigation (sidebar + mobile bars); hide only the
   marketing header on app routes so navigation is not duplicated. The footer
   stays, and the vanilla support widget is hidden because the SPA mounts its
   own React chat. */
html.cw-portal .cw-header {
  display: none !important;
}
html.cw-portal #cw-support-widget {
  display: none !important;
}

@media (max-width: 1023px) {
  .cw-header .cw-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 16px;
    row-gap: 8px;
  }
  .cw-header .cw-nav-wrap {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .cw-header .cw-nav {
    overflow-x: auto;
  }
  .cw-header .cw-more-btn span {
    display: none;
  }
  .cw-header .cw-more-btn {
    padding: 6px 8px;
  }
}
@media (max-width: 767px) {
  .cw-header .cw-login,
  .cw-header .btn-ghost {
    display: none;
  }
}

/* ---- Site footer (shared by marketing + portal, every hostname) ---- */
.cw-footer {
  background: var(--cw-color-footer-bg);
  border-top: 1px solid var(--cw-color-line);
}
.cw-footer .cw-inner {
  max-width: 1152px;
  margin: 0 auto;
  padding: 48px 16px;
}
.cw-footer .cw-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}
.cw-footer .cw-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.cw-footer .cw-brand img {
  display: block;
}
.cw-footer .cw-brand span {
  font-weight: 600;
  font-size: 14px;
  color: var(--cw-color-text-primary);
}
.cw-footer .cw-brand b {
  color: var(--cw-color-brand-text);
  font-weight: 600;
}
.cw-footer p {
  font-size: 13px;
  color: var(--cw-color-text-secondary);
  line-height: 1.6;
  margin: 0;
}
.cw-footer h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--cw-color-text-primary);
  margin: 0 0 16px;
}
.cw-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cw-footer li {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--cw-color-text-secondary);
}
.cw-footer a {
  color: var(--cw-color-text-secondary);
  text-decoration: none;
  transition: color .15s;
}
.cw-footer a:hover {
  color: var(--cw-color-text-primary);
}
.cw-footer .cw-bottom {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--cw-color-line);
  text-align: center;
  font-size: 14px;
  color: var(--cw-color-text-secondary);
}
.cw-footer .cw-bottom a {
  color: var(--cw-color-text-secondary);
}
.cw-footer .cw-bottom a:hover {
  color: var(--cw-color-text-primary);
}
.cw-footer .cw-sep {
  margin: 0 8px;
}
.cw-footer .cw-social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
}
.cw-footer .cw-social li {
  margin: 0;
}
.cw-footer .cw-social a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--cw-color-line);
  border-radius: 10px;
  color: var(--cw-color-text-secondary);
  transition: color .15s, border-color .15s, background-color .15s;
}
.cw-footer .cw-social a:hover {
  color: var(--cw-color-text-primary);
  border-color: var(--cw-color-text-muted);
}
.cw-footer .cw-social svg {
  width: 18px;
  height: 18px;
  display: block;
}
@media (max-width: 767px) {
  .cw-footer .cw-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ---- Docs page: activation guide (scoped; no inline CSS) ---- */
.cw-doc {
  font-family: var(--cw-font-sans);
  -webkit-font-smoothing: antialiased;
}
.cw-doc .container {
  max-width: 768px;
  margin: 0 auto;
  padding: 64px 16px;
}
.cw-doc .container * {
  box-sizing: border-box;
}
.cw-doc .container h1 {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 24px;
}
.cw-doc .container h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 8px;
}
.cw-doc .container p {
  color: var(--cw-color-text-secondary);
  margin: 0 0 8px;
  line-height: 1.6;
}
.cw-doc .container pre {
  background: var(--cw-color-bg-raised);
  border: 1px solid var(--cw-color-line);
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  color: var(--cw-color-brand-text);
  overflow-x: auto;
  margin: 0 0 16px;
}
.cw-doc .cw-doc-link {
  margin-top: 24px;
}
.cw-doc .cw-doc-link a {
  color: var(--cw-color-brand-text);
  text-decoration: none;
}

/* ---- Accessibility floor ---- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--cw-color-focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Legacy normalization (targets exact inline slop values) ---- */
/* Green-tinted borders → quiet hairline */
[style*="border:1px solid rgba(65,205,82,0.15"] {
  border-color: var(--cw-color-line) !important;
}
[style*="border:1px solid rgba(65,205,82,0.2"] {
  border-color: var(--cw-color-line) !important;
}
[style*="border:1px solid rgba(65,205,82,0.25"] {
  border-color: var(--cw-color-line) !important;
}
[style*="border:1px solid rgba(65,205,82,0.4"] {
  border-color: var(--cw-color-line-strong) !important;
}
[style*="border-top:2px solid #41CD52"] {
  border-top-color: var(--cw-color-line) !important;
}

/* Gradient primary buttons → solid accent; kill glow shadows */
[style*="linear-gradient(135deg,#41CD52,#70e07f"] {
  background: var(--cw-color-brand) !important;
  color: var(--cw-color-brand-ink) !important;
  box-shadow: none !important;
}
[style*="box-shadow:0 4px 24px rgba(65,205,82"] {
  box-shadow: none !important;
}
[style*="box-shadow:0 6px 24px rgba(65,205,82"] {
  box-shadow: none !important;
}

/* Gradient CTA panels → flat surface */
[style*="linear-gradient(135deg,rgba(65,205,82,0.08"] {
  background: var(--cw-color-bg-card) !important;
}

/* Tinted icon tiles → neutral chip */
[style*="background:rgba(65,205,82,0.1)"] {
  background: var(--cw-color-bg-raised) !important;
}

/* Type slop */
.font-extrabold {
  font-weight: 600 !important;
}
.font-bold {
  font-weight: 600 !important;
}
.uppercase {
  text-transform: none !important;
}
.tracking-wide {
  letter-spacing: 0 !important;
}

/* Hover-lift / translate on cards and buttons → color only */
[class*="hover:translate-y"]:hover {
  transform: none !important;
}

/* Green scrollbar → neutral */
::-webkit-scrollbar-thumb {
  background: var(--cw-color-line-strong) !important;
}
::selection {
  background: color-mix(in srgb, var(--cw-color-brand) 28%, transparent) !important;
}

/* ---- Homepage (scoped; replaces the page's inline styles) ---- */
.cw-home .t-primary {
  color: var(--cw-color-text-primary);
}
.cw-home .t-2 {
  color: var(--cw-color-text-secondary);
}
.cw-home .t-muted {
  color: var(--cw-color-text-muted);
}
.cw-home .t-accent {
  color: var(--cw-color-brand-text);
}
.cw-home .t-lead {
  line-height: 1.6;
}
.cw-home .h {
  font-weight: 600;
  color: var(--cw-color-text-primary);
}
.cw-home .h-lg {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--cw-color-text-primary);
}
.cw-home .h-md {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--cw-color-text-primary);
}
.cw-home .font-medium {
  font-weight: 500;
  color: var(--cw-color-text-primary);
}
.cw-home .num {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--cw-color-text-primary);
}
.cw-home .num-muted {
  font-variant-numeric: tabular-nums;
  color: var(--cw-color-text-muted);
}
.cw-home .mono {
  font-family: var(--cw-font-mono);
}
.cw-home .dot {
  border-radius: 9999px;
  display: inline-block;
}
.cw-home .dot-9 {
  width: 9px;
  height: 9px;
}
.cw-home .dot-6 {
  width: 6px;
  height: 6px;
}
.cw-home .dot-3a {
  background: var(--cw-color-text-muted);
}
.cw-home .dot-green {
  background: var(--cw-color-brand);
}
.cw-home .dot-primary {
  background: var(--cw-color-brand);
}
.cw-home .dot-tertiary {
  background: var(--cw-color-warning);
}
.cw-home .dot-error {
  background: var(--cw-color-error);
}
.cw-home .inline-dot {
  display: inline-block;
}
.cw-home .thumb {
  aspect-ratio: 16 / 9;
  background: var(--cw-color-bg-raised);
}
.cw-home .play-overlay {
  background: rgba(15, 15, 18, 0.35);
}
.cw-home .play-btn {
  background: var(--cw-color-brand);
}
.cw-home .row-div {
  border-top: 1px solid var(--cw-color-line);
}
.cw-home .bar-div {
  border-bottom: 1px solid var(--cw-color-line);
}
.cw-home .tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--cw-color-bg-raised);
  border: 1px solid var(--cw-color-line);
  color: var(--cw-color-text-secondary);
  font-family: var(--cw-font-mono);
}
.cw-home .hero-card {
  background: var(--cw-color-bg-card);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
}

/* Signature: Qt Designer selection marquee (homepage) */
.cw-home .select-frame {
  position: relative;
  border: 1px solid var(--cw-color-brand);
  border-radius: 12px;
}
.cw-home .select-frame::before,
.cw-home .select-frame::after,
.cw-home .select-frame .h3,
.cw-home .select-frame .h4 {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  background: var(--cw-color-bg-body);
  border: 1px solid var(--cw-color-brand);
}
.cw-home .select-frame::before {
  top: -4px;
  left: -4px;
}
.cw-home .select-frame::after {
  top: -4px;
  right: -4px;
}
.cw-home .select-frame .h3 {
  bottom: -4px;
  left: -4px;
}
.cw-home .select-frame .h4 {
  bottom: -4px;
  right: -4px;
}

/* Single entrance: a short fade/rise as sections enter the viewport. */
.cw-home .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s ease, transform .5s ease;
}
.cw-home .reveal.in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .cw-home .reveal {
    transition: none;
  }
}

/* Gallery preview tiles (no inline colors). */
.gallery-tile {
  background: var(--cw-color-bg-raised);
  aspect-ratio: 1;
}

/* Tutorial video overlays (no inline colors). */
.video-player {
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--cw-color-line);
}
.video-play {
  width: 72px;
  height: 72px;
  background: var(--cw-color-overlay);
  color: var(--cw-color-brand-text);
}
.video-title {
  background: linear-gradient(transparent, var(--cw-color-overlay));
  color: var(--cw-color-text-primary);
}
.video-lightbox {
  background: var(--cw-color-overlay);
}

/* ---- Shared text utilities (marketing + SPA) ---- */
.t-primary {
  color: var(--cw-color-text-primary);
}
.t-2 {
  color: var(--cw-color-text-secondary);
}
.t-muted {
  color: var(--cw-color-text-muted);
}
.t-accent {
  color: var(--cw-color-brand-text);
}
.num {
  font-variant-numeric: tabular-nums;
}
.h {
  font-weight: 600;
  color: var(--cw-color-text-primary);
}
.h-lg {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--cw-color-text-primary);
}
.h-md {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--cw-color-text-primary);
}

/* Shared scroll-reveal (marketing pages). Additive: shown by default. */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s ease, transform .5s ease;
}
.reveal.in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    transition: none;
  }
}

/* React inline styles render with spaces after colons/commas; catch those
   variants of the legacy slop the no-space selectors above miss. */
[style*="border: 1px solid rgba(65, 205, 82"] {
  border-color: var(--cw-color-line) !important;
}
[style*="background: linear-gradient(135deg, #41CD52, #70e07f"] {
  background: var(--cw-color-brand) !important;
  color: var(--cw-color-brand-ink) !important;
  box-shadow: none !important;
}
[style*="background-color: rgba(65, 205, 82, 0.15"] {
  background: var(--cw-color-bg-raised) !important;
}

/* ---- Shared form controls (SPA) ---- */
.field {
  background: var(--cw-color-bg-raised);
  color: var(--cw-color-text-primary);
  border: 1px solid var(--cw-color-line-strong);
  border-radius: var(--cw-radius-control);
  transition: border-color .15s;
}
.field:focus {
  border-color: var(--cw-color-brand-text);
  outline: none;
}
.divider {
  border-top: 1px solid var(--cw-color-line);
}

/* Auth pages: subtle brand-panel step (no gradient) */
.auth-brand {
  background: var(--cw-color-bg-raised);
  border-right: 1px solid var(--cw-color-line);
}
@media (max-width: 767px) {
  .auth-brand {
    border-right: 0;
    border-bottom: 1px solid var(--cw-color-line);
  }
}

/* ===== Support chat widget (static marketing pages) ===== */
#cw-support-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--cw-color-brand);
  color: var(--cw-color-brand-ink);
  border: none;
  box-shadow: 0 4px 12px var(--cw-color-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: var(--cw-z-support-bubble);
  transition: transform .15s, opacity .15s;
}
#cw-support-bubble:hover {
  transform: scale(1.05);
  opacity: .95;
}
#cw-support-bubble[aria-expanded="true"] {
  background: var(--cw-color-brand);
  filter: brightness(0.92);
}

#cw-support-panel {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 360px;
  height: 520px;
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line-strong);
  border-radius: 14px;
  box-shadow: 0 10px 40px var(--cw-color-overlay);
  display: flex;
  flex-direction: column;
  z-index: var(--cw-z-support-panel);
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--cw-color-text-primary);
}
.cw-support-hidden {
  display: none !important;
}

.cw-support-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--cw-color-line);
  background: var(--cw-color-bg-raised);
}
.cw-support-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--cw-color-text-primary);
}
.cw-support-close {
  background: none;
  border: none;
  color: var(--cw-color-text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
}
.cw-support-close:hover {
  color: var(--cw-color-text-primary);
}

.cw-support-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cw-support-msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.cw-support-visitor {
  align-self: flex-end;
  background: var(--cw-color-brand);
  color: var(--cw-color-brand-ink);
}
.cw-support-assistant {
  align-self: flex-start;
  background: var(--cw-color-bg-raised);
  color: var(--cw-color-text-primary);
  border: 1px solid var(--cw-color-line);
}

.cw-support-email-prompt,
.cw-support-ticket {
  padding: 12px 16px;
  border-top: 1px solid var(--cw-color-line);
  background: var(--cw-color-bg-raised);
}
.cw-support-prompt-text {
  font-size: 12px;
  color: var(--cw-color-text-secondary);
  margin: 0 0 8px 0;
}
.cw-support-email-form {
  display: flex;
  gap: 6px;
}
.cw-support-email-input {
  flex: 1;
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line);
  color: var(--cw-color-text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.cw-support-email-btn {
  background: var(--cw-color-brand);
  color: var(--cw-color-brand-ink);
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.cw-support-email-btn:hover {
  filter: brightness(0.92);
}

.cw-support-ticket-link {
  display: flex;
  gap: 6px;
}
.cw-support-ticket-input {
  flex: 1;
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line);
  color: var(--cw-color-text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-family: monospace;
}
.cw-support-ticket-copy {
  background: var(--cw-color-brand);
  color: var(--cw-color-brand-ink);
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.cw-support-send-form {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--cw-color-line);
  background: var(--cw-color-bg-raised);
}
.cw-support-input {
  flex: 1;
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line);
  color: var(--cw-color-text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
}
.cw-support-send-btn {
  background: var(--cw-color-brand);
  color: var(--cw-color-brand-ink);
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-support-send-btn:hover {
  filter: brightness(0.92);
}

.cw-support-error {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--cw-color-error);
  background: color-mix(in srgb, var(--cw-color-error) 12%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--cw-color-error) 20%, transparent);
}

/* Form + chip controls used by the SPA posts pages. */
.input {
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line-strong);
  border-radius: var(--cw-radius-control);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--cw-color-text-primary);
}
/* Icon-prefixed inputs: .input's shorthand padding would otherwise beat
   Tailwind's pl-* utility (unlayered CSS wins), leaving text under the icon. */
.input.pl-9 {
  padding-left: 2.25rem;
}
.input.pl-10 {
  padding-left: 2.5rem;
}
.input.pl-11 {
  padding-left: 2.75rem;
}
.input.pl-12 {
  padding-left: 3rem;
}
.input:focus {
  outline: none;
  border-color: var(--cw-color-brand-text);
}
.chip {
  border: 1px solid var(--cw-color-line-strong);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--cw-color-text-secondary);
  white-space: nowrap;
}
.chip:hover {
  color: var(--cw-color-text-primary);
  border-color: var(--cw-color-text-muted);
}
.chip-active {
  background: var(--cw-color-brand);
  color: var(--cw-color-brand-ink);
  border-color: var(--cw-color-brand-text);
  font-weight: 600;
}

/* Markdown body for post detail. */
.prose-post h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 20px 0 8px;
}
.prose-post h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 18px 0 8px;
}
.prose-post h3,
.prose-post h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 6px;
}
.prose-post p {
  margin: 0 0 12px;
}
.prose-post a {
  color: var(--cw-color-brand-text);
  text-decoration: underline;
}
.prose-post code {
  background: var(--cw-color-bg-card);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--cw-font-mono);
  font-size: 12px;
}
.prose-post pre {
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line);
  border-radius: var(--cw-radius-control);
  padding: 12px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.prose-post pre code {
  background: none;
  padding: 0;
}
.prose-post ul,
.prose-post ol {
  margin: 0 0 12px;
  padding-left: 20px;
}
/* === Widget catalog (/gallery/) ======================================== */
.catalog-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--cw-radius-pill);
  background: var(--cw-color-bg-raised);
  border: 1px solid var(--cw-color-line);
  color: var(--cw-color-text-secondary);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}
.catalog-pill-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--cw-color-brand); }
.catalog-count { font-variant-numeric: tabular-nums; }
.catalog-search { position: relative; width: 100%; max-width: 320px; }
.catalog-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--cw-color-bg-input);
  border: 1px solid var(--cw-color-line);
  border-radius: var(--cw-radius-control);
  color: var(--cw-color-text-primary);
  font-size: 15px;
  line-height: 22px;
}
.catalog-search input::placeholder { color: var(--cw-color-text-muted); }
.catalog-search input:focus { outline: none; border-color: var(--cw-color-brand); box-shadow: 0 0 0 3px var(--cw-color-focus-ring); }
.catalog-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--cw-color-text-muted); pointer-events: none; }
.catalog-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.catalog-tab {
  padding: 4px 16px;
  border: 0;
  border-radius: var(--cw-radius-pill);
  background: transparent;
  color: var(--cw-color-text-secondary);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  cursor: pointer;
}
.catalog-tab:hover { background: var(--cw-color-bg-raised); color: var(--cw-color-text-primary); }
.catalog-tab[aria-selected="true"] { background: var(--cw-color-inverse-surface); color: var(--cw-color-inverse-on-surface); }
.catalog-tab:focus-visible { outline: 2px solid var(--cw-color-focus-ring); outline-offset: 2px; }
.catalog-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 768px) { .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.catalog-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 12px;
  padding: 24px;
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line);
  border-radius: var(--cw-radius-card);
  color: inherit;
  text-decoration: none;
}
.catalog-card:hover { border-color: var(--cw-color-line-strong); }
.catalog-card[hidden] { display: none; }
.catalog-preview {
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cw-color-brand);
  background: var(--cw-color-bg-raised);
  border: 1px solid var(--cw-color-line);
  border-radius: var(--cw-radius-control);
  overflow: hidden;
}
.catalog-preview img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 8px; }
.catalog-preview svg { width: 40px; height: 40px; }
.catalog-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.catalog-meta h2 { margin: 0; font-size: 16px; line-height: 22px; font-weight: 600; color: var(--cw-color-text-primary); }
.catalog-license { font-family: var(--cw-font-mono); font-size: 12px; line-height: 16px; color: var(--cw-color-text-muted); white-space: nowrap; }
.catalog-card[data-license="pro"] .catalog-license { color: var(--cw-color-brand-text); }
.catalog-desc { margin: 0; font-size: 15px; line-height: 22px; color: var(--cw-color-text-secondary); }
.catalog-import {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--cw-color-bg-raised);
  border: 1px solid var(--cw-color-line);
  border-radius: var(--cw-radius-control);
}
.catalog-import code {
  flex: 1;
  min-width: 0;
  font-family: var(--cw-font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--cw-color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catalog-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--cw-color-text-muted);
  cursor: pointer;
}
.catalog-copy:hover { background: var(--cw-color-bg-card); color: var(--cw-color-text-primary); }
.catalog-copy:focus-visible { outline: 2px solid var(--cw-color-focus-ring); outline-offset: 1px; }
.catalog-empty {
  padding: 32px;
  text-align: center;
  color: var(--cw-color-text-secondary);
  background: var(--cw-color-bg-card);
  border: 1px solid var(--cw-color-line);
  border-radius: var(--cw-radius-card);
}
.catalog-card { position: relative; }
.catalog-stretch { position: absolute; inset: 0; border-radius: var(--cw-radius-card); }
.catalog-stretch:focus-visible { outline: 2px solid var(--cw-color-focus-ring); outline-offset: 2px; }
.catalog-import { position: relative; z-index: 1; }

/* === Pricing (/pricing/) =============================================== */
.pricing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--cw-radius-pill);
  background: var(--cw-color-bg-raised);
  border: 1px solid var(--cw-color-line);
  color: var(--cw-color-text-primary);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}
.pricing-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--cw-color-brand);
}
.pricing-card { min-width: 0; }
.pricing-card-featured { border: 2px solid var(--cw-color-brand); }
.pricing-flag {
  align-self: flex-start;
  margin: 0 0 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cw-color-brand) 12%, transparent);
  color: var(--cw-color-brand-text);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}
.pricing-price {
  margin: 16px 0 0;
  font-size: 36px;
  line-height: 40px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 640px) {
  .pricing-price { font-size: 40px; line-height: 44px; }
}
