/* ============================================================
   TabShift product page — page-scoped styles
   Palette derives from the subject: seeing structure in a
   tangled system. Deep blue-black ground, brand green lifted
   for dark surfaces, three signal colors that ARE the product's
   recommendation states (never decoration).
   ============================================================ */

:root {
  --ts-ground: #0E1721;
  --ts-surface: #16212D;
  --ts-surface-raised: #1C2938;
  --ts-rule: #24333F;
  --ts-text: #F2F5F4;
  --ts-muted: #8CA0AE;
  --ts-accent: #2FBF7E;
  --ts-accent-dim: #1F8A5C;

  /* Signal colors = recommendation states. Used only where a
     Migrate / Review / Retire state appears. */
  --ts-migrate: #2FBF7E;
  --ts-review: #E0A030;
  --ts-retire: #D9636B;

  /* Node types (architectural, distinct from signals) */
  --ts-node-database: #8CA0AE;
  --ts-node-flow: #45B8C8;
  --ts-node-datasource: #4E8FD0;
  --ts-node-workbook: #9B8CE0;
  --ts-node-view: #5E7286;

  --ts-display: 'Bricolage Grotesque', 'Avenir Next', 'Helvetica Neue', sans-serif;
  --ts-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ts-mono: 'IBM Plex Mono', 'SF Mono', Menlo, monospace;

  --ts-max: 1120px;
  --ts-rail: 92px;
}

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

html { scroll-behavior: smooth; }

body.ts-page {
  background: var(--ts-ground);
  color: var(--ts-text);
  font-family: var(--ts-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.ts-page ::selection { background: rgba(47, 191, 126, 0.28); }

.ts-page a { color: var(--ts-accent); text-decoration: none; }
.ts-page a:hover { text-decoration: underline; }

.ts-page :focus-visible {
  outline: 2px solid var(--ts-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.ts-skip-link {
  position: absolute; left: 1rem; top: -3rem;
  z-index: 200; padding: 0.5rem 1rem;
  background: var(--ts-accent); color: #06281A;
  font-family: var(--ts-mono); font-size: 0.85rem;
  border-radius: 4px; transition: top 150ms ease;
}
.ts-skip-link:focus { top: 1rem; text-decoration: none; }

/* ---------- top bar ---------- */

.ts-topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--ts-max); margin: 0 auto;
  padding: 1.25rem 1.5rem;
}
.ts-topbar .ts-home {
  font-family: var(--ts-mono); font-size: 0.85rem; color: var(--ts-muted);
}
.ts-topbar .ts-home:hover { color: var(--ts-text); text-decoration: none; }
.ts-wordmark {
  font-family: var(--ts-display); font-weight: 700; font-size: 1.15rem;
  letter-spacing: 0.01em; color: var(--ts-text);
}
.ts-wordmark .ts-shift { color: var(--ts-accent); }

/* ---------- stage spine (left rail) ---------- */

.ts-spine {
  position: fixed; top: 0; bottom: 0; left: 0;
  width: var(--ts-rail);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  pointer-events: none;
}
.ts-spine-inner { position: relative; height: 62vh; pointer-events: auto; }
.ts-spine-track {
  position: absolute; left: 10px; top: 0; bottom: 0;
  width: 2px; background: var(--ts-rule); border-radius: 1px;
}
.ts-spine-fill {
  position: absolute; left: 10px; top: 0;
  width: 2px; height: 0; background: var(--ts-accent); border-radius: 1px;
  transition: height 120ms linear;
}
.ts-spine-stage {
  position: absolute; left: 0;
  display: flex; align-items: center; gap: 0.55rem;
  background: none; border: 0; cursor: pointer;
  color: var(--ts-muted);
  font-family: var(--ts-mono); font-size: 0.68rem; letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateY(-50%);
  padding: 0.2rem 0;
}
.ts-spine-stage .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ts-ground);
  border: 2px solid var(--ts-rule);
  flex: none;
  transition: border-color 200ms ease, background 200ms ease;
}
.ts-spine-stage.lit { color: var(--ts-text); }
.ts-spine-stage.lit .dot { border-color: var(--ts-accent); background: var(--ts-accent); }
.ts-spine-stage:hover { color: var(--ts-text); }

/* ---------- layout shell ---------- */

.ts-main { display: block; }
.ts-section {
  max-width: var(--ts-max);
  margin: 0 auto;
  padding: 5.5rem 1.5rem;
}
.ts-eyebrow {
  font-family: var(--ts-mono); font-size: 0.78rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ts-accent);
  margin-bottom: 1rem;
}
.ts-section > h2 {
  font-family: var(--ts-display); font-weight: 700;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  line-height: 1.15; letter-spacing: -0.01em;
  margin-bottom: 1rem;
  max-width: 22ch;
}
.ts-section .ts-lede {
  color: var(--ts-muted); max-width: 58ch; margin-bottom: 2.5rem;
}

/* ---------- hero ---------- */

.ts-hero { padding-top: 4.5rem; padding-bottom: 4rem; }
.ts-hero h1 {
  font-family: var(--ts-display); font-weight: 800;
  font-size: clamp(2.1rem, 5.6vw, 3.9rem);
  line-height: 1.06; letter-spacing: -0.02em;
  max-width: 18ch;
  margin: 0.75rem 0 1.5rem;
}
.ts-hero h1 em {
  font-style: normal; color: var(--ts-accent);
}
.ts-hero .ts-sub {
  font-size: 1.15rem; color: var(--ts-muted);
  max-width: 54ch; margin-bottom: 1.75rem;
}
.ts-hero .ts-sub strong { color: var(--ts-text); font-weight: 600; }

.ts-badges {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  list-style: none; margin: 0 0 2.25rem;
}
.ts-badges li {
  font-family: var(--ts-mono); font-size: 0.78rem;
  color: var(--ts-muted);
  border: 1px solid var(--ts-rule); border-radius: 999px;
  padding: 0.3rem 0.8rem;
}
.ts-badges li.ts-badge-key { color: var(--ts-accent); border-color: var(--ts-accent-dim); }

/* .ts-page prefix beats the `.ts-page a` color rule's specificity */
.ts-page .ts-cta {
  display: inline-block;
  background: var(--ts-accent); color: #06281A;
  font-family: var(--ts-display); font-weight: 700; font-size: 1.05rem;
  padding: 0.85rem 1.7rem; border-radius: 6px;
  transition: transform 150ms ease, background 150ms ease;
}
.ts-page .ts-cta:hover { background: #3ACD8C; text-decoration: none; transform: translateY(-1px); }
.ts-cta-note {
  display: block; margin-top: 0.8rem;
  font-family: var(--ts-mono); font-size: 0.8rem; color: var(--ts-muted);
}

/* ---------- demo ---------- */

.ts-demo { padding-top: 3rem; }

.ts-estate-stats {
  display: flex; flex-wrap: wrap; gap: 2.25rem;
  margin-bottom: 1.5rem;
}
.ts-estate-stats .stat { font-family: var(--ts-mono); }
.ts-estate-stats .stat b {
  display: block; font-size: 1.45rem; font-weight: 500; color: var(--ts-text);
}
.ts-estate-stats .stat span {
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ts-muted);
}
.ts-estate-stats .stat.sig-migrate b { color: var(--ts-migrate); }
.ts-estate-stats .stat.sig-review b { color: var(--ts-review); }
.ts-estate-stats .stat.sig-retire b { color: var(--ts-retire); }

.ts-graph-shell {
  position: relative;
  background: var(--ts-surface);
  border: 1px solid var(--ts-rule);
  border-radius: 10px;
  overflow: hidden;
}
.ts-graph-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--ts-rule);
}
.ts-graph-toolbar input[type="search"] {
  flex: 1 1 220px; min-width: 0; max-width: 320px;
  background: var(--ts-ground); color: var(--ts-text);
  border: 1px solid var(--ts-rule); border-radius: 6px;
  font-family: var(--ts-mono); font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
}
.ts-graph-toolbar input[type="search"]::placeholder { color: var(--ts-muted); }
.ts-btn {
  background: none; border: 1px solid var(--ts-rule); border-radius: 6px;
  color: var(--ts-muted); cursor: pointer;
  font-family: var(--ts-mono); font-size: 0.8rem;
  padding: 0.45rem 0.8rem;
  transition: color 150ms ease, border-color 150ms ease;
}
.ts-btn:hover { color: var(--ts-text); border-color: var(--ts-muted); }
.ts-btn[aria-pressed="true"] { color: var(--ts-accent); border-color: var(--ts-accent-dim); }

.ts-legend {
  display: flex; flex-wrap: wrap; gap: 0.85rem;
  list-style: none; margin-left: auto;
  font-family: var(--ts-mono); font-size: 0.72rem; color: var(--ts-muted);
}
.ts-legend li { display: flex; align-items: center; gap: 0.4rem; }
.ts-legend .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.swatch.t-database { background: var(--ts-node-database); }
.swatch.t-flow { background: var(--ts-node-flow); }
.swatch.t-datasource { background: var(--ts-node-datasource); }
.swatch.t-workbook { background: var(--ts-node-workbook); }
.swatch.t-view { background: var(--ts-node-view); }

.ts-graph-viewport { position: relative; }
#ts-graph {
  width: 100%; height: 560px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(69, 184, 200, 0.05), transparent 55%),
    var(--ts-surface);
}
.ts-graph-hint {
  position: absolute; left: 1rem; bottom: 0.85rem;
  font-family: var(--ts-mono); font-size: 0.72rem; color: var(--ts-muted);
  pointer-events: none;
}

/* asset detail panel */
.ts-panel {
  position: absolute; top: 1rem; right: 1rem;
  width: min(330px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow-y: auto;
  background: var(--ts-surface-raised);
  border: 1px solid var(--ts-rule); border-radius: 8px;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.ts-panel[hidden] { display: none; }
.ts-panel-close {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: none; border: 0; color: var(--ts-muted); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 0.35rem 0.5rem;
}
.ts-panel-close:hover { color: var(--ts-text); }
.ts-panel .p-type {
  font-family: var(--ts-mono); font-size: 0.7rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ts-muted);
}
.ts-panel .p-name {
  font-family: var(--ts-mono); font-size: 1rem; font-weight: 500;
  margin: 0.3rem 0 0.15rem; padding-right: 1.25rem; overflow-wrap: anywhere;
}
.ts-panel .p-project { font-size: 0.85rem; color: var(--ts-muted); margin-bottom: 0.9rem; }

.ts-scoreline { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.9rem; }
.ts-scoreline .p-score {
  font-family: var(--ts-mono); font-size: 2rem; font-weight: 500; line-height: 1;
}
.ts-scoreline .p-score small { font-size: 0.85rem; color: var(--ts-muted); font-weight: 400; }

.ts-chip {
  font-family: var(--ts-mono); font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.22rem 0.65rem; border-radius: 999px;
  border: 1px solid;
}
.ts-chip.sig-migrate { color: var(--ts-migrate); border-color: var(--ts-migrate); background: rgba(47, 191, 126, 0.1); }
.ts-chip.sig-review  { color: var(--ts-review);  border-color: var(--ts-review);  background: rgba(224, 160, 48, 0.1); }
.ts-chip.sig-retire  { color: var(--ts-retire);  border-color: var(--ts-retire);  background: rgba(217, 99, 107, 0.1); }

.ts-dims { list-style: none; margin-bottom: 0.9rem; }
.ts-dims li { margin-bottom: 0.5rem; }
.ts-dims .d-row {
  display: flex; justify-content: space-between;
  font-family: var(--ts-mono); font-size: 0.72rem; color: var(--ts-muted);
  margin-bottom: 0.2rem;
}
.ts-dims .d-row b { color: var(--ts-text); font-weight: 500; }
.ts-dims .d-track {
  height: 4px; border-radius: 2px; background: var(--ts-rule); overflow: hidden;
}
.ts-dims .d-bar {
  height: 100%; width: 0; border-radius: 2px; background: var(--ts-muted);
  transition: width 400ms ease;
}
.ts-panel .p-rationale { font-size: 0.9rem; color: var(--ts-text); line-height: 1.55; }
.ts-panel .p-blast {
  margin-top: 0.9rem; padding-top: 0.9rem;
  border-top: 1px solid var(--ts-rule);
  font-size: 0.9rem; line-height: 1.55;
}
.ts-panel .p-blast b { color: var(--ts-retire); }

/* fallback / accessible asset list */
.ts-asset-list { margin-top: 1.25rem; }
.ts-asset-list[hidden] { display: none; }
.ts-asset-list .ts-table-scroll {
  overflow-x: auto; border: 1px solid var(--ts-rule); border-radius: 8px;
}
.ts-asset-list table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem; min-width: 720px;
}
.ts-asset-list caption {
  text-align: left; font-family: var(--ts-mono); font-size: 0.78rem;
  color: var(--ts-muted); padding: 0.75rem 1rem;
}
.ts-asset-list th, .ts-asset-list td {
  text-align: left; padding: 0.55rem 1rem;
  border-top: 1px solid var(--ts-rule);
  vertical-align: top;
}
.ts-asset-list th {
  font-family: var(--ts-mono); font-size: 0.7rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ts-muted); font-weight: 500;
}
.ts-asset-list td.mono, .ts-asset-list td .name { font-family: var(--ts-mono); font-size: 0.82rem; }
.ts-asset-list td.score { font-family: var(--ts-mono); text-align: right; }
.ts-asset-list td .ts-chip { font-size: 0.62rem; padding: 0.15rem 0.5rem; }
.ts-asset-list td.rationale { color: var(--ts-muted); min-width: 260px; }

.ts-demo-footnote {
  margin-top: 1.25rem;
  font-family: var(--ts-mono); font-size: 0.8rem; color: var(--ts-muted);
}

/* ---------- pipeline ---------- */

.ts-pipeline-row {
  position: relative;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem;
  margin: 3rem 0 0;
}
.ts-pipeline-connector {
  position: absolute; left: 0; right: 0; top: 17px;
  width: 100%; height: 2px; overflow: visible; pointer-events: none;
}
.ts-pipeline-connector line {
  stroke: var(--ts-rule); stroke-width: 2;
}
.ts-pipeline-connector line.draw {
  stroke: var(--ts-accent);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.no-js .ts-pipeline-connector line.draw { stroke-dashoffset: 0; }
.ts-stage {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  background: none; border: 0; cursor: pointer;
  color: var(--ts-muted); font-family: var(--ts-mono);
  font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0; opacity: 0; transform: translateY(6px);
  transition: opacity 350ms ease, transform 350ms ease, color 150ms ease;
}
.ts-stage .stage-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ts-ground);
  border: 2px solid var(--ts-rule);
  font-size: 0.72rem; color: var(--ts-muted);
  transition: border-color 200ms ease, color 200ms ease;
}
.ts-stage.revealed { opacity: 1; transform: none; }
.ts-stage:hover, .ts-stage[aria-expanded="true"] { color: var(--ts-text); }
.ts-stage[aria-expanded="true"] .stage-dot {
  border-color: var(--ts-accent); color: var(--ts-accent);
}
.ts-stage-panels { margin-top: 1.75rem; }
.ts-stage-panel {
  background: var(--ts-surface);
  border: 1px solid var(--ts-rule); border-left: 3px solid var(--ts-accent);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  max-width: 62ch;
}
.ts-stage-panel[hidden] { display: none; }
.ts-stage-panel h3 {
  font-family: var(--ts-display); font-size: 1.05rem; font-weight: 700;
  margin-bottom: 0.4rem;
}
.ts-stage-panel p { font-size: 0.95rem; color: var(--ts-muted); }
.ts-stage-panel p strong { color: var(--ts-text); font-weight: 600; }

/* reduced-motion / no-JS default: stages visible */
.no-js .ts-stage, .reduced-motion .ts-stage { opacity: 1; transform: none; }

/* ---------- captures (GIF slots) ---------- */

/* Stacked full-width so the screen recordings render near native size */
.ts-captures-grid {
  display: grid; grid-template-columns: 1fr; gap: 2.5rem;
}
.ts-captures-grid figure {
  background: var(--ts-surface);
  border: 1px solid var(--ts-rule); border-radius: 8px;
  overflow: hidden;
}
.ts-captures-grid .frame {
  aspect-ratio: 1548 / 720; width: 100%;
  background: var(--ts-ground);
}
.ts-captures-grid img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.ts-captures-grid figcaption {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 1.25rem;
  padding: 1rem 1.25rem;
  font-size: 0.9rem; color: var(--ts-muted); line-height: 1.5;
}
.ts-captures-grid figcaption b {
  color: var(--ts-text); font-weight: 600;
  font-family: var(--ts-mono); font-size: 0.82rem;
  flex: none;
}

/* ---------- proof ---------- */

.ts-proof-list { list-style: none; max-width: 62ch; }
.ts-proof-list li {
  padding: 1.2rem 0 1.2rem 1.4rem;
  border-left: 2px solid var(--ts-rule);
  position: relative;
}
.ts-proof-list li::before {
  content: ""; position: absolute; left: -5px; top: 1.75rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ts-accent);
}
.ts-proof-list b {
  display: block; font-family: var(--ts-mono); font-size: 0.85rem;
  font-weight: 500; margin-bottom: 0.25rem;
}
.ts-proof-list p { font-size: 0.95rem; color: var(--ts-muted); }
.ts-proof-list p strong { color: var(--ts-text); font-weight: 600; }

/* ---------- close ---------- */

.ts-close { text-align: center; padding-bottom: 4rem; }
.ts-close h2 { margin-left: auto; margin-right: auto; }
.ts-close .ts-lede { margin-left: auto; margin-right: auto; }
.ts-smallprint {
  margin-top: 3rem;
  font-family: var(--ts-mono); font-size: 0.78rem; color: var(--ts-muted);
}
.ts-smallprint a { color: var(--ts-muted); text-decoration: underline; }
.ts-smallprint a:hover { color: var(--ts-text); }

/* ---------- responsive ---------- */

@media (max-width: 1279px) {
  .ts-spine { display: none; }
}
@media (min-width: 1280px) {
  .ts-topbar, .ts-section { padding-left: calc(var(--ts-rail) + 0.5rem); }
}

@media (max-width: 900px) {
  #ts-graph { height: 460px; }
  .ts-legend { margin-left: 0; }
}

@media (max-width: 640px) {
  .ts-section { padding: 3.5rem 1.1rem; }
  #ts-graph { height: 400px; }
  .ts-panel {
    position: static; width: auto; max-height: none;
    border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0;
    box-shadow: none;
  }
  .ts-pipeline-row {
    grid-template-columns: 1fr; gap: 1rem; justify-items: start;
  }
  .ts-pipeline-connector { display: none; }
  .ts-stage { flex-direction: row; }
  .ts-stage .stage-dot { width: 30px; height: 30px; font-size: 0.65rem; }
  .ts-estate-stats { gap: 1.4rem; }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ts-page *, .ts-page *::before, .ts-page *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ts-stage { opacity: 1; transform: none; }
}
