/* Orthos Robotics site styles.
   Palette from the pitch deck: black, white, cool greys, one signal blue. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
  font-weight: 500 700;
  font-display: swap;
}

:root {
  --ink: #000000;
  --paper: #ffffff;
  --mist: #f2f3f5;
  --rule: #dadde2;
  --slate: #5a606a;
  --signal: #2f6bff;
  --dark-text: #a3a9b3;
  --dark-rule: #2a2d33;
  --dark-panel: #0d0e10;

  /* Names used by the API reference page */
  --black: var(--ink);
  --teal: var(--signal);
  --border: var(--rule);
  --grey: var(--mist);
  --text: var(--ink);

  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --wrap: 1200px;
  --gutter: clamp(20px, 4vw, 48px);
  --band: clamp(72px, 10vw, 136px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.92em; }

h1, h2, h3 { margin: 0; font-weight: 700; }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 10;
  background: var(--signal); color: #fff; padding: 10px 14px; text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Type ---------- */

.display {
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(2.9rem, 5.9vw, 5.4rem);
  line-height: 0.93;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.display-2, h2 {
  font-stretch: 118%;
  font-weight: 760;
  font-size: clamp(2rem, 4.2vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h3 {
  font-stretch: 108%;
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
}
.lede { font-size: clamp(1.1rem, 1.6vw, 1.32rem); line-height: 1.5; max-width: 34em; }
.body-lg { font-size: clamp(1.08rem, 1.4vw, 1.22rem); line-height: 1.55; color: var(--slate); max-width: 36em; margin: 0; }
.section-title { max-width: 18em; margin-bottom: clamp(40px, 6vw, 72px); }

/* ---------- Buttons ---------- */

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  font-family: var(--sans); font-weight: 650; font-size: 0.98rem; font-stretch: 105%;
  text-decoration: none; border-radius: 3px; border: 1.5px solid transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn-signal { background: var(--signal); color: #fff; }
.btn-signal:hover { background: #1f57e6; }
.btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { border-color: #fff; }
.btn-line { color: var(--ink); border-color: var(--ink); }
.btn-line:hover { background: var(--ink); color: #fff; }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 0.88rem; background: var(--ink); color: #fff; }
.btn-small:hover { background: var(--signal); }

/* ---------- Header ---------- */

.site-head { border-bottom: 1px solid var(--rule); background: var(--paper); }
.site-head-row { display: flex; align-items: center; gap: 28px; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-word {
  font-stretch: 125%; font-weight: 800; font-size: 1.12rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.site-nav { display: flex; gap: 26px; margin-left: auto; font-size: 0.94rem; }
.site-nav a { text-decoration: none; color: var(--slate); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }

.site-head.is-dark { background: var(--ink); color: #fff; border-bottom-color: var(--dark-rule); }
.site-head.is-dark .site-nav a { color: var(--dark-text); }
.site-head.is-dark .site-nav a:hover { color: #fff; }
.site-head.is-dark .btn-small { background: #fff; color: var(--ink); }
.site-head.is-dark .btn-small:hover { background: var(--signal); color: #fff; }

/* ---------- Bands ---------- */

.band { padding: var(--band) 0; }
.split {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 80px); align-items: end;
}

/* ---------- Hero ---------- */

.hero { background: var(--ink); color: #fff; padding: clamp(56px, 8vw, 112px) 0 clamp(64px, 9vw, 128px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 500px);
  gap: clamp(40px, 6vw, 88px); align-items: center;
}
.hero .lede { color: var(--dark-text); margin: 28px 0 0; }

/* Console */
.console {
  margin: 0; background: var(--dark-panel); border: 1px solid var(--dark-rule);
  border-radius: 10px; overflow: hidden; color: #d9dde3;
  font-family: var(--mono); font-size: 0.78rem; line-height: 1.5;
}
.console-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--dark-rule);
}
.console-robot { color: #fff; font-weight: 600; }
.console-site { color: #6f7680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode {
  margin-left: auto; flex-shrink: 0; padding: 2px 9px; border-radius: 999px;
  border: 1px solid #555b64; color: #e6e8eb; font-size: 0.72rem;
  transition: background-color .3s ease, border-color .3s ease, color .3s ease;
}
.mode[data-mode="connecting"] { border-color: var(--signal); color: #9db8ff; }
.mode[data-mode="manual"] { background: var(--signal); border-color: var(--signal); color: #fff; }
.mode[data-mode="auto"] { border-color: #fff; color: #fff; }

.floor { width: 100%; height: auto; background: #08090a; border-bottom: 1px solid var(--dark-rule); }
.floor .racks rect { fill: #1b1e23; }
.floor .rack-ticks path { stroke: #0d0e10; stroke-width: 2; }
.floor .pallet { fill: none; stroke: #c9ced6; stroke-width: 1.5; stroke-dasharray: 3 3; }
.floor .plan { stroke: #5a606a; stroke-width: 1.5; stroke-dasharray: 4 5; fill: none; }
.floor .detour {
  stroke: var(--signal); stroke-width: 2.5; fill: none; stroke-linecap: round;
  stroke-dasharray: 160; stroke-dashoffset: 160;
}
.floor .bot circle { fill: #fff; transition: fill .3s ease; }
.floor .bot path { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.console.is-manual .floor .bot circle { fill: var(--signal); }
.console.is-manual .floor .bot path { stroke: #fff; }
.console.is-manual .floor .plan, .console.is-done .floor .plan { opacity: 0; transition: opacity .4s ease; }
.console.is-done .floor .detour { stroke-dashoffset: 0; opacity: .45; }

.log { list-style: none; margin: 0; padding: 12px 16px 6px; min-height: 13.2em; }
.log li { display: grid; grid-template-columns: 5.4em 1fr; gap: 10px; padding: 3px 0; }
.log time { color: #5f6670; }
.log code { color: #9db8ff; font-size: 1em; word-break: break-all; }
.log .log-proof span { color: #fff; }
.console.is-playing .log li { opacity: 0; transform: translateY(4px); }
.console.is-playing .log li.is-in { opacity: 1; transform: none; transition: opacity .35s ease, transform .35s ease; }

.console-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px 12px; border-top: 1px solid var(--dark-rule); color: #6f7680;
}
.replay {
  font: inherit; color: #c9ced6; background: none; border: 1px solid #3a3f47;
  border-radius: 3px; padding: 3px 10px; cursor: pointer;
}
.replay:hover { color: #fff; border-color: #fff; }
.replay[hidden] { display: none; }

/* ---------- Problem: the race ---------- */

.problem h2 { max-width: 12em; }
.race { margin-top: clamp(48px, 7vw, 88px); display: grid; gap: 18px; }
.race-row {
  display: grid; grid-template-columns: 8.5em minmax(0, 1fr) 11em;
  gap: 20px; align-items: center;
}
.race-name { font-weight: 700; font-stretch: 110%; }
.race-track { display: flex; gap: 3px; min-width: 0; }
.seg {
  display: flex; align-items: center; min-height: 52px; padding: 0 12px;
  background: var(--mist); color: var(--slate); font-size: 0.86rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg-short { flex: 1.1 1 0; }
.seg-long {
  flex: 4 1 0; color: var(--ink);
  background: repeating-linear-gradient(135deg, var(--mist) 0 9px, #e4e6ea 9px 18px);
}
.seg-end { flex: 0 0 auto; background: var(--ink); color: #fff; }
.seg:first-child { border-radius: 3px 0 0 3px; }
.seg:last-child { border-radius: 0 3px 3px 0; }
.is-orthos .race-track { width: 100%; }
.is-orthos .seg-tiny { flex: 0 0 22px; padding: 0; background: var(--signal); }
.is-orthos .seg-end { background: var(--signal); }
.is-orthos .race-name { color: var(--signal); }
.race-cost { display: flex; flex-direction: column; line-height: 1.25; }
.race-cost strong { font-stretch: 118%; font-weight: 780; font-size: 1.5rem; letter-spacing: -0.01em; }
.race-cost span { color: var(--slate); font-size: 0.9rem; }
.is-orthos .race-cost strong { color: var(--signal); }

/* ---------- Pillars ---------- */

.platform { background: var(--mist); }
.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 2px solid var(--ink); }
.pillar { padding: 28px 32px 8px 0; }
.pillar + .pillar { padding-left: 32px; border-left: 1px solid var(--rule); }
.pillar h3 { font-size: 1.45rem; margin-bottom: 14px; }
.pillar p { margin: 0; color: var(--slate); max-width: 30em; }

/* ---------- Data loop ---------- */

.loop { background: var(--ink); color: #fff; }
.loop .body-lg { color: var(--dark-text); }
.cycle {
  list-style: none; margin: clamp(88px, 10vw, 128px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  counter-reset: step; position: relative;
}
.cycle::before {
  /* the outbound track */
  content: ""; position: absolute; left: 12px; right: calc(20% - 12px); top: 11px; height: 2px; background: var(--dark-rule);
}
.cycle::after {
  /* the return path, from the last step back over the top to the first */
  content: ""; position: absolute; left: 11px; right: calc(20% - 13px); top: -34px; height: 34px;
  border: 2px solid var(--signal); border-bottom: 0; border-radius: 14px 14px 0 0;
}
.cycle li:first-child > h3::before {
  /* arrowhead where the return path meets step 1 */
  content: ""; position: absolute; left: 7px; top: -9px;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--signal);
}
.cycle li { counter-increment: step; position: relative; padding: 44px 24px 0 0; }
.cycle li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); border: 2px solid var(--signal); color: #fff;
  font-size: 0.72rem; font-weight: 700;
}
.cycle li:nth-child(3)::before, .cycle li:nth-child(4)::before { background: var(--signal); }
.cycle h3 { font-size: 1.08rem; margin-bottom: 10px; }
.cycle p { margin: 0; color: var(--dark-text); font-size: 0.95rem; }


/* ---------- Architecture ---------- */

.chain {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr) 96px minmax(0, 1fr);
  align-items: stretch;
}
.node { border: 1.5px solid var(--ink); border-radius: 6px; padding: 24px 24px 26px; }
.node:last-child { background: var(--ink); color: #fff; }
.node:last-child p, .node:last-child .node-where { color: var(--dark-text); }
.node-where { font-size: 0.88rem; color: var(--slate); margin-bottom: 18px; }
.node h3 { font-size: 1.4rem; margin-bottom: 10px; }
.node p { margin: 0; color: var(--slate); }
.link { position: relative; display: flex; align-items: center; justify-content: center; }
.link::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: repeating-linear-gradient(90deg, var(--signal) 0 6px, transparent 6px 11px);
}
.link span {
  position: relative; background: var(--paper); padding: 2px 6px;
  font-size: 0.78rem; color: var(--signal); font-weight: 600; text-align: center;
}
.fits { margin: 40px 0 0; color: var(--slate); max-width: 48em; }
.fits a { color: var(--ink); text-underline-offset: 3px; }

/* ---------- Pilot ---------- */

.pilot { border-top: 1px solid var(--rule); }
.pilot-grid {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px); align-items: end;
}
.pilot .actions { margin-top: 28px; }

/* ---------- About ---------- */

.about-head h1 { max-width: 13em; }
.prose { margin-top: clamp(36px, 5vw, 56px); max-width: 38em; font-size: 1.14rem; color: #2b2f35; }
.prose p { margin: 0 0 1.1em; }
.about-why { background: var(--mist); }

/* ---------- Footer ---------- */

.site-foot { background: var(--ink); color: var(--dark-text); padding: 56px 0 40px; font-size: 0.94rem; }
.site-foot-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px 48px; align-items: start;
}
.site-foot .brand { color: #fff; }
.foot-brand p { margin: 14px 0 0; max-width: 24em; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: flex-end; }
.foot-nav a { text-decoration: none; }
.foot-nav a:hover { color: #fff; }
.foot-legal { grid-column: 1 / -1; margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--dark-rule); font-size: 0.85rem; color: #6f7680; }

/* ---------- API reference page (kept from the old layout) ---------- */

.api-content { padding: clamp(48px, 7vw, 88px) var(--gutter); margin: 0 auto; }
.api-content h1 { font-stretch: 118%; letter-spacing: -0.02em; }

/* ---------- Responsive ---------- */

@media (max-width: 1020px) {
  .site-nav { gap: 18px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .console { max-width: 600px; }
  .chain { grid-template-columns: minmax(0, 1fr); }
  .link { height: 56px; }
  .link::before { left: 50%; right: auto; top: 0; bottom: 0; width: 2px; height: auto;
    background: repeating-linear-gradient(180deg, var(--signal) 0 6px, transparent 6px 11px); }
  .cycle { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .cycle::before { left: 11px; right: auto; top: 12px; bottom: 12px; width: 2px; height: auto; }
  .cycle::after { display: none; }
  .cycle li { padding: 0 0 0 48px; }
  .cycle li:first-child > h3::before { display: none; }
  .cycle { margin-top: 56px; }
}

@media (max-width: 860px) {
  .site-head-row { flex-wrap: wrap; height: auto; padding-top: 14px; justify-content: space-between; gap: 12px 20px; }
  .site-nav {
    order: 3; flex: 1 0 100%; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 14px;
    gap: 22px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-size: 0.9rem;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .split, .pilot-grid { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .pillars { grid-template-columns: minmax(0, 1fr); }
  .pillar, .pillar + .pillar { padding: 24px 0; border-left: 0; }
  .pillar + .pillar { border-top: 1px solid var(--rule); }
  .race-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; }
  .race-name { grid-column: 1 / -1; }
  .race-cost { text-align: right; }
  .seg { font-size: 0.78rem; padding: 0 8px; min-height: 44px; }
  .seg-short { display: none; }
  .site-foot-row { grid-template-columns: minmax(0, 1fr); }
  .foot-nav { justify-content: flex-start; }
  .endpoint { grid-template-columns: 1fr !important; }
  .endpoint-right { position: static !important; }
  .api-content table { display: block; overflow-x: auto; }
}

@media (max-width: 480px) {
  .console { font-size: 0.72rem; }
  .console-site { display: none; }
  .log li { grid-template-columns: 1fr; gap: 0; padding: 5px 0; }
  .race-row { grid-template-columns: minmax(0, 1fr); }
  .race-cost { text-align: left; flex-direction: row; gap: 10px; align-items: baseline; }
  .race-cost strong { font-size: 1.2rem; }
}
