/* hilo landing. Tokens first: if a value isn't here, it doesn't exist. */
:root {
  --blue: #0058FF;
  --blue-hover: #0046D1;
  --paper: #F3F1EE;
  --ink: #0B1230;
  --ink-soft: #4A5370;

  --sans: "Host Grotesk", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --dot: "Doto", var(--mono);

  --gutter: clamp(20px, 8.33vw, 120px);
  --pad: clamp(64px, 6.7vw, 96px);

  --ease: cubic-bezier(.16, 1, .3, 1);
  --fast: 120ms;  /* hover */
  --ui: 400ms;    /* interface */
  --art: 900ms;   /* illustration */
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font: 400 clamp(17px, 1.4vw, 20px)/1.5 var(--sans);
  letter-spacing: -.01em;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, picture, svg, canvas { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

h1, h2 { font-weight: 500; text-wrap: balance; }
h1 { font-size: clamp(44px, 5.56vw, 80px); line-height: .95; letter-spacing: -.045em; }
h2 { font-size: clamp(34px, 3.61vw, 52px); line-height: 1.02; letter-spacing: -.035em; }

section {
  padding: var(--pad) max(var(--gutter), calc(50vw - 600px));
  overflow: hidden;
  scroll-margin-top: 80px;
}
.blue { background: var(--blue); color: #fff; }
.ink { background: var(--ink); color: #fff; }
.paper p { color: var(--ink-soft); }
.blue p, .ink li { color: rgb(255 255 255 / .9); }

/* seams: where the colour changes, the section above reaches into this one and breaks into dots
   that clear, bottom row first, while the section scrolls in (--p). Without motion: a clean edge. */
section { position: relative; }
.blue + section { --above: var(--blue); }
.ink + section { --above: var(--ink); }
.paper + section { --above: var(--paper); }
:is(.blue, .ink) + section::after, .paper + :is(.blue, .ink)::after {
  content: ""; position: absolute; inset: 0 0 auto; height: var(--pad); pointer-events: none;
  background: var(--above);
  --t: calc((1 - var(--p, 1)) * 10 - .35);   /* rows the colour still reaches; a dot fills its 16px cell at 11.5px */
  --r0: clamp(-1px, var(--t) * 2.9px, 11.5px);
  --r1: clamp(-1px, (var(--t) - 1) * 2.9px, 11.5px);
  --r2: clamp(-1px, (var(--t) - 2) * 2.9px, 11.5px);
  --r3: clamp(-1px, (var(--t) - 3) * 2.9px, 11.5px);
  --r4: clamp(-1px, (var(--t) - 4) * 2.9px, 11.5px);
  --r5: clamp(-1px, (var(--t) - 5) * 2.9px, 11.5px);
  --rows:
    radial-gradient(circle, #000 var(--r0), #0000 calc(var(--r0) + .6px)) 50% 0 / 16px 16px repeat-x,
    radial-gradient(circle, #000 var(--r1), #0000 calc(var(--r1) + .6px)) 50% 16px / 16px 16px repeat-x,
    radial-gradient(circle, #000 var(--r2), #0000 calc(var(--r2) + .6px)) 50% 32px / 16px 16px repeat-x,
    radial-gradient(circle, #000 var(--r3), #0000 calc(var(--r3) + .6px)) 50% 48px / 16px 16px repeat-x,
    radial-gradient(circle, #000 var(--r4), #0000 calc(var(--r4) + .6px)) 50% 64px / 16px 16px repeat-x,
    radial-gradient(circle, #000 var(--r5), #0000 calc(var(--r5) + .6px)) 50% 80px / 16px 16px repeat-x;
  -webkit-mask: var(--rows); mask: var(--rows);
}
/* not under the hero: its halftone runs off the bottom edge, and a band of blue below it reads as the art cut short */
.hero + section::after { content: none; }

.center { text-align: center; }
.center p { max-width: 660px; margin-inline: auto; }
.center p, .copy p { margin-top: 20px; }
.data { font: 400 13px/1.5 var(--mono); letter-spacing: 0; }
.data i { font-style: normal; margin-inline: .6em; }
.m { display: none; }
.dots { font-family: var(--dot); font-weight: 900; line-height: 1; letter-spacing: -.04em; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 10;
  display: flex; align-items: center; gap: 36px;
  height: 80px; padding-inline: clamp(20px, 5.56vw, 80px);
  background: var(--blue); color: #fff;
  transition: transform 300ms var(--ease);
}
.nav.hide { transform: translateY(-100%); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; font-weight: 500; font-size: 20px; letter-spacing: -.02em; }
nav { display: flex; gap: 36px; font-size: 15px; }
nav a { position: relative; opacity: .9; transition: opacity var(--fast) ease-out; }
nav a:hover { opacity: 1; }
/* the underline is a thread of dots, laid one dot per step */
nav a::after {
  content: ""; position: absolute; inset: auto 0 -7px; height: 3px;
  background: radial-gradient(circle, currentColor 0 1px, transparent 1.5px) 0 0 / 6px 3px repeat-x;
  clip-path: inset(0 100% 0 0); transition: clip-path var(--fast) steps(6, end);
}
nav a:hover::after, nav a:focus-visible::after { clip-path: inset(0); }
.install {
  padding: 9px 16px; border-radius: 4px;
  font-weight: 500; font-size: 15px;
  background: #fff; color: var(--blue);
  transition: background var(--fast) ease-out, color var(--fast) ease-out;
}
.install:hover { background: var(--paper); color: var(--blue-hover); }

/* ---------- install command: the one CTA ---------- */
.cmd {
  position: relative; --d: .35s;
  display: inline-flex; align-items: center; gap: 24px;
  max-width: 100%; margin-top: 30px; padding: 6px 6px 6px 20px;
  border-radius: 4px; background: #fff; color: var(--ink); text-align: left;
}
.cmd code { font: 400 15px/1.4 var(--mono); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd code::before { content: "$ "; opacity: .55; }
.cmd button {
  flex: none; padding: 11px 18px; border: 0; border-radius: 2px;
  font: 500 14px/1 var(--mono);
  background: var(--blue); color: #fff; cursor: pointer;
  transition: background var(--fast) ease-out;
}
.cmd button:hover { background: var(--blue-hover); }
.cmd button.copied { background: var(--ink); }
/* copied: the command leaves along a thread of dots */
.cmd::after {
  content: ""; position: absolute; inset: auto 6px 2px 20px; height: 3px;
  background: radial-gradient(circle, var(--blue) 0 1px, transparent 1.5px) 0 0 / 6px 3px repeat-x;
  clip-path: inset(0 100% 0 0);
}
.cmd.sent::after { animation: wipe var(--ui) steps(40, end) both; }
.cmd + .data { margin-top: 14px; }

/* ---------- 1 hero ---------- */
.hero { padding-top: 112px; padding-bottom: 0; text-align: center; }
.hero .sub { max-width: 680px; margin: 30px auto 0; }
.thread { width: min(920px, 100%); aspect-ratio: 920 / 440; margin: 10px auto 0; overflow: hidden; }
.thread :is(img, canvas) { width: 100%; }

/* ---------- 2 problem ---------- */
.panes { display: grid; grid-template-columns: 1fr 80px 1fr; align-items: center; margin-top: 56px; }
.cut { color: var(--blue); }
.pane {
  min-width: 0; overflow: hidden;
  border: 1px solid var(--ink); border-radius: 4px; background: #fff; color: var(--ink);
  font: 400 12px/22px var(--mono); letter-spacing: 0; font-variant-ligatures: none;
}
.pane figcaption {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  height: 36px; padding-inline: 14px;
  background: var(--paper); border-bottom: 1px solid var(--ink);
}
.pane figcaption b { font-weight: 500; white-space: nowrap; }
.pane figcaption span { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane pre { font: inherit; padding-block: 14px; overflow-x: auto; }
.l { display: block; position: relative; padding: 0 14px 0 46px; }
.l::before { content: attr(data-n); position: absolute; left: 14px; color: var(--ink-soft); opacity: .7; }
.l i { font-style: normal; }
.l.hl { background: rgb(11 18 48 / .08); }
.l.m, .tag-m { display: none; }
.tag { position: absolute; right: 14px; font-weight: 500; }
.type { display: inline-block; vertical-align: top; }

/* ---------- 3 the figure ---------- */
.figure .dots { margin-top: 20px; font-size: clamp(112px, 14.6vw, 210px); font-weight: calc(100 + 800 * var(--p, 1)); color: var(--blue); text-align: center; }
.track {
  --dots: radial-gradient(circle, var(--blue) 0 3px, transparent 3.5px) 0 50% / 20px 100% repeat-x;
  position: relative; height: 40px; max-width: 1000px; margin: 20px auto 0;
}
.track::before, .lit { content: ""; position: absolute; inset: 0; background: var(--dots); }
.track::before { opacity: .3; }
.lit { right: auto; width: 68%; }
.packet { position: absolute; top: 50%; left: 68%; width: 16px; height: 16px; margin: -8px 0 0 -18px; border-radius: 50%; background: var(--blue); }
.machines { display: flex; justify-content: space-between; max-width: 1000px; margin: 14px auto 0; font: 400 14px/1.4 var(--mono); letter-spacing: 0; }
.machines b { display: block; font-weight: 500; color: var(--ink); }
.machines p:last-child { text-align: right; }

/* ---------- 4 the rule ---------- */
.rule { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 680px); justify-content: space-between; align-items: center; gap: 48px; }
.diagram { display: grid; grid-template-columns: 230px 100px 1fr; grid-template-rows: 84px 84px; gap: 46px 40px; }
.box {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 0 16px; border: 1.5px solid #fff; border-radius: 2px; letter-spacing: 0;
}
.box b { font: 500 13px/1.2 var(--mono); }
.box span { font: 400 12px/18px var(--mono); opacity: .9; }
.box.solid { background: #fff; color: var(--ink); }
.box.solid span { color: var(--ink-soft); opacity: 1; }
/* --d: when each box switches on. The first write leaves first, so it arrives first. */
.w1 { grid-area: 1 / 1; --d: 0s; } .w2 { grid-area: 2 / 1; --d: .12s; }
.anchor { grid-area: 1 / 2 / 3 / 3; align-items: center; --d: .45s; }
.r1 { grid-area: 1 / 3; --d: .8s; } .r2 { grid-area: 2 / 3; --d: 1.15s; }
.w1::after, .w2::after, .r1::before, .r2::before {
  content: ""; position: absolute; top: 50%; width: 40px; height: 2px; margin-top: -1px; background: #fff;
}
.w1::after, .w2::after { left: calc(100% + 1.5px); }
.r1::before, .r2::before { right: calc(100% + 1.5px); }

/* ---------- 5 branches ---------- */
.branches { padding-bottom: 64px; }
.branches :is(picture, canvas) { margin-top: 56px; }
.branches :is(img, canvas) { width: 100%; }

/* ---------- 6 setup ---------- */
.setup { text-align: center; }
.setup .dots { display: flex; justify-content: center; align-items: center; gap: .13em; margin-top: 36px; font-size: clamp(76px, 14.6vw, 210px); color: #fff; }
.cursor { width: .4em; height: .72em; background: var(--blue); }
.steps {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 38px;
  margin-top: 48px; padding: 0; list-style: none; counter-reset: step;
  text-align: left; font-size: clamp(17px, 1.25vw, 18px); line-height: 1.45;
}
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: block; margin-bottom: 10px; font: 500 14px/1.45 var(--mono); opacity: .6; }

/* ---------- 7 cloud agents ---------- */
.cloud {
  display: flex; align-items: flex-end; min-height: 760px; padding-bottom: 88px;
  image-rendering: pixelated;
}
/* the network opens from the anchor as the section scrolls in: the centre of the circle is the server in the art */
.cloud::before {
  content: ""; position: absolute; inset: 0;
  background: url(assets/network.png) 50% -40px / max(1440px, 100%) auto no-repeat;
  clip-path: circle(calc(var(--p, 1) * 100%) at calc(50% + .16 * max(1440px, 100%)) calc(.2535 * max(1440px, 100vw) - 40px));
}
.cloud .copy { position: relative; max-width: 560px; }
.art-m { display: none; }

/* ---------- 8 security ---------- */
.security { display: grid; grid-template-columns: minmax(0, 540px) minmax(0, 520px); justify-content: space-between; align-items: center; gap: 48px; }
.security code, .faq code { font: 400 .9em var(--mono); letter-spacing: 0; color: var(--ink); }
.security .data { margin-top: 24px; }

/* ---------- 9 questions: all open, nothing to click ---------- */
.faq { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 680px); justify-content: space-between; align-items: start; gap: 48px; }
.faq dl { border-bottom: 1px solid var(--ink); }
.faq dt { padding-top: 22px; border-top: 1px solid var(--ink); font-weight: 500; }
.faq dd { margin-top: 8px; padding-bottom: 26px; color: var(--ink-soft); overflow-wrap: anywhere; }

/* ---------- 10 close ---------- */
.close { padding-bottom: 0; text-align: center; }
footer { display: flex; align-items: center; gap: 32px; margin-top: 72px; padding-top: 24px; border-top: 1px solid rgb(255 255 255 / .3); text-align: left; }
footer .brand { font-size: 18px; }
footer nav { gap: 32px; }
/* "hilo" in Doto is about 2.35em wide: sized to fill the content width and bleed off the bottom */
/* its dots swell and it rises as the page reaches the end */
.wordmark span { display: block; font-weight: calc(100 + 800 * var(--p, 1)); transform: translateY(calc((1 - var(--p, 1)) * 24%)); }
.close .wordmark { height: .62em; margin-top: .04em; overflow: hidden; font-size: min(35.4vw, 510px); line-height: .8; letter-spacing: -.02em; white-space: nowrap; color: #fff; }

/* ---------- motion ----------
   Type arrives eased; anything made of dots or code moves in steps, on the grid.
   Every reveal is an animation held on its first frame until main.js adds .in,
   so each one is written once. Scrubbed pieces read --p (0 → 1), also from main.js. */
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes rise { from { transform: translateY(115%); } }
@keyframes up { from { opacity: 0; transform: translateY(16px); } }
@keyframes flick { 0% { opacity: 0; } 1%, 30% { opacity: 1; } 31%, 50% { opacity: .25; } 51%, 100% { opacity: 1; } }
@keyframes draw { from { transform: scaleX(0); } }
@keyframes snap { from { transform: translateX(var(--x)); } }
@keyframes carriage { from { transform: translateX(calc(-6ch + .24em)); } }   /* six characters back, less their tracking */
@keyframes blink { 50% { opacity: 0; } }
/* a write crosses in the first fifth of the loop, rests, then the line clears */
@keyframes travel { 0% { width: 0; } 22%, 86% { width: 100%; opacity: 1; } 100% { width: 100%; opacity: 0; } }
@keyframes ride { 0% { left: 0; } 22%, 86% { left: 100%; opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes ping { 0%, 9% { color: var(--blue); } 9.1%, 100% { color: var(--ink); } }

/* word masks: the padding keeps descenders inside the mask */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .2em; margin-bottom: -.2em; }
.w > span { display: inline-block; }

@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal]:not(.in), .js [data-reveal]:not(.in) *, .js [data-reveal]:not(.in) *::before, .js [data-reveal]:not(.in) *::after,
  .js :is(h1, h2):not(.in) ~ * { animation-play-state: paused !important; }

  /* headings rise word by word, then what follows them */
  .js :is(h1, h2):not([data-reveal]) { visibility: hidden; }   /* until main.js has split the words */
  .js .w > span { animation: rise var(--art) var(--ease) both; animation-delay: calc(var(--i) * 45ms); }
  .js :is(h1, h2) ~ :is(p, .cmd, footer):not(.dots) { animation: up var(--art) var(--ease) both; animation-delay: var(--d, .25s); }
  .js .faq h2 ~ dl { animation: up var(--art) var(--ease) .25s both; }
  .data, footer { --d: .45s; }

  /* halftones: main.js redraws each one on a canvas, dot by dot */
  .js [data-dots] { visibility: hidden; }

  /* problem: each side types the line the other never gets, then the thread parts */
  .js .type { animation: wipe 700ms steps(var(--n), end) .3s both; }
  .js :is(.tag, .tag-m) { animation: flick var(--ui) steps(1) 1s both; }
  .js .pane:last-child .type { animation-delay: 1.1s; }
  .js .pane:last-child :is(.tag, .tag-m) { animation-delay: 1.8s; }
  .js .cut path { animation: snap var(--ui) var(--ease) 2s both; }

  /* figure: writes keep crossing while the track is on screen */
  .js .track.live .lit { animation: travel 2.4s steps(50, end) infinite; }
  .js .track.live .packet { animation: ride 2.4s steps(50, end) infinite; }
  .js .track.live ~ .machines b { animation: ping 2.4s steps(1) infinite; }
  .js .track.live ~ .machines p:last-child b { animation-delay: .53s; }

  /* rule: boxes switch on in the order of the race, wires run between them */
  .js .diagram .box { animation: flick var(--ui) steps(1) var(--d) both; }
  .js .diagram .box::before, .js .diagram .box::after { transform-origin: left; animation: draw 200ms steps(5, end) both; }
  .js .diagram .box::after { animation-delay: calc(var(--d) + .25s); }
  .js .diagram .box::before { animation-delay: var(--d); }

  /* setup: the command is typed, then its output prints line by line */
  .cursor { animation: blink 1s steps(1) infinite; }
  .js .setup .big span { animation: wipe 600ms steps(6, end) .2s both; }
  .js .setup .cursor { animation: blink 1s steps(1) .8s infinite, carriage 600ms steps(6, end) .2s both; }   /* solid while it types */
  .js .steps li { animation: flick var(--ui) steps(1) both; animation-delay: calc(.5s + var(--i) * .3s); }
}

/* ---------- narrower ---------- */
@media (max-width: 1100px) {
  .panes { grid-template-columns: 1fr; justify-items: center; }
  .pane { width: 100%; max-width: 640px; }
  .cut { transform: rotate(90deg); }
  .rule { grid-template-columns: 1fr; }
  .rule .copy { max-width: 560px; }
  .faq { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 900px) {
  .nav nav { display: none; }
  .cmd { display: flex; flex-direction: column; align-items: stretch; gap: 12px; max-width: 560px; margin-inline: auto; padding: 14px; }
  .cmd code { font-size: 13px; line-height: 20px; white-space: normal; overflow-wrap: anywhere; }
  .cmd code::before { content: none; }
  .cmd button { height: 44px; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .cloud { display: block; min-height: 0; padding-top: 0; padding-bottom: 64px; }
  .cloud::before { content: none; }
  .art-m { display: block; width: min(100%, 560px); margin: 0 auto 24px; image-rendering: pixelated; clip-path: circle(calc(var(--p, 1) * 100%)); }
  .security { grid-template-columns: 1fr; }
  .security :is(img, canvas) { width: min(240px, 60%); margin-inline: auto; }
  footer { flex-direction: column; align-items: flex-start; gap: 16px; }
  footer nav { flex-wrap: wrap; gap: 8px 20px; }
}

@media (max-width: 760px) {
  .diagram { grid-template-columns: 1fr; grid-template-rows: none; gap: 8px; }
  .diagram > * { grid-area: auto; }
  .box { padding: 12px 14px; }
  .anchor { margin-block: 12px; }
  .w1::after, .w2::after, .r1::before, .r2::before { content: none; }
  .anchor::before, .anchor::after { content: ""; position: absolute; left: 50%; width: 2px; height: 20px; margin-left: -1px; background: #fff; }
  .anchor::before { bottom: calc(100% + 1.5px); }
  .anchor::after { top: calc(100% + 1.5px); }
}

@media (max-width: 560px) {
  section { scroll-margin-top: 60px; }
  .d { display: none; }
  .m { display: initial; }
  .data { font-size: 12px; }

  .nav { height: 60px; }
  .brand { gap: 8px; font-size: 18px; }
  .brand img { width: 24px; height: 24px; }
  .install { padding: 8px 14px; font-size: 14px; }

  .hero { padding-top: 88px; }
  .hero .sub, .cmd { margin-top: 20px; }
  .thread { width: 100vw; max-width: none; aspect-ratio: 390 / 300; margin: 12px calc(-1 * var(--gutter)) 0; }

  .panes { margin-top: 28px; }
  .cut { width: 40px; }
  .pane { font-size: 11px; }
  .pane figcaption span, .l i, .l.d, .tag { display: none; }
  .pane pre { padding-block: 12px 0; }
  .l { padding: 0 12px 0 40px; }
  .l::before { left: 12px; }
  .l.m { display: block; }
  .tag-m { display: block; padding: 8px 12px 12px; text-align: right; font-weight: 500; color: var(--ink); }

  .figure .dots { margin-top: 12px; }
  .machines { font-size: 12px; }

  .steps { grid-template-columns: 1fr; gap: 18px; }
  .steps li { display: grid; grid-template-columns: 14px 1fr; gap: 14px; }
  .steps li::before { margin: 0; }

  .art-m { width: 100vw; max-width: none; margin: 0 calc(-1 * var(--gutter)) 24px; }
  footer { margin-top: 40px; }
}
