/* Shared light palette: text tokens pass 4.5:1 on both page surfaces. */
:root {
  color-scheme: light;
  --bg: #F4F8F7;
  --panel: #FFFFFF;
  --text: #102432;
  --muted: #506574;
  --accent: #075E56;
  --green: #087F72;
  --pending: #946200;
  --line: #CBD8DB;
}

/* Document, typography and keyboard navigation. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  background-image:
    linear-gradient(rgb(8 127 114 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(8 127 114 / 4%) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--text);
  font: 16px/1.75 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
}

a {
  display: inline-block;
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding-block: 0.5rem;
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

a:focus-visible,
summary:focus-visible,
#motion-toggle:focus-visible,
#motion-toggle:focus-visible + .motion-control {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -100px;
}

.skip:focus {
  top: 8px;
  z-index: 2;
  padding: 0.5rem 1rem;
  background: var(--panel);
}

h1 {
  margin: 1.25rem 0;
  font-size: clamp(2.5rem, 4.8vw, 4rem);
  line-height: 1.15;
  letter-spacing: normal;
}

h2 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1.3;
  letter-spacing: normal;
}

h3 {
  margin: 0 0 0.625rem;
  font-size: 1.125rem;
  line-height: 1.5;
}

p {
  margin: 0 0 1rem;
}

/* Header accepts flow, capabilities and install links in either locale. */
header,
main,
footer {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 32px;
}

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 1.5rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  min-width: 0;
}

nav a {
  color: var(--text);
  font-size: 0.875rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 40px;
  height: 40px;
}

/* Hero and host badges; the adjacent diagram is an illustration, never live status. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 2rem;
  padding-block: 2.5rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lead {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.08rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.75rem;
}

.button,
.button:hover {
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--panel);
  font-weight: 700;
  text-decoration: none;
}

.button:hover {
  text-decoration: underline;
}

.hosts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.hosts li {
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  font-size: 0.875rem;
  font-weight: 600;
}

.terminal,
.workflow-illustration {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  background: var(--panel);
}

.terminal-head {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  border-radius: 0.875rem 0.875rem 0 0;
  background: var(--bg);
  color: var(--muted);
  font: 0.75rem/1.6 ui-monospace, monospace;
}

.terminal-body {
  padding: 1.5rem;
}

.terminal-body .prompt {
  color: var(--green);
  font: 0.875rem/1.8 ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.tag {
  flex-shrink: 0;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.version {
  margin-top: 1.25rem;
  color: var(--muted);
  font: 0.75rem/1.75 ui-monospace, monospace;
}

/* Native checkbox controls every animation in its following canvas, without JS. */
.workflow-illustration {
  padding: 1.25rem;
  box-shadow: 0 12px 40px #1822300D;
}

.diagram-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

#motion-toggle {
  width: 20px;
  height: 20px;
  margin: 0 0.5rem 0 0;
  vertical-align: middle;
  accent-color: var(--accent);
  cursor: pointer;
}

.motion-control {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  max-width: calc(100% - 36px);
  vertical-align: middle;
  color: var(--muted);
  font-size: 0.8125rem;
  cursor: pointer;
  border-radius: 0.25rem;
}

.workflow-canvas {
  min-width: 0;
  margin-top: 0.5rem;
}

.request-node {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  column-gap: 0.75rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 0.625rem;
  background: var(--bg);
}

.diagram-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.request-node .prompt {
  margin: 0.25rem 0 0;
  color: var(--green);
  font: 0.875rem/1.65 ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.request-node .diagram-icon {
  grid-row: span 2;
  width: 40px;
  height: 40px;
}

.diagram-ticket {
  margin: 0.875rem 0;
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
}

.diagram-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 1rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-canvas .diagram-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 0.375rem;
  border: 2px solid var(--line);
  border-radius: 0.75rem;
  background: var(--panel);
  text-align: center;
  animation: diagram-emphasis 24s ease-in-out infinite;
}

.diagram-node b {
  font-size: 0.875rem;
  line-height: 1.4;
}

.diagram-icon {
  width: 56px;
  height: 56px;
  max-width: 100%;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.diagram-number {
  color: var(--muted);
  font: 0.75rem/1.4 ui-monospace, monospace;
}

/* Only connect neighbors on the same row. Numbers preserve row-major reading. */
.diagram-node::after {
  content: "→";
  position: absolute;
  inset-inline-end: -1.375rem;
  top: 42%;
  color: var(--muted);
  font-size: 1rem;
}

.diagram-node:nth-child(3n)::after {
  content: none;
}

.diagram-delivery {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--green);
  border-radius: 0.625rem;
  color: var(--green);
  font-weight: 700;
}

.diagram-delivery svg {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.workflow-canvas .node-1 { animation-delay: 0s; }
.workflow-canvas .node-2 { animation-delay: 4s; }
.workflow-canvas .node-3 { animation-delay: 8s; }
.workflow-canvas .node-4 { animation-delay: 12s; }
.workflow-canvas .node-5 { animation-delay: 16s; }
.workflow-canvas .node-6 { animation-delay: 20s; }

/* A single gentle emphasis per node, with no opacity or text changes. */
@keyframes diagram-emphasis {
  0%, 16%, 100% {
    border-color: var(--line);
    transform: none;
    box-shadow: none;
  }
  4%, 12% {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px #4F46E51A;
  }
}

#motion-toggle:not(:checked) ~ .workflow-canvas,
#motion-toggle:not(:checked) ~ .workflow-canvas::before,
#motion-toggle:not(:checked) ~ .workflow-canvas::after,
#motion-toggle:not(:checked) ~ .workflow-canvas *,
#motion-toggle:not(:checked) ~ .workflow-canvas *::before,
#motion-toggle:not(:checked) ~ .workflow-canvas *::after {
  animation-play-state: paused !important;
}

/* Section and grid primitives: items shrink instead of expanding the page. */
.section {
  padding-block: 2.5rem;
  border-top: 1px solid var(--line);
}

.guide-page {
  max-width: 860px;
  padding-block: 2.5rem 4rem;
}

.guide-page article > .lead {
  max-width: 72ch;
}

.guide-section {
  padding-block: 1.75rem;
  border-top: 1px solid var(--line);
}

.guide-section h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
}

.grid,
.stage-grid,
.optional-grid,
.scenes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.stage-grid {
  align-items: start;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

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

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

.hero > *,
.flow > *,
.grid > *,
.stage-grid > *,
.optional-grid > *,
.scenes > *,
.delivery-grid > *,
.install-grid > *,
.examples > *,
.diagram-stages > * {
  min-width: 0;
}

.install-grid > div {
  min-width: 0;
}

.card,
.examples article {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--panel);
}

.card p,
.note {
  color: var(--muted);
  font-size: 0.875rem;
}

.card,
.stage,
.terminal {
  box-shadow: 0 2px 8px #18223008;
}

/* The six scenes and four deliverables lead with local SVG artwork. */
.scene-art,
.delivery-icon {
  display: block;
  width: 80px;
  height: 80px;
  max-width: 100%;
  margin-bottom: 0.875rem;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.delivery-icon {
  width: 48px;
  height: 48px;
}

.scenes {
  align-items: start;
}

.delivery-grid h3 {
  margin-bottom: 0;
}

.pending .delivery-icon {
  color: var(--pending);
}

.workflow-details,
.optional-details,
.delivery-details,
.install-note-details,
.updates-details {
  min-width: 0;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--panel);
}

.workflow-details > :not(summary),
.optional-details > :not(summary),
.delivery-details > :not(summary),
.install-note-details > :not(summary),
.updates-details > :not(summary) {
  margin-inline: 1rem;
  margin-bottom: 1rem;
}

.pending {
  border-top: 3px solid var(--pending);
}

.pending h3 {
  color: var(--pending);
}

/* Six compact overview cells, separate from the expandable stage reference. */
.flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: stage;
}

.flow li {
  padding: 1rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  font-size: 0.875rem;
  counter-increment: stage;
}

.flow li::before {
  display: block;
  margin-bottom: 0.375rem;
  color: var(--accent);
  font: 0.75rem/1.75 ui-monospace, monospace;
  content: "0" counter(stage);
}

/* Native summary retains its keyboard behavior and disclosure marker. */
summary {
  display: list-item;
  min-width: 44px;
  min-height: 44px;
  padding: 0.75rem;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

summary::marker {
  color: var(--accent);
}

summary:hover {
  color: var(--accent);
}

.stage,
.principles,
.more-examples {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--panel);
}

.stage summary {
  padding: 1rem;
}

.step-number {
  display: inline-block;
  margin-inline-end: 0.5rem;
  color: var(--accent);
  font: 0.8125rem/1.75 ui-monospace, monospace;
}

.stage summary strong {
  font-size: 1rem;
}

.stage summary code {
  display: block;
  margin-top: 0.375rem;
  color: var(--muted);
  font-size: 0.8125rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.stage-body {
  padding: 1.25rem;
  border-top: 1px solid var(--line);
}

.stage-body p {
  color: var(--muted);
  font-size: 0.875rem;
}

.stage-body dl {
  margin: 0;
  font-size: 0.875rem;
}

.stage-body dt {
  font-weight: 700;
}

.stage-body dd {
  margin: 0.25rem 0 1rem;
  color: var(--muted);
}

.stage-body a {
  font-size: 0.875rem;
}

.scenes details {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}

.principles,
.more-examples {
  margin-top: 1.5rem;
}

.principles .grid,
.more-examples .examples {
  padding: 1.25rem;
  border-top: 1px solid var(--line);
}

.principles > h3,
.more-examples > .note {
  padding-inline: 1.25rem;
}

/* Commands wrap in cards; installation scripts scroll within their pre only. */
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  margin: 1rem 0;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  color: var(--text);
  overflow-x: auto;
  font: 0.8125rem/1.9 ui-monospace, SFMono-Regular, Consolas, monospace;
}

pre code {
  white-space: pre;
  overflow-wrap: normal;
}

.example-command,
.examples code {
  display: block;
  color: var(--green);
  font-size: 0.8125rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Boundary notes, reviewed updates and footer. */
.boundary {
  margin-top: 1.75rem;
  padding: 1.25rem;
  border-left: 3px solid var(--accent);
  background: var(--panel);
}

.update {
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.update time {
  margin-inline-start: 1rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

footer {
  padding-block: 2rem 2.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

footer a {
  margin-inline-end: 1rem;
}

/* Tablet: two reference columns; navigation wraps without clipping. */
@media (max-width: 850px) {
  header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding-block: 2rem;
  }

  .grid,
  .stage-grid,
  .optional-grid,
  .scenes,
  .delivery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

/* Phone: single columns and a numbered vertical overview timeline. */
@media (max-width: 520px) {
  header,
  main,
  footer {
    padding-inline: 20px;
  }

  .grid,
  .stage-grid,
  .optional-grid,
  .scenes,
  .delivery-grid,
  .examples,
  .flow {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .workflow-illustration {
    padding: 0.875rem;
  }

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

  .diagram-node:nth-child(3n)::after {
    content: "→";
  }

  .diagram-node:nth-child(2n)::after {
    content: none;
  }

  .flow {
    gap: 0;
  }

  .flow li {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 0;
    border-inline-start: 2px solid var(--line);
    border-radius: 0;
    background: none;
  }

  .flow li::before {
    margin-bottom: 0;
  }

  .card,
  .examples article,
  .terminal-body {
    padding: 1.25rem;
  }

  .section {
    padding-block: 2.25rem;
  }
}

/* Reduced motion is fully static regardless of the checkbox state. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto !important;
  }
}
