/* Ylide website. Colours and type follow docs/design.md: cold cryostat blue,
   qubit cyan for the AI, brass for what is physical and local. */

@font-face {
  font-family: 'Instrument Sans';
  src: url(/assets/fonts/instrument-sans-latin.woff2) format('woff2-variations');
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url(/assets/fonts/instrument-sans-latin-ext.woff2) format('woff2-variations');
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url(/assets/fonts/jetbrains-mono-latin.woff2) format('woff2-variations');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #0c111b;
  --bg-2: #111726;
  --bg-3: #18202f;
  --line: #273246;
  --text: #e7ecf4;
  --text-2: #9aa6bb;
  --text-3: #808ca6;
  --qubit: #22d3ee;
  --brass: #c9a66b;
  --frost: #e6ecf5;
  --add: #3dd68c;
  --del: #f47067;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --wrap: 1240px;
  --gutter: 32px;
  --tube: clamp(110px, 15vw, 220px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* Instrument Sans covers Latin only; other scripts get the best system font
   for them. Latin words inside (Ylide, GPU names) keep Instrument Sans. */
:root:lang(zh) {
  --sans: 'Instrument Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans SC', 'Source Han Sans SC', sans-serif;
}
:root:lang(ja) {
  --sans: 'Instrument Sans', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo UI', 'Noto Sans JP', sans-serif;
}
:root:lang(ko) {
  --sans: 'Instrument Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
}
:root:lang(hi) {
  --sans: 'Instrument Sans', 'Kohinoor Devanagari', 'Nirmala UI', 'Mangal', 'Noto Sans Devanagari', sans-serif;
}
:root:lang(ar) {
  --sans: 'Instrument Sans', 'Geeza Pro', 'Segoe UI', 'Noto Sans Arabic', Tahoma, sans-serif;
}
:root:lang(ru) {
  --sans: 'Instrument Sans', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

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

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.88em;
}

code {
  color: var(--text);
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--text);
  text-align: center;
  line-height: 1.5;
}

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

/* The world lines are drawn on one fixed canvas behind the content. */
.braid {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

main,
.top,
.foot {
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------------ header */

.top {
  position: absolute;
  top: var(--suggest-h, 0px);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 24px var(--gutter);
  z-index: 2;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand svg {
  width: 26px;
  height: 26px;
}

/* What the name spells out; English in every language, like the name. */
.brand .slogan {
  padding-inline-start: 12px;
  border-inline-start: 1px solid var(--line);
  color: var(--text-3);
  font-weight: 400;
  font-size: 0.875rem;
  letter-spacing: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.9375rem;
}

.nav-link {
  color: var(--text-2);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text);
}

/* Language menu: a native disclosure, so it works without script. */
.lang-menu {
  position: relative;
}

.lang-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
}

.lang-menu summary::-webkit-details-marker {
  display: none;
}

.lang-menu summary:hover,
.lang-menu[open] summary {
  color: var(--text);
}

.lang-menu svg {
  width: 16px;
  height: 16px;
}

.lang-menu ul {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 10px);
  z-index: 5;
  display: grid;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.lang-menu a {
  display: block;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--text-2);
  text-decoration: none;
}

.lang-menu a:hover {
  background: var(--bg-3);
  color: var(--text);
}

.lang-menu a[aria-current] {
  color: var(--qubit);
}

/* Offer of the visitor's own language, shown by site.js. */
.lang-suggest {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 10px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 0.9375rem;
}

.lang-suggest a {
  color: var(--qubit);
}

.lang-suggest button {
  border: none;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}

/* ------------------------------------------------------------ buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 6px;
  background: var(--qubit);
  color: #03222b;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 150ms ease, transform 150ms ease;
}

.button:hover {
  background: #5ce1f3;
}

.button:active {
  transform: translateY(1px);
}

.button.small {
  padding: 8px 14px;
  font-size: 0.875rem;
}

.button.large {
  padding: 18px 32px;
  font-size: 1.125rem;
}

/* ------------------------------------------------------------ type */

h1,
h2 {
  margin: 0;
  font-weight: 620;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.75rem, 6.2vw, 6rem);
  font-stretch: 82%;
  line-height: 0.96;
  max-width: 13ch;
}

h2 {
  font-size: clamp(2.125rem, 4.2vw, 3.75rem);
  font-stretch: 85%;
  line-height: 1;
  max-width: 13ch;
}

p {
  margin: 0;
  color: var(--text-2);
  max-width: 34rem;
  text-wrap: pretty;
}

:root:is(:lang(zh), :lang(ja), :lang(ko), :lang(hi), :lang(ar)) :is(h1, h2) {
  letter-spacing: 0;
  line-height: 1.18;
}

:root:is(:lang(zh), :lang(ja), :lang(ko)) :is(h1, h2) {
  max-width: 12em;
}

:root:lang(ja) :is(h1, h2, p) {
  word-break: auto-phrase;
}

:root:lang(ko) :is(h1, h2, p) {
  word-break: keep-all;
}

:root:is(:lang(hi), :lang(ar)) body {
  line-height: 1.75;
}

.lead {
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  line-height: 1.55;
}

.meta {
  color: var(--text-3);
  font-size: 0.875rem;
}

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

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 128px 0 72px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: center;
  gap: 48px;
}

.hero-text {
  display: grid;
  gap: 28px;
}

.cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin-top: 8px;
}

.cta .meta {
  max-width: 26rem;
}

.hero-mark-wrap {
  display: flex;
  justify-content: center;
}

.hero-mark {
  display: block;
  width: clamp(200px, 25vw, 360px);
  height: auto;
}

.hero-mark path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.intro .hero-mark path {
  animation: draw 1300ms cubic-bezier(0.6, 0, 0.2, 1) both;
}

.intro .hero-mark path + path {
  animation-delay: 180ms;
}

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }
}

/* ------------------------------------------------------------ showcase */

.showcase {
  padding: 4vh 0 16vh;
  perspective: 1800px;
}

.showcase-figure {
  margin: 0;
}

.showcase-window {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.55);
  transform-origin: 50% 100%;
  will-change: transform;
}

.showcase-window img {
  display: block;
  width: 100%;
  height: auto;
}

.showcase figcaption {
  margin-top: 20px;
  color: var(--text-3);
  font-size: 0.9375rem;
  text-align: center;
}

/* ------------------------------------------------------------ features */

.feature {
  padding: 22vh 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--tube) minmax(0, 1fr);
  align-items: center;
}

.feature-text {
  grid-column: 1;
  display: grid;
  gap: 24px;
  align-content: start;
}

.feature-visual {
  grid-column: 3;
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
}

.chat {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.msg p {
  color: var(--text);
  font-size: 0.9375rem;
  max-width: none;
}

.msg-user {
  justify-self: end;
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg-3);
}

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--text-3);
  font-size: 0.8125rem;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-qubit {
  background: var(--qubit);
}

.stats {
  display: block;
  margin-top: 10px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.diff {
  overflow: hidden;
}

.diff-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 0.9375rem;
}

.kbd-hint {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--qubit);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.code {
  margin: 0;
  padding: 16px 0;
  overflow-x: auto;
  color: var(--text-2);
  font-size: clamp(0.6875rem, 1.05vw, 0.8125rem);
  line-height: 1.75;
}

.code > code {
  display: block;
  min-width: max-content;
  color: inherit;
  font-size: inherit;
}

.code .ln {
  display: inline-block;
  width: 2.5em;
  padding-left: 1em;
  color: var(--text-3);
  user-select: none;
}

.code .del,
.code .add {
  display: block;
}

.code .del {
  background: rgba(244, 112, 103, 0.09);
  color: #f6a29b;
}

.code .add {
  background: rgba(61, 214, 140, 0.09);
  color: #8be8b8;
}

.code .del .ln {
  color: var(--del);
}

.code .add .ln {
  color: var(--add);
}

.diff-actions {
  display: flex;
  gap: 8px;
  padding: 0 18px 18px;
}

.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text-2);
  font-size: 0.8125rem;
}

.chip-accept {
  border-color: transparent;
  background: var(--qubit);
  color: #03222b;
  font-weight: 600;
}

/* ------------------------------------------------------------ agents */

/* Tall section with a pinned view: scrolling through it plays the run. */
.agents {
  position: relative;
  height: 360vh;
}

.agents-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 18px;
  height: 2px;
  border-radius: 1px;
}

.swatch-qubit {
  background: var(--qubit);
}

.swatch-brass {
  background: var(--brass);
}

.swatch-frost {
  background: var(--frost);
}

.steps {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  gap: 4px;
  padding-block: 14px;
  padding-inline: 18px 0;
  border-inline-start: 2px solid var(--line);
  color: var(--text-3);
  font-size: 1rem;
  transition: color 250ms ease, border-color 250ms ease, opacity 250ms ease;
  opacity: 0.55;
}

.steps li.is-active {
  color: var(--text);
  opacity: 1;
}

.steps li.is-done {
  opacity: 0.8;
}

.steps li.is-active:has(.role-qubit) {
  border-color: var(--qubit);
}

.steps li.is-active:has(.role-brass) {
  border-color: var(--brass);
}

.steps li.is-active:has(.role-frost) {
  border-color: var(--frost);
}

.role {
  font-family: var(--mono);
  font-size: 0.75rem;
}

.role-qubit {
  color: var(--qubit);
}

.role-brass {
  color: var(--brass);
}

.role-frost {
  color: var(--frost);
}

/* ------------------------------------------------------------ setup */

/* Pinned like the agents section: scrolling through it pages through the
   five setup screens. The window spans the gap and the visual column; the
   world lines move into a narrow lane on its left meanwhile (site.js). */
.setup {
  position: relative;
  height: 440vh;
}

.setup-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
}

.setup .feature-text {
  gap: 20px;
}

.setup-steps {
  display: grid;
  gap: 2px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.setup-steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  color: var(--text-3);
  opacity: 0.6;
  transition: opacity 250ms ease, color 250ms ease;
}

.setup-steps li.is-active {
  color: var(--text-2);
  opacity: 1;
}

.setup-steps li.is-active strong {
  color: var(--text);
}

.setup-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 0.75rem;
  transform: translateY(-1px);
}

.setup-steps li.is-active .setup-num {
  border-color: var(--qubit);
  color: var(--qubit);
}

.setup-steps li.is-done .setup-num {
  border-color: transparent;
  background: rgba(34, 211, 238, 0.16);
  color: var(--qubit);
}

.setup-copy strong {
  color: var(--text-2);
  font-weight: 600;
}

.setup-figure {
  grid-column: 2 / 4;
  margin: 0;
  margin-inline-start: 84px;
  min-width: 0;
}

.window {
  position: relative;
  aspect-ratio: 1424 / 995;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left top;
  opacity: 0;
  will-change: opacity, transform;
}

.shot:first-child {
  opacity: 1;
}

.setup-figure .note {
  margin-top: 14px;
}

/* ------------------------------------------------------------ privacy */

.gates {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.gates li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.gate-name {
  color: var(--text);
}

.host {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.switch {
  position: relative;
  width: 30px;
  height: 18px;
  border-radius: 9px;
  background: rgba(34, 211, 238, 0.22);
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--qubit);
}

/* ------------------------------------------------------------ finale */

.finale {
  padding: 26vh 0 28vh;
}

.finale-inner {
  display: grid;
  justify-items: center;
  gap: 24px;
  text-align: center;
}

.finale h2 {
  max-width: 16ch;
}

.finale p {
  max-width: 36rem;
}

.finale .button {
  margin-top: 28px;
}

/* ------------------------------------------------------------ legal pages */

.legal {
  max-width: 760px;
  padding-top: 160px;
  padding-bottom: 120px;
}

.legal h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: 28px;
}

.legal h2 {
  margin: 48px 0 12px;
  font-size: 1.5rem;
  font-stretch: 100%;
  letter-spacing: -0.015em;
  max-width: none;
}

.legal p,
.legal address {
  max-width: none;
  color: var(--text-2);
  font-style: normal;
}

.legal .missing {
  padding: 16px 18px;
  border: 1px solid var(--brass);
  border-radius: 8px;
  color: var(--brass);
}

/* ------------------------------------------------------------ footer */

.foot {
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-3);
  font-size: 0.875rem;
}

.foot-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 28px;
  padding-bottom: 28px;
}

.foot-links {
  display: flex;
  gap: 22px;
}

.foot-links a {
  text-decoration: none;
}

.foot-links a:hover {
  color: var(--text);
}

/* ------------------------------------------------------------ small screens */

@media (max-width: 760px) {
  :root {
    --gutter: 20px;
  }

  /* The world lines run down the left edge; content keeps clear of them. */
  .home main .wrap {
    padding-inline-start: 60px;
  }

  .nav-link,
  .brand .slogan {
    display: none;
  }

  .nav {
    gap: 16px;
  }

  .hero {
    min-height: 0;
    padding: 112px 0 40px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 56px;
  }

  .hero-mark-wrap {
    justify-content: flex-start;
  }

  .hero-mark {
    width: 132px;
  }

  .feature {
    padding: 14vh 0;
  }

  .feature-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }

  .feature-visual {
    grid-column: 1;
  }

  .agents {
    height: 300vh;
  }

  .setup {
    height: 340vh;
  }

  .setup-pin {
    height: auto;
    min-height: 100vh;
    padding: 64px 0;
  }

  .setup .feature-text p {
    display: none;
  }

  .setup-steps li {
    padding: 4px 0;
  }

  .setup-steps .setup-copy {
    font-size: 0.875rem;
  }

  .setup-figure {
    grid-column: 1;
    margin-inline-start: 0;
  }

  .agents-pin {
    height: auto;
    min-height: 100vh;
    padding: 72px 0;
  }

  .agents .feature-grid {
    gap: 24px;
  }

  .steps li {
    padding-block: 10px;
    padding-inline: 14px 0;
    font-size: 0.9375rem;
  }

  .finale-inner {
    justify-items: start;
    text-align: start;
  }

  .foot-row {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .button,
  .steps li {
    transition: none;
  }
}
