/* cicoria: a chicory flower is the colour of the page, the terminal is the one of the app. */
:root {
  --petal: #4f63e8;       /* the flower: the hero field */
  --petal-ink: #3443b8;   /* links on the page */
  --petal-pale: #e7eafd;
  --ink: #15173a;
  --soft: #50547a;
  --page: #ffffff;
  --shade: #f3f4fa;
  --line: #dadded;
  --leaf: #2e8a57;
  --pollen: #b9850f;
  --on-petal: #ffffff;
  --on-petal-soft: #eef0ff;
  --night: #1e1f2e;       /* the terminal, as the app draws it */
  --t-line: #3a3c55;
  --term: #d6d8ea;
  --t-dim: #7c80a3;
  --t-blue: #8ea2ff;
  --t-green: #7fd39c;
  --t-amber: #f0c25a;
  --t-red: #f08a8a;
  --t-hi: #2b2d42;
  --display: "Martian Mono", ui-monospace, Menlo, Consolas, monospace;
  --body: "Schibsted Grotesk", system-ui, sans-serif;
  --measure: 36rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --petal: #3b4dcc; --petal-ink: #a7b4ff; --petal-pale: #22264d;
    --ink: #e7e9f8; --soft: #a8acd0; --page: #13142a; --shade: #1a1c36; --line: #2d3055;
    --leaf: #7fd39c; --pollen: #f0c25a; --on-petal-soft: #d3d8ff; --night: #0f1020; --t-line: #2f3150;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --petal: #3b4dcc; --petal-ink: #a7b4ff; --petal-pale: #22264d;
  --ink: #e7e9f8; --soft: #a8acd0; --page: #13142a; --shade: #1a1c36; --line: #2d3055;
  --leaf: #7fd39c; --pollen: #f0c25a; --on-petal-soft: #d3d8ff; --night: #0f1020; --t-line: #2f3150;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 1.125rem/1.6 var(--body); }
a { color: var(--petal-ink); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--petal-ink); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--petal); color: #fff; }
img, video { max-width: 100%; }

h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 1rem + 1.6vw, 2.1rem); font-weight: 600; line-height: 1.15; font-stretch: 100%; }
h3 { font-size: 1.0625rem; font-weight: 600; line-height: 1.35; font-stretch: 92%; }
p { margin: 0 0 1em; max-width: var(--measure); }
code, kbd, pre, samp { font-family: var(--display); font-stretch: 87.5%; font-size: 0.8em; }
kbd {
  display: inline-block; padding: 0.05em 0.42em; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; background: var(--page); color: var(--ink); white-space: nowrap; line-height: 1.5;
}
p code, li code, td code { background: var(--shade); border-radius: 4px; padding: 0.1em 0.32em; }

.wrap { max-width: 76rem; margin: 0 auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 9; background: var(--page); padding: 0.5rem 1rem; }

/* Top bar, drawn on the petal on both pages. */
.bar { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2rem); padding-block: 1.25rem; font-family: var(--display); font-stretch: 92%; font-size: 0.875rem; }
.bar a { color: var(--on-petal); text-decoration: none; }
.bar a:hover, .bar a[aria-current="page"]:not(.mark) { text-decoration: underline; text-underline-offset: 0.35em; }
.bar .mark { margin-right: auto; display: inline-flex; align-items: center; gap: 0.55rem; font-size: 1.0625rem; font-weight: 700; font-stretch: 112.5%; letter-spacing: -0.01em; }
.bar .mark svg { width: 1.6rem; height: 1.6rem; }

/* Hero: the flower's own colour, the headline set from narrow to wide. */
.hero { background: var(--petal); color: var(--on-petal); padding-bottom: clamp(2.5rem, 6vw, 5rem); }
.hero h1 { font-size: clamp(2rem, 0.9rem + 4.6vw, 4.6rem); line-height: 1.04; letter-spacing: -0.035em; margin-top: clamp(2rem, 6vw, 5rem); max-width: 15em; }
.hero h1 span { display: block; }
.hero .squeeze { font-weight: 300; font-stretch: 75%; }
.hero .spread { font-weight: 800; font-stretch: 112.5%; margin-top: 0.12em; }
.hero .lede { font-size: clamp(1.125rem, 1rem + 0.4vw, 1.3125rem); line-height: 1.5; color: var(--on-petal-soft); margin: clamp(1.5rem, 3vw, 2.2rem) 0 2rem; max-width: 34rem; }
.hero .links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; font-family: var(--display); font-stretch: 92%; font-size: 0.875rem; margin: 1.2rem 0 0; }
.hero .links a { color: var(--on-petal); }

.install { display: flex; align-items: stretch; width: fit-content; max-width: 100%; border-radius: 8px; background: var(--night); color: var(--term); font-family: var(--display); font-stretch: 87.5%; font-size: 0.875rem; }
.install code { font-size: inherit; padding: 0.9rem 0.9rem 0.9rem 1.1rem; overflow-x: auto; white-space: nowrap; }
.install code::before { content: "$ "; color: var(--t-dim); }
.install button {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 0 8px 8px 0; min-width: 6em;
  padding: 0 1.1rem; background: var(--t-blue); color: var(--night);
}
.install button:hover { background: var(--term); }
.install button:focus-visible { outline: 2px solid var(--term); outline-offset: -5px; }

/* The playable workspace. */
.live { margin-top: clamp(2.5rem, 6vw, 4rem); }
.ws {
  background: var(--night); color: var(--term); border-radius: 10px; padding: 1rem 1rem 0.55rem;
  font-family: var(--display); font-stretch: 87.5%; font-size: clamp(0.72rem, 0.66rem + 0.2vw, 0.8125rem); line-height: 1.55;
  box-shadow: 0 2.5rem 4rem -2rem rgb(12 14 40 / 0.6);
}
.ws:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.ws-grid { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr) 15.5rem; gap: 0.75rem; min-height: 21rem; }
.ws-col { display: grid; gap: 0.75rem; align-content: start; }
.tp { position: relative; border: 1px solid var(--t-line); border-radius: 4px; padding: 0.85rem 0.7rem 0.55rem; min-width: 0; }
.tp.lit { border-color: #73c7c8; }
.tp-t { position: absolute; top: -0.78em; left: 0.6rem; padding: 0 0.4rem; background: var(--night); color: var(--t-dim); white-space: nowrap; max-width: calc(100% - 1.2rem); overflow: hidden; text-overflow: ellipsis; }
.tp.lit > .tp-t { color: #73c7c8; }
.tp pre { margin: 0; font-size: inherit; font-stretch: inherit; white-space: pre-wrap; }
.ws-sessions { list-style: none; margin: 0; padding: 0; }
.ws-sessions button {
  all: unset; box-sizing: border-box; display: grid; grid-template-columns: 1.3ch 1.6ch minmax(0, 1fr) auto; gap: 0 0.6ch;
  width: 100%; padding: 0 0.25rem; border-radius: 2px; cursor: pointer; color: var(--term);
}
.ws-sessions button:hover { background: var(--t-hi); }
.ws-sessions button:focus-visible { outline: 1px solid var(--t-blue); }
.ws-sessions [aria-current="true"] { background: var(--t-hi); font-weight: 600; }
.ws-sessions .n, .ws-sessions .age { color: var(--t-dim); font-weight: 400; }
.ws-sessions .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-working { color: var(--t-green); } .s-input { color: var(--t-amber); } .s-done { color: var(--t-green); }
.s-idle { color: var(--t-dim); } .s-exit { color: var(--t-red); }
.ws-pane { display: flex; flex-direction: column; }
.ws-out { flex: 1; display: grid; align-content: start; gap: 0.55rem; padding-top: 0.2rem; }
.ws-out p { margin: 0; max-width: none; }
.ws-out .you { color: var(--term); background: var(--t-hi); padding: 0 0.4rem; }
.ws-out .dim { color: var(--t-dim); }
.ws-out .ask { color: var(--t-amber); }
.ws-choices { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; }
.ws-choices button {
  font: inherit; color: var(--term); background: transparent; border: 1px solid var(--t-line); border-radius: 3px;
  padding: 0.1rem 0.6rem; cursor: pointer;
}
.ws-choices button:hover, .ws-choices button:focus-visible { border-color: var(--t-amber); color: var(--t-amber); outline: 0; }
.ws-prompt { border-top: 1px solid var(--t-line); margin-top: 0.8rem; padding-top: 0.35rem; color: var(--t-dim); }
.ws-files { margin: 0; padding: 0; list-style: none; }
.ws-files li { display: grid; grid-template-columns: 1.6ch minmax(0, 1fr) auto; gap: 0.6ch; }
.ws-files .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-files .add { color: var(--t-green); } .ws-files .del { color: var(--t-red); }
.ws-files .M { color: var(--t-amber); } .ws-files .A { color: var(--t-green); } .ws-files .Q { color: var(--t-green); }
.ws-queue li { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-status { display: flex; justify-content: space-between; gap: 1rem; min-height: 1.55em; padding: 0.45rem 0.25rem 0; color: var(--t-dim); }
.ws-status .need { color: var(--t-amber); }
.ws-status .keys { white-space: nowrap; }
.ws-hint { color: var(--on-petal-soft); font-size: 0.9375rem; margin: 1rem 0 0; max-width: 44rem; }
.ws-hint kbd { background: transparent; border-color: rgb(255 255 255 / 0.45); color: var(--on-petal); }
@media (prefers-reduced-motion: no-preference) {
  .ws-flash { animation: flash 0.9s ease-out 1; }
  @keyframes flash { from { background: rgb(240 194 90 / 0.28); } to { background: transparent; } }
}
@media (max-width: 64rem) { .ws-grid { grid-template-columns: 14rem minmax(0, 1fr); } .ws-right { display: none; } }
@media (max-width: 40rem) {
  .ws { padding: 0.9rem 0.6rem 0.5rem; }
  .ws-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .ws-left .tp:not(:first-child) { display: none; }
  .ws-out { min-height: 13rem; }
  .ws-status .keys { display: none; }
}

/* Sections */
.band { padding-block: clamp(3.5rem, 9vw, 7rem); }
.band-shade { background: var(--shade); }
.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 1.5rem clamp(2rem, 6vw, 5rem); align-items: end; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.intro p { color: var(--soft); margin: 0; }
@media (max-width: 52rem) { .intro { grid-template-columns: minmax(0, 1fr); } }

.recording video { display: block; width: 100%; height: auto; border-radius: 10px; background: var(--night); }
.recording figcaption { color: var(--soft); font-size: 0.9375rem; margin-top: 1rem; max-width: 46rem; }

/* Abilities: what it does, next to the piece of the interface that shows it. */
.ability { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.5rem clamp(2rem, 6vw, 5rem); align-items: center; padding-block: clamp(1.75rem, 4vw, 2.75rem); border-top: 1px solid var(--line); }
.ability:first-of-type { border-top: 0; padding-top: 0; }
.ability h3 { font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem); font-stretch: 100%; margin-bottom: 0.7rem; }
.ability p { color: var(--soft); }
.ability p:last-child { margin-bottom: 0; }
@media (max-width: 52rem) { .ability { grid-template-columns: minmax(0, 1fr); } }

.term { background: var(--night); color: var(--term); border-radius: 8px; padding: 1.15rem 1rem 0.9rem; font-family: var(--display); font-stretch: 87.5%; font-size: 0.8125rem; line-height: 1.55; display: grid; gap: 1rem; overflow-x: auto; }
.term pre { margin: 0; font-size: inherit; font-stretch: inherit; }
.term .d { color: var(--t-dim); } .term .b { color: var(--t-blue); } .term .g { color: var(--t-green); }
.term .w { color: var(--t-amber); } .term .r { color: var(--t-red); } .term .hl { background: var(--t-hi); display: inline-block; min-width: 100%; }
.term-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 34rem) { .term-split { grid-template-columns: minmax(0, 1fr); } }

/* The status marks, large. */
.marks { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 0; }
.marks div { background: var(--page); padding: 1.1rem 1rem 1rem; }
.marks dt { font-family: var(--display); font-size: 2rem; line-height: 1; margin-bottom: 0.7rem; }
.marks dd { margin: 0; font-size: 0.9375rem; color: var(--soft); line-height: 1.4; }
.mk-working, .mk-done { color: var(--leaf); } .mk-input { color: var(--pollen); } .mk-idle { color: var(--soft); } .mk-exit { color: #c0394a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mk-exit { color: var(--t-red); } }
:root[data-theme="dark"] .mk-exit { color: var(--t-red); }

/* Agents */
.agents { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); border-top: 2px solid var(--ink); }
.agents li { padding: 1.1rem 1.25rem 1.25rem 0; border-bottom: 1px solid var(--line); }
.agents b { display: block; font-family: var(--display); font-stretch: 100%; font-weight: 600; font-size: 1rem; margin-bottom: 0.35rem; }
.agents span { color: var(--soft); font-size: 0.9375rem; line-height: 1.45; display: block; }

/* The principle, on the petal again. */
.principle { background: var(--petal); color: var(--on-petal); }
.principle h2 { font-size: clamp(1.8rem, 1rem + 3vw, 3.4rem); font-stretch: 112.5%; font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; max-width: 14em; }
.principle .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.5rem clamp(1.5rem, 4vw, 3rem); margin-top: clamp(2rem, 5vw, 3.5rem); }
.principle .facts p { margin: 0; padding-top: 1rem; border-top: 1px solid rgb(255 255 255 / 0.4); color: var(--on-petal-soft); }
.principle .facts b { color: var(--on-petal); font-weight: 600; }

/* First minute: a real sequence. */
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 1.75rem; max-width: 46rem; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 3rem minmax(0, 1fr); }
.steps li::before { content: counter(step); font-family: var(--display); font-weight: 700; font-stretch: 112.5%; font-size: 1.5rem; line-height: 1.1; color: var(--petal-ink); }
.steps p { margin: 0 0 0.6rem; }
.steps .term { width: fit-content; max-width: 100%; }

.closing h2 { max-width: 20em; margin-bottom: 1.6rem; }

.foot { border-top: 1px solid var(--line); padding-block: 2.5rem 3.5rem; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1.5rem clamp(1.5rem, 5vw, 4rem); align-items: end; color: var(--soft); font-size: 0.9375rem; }
.foot svg { width: 4.5rem; height: auto; }
.foot p { margin: 0; max-width: 34rem; }
.foot nav { display: flex; gap: 1.5rem; font-family: var(--display); font-stretch: 92%; font-size: 0.8125rem; }
@media (max-width: 52rem) { .foot { grid-template-columns: minmax(0, 1fr); } }

/* Guide */
.guide-top { background: var(--petal); }
.guide { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 5rem); padding-block: clamp(2rem, 5vw, 3.5rem) 5rem; }
.toc { position: sticky; top: 1.25rem; align-self: start; max-height: calc(100vh - 2.5rem); overflow-y: auto; font-size: 0.875rem; padding-right: 0.25rem; }
.toc h2 { font-size: 0.75rem; font-stretch: 92%; font-weight: 600; color: var(--soft); letter-spacing: 0; margin: 1.4rem 0 0.4rem 0.6rem; }
.toc h2:first-child { margin-top: 0; }
.toc .groups > div + div h2 { margin-top: 1.4rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 0.22rem 0.6rem; border-radius: 5px; color: var(--ink); text-decoration: none; }
.toc a:hover { background: var(--shade); }
.toc a.here { background: var(--petal-pale); color: var(--petal-ink); font-weight: 600; }
.doc { min-width: 0; }
.doc > header h1 { font-size: clamp(1.9rem, 1rem + 3vw, 3rem); font-weight: 800; font-stretch: 112.5%; letter-spacing: -0.035em; line-height: 1.05; margin-bottom: 1.2rem; }
.doc > header p { font-size: 1.1875rem; color: var(--soft); max-width: 40rem; }
.doc section { padding-top: clamp(2.5rem, 5vw, 3.75rem); }
.doc h2 { font-size: clamp(1.35rem, 1rem + 1.1vw, 1.75rem); padding-top: 1rem; border-top: 2px solid var(--ink); margin-bottom: 1rem; }
.doc h3 { margin: 2rem 0 0.6rem; }
.doc p, .doc li { max-width: 40rem; }
.doc ul { padding-left: 1.2rem; margin: 0 0 1em; }
.doc li { margin-bottom: 0.4em; }
.doc pre { margin: 0 0 1.2em; background: var(--night); color: var(--term); border-radius: 8px; padding: 0.9rem 1.1rem; font-size: 0.8125rem; line-height: 1.55; overflow-x: auto; max-width: 48rem; }
.doc pre .c { color: var(--t-dim); }
.table { overflow-x: auto; margin: 0 0 1.4em; max-width: 52rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; line-height: 1.45; }
th { text-align: left; font-weight: 600; padding: 0 1rem 0.55rem 0; border-bottom: 1px solid var(--ink); vertical-align: bottom; }
td { padding: 0.55rem 1rem 0.55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
td:first-child { font-family: var(--display); font-stretch: 87.5%; font-size: 0.8125rem; white-space: nowrap; padding-top: 0.68rem; }
th:last-child, td:last-child { padding-right: 0; }
td.wrap-ok { white-space: normal; }
.note { border-left: 3px solid var(--petal); background: var(--shade); padding: 0.9rem 1.1rem; margin: 0 0 1.3em; max-width: 40rem; border-radius: 0 6px 6px 0; }
.note p { margin: 0; }
.flow { list-style: none; counter-reset: hop; margin: 0.5rem 0 1.6rem; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; max-width: 56rem; }
.flow li { counter-increment: hop; position: relative; padding: 2.4rem 1.1rem 0 0; font-size: 0.9375rem; line-height: 1.45; color: var(--soft); }
.flow li::before { content: counter(hop); position: absolute; top: 0; left: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--petal); color: #fff; font: 700 0.8125rem/1.7rem var(--display); text-align: center; }
.flow li::after { content: ""; position: absolute; top: 0.85rem; left: 2.2rem; right: 0.5rem; border-top: 1px dashed var(--line); }
.flow li:last-child::after { display: none; }
.flow b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 0.25rem; }
@media (max-width: 46rem) {
  .flow { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
  .flow li { padding: 0 0 0 2.6rem; }
  .flow li::after { display: none; }
}
@media (max-width: 56rem) {
  .guide { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; max-height: none; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
  .toc .groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1rem; }
  .toc h2:first-child, .toc .groups > div > h2 { margin-top: 0.8rem; }
}
