/* Swazor demo theme. Self-contained: no fonts, CDNs or scripts; every colour is a token. */
:root {
  color-scheme: light dark;
  --swz-bg: #f6f7fc; --swz-bg-2: #eceffa; --swz-text: #151a2e; --swz-muted: #4b546d;
  --swz-card: #fff; --swz-border: #dbe0ee; --swz-primary: #4a3fd0; --swz-primary-ink: #fff;
  --swz-accent: #0f9d8a; --swz-warn: #b7791f; --swz-ok: #178a52;
  --swz-glow: rgba(74, 63, 208, .13); --swz-shadow: 0 1px 2px rgba(21, 26, 46, .05), 0 8px 24px -12px rgba(21, 26, 46, .14);
  --swz-shadow-lift: 0 2px 4px rgba(21, 26, 46, .06), 0 18px 36px -16px rgba(74, 63, 208, .3);
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem; --sp-8: 4.5rem;
  --radius: 1rem; --radius-sm: .65rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --swz-bg: #0d1019; --swz-bg-2: #141828; --swz-text: #eef0ff; --swz-muted: #aeb6cf;
    --swz-card: #171b2b; --swz-border: #2d3350; --swz-primary: #a79fff; --swz-primary-ink: #11142a;
    --swz-accent: #3fd0b8; --swz-warn: #e7b04f; --swz-ok: #4ad58b;
    --swz-glow: rgba(167, 159, 255, .14); --swz-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
    --swz-shadow-lift: 0 2px 4px rgba(0, 0, 0, .4), 0 20px 40px -18px rgba(167, 159, 255, .35);
  }
}
:root[data-theme="dark"] {
  --swz-bg: #0d1019; --swz-bg-2: #141828; --swz-text: #eef0ff; --swz-muted: #aeb6cf;
  --swz-card: #171b2b; --swz-border: #2d3350; --swz-primary: #a79fff; --swz-primary-ink: #11142a;
  --swz-accent: #3fd0b8; --swz-warn: #e7b04f; --swz-ok: #4ad58b;
  --swz-glow: rgba(167, 159, 255, .14); --swz-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
  --swz-shadow-lift: 0 2px 4px rgba(0, 0, 0, .4), 0 20px 40px -18px rgba(167, 159, 255, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; line-height: 1.65;
  color: var(--swz-text);
  background: radial-gradient(900px 380px at 50% -120px, var(--swz-glow), transparent 70%), var(--swz-bg);
  background-attachment: fixed;
}
a { color: var(--swz-primary); text-underline-offset: .22em; }
button { font: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; vertical-align: middle; }

/* Buttons and links that look like buttons */
button, .button-link {
  display: inline-flex; align-items: center; vertical-align: middle; justify-content: center; gap: var(--sp-2);
  padding: .65rem 1.1rem; border: 1px solid var(--swz-border); border-radius: var(--radius-sm); font-weight: 600;
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease);
  touch-action: manipulation;
}
button { background: var(--swz-card); color: var(--swz-text); }
button.primary, .primary { background: var(--swz-primary); color: var(--swz-primary-ink); border-color: var(--swz-primary); }
.secondary { background: var(--swz-card); color: var(--swz-text); }
.button-link { text-decoration: none; }
button:hover, .button-link:hover { transform: translateY(-1px); box-shadow: var(--swz-shadow-lift); }
button:active, .button-link:active { transform: translateY(0) scale(.97); box-shadow: none; }
.secondary:hover { border-color: var(--swz-primary); }
.button-link .icon { transition: transform .2s var(--ease); }
.button-link:hover .icon { transform: translateX(3px); }
:focus-visible { outline: 3px solid var(--swz-primary); outline-offset: 3px; }

.shell { max-width: 1160px; margin: auto; padding: 0 clamp(1.1rem, 4vw, 3rem); min-height: 100dvh; display: flex; flex-direction: column; }
#main { flex: 1; }

/* Header: brand left, nav middle, icon toggle right. On phones the nav drops to a
   second row that scrolls sideways instead of wrapping or overflowing the page. */
.site-header {
  position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-5);
  padding: var(--sp-4) 0; border-bottom: 1px solid var(--swz-border);
  background: color-mix(in srgb, var(--swz-bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: var(--sp-3); font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; text-decoration: none; color: var(--swz-text); }
.logo { border-radius: .55rem; box-shadow: 0 6px 16px -6px var(--swz-primary); }
.logo-stop-a { stop-color: #7b6cff; } .logo-stop-b { stop-color: #3b2fc0; }
nav { display: flex; gap: var(--sp-1); min-width: 0; }
nav a { color: var(--swz-muted); text-decoration: none; font-weight: 600; padding: .4rem .8rem; border-radius: 2rem; white-space: nowrap; transition: background-color .2s var(--ease), color .2s var(--ease); }
nav a:hover { color: var(--swz-text); background: color-mix(in srgb, var(--swz-primary) 10%, transparent); }
nav a[aria-current="page"] { color: var(--swz-primary); background: color-mix(in srgb, var(--swz-primary) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--swz-primary) 30%, transparent); }
.icon-button { width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 50%; color: var(--swz-muted); }
.icon-button:hover { color: var(--swz-primary); }
.icon-button > span:not(.sr-only) { display: inline-flex; }
.theme-moon { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-sun { display: none !important; } :root:not([data-theme="light"]) .theme-moon { display: inline-flex !important; } }
:root[data-theme="dark"] .theme-sun { display: none !important; }
:root[data-theme="dark"] .theme-moon { display: inline-flex !important; }
:root[data-theme="light"] .theme-sun { display: inline-flex !important; }
:root[data-theme="light"] .theme-moon { display: none !important; }
.icon-button:active .icon { transform: rotate(25deg); }
.icon-button .icon { transition: transform .3s var(--ease); }

/* Type */
.eyebrow { font-size: .75rem; font-weight: 750; letter-spacing: .14em; color: var(--swz-primary); margin: 0; }
h1, h2, h3 { word-spacing: normal; font-kerning: normal; text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 6.5vw, 4.6rem); line-height: 1.1; font-weight: 750; letter-spacing: -.015em; word-spacing: .05em; white-space: pre-line; margin: var(--sp-4) 0 var(--sp-5); max-width: 850px; }
h2 { font-size: clamp(1.65rem, 3vw, 2.3rem); line-height: 1.2; font-weight: 750; letter-spacing: -.01em; word-spacing: .04em; margin: .6rem 0; }
h3 { font-size: 1.45rem; letter-spacing: -.01em; margin: var(--sp-2) 0 0; }
.lead { max-width: 720px; color: var(--swz-muted); font-size: clamp(1.05rem, 2vw, 1.25rem); margin: 0; }
.muted { color: var(--swz-muted); }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; margin: var(--sp-5) 0; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--sp-6); align-items: center; padding: clamp(2.5rem, 7vw, 5rem) 0 var(--sp-7); }
.features { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; margin-top: var(--sp-6); font-size: .85rem; color: var(--swz-muted); }
.features span::before { content: ""; display: inline-block; width: .45rem; height: .45rem; margin-right: .5rem; border-radius: 50%; background: var(--swz-accent); }
.hero-art { padding: var(--sp-4); border: 1px solid var(--swz-border); border-radius: calc(var(--radius) * 1.4); background: color-mix(in srgb, var(--swz-card) 80%, transparent); box-shadow: var(--swz-shadow); }

/* Connection diagram */
.diagram { width: 100%; height: auto; display: block; }
.dg-box { fill: var(--swz-card); stroke: var(--swz-border); stroke-width: 1.5; }
.dg-line, .dg-block { fill: color-mix(in srgb, var(--swz-muted) 28%, transparent); }
.dg-line-accent { fill: var(--swz-primary); opacity: .85; }
.dg-dot { fill: color-mix(in srgb, var(--swz-muted) 45%, transparent); }
.dg-block-live { fill: color-mix(in srgb, var(--swz-accent) 40%, transparent); animation: dg-update 3.2s ease-in-out infinite; }
.dg-wire { fill: none; stroke: var(--swz-primary); stroke-width: 2; stroke-dasharray: 3 7; stroke-linecap: round; opacity: .55; animation: dg-flow 1.2s linear infinite; }
.dg-packet { fill: var(--swz-primary); transform-box: fill-box; }
.dg-packet-out { animation: dg-out 3.2s var(--ease) infinite; }
.dg-packet-back { fill: var(--swz-accent); animation: dg-back 3.2s var(--ease) infinite 1.6s; }
.dg-label { fill: var(--swz-text); font: 700 15px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.dg-label-accent { fill: var(--swz-primary); font-size: 14px; letter-spacing: .02em; }
.dg-caption { fill: var(--swz-muted); font: 12px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
@keyframes dg-flow { to { stroke-dashoffset: -20; } }
@keyframes dg-out { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; } 55% { transform: translateX(148px); opacity: 1; } 62%, 100% { transform: translateX(148px); opacity: 0; } }
@keyframes dg-back { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; } 55% { transform: translateX(-148px); opacity: 1; } 62%, 100% { transform: translateX(-148px); opacity: 0; } }
@keyframes dg-update { 0%, 52% { opacity: .5; } 60% { opacity: 1; } 100% { opacity: .5; } }

/* Cards */
.card { background: var(--swz-card); border: 1px solid var(--swz-border); border-radius: var(--radius); box-shadow: var(--swz-shadow); padding: var(--sp-4); }
.card-large { padding: var(--sp-5); }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); margin: var(--sp-6) 0; }
.mode-card { display: flex; flex-direction: column; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease); }
.mode-card:hover { transform: translateY(-4px); box-shadow: var(--swz-shadow-lift); border-color: color-mix(in srgb, var(--swz-primary) 45%, var(--swz-border)); }
.mode-card-live { border-color: color-mix(in srgb, var(--swz-primary) 40%, var(--swz-border)); }
.mode-card p { margin: var(--sp-2) 0 0; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.mode-icon { display: inline-flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; border-radius: .85rem; color: var(--swz-primary); background: color-mix(in srgb, var(--swz-primary) 12%, transparent); }
.mode-number { display: block; margin-top: var(--sp-4); color: var(--swz-muted); font-family: ui-monospace, monospace; font-size: .8rem; }
.badge { border: 1px solid var(--swz-border); border-radius: 2rem; padding: .15rem .7rem; font-size: .72rem; font-weight: 600; color: var(--swz-muted); }
.badge-live { color: var(--swz-ok); border-color: color-mix(in srgb, var(--swz-ok) 45%, var(--swz-border)); background: color-mix(in srgb, var(--swz-ok) 10%, transparent); }
.subtitle { margin-top: .15rem; font-weight: 600; }
.mode-link { display: inline-flex; align-items: center; gap: .35rem; margin-top: auto; padding-top: var(--sp-4); font-size: .9rem; font-weight: 600; }

/* Live deployments: every row is the same two-column grid (name | status), also on phones. */
.status-section { padding: var(--sp-6) 0 var(--sp-8); }
#demo-status { border: 1px solid var(--swz-border); border-radius: var(--radius); overflow: hidden; margin-top: var(--sp-5); background: var(--swz-card); box-shadow: var(--swz-shadow); }
.status-row { display: grid; grid-template-columns: minmax(7.5rem, 11rem) 1fr; align-items: center; gap: var(--sp-3); min-height: 3.5rem; padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--swz-border); }
.status-row:last-child { border: 0; }
.status-name { display: inline-flex; align-items: center; gap: var(--sp-3); font-weight: 600; color: var(--swz-text); text-decoration: none; }
.status-name:hover { color: var(--swz-primary); }
.status-name::before { content: ""; width: .6rem; height: .6rem; flex: none; border-radius: 50%; background: var(--swz-muted); opacity: .5; }
.status-row[data-state="online"] .status-name::before { background: var(--swz-ok); opacity: 1; box-shadow: 0 0 0 4px color-mix(in srgb, var(--swz-ok) 22%, transparent); }
.status-row[data-state="checking"] .status-name::before { animation: pulse 1.2s ease-in-out infinite; }
.status-row[data-state="down"] .status-name::before { background: var(--swz-warn); opacity: 1; }
.status-detail { color: var(--swz-muted); font-family: ui-monospace, monospace; font-size: .8rem; overflow-wrap: anywhere; }
@keyframes pulse { 50% { opacity: .2; } }
.status-section { padding-top: var(--sp-6); }

/* Pages */
.page { padding: var(--sp-7) 0 var(--sp-8); }
.page h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
.page > .card { max-width: 720px; margin-top: var(--sp-6); }
.count { display: inline-block; font-size: 3rem; font-weight: 750; line-height: 1.2; letter-spacing: -.02em; margin: var(--sp-1) var(--sp-3) var(--sp-1) 0; vertical-align: middle; font-variant-numeric: tabular-nums; }
.count.bump { animation: bump .35s var(--ease); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.1); color: var(--swz-primary); } 100% { transform: scale(1); } }
.live-badge { display: inline-flex; align-items: center; gap: .45rem; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--swz-ok); }
.live-badge::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
.site-footer { display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; padding: var(--sp-5) 0 var(--sp-6); border-top: 1px solid var(--swz-border); font-size: .8rem; color: var(--swz-muted); }
.site-footer p { margin: 0; }

/* Entrance: cascade only the first screenful; later patches never re-run it. */
.hero-copy > *, .hero-art, .page > *, .mode-card, .status-section > * { animation: rise .6s var(--ease) both; }
.hero-copy > :nth-child(2) { animation-delay: .05s; } .hero-copy > :nth-child(3) { animation-delay: .1s; }
.hero-copy > :nth-child(4) { animation-delay: .15s; } .hero-copy > :nth-child(5) { animation-delay: .2s; }
.hero-art { animation-delay: .15s; }
.mode-card:nth-child(2) { animation-delay: .08s; } .mode-card:nth-child(3) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Connecting state: the static copy in index.html and the server-rendered twin
   share these rules, so nothing jumps when the circuit takes over. */
.boot { padding: clamp(2.5rem, 7vw, 5rem) 0 var(--sp-7); min-height: 24rem; }
.boot-shell { max-width: 1160px; margin: auto; padding: 0 clamp(1.1rem, 4vw, 3rem); min-height: 100dvh; display: flex; flex-direction: column; }
.boot-bar { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) 0; border-bottom: 1px solid var(--swz-border); min-height: 4.4rem; }
.boot-bar .sk-dot { margin-left: auto; }
.sk { height: 1rem; border-radius: .5rem; margin-bottom: var(--sp-3); max-width: 720px;
  background: linear-gradient(100deg, color-mix(in srgb, var(--swz-muted) 14%, transparent) 30%, color-mix(in srgb, var(--swz-muted) 28%, transparent) 50%, color-mix(in srgb, var(--swz-muted) 14%, transparent) 70%);
  background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.sk-eyebrow { width: 9rem; height: .8rem; margin-bottom: var(--sp-4); }
.sk-title { height: clamp(2.2rem, 6vw, 4rem); border-radius: .8rem; max-width: 640px; margin-bottom: var(--sp-3); }
.sk-short { width: 60%; }
.sk-text { margin-top: var(--sp-4); }
.sk-logo { width: 28px; height: 28px; flex: none; margin: 0; border-radius: .55rem; }
.sk-pill { width: 4.6rem; height: 1.6rem; margin: 0; border-radius: 2rem; flex: none; }
.sk-dot { width: 2.5rem; height: 2.5rem; flex: none; margin: 0; border-radius: 50%; }
.boot-note { display: inline-flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-5); color: var(--swz-muted); font-size: .9rem; }
.boot-note::before { content: ""; width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--swz-primary) 25%, transparent); border-top-color: var(--swz-primary); animation: spin .8s linear infinite; }
@keyframes shimmer { to { background-position: -300% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.skip-link { position: absolute; left: 1rem; top: -100px; padding: .5rem; background: var(--swz-card); z-index: 10; }
.skip-link:focus { top: 1rem; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: var(--sp-5); }
  .hero-art { order: 2; }
}
@media (max-width: 760px) {
  .mode-grid { grid-template-columns: 1fr; gap: var(--sp-4); }
  .site-header { position: static; grid-template-columns: 1fr auto; row-gap: var(--sp-2); padding: var(--sp-3) 0 var(--sp-2); }
  .brand { font-size: 1.25rem; }
  .site-header nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--sp-4) * -1); padding: 0 var(--sp-4); }
  .site-header nav::-webkit-scrollbar { display: none; }
  .status-row { grid-template-columns: 1fr; gap: var(--sp-1); }
  .boot-bar { min-height: 3.75rem; }
  .boot-bar .sk-pill { display: none; }
  .actions .button-link { flex: 1 1 100%; }
  .count { font-size: clamp(1.9rem, 8.5vw, 2.6rem); }
}

/* Tabs page. The runtime emits the .swz-tab-* DOM for TabManager, so these rules mirror
   the CLI template's framework CSS, written in the demo's tokens (light and dark). */
.tabs-card { padding: var(--sp-5) var(--sp-5) var(--sp-4); }
.tab-strip { min-height: 2.75rem; box-shadow: inset 0 -1px 0 var(--swz-border); }
.swz-tab-manager { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--swz-border) transparent; }
.swz-tab-btn { display: flex; align-items: center; gap: .4rem; padding: .6rem .95rem; border: 0; border-bottom: 2px solid transparent; border-radius: .6rem .6rem 0 0; background: transparent; color: var(--swz-muted); box-shadow: none; font-size: .95rem; font-weight: 600; white-space: nowrap; transition: color .15s, border-color .15s, background-color .15s; }
.swz-tab-btn:hover { color: var(--swz-text); background: color-mix(in srgb, var(--swz-primary) 8%, transparent); transform: none; box-shadow: none; }
.swz-tab-btn:active { transform: none; box-shadow: none; }
.swz-tab-btn:focus-visible { outline-offset: -3px; }
.swz-tab-btn.active { color: var(--swz-primary); border-bottom-color: var(--swz-primary); }
.swz-tab-reorderable .swz-tab-btn { touch-action: pan-x pan-y pinch-zoom; user-select: none; flex-shrink: 0; cursor: grab; }
.swz-tab-btn.swz-tab-dragging { z-index: 1000; cursor: grabbing; transition: none; color: var(--swz-text); background: var(--swz-card); border-radius: .6rem; box-shadow: var(--swz-shadow-lift); }
.swz-tab-drop-indicator { flex-shrink: 0; box-sizing: border-box; border: 2px dashed var(--swz-primary); border-radius: .6rem; background: color-mix(in srgb, var(--swz-primary) 8%, transparent); }
.swz-tab-announcement { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.swz-tab-icon { font-size: 14px; }
.swz-tab-close { font-size: 16px; opacity: 0; padding: 0 2px; cursor: pointer; transition: opacity 150ms; }
.swz-tab-btn:hover .swz-tab-close { opacity: .6; }
.swz-tab-close:hover { opacity: 1; }
.tab-panel { padding-top: var(--sp-5); }
.tab-panel h3 { margin: var(--sp-1) 0 0; }
.tab-panel .muted { margin: var(--sp-2) 0 0; font-size: .95rem; }
.tab-hint { margin: var(--sp-5) 0 0; font-size: .85rem; }
.tab-order { display: flex; flex-wrap: wrap; gap: var(--sp-2); list-style: none; margin: var(--sp-4) 0 0; padding: 0; }
.tab-order li { display: inline-flex; align-items: center; gap: var(--sp-2); padding: .3rem .9rem .3rem .3rem; border: 1px solid var(--swz-border); border-radius: 2rem; background: var(--swz-bg-2); font-weight: 600; font-size: .95rem; }
.tab-rank { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: color-mix(in srgb, var(--swz-primary) 16%, transparent); color: var(--swz-primary); font-size: .8rem; font-variant-numeric: tabular-nums; }
.tab-readout-title { font-weight: 700; }
.tab-readout-count { color: var(--swz-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .tabs-card { padding: var(--sp-3) var(--sp-3) var(--sp-4); }
  .swz-tab-btn { padding: .55rem .7rem; font-size: .9rem; }
  .tab-panel { padding-top: var(--sp-4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .dg-packet { display: none; }
  .sk { animation: none; }
  .boot-note::before { animation: none; border-top-color: var(--swz-primary); }
}
