#let dev = json.decode(sys.inputs.at("dev", default: "false"))

#let todo = emph(text(green)[TODO])
#let zwj = "\u{200D}"
#let flag = (
  gb: "\u{1F1EC}" + zwj + "\u{1F1E7}",
  de: "\u{1F1E9}" + zwj + "\u{1F1EA}",
)

#let bg = if dev { rgb("#212224") } else { luma(100%) }
#let fg = if dev { rgb("#B6B3B4") } else { luma(0%) }
#let gamut = gradient.linear(bg, fg)

#let lang = sys.inputs.at("lang", default: "de")
/// Chooses the translation according to the current language.
#let tr(..it) = it.named().at(lang, default: todo)

#let sans = text.with(font: "B612")
#let mono = text.with(font: "B612 Mono")
#let key(name) = box(
  inset: (x: 0.3em),
  outset: (y: 0.3em),
  radius: 0.25em,
  fill: gamut.sample(20%),
  stroke: (bottom: gamut.sample(40%)),
  sans(name),
)
#let phys(name) = emph(mono(name))


#set page(
  fill: bg,
  header: {
    tr(
      en: flag.gb + [ English],
      de: flag.de + [ Deutsch],
    )
    h(1fr)
  }
)
#set text(14pt, fill: fg, lang: lang)


#text(3em, tr(
  en: [How to Flightsim],
  de: [How to Flugsimulator],
))

- #tr(
  en: [What means what:],
  de: [Was heißt was:],
)

  - #tr(
      en: key[Things like this]
        + [ are keys on the *keyboard*.],
      de: key[Solcher Text]
        + [ bezieht sich auf Tasten
        auf der Tastatur.],
    )

  - #tr(
      en: phys[Things like this]
        + [ are physical inputs
        such as *levers*,
        *buttons* and
        *switches*.],
      de: phys[Solcher Text]
        + [ bezieht sich auf
        physische Eingabegeräte
        wie *Hebel*,
        *Knöpfe* und
        *Schalter*.],
    )

- #tr(
  en: [This contains a summary
    of the in-simulator tutorial.
    Consider reading this first in full and
    then follow the steps.],
  de: [Das hier enthält eine Zusammenfassung
    des Tutorials im Simulator.
    Es empfiehlt sich,
    das hier vollständig zu lesen und
    erst dann die Schritte zu befolgen.
  ],
)

+ #tr(
  en: [
    *Press* #key[Win] and #key[Enter]
    to restart the simulator.
  ],
  de: [
    *Drücke* #key[Windows-Taste] und
    #key[Enter]
    um die Simulation neuzustarten.
  ],
)

+ #tr(
  en: [
    *Follow the instructions*
    listed at the very bottom
    of the *screen*
    to reset the physical state
    of most inputs.
  ],
  de: [
    *Befolge* die Anweisungen
    ganz unten auf dem *Bildschirm*
    um die physischen Eingabegeräte
    zurückzusetzen.
  ],
)

+ #tr(
  en: [
    *Pull* the #phys[thrust levers]
    fully back to reset them as well.
  ],
  de: [
    *Ziehe* den #phys[Schubhebel]
    bis zum Anschlag *zurück*,
    um diesen auch zurückzusetzen.
  ],
)

+ #tr(
  en: [
    *Wait* for the simulation to load.
  ],
  de: [
    *Warte*, bis die Simulation geladen ist.
  ]
)

+ #tr(
  en: [
    *Push* the #phys[thrust levers]
    fully forward
    to accelerate.
  ],
  de: [
    *Schiebe* den #phys[Schubhebel]
    bis zum Anschlag *vorwärts*
    um zu beschleunigen.
  ],
)

+ #tr(
  en: [
    *Gently use* the #phys[rudder pedals]
    to keep the aircraft on the runway.
  ],
  de: [
    *Vorsichtig, benutze* die #phys[Ruder Pedale]
    um das Flugzeug auf der Landebahn zu halten.
  ],
)

+ #tr(
  en: [
    *Wait* until speed is at 140 knots.
  ],
  de: [
    *Warte*, bis die Geschwindigkeit
    bei 140 Knoten ist.
  ],
)

+ #tr(
  en: [
    *Gently pull* the #phys[stick] back
    to take off.
  ],
  de: [
    *Ziehe behutsam* den #phys[Joystick]
    zurück um abzuheben.
  ],
)

+ #tr(
  en: [
    *Press* the #phys[gear up] button on the #phys[Joystick]
    to raise the landing gear.
  ],
  de: [
    *Drücke* den #phys[gear up] Knopf am #phys[Joystick]
    um das Fahrwerk einzufahren.
  ],
)

+ #tr(
  en: [
    *Press* the #phys[flaps up] button on the #phys[Joystick]
    to retract the flaps.
  ],
  de: [
    *Drücke* den #phys[flaps up] Knopf am #phys[Joystick]
    um die Klappen einzufahren.
  ],
)

+ #tr(
  en: [
    You're done with the setup!
    Good luck, have fun flying!
  ],
  de: [
    Du bist fertig mit dem Einrichten!
    Viel Spaß beim Fliegen!
  ],
)