/*
  tweakcn-compatible shadcn/ui theme tokens.
  These variables can be replaced directly with CSS exported from tweakcn.
*/
:root {
  color-scheme: light;
  --background: 0 0% 99%;
  --foreground: 224 71% 4%;
  --card: 0 0% 100%;
  --card-foreground: 224 71% 4%;
  --popover: 0 0% 100%;
  --popover-foreground: 224 71% 4%;
  --primary: 199 89% 34%;
  --primary-foreground: 0 0% 100%;
  --secondary: 155 44% 92%;
  --secondary-foreground: 157 64% 16%;
  --muted: 220 14% 96%;
  --muted-foreground: 220 9% 39%;
  --accent: 38 92% 58%;
  --accent-foreground: 24 10% 10%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 100%;
  --border: 220 13% 88%;
  --input: 220 13% 88%;
  --ring: 199 89% 34%;
  --sidebar: 222 47% 11%;
  --sidebar-foreground: 210 40% 96%;
  --sidebar-muted: 215 20% 65%;
  --sidebar-accent: 199 89% 34%;
  --sidebar-border: 215 28% 22%;
  --stable: 158 64% 38%;
  --beta: 268 66% 48%;
  --radius: 8px;
  --shadow: 0 18px 42px hsl(220 43% 11% / 0.08);
}

[data-resolved-theme="dark"] {
  color-scheme: dark;
  --background: 224 33% 8%;
  --foreground: 210 40% 96%;
  --card: 224 30% 12%;
  --card-foreground: 210 40% 96%;
  --popover: 224 30% 12%;
  --popover-foreground: 210 40% 96%;
  --primary: 193 91% 55%;
  --primary-foreground: 224 71% 4%;
  --secondary: 158 42% 18%;
  --secondary-foreground: 154 64% 88%;
  --muted: 223 24% 17%;
  --muted-foreground: 215 20% 72%;
  --accent: 42 94% 62%;
  --accent-foreground: 24 10% 10%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 100%;
  --border: 221 22% 22%;
  --input: 221 22% 22%;
  --ring: 193 91% 55%;
  --sidebar: 225 42% 6%;
  --sidebar-foreground: 210 40% 96%;
  --sidebar-muted: 215 20% 70%;
  --sidebar-accent: 193 91% 55%;
  --sidebar-border: 221 22% 18%;
  --stable: 154 64% 52%;
  --beta: 271 91% 65%;
  --shadow: 0 18px 42px hsl(0 0% 0% / 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, hsl(var(--secondary) / 0.5), transparent 26rem),
    hsl(var(--background));
  color: hsl(var(--foreground));
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

button {
  font: inherit;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  border-radius: var(--radius);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.65rem 0.9rem;
  text-decoration: none;
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 1rem;
}

.layout {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: hsl(var(--sidebar));
  color: hsl(var(--sidebar-foreground));
  border-right: 1px solid hsl(var(--sidebar-border));
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: var(--radius);
  background: hsl(var(--sidebar-accent));
  color: hsl(var(--primary-foreground));
  font-weight: 800;
}

.brand h1,
.topbar h2,
.section h2,
.hero h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 1.02rem;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: hsl(var(--sidebar-muted));
}

.nav {
  display: grid;
  gap: 0.25rem;
}

.nav a {
  border-radius: var(--radius);
  color: hsl(var(--sidebar-muted));
  padding: 0.62rem 0.72rem;
  text-decoration: none;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.nav a:hover,
.nav a.active {
  background: hsl(var(--sidebar-accent) / 0.18);
  color: hsl(var(--sidebar-foreground));
}

.sidebar-note {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid hsl(var(--sidebar-border));
  border-radius: var(--radius);
  color: hsl(var(--sidebar-muted));
  padding: 0.75rem;
  font-size: 0.85rem;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: hsl(var(--stable));
  box-shadow: 0 0 0 4px hsl(var(--stable) / 0.16);
}

.content {
  min-width: 0;
  padding: 1.4rem clamp(1rem, 4vw, 3.5rem) 4rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  min-height: 4.8rem;
  padding: 0.75rem 0;
  background: hsl(var(--background) / 0.88);
  backdrop-filter: blur(16px);
}

.topbar h2 {
  font-size: clamp(1.05rem, 2vw, 1.32rem);
}

.theme-switcher {
  display: inline-flex;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  border-radius: var(--radius);
  padding: 0.25rem;
  box-shadow: var(--shadow);
}

.theme-switcher button,
.icon-button,
.code-title button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
}

.theme-switcher button {
  gap: 0.42rem;
  min-height: 2rem;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: hsl(var(--muted-foreground));
  padding: 0.35rem 0.62rem;
}

.theme-switcher button.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.theme-switcher svg,
.icon-button svg,
.button svg,
.card svg,
.code-title svg,
.callout svg,
.check-list svg,
.architecture svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(20rem, 0.75fr);
  gap: 1rem;
  align-items: stretch;
  min-height: 29rem;
  padding: clamp(1.2rem, 3vw, 2.2rem) 0 1.6rem;
}

.hero-copy,
.hero-panel,
.card,
.table-wrap,
.endpoint-list,
.code-card,
.callout,
.check-list,
.repo-tree {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.3rem, 4vw, 3rem);
}

.hero h2 {
  max-width: 48rem;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 1.02;
}

.hero p {
  max-width: 48rem;
  margin: 1rem 0 0;
  color: hsl(var(--muted-foreground));
  font-size: clamp(1rem, 1.4vw, 1.15rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.6rem;
  border-radius: var(--radius);
  padding: 0.62rem 0.95rem;
  text-decoration: none;
  font-weight: 700;
}

.button.primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.button.secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.2rem;
}

.panel-row {
  display: grid;
  gap: 0.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem;
  background: hsl(var(--muted) / 0.55);
}

.pill {
  width: max-content;
  border-radius: 999px;
  padding: 0.18rem 0.58rem;
  font-size: 0.75rem;
  font-weight: 800;
}

.pill.stable {
  background: hsl(var(--stable) / 0.14);
  color: hsl(var(--stable));
}

.pill.beta {
  background: hsl(var(--beta) / 0.15);
  color: hsl(var(--beta));
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.metric-strip div {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.85rem;
}

.metric-value,
.metric-label {
  display: block;
}

.metric-value {
  color: hsl(var(--primary));
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
}

.metric-label {
  margin-top: 0.25rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
}

.section {
  scroll-margin-top: 6rem;
  padding-top: 2.4rem;
}

.section-heading {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.section h2 {
  font-size: clamp(1.45rem, 2.6vw, 2.25rem);
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.platform-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  padding: 1.1rem;
}

.card svg {
  color: hsl(var(--primary));
}

.card h3 {
  margin: 0.75rem 0 0.45rem;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  color: hsl(var(--muted-foreground));
}

.architecture {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  padding: clamp(1rem, 3vw, 1.8rem);
  box-shadow: var(--shadow);
}

.node {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  width: min(100%, 26rem);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--muted) / 0.45);
  padding: 1rem;
  text-align: center;
}

.node span {
  color: hsl(var(--muted-foreground));
  font-size: 0.9rem;
}

.nginx {
  background: hsl(var(--primary) / 0.11);
}

.connector {
  width: 2px;
  height: 1.4rem;
  background: hsl(var(--border));
}

.split-lines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(100%, 32rem);
  gap: 1rem;
}

.split-lines span {
  height: 1.3rem;
  border-top: 2px solid hsl(var(--border));
  border-left: 2px solid hsl(var(--border));
  border-right: 2px solid hsl(var(--border));
}

.instances {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: min(100%, 42rem);
}

.stable-node {
  border-color: hsl(var(--stable) / 0.45);
}

.beta-node {
  border-color: hsl(var(--beta) / 0.45);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 46rem;
}

th,
td {
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.9rem 1rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: hsl(var(--muted) / 0.6);
  font-size: 0.82rem;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

code {
  border: 1px solid hsl(var(--border));
  border-radius: 0.35rem;
  background: hsl(var(--muted));
  padding: 0.08rem 0.25rem;
  font-size: 0.9em;
}

.endpoint-list {
  display: grid;
}

.endpoint-list div {
  display: grid;
  grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.85rem 1rem;
}

.endpoint-list div:last-child {
  border-bottom: 0;
}

.endpoint-list span {
  color: hsl(var(--muted-foreground));
}

.code-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.pipeline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2rem minmax(0, 1fr) 2rem minmax(0, 1fr) 2rem minmax(0, 1fr) 2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: stretch;
}

.pipeline-step {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: var(--shadow);
  padding: 1rem;
}

.pipeline-step svg {
  width: 1rem;
  height: 1rem;
  color: hsl(var(--primary));
}

.pipeline-step span {
  color: hsl(var(--muted-foreground));
}

.pipeline-arrow {
  position: relative;
  min-height: 100%;
}

.pipeline-arrow::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  right: 0.15rem;
  top: 50%;
  height: 2px;
  background: hsl(var(--border));
}

.pipeline-arrow::after {
  content: "";
  position: absolute;
  right: 0.1rem;
  top: calc(50% - 0.27rem);
  width: 0.52rem;
  height: 0.52rem;
  border-top: 2px solid hsl(var(--border));
  border-right: 2px solid hsl(var(--border));
  transform: rotate(45deg);
}

.code-card {
  overflow: hidden;
}

.code-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.75rem 0.9rem;
  font-weight: 700;
}

.code-title button {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.code-title button.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

pre {
  margin: 0;
  overflow-x: auto;
  padding: 1rem;
}

pre code {
  border: 0;
  background: transparent;
  padding: 0;
}

.callout {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-top: 1rem;
  padding: 1rem;
}

.callout svg {
  color: hsl(var(--primary));
  margin-top: 0.25rem;
}

.callout p {
  margin: 0;
}

.check-list {
  display: grid;
}

.check-list div {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.9rem 1rem;
}

.check-list div:last-child {
  border-bottom: 0;
}

.check-list svg {
  color: hsl(var(--primary));
  margin-top: 0.2rem;
}

.timeline {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding-left: 1.2rem;
}

.timeline li {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: var(--shadow);
  padding: 0.85rem 1rem;
}

.ownership-table {
  margin-top: 1rem;
}

.repo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.repo-tree {
  overflow-x: auto;
}

.mobile-only,
.backdrop {
  display: none;
}

.icon-button {
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
}

@media (max-width: 980px) {
  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(19rem, calc(100vw - 3rem));
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: hsl(224 71% 4% / 0.48);
  }

  .mobile-only {
    display: inline-flex;
  }

  .hero,
  .grid.two,
  .platform-flow,
  .code-grid,
  .instances {
    grid-template-columns: 1fr;
  }

  .repo-grid {
    grid-template-columns: 1fr;
  }

  .pipeline {
    grid-template-columns: 1fr;
  }

  .pipeline-arrow {
    min-height: 1.6rem;
  }

  .pipeline-arrow::before {
    left: 50%;
    right: auto;
    top: 0;
    bottom: 0;
    width: 2px;
    height: auto;
  }

  .pipeline-arrow::after {
    left: calc(50% - 0.25rem);
    right: auto;
    top: auto;
    bottom: 0.1rem;
    transform: rotate(135deg);
  }

  .topbar {
    align-items: flex-start;
  }

  .theme-switcher span {
    display: none;
  }

  .endpoint-list div {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .content {
    padding-inline: 0.9rem;
  }

  .topbar {
    gap: 0.65rem;
  }

  .hero {
    min-height: auto;
  }

  .hero-copy,
  .hero-panel {
    padding: 1rem;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }
}
